Skip to content

Commit

Permalink
Use ar & tar instead of dpkg -x
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Aug 31, 2021
1 parent 826a617 commit 570fd0a
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/datalad_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2076,20 +2076,26 @@ def install_deb(
install_dir: Optional[Path] = None,
extra_args: Optional[List[str]] = None,
) -> Path:
cmd: List[Union[str, os.PathLike]] = ["dpkg"]
if extra_args is not None:
cmd.extend(extra_args)
if install_dir is None:
cmd: List[Union[str, os.PathLike]] = ["dpkg"]
if extra_args is not None:
cmd.extend(extra_args)
cmd.append("-i")
cmd.append(debpath)
manager.sudo(*cmd)
return Path("/usr/bin")
else:
if extra_args:
log.warning("Not using dpkg; ignoring --extra-args")
assert os.path.isabs(debpath)
install_dir.mkdir(parents=True, exist_ok=True)
cmd.append("-x")
cmd.append(debpath)
cmd.append(install_dir)
runcmd(*cmd)
install_dir = install_dir.resolve()
with tempfile.TemporaryDirectory() as tmpdir:
oldpwd = os.getcwd()
os.chdir(tmpdir)
runcmd("ar", "-x", debpath)
runcmd("tar", "-C", install_dir, "-xzf", "data.tar.gz")
os.chdir(oldpwd)
manager.addpath(install_dir / bin_path)
return install_dir / bin_path

Expand Down

0 comments on commit 570fd0a

Please sign in to comment.