mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-07 19:03:38 +00:00
remove remove flag from repo
This commit is contained in:
@@ -59,22 +59,15 @@ class Repo(LazyLogging):
|
|||||||
"""
|
"""
|
||||||
return self.root / f"{self.name}.db.tar.gz"
|
return self.root / f"{self.name}.db.tar.gz"
|
||||||
|
|
||||||
def add(self, path: Path, *, remove: bool = True) -> None:
|
def add(self, path: Path) -> None:
|
||||||
"""
|
"""
|
||||||
add new package to repository
|
add new package to repository
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
path(Path): path to archive to add
|
path(Path): path to archive to add
|
||||||
remove(bool, optional): whether to remove old packages or not (Default value = True)
|
|
||||||
"""
|
"""
|
||||||
command = ["repo-add", *self.sign_args]
|
|
||||||
if remove:
|
|
||||||
command.extend(["--remove"])
|
|
||||||
command.extend([str(self.repo_path), str(path)])
|
|
||||||
|
|
||||||
# add to repository
|
|
||||||
check_output(
|
check_output(
|
||||||
*command,
|
"repo-add", *self.sign_args, "--remove", str(self.repo_path), str(path),
|
||||||
exception=BuildError.from_process(path.name),
|
exception=BuildError.from_process(path.name),
|
||||||
cwd=self.root,
|
cwd=self.root,
|
||||||
logger=self.logger,
|
logger=self.logger,
|
||||||
|
|||||||
@@ -35,17 +35,6 @@ def test_repo_add(repo: Repo, mocker: MockerFixture) -> None:
|
|||||||
assert "--remove" in check_output_mock.call_args[0]
|
assert "--remove" in check_output_mock.call_args[0]
|
||||||
|
|
||||||
|
|
||||||
def test_repo_add_no_remove(repo: Repo, mocker: MockerFixture) -> None:
|
|
||||||
"""
|
|
||||||
must call repo-add without remove flag
|
|
||||||
"""
|
|
||||||
check_output_mock = mocker.patch("ahriman.core.alpm.repo.check_output")
|
|
||||||
|
|
||||||
repo.add(Path("path"), remove=False)
|
|
||||||
check_output_mock.assert_called_once() # it will be checked later
|
|
||||||
assert "--remove" not in check_output_mock.call_args[0]
|
|
||||||
|
|
||||||
|
|
||||||
def test_repo_init(repo: Repo, mocker: MockerFixture) -> None:
|
def test_repo_init(repo: Repo, mocker: MockerFixture) -> None:
|
||||||
"""
|
"""
|
||||||
must call repo-add with empty package list on repo initializing
|
must call repo-add with empty package list on repo initializing
|
||||||
|
|||||||
Reference in New Issue
Block a user