launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28691
Re: [Merge] ~jugmac00/lpcraft:add-additional-apt-repositories into lpcraft:main
Diff comments:
> diff --git a/lpcraft/commands/run.py b/lpcraft/commands/run.py
> index dd39c1c..2b3db26 100644
> --- a/lpcraft/commands/run.py
> +++ b/lpcraft/commands/run.py
> @@ -226,19 +227,33 @@ def _install_apt_packages(
> host_architecture: str,
> remote_cwd: Path,
> apt_replacement_repositories: Optional[List[str]],
> + additional_apt_repositories: Optional[List[str]],
> environment: Optional[Dict[str, Optional[str]]],
> ) -> None:
> - if apt_replacement_repositories:
> - # replace sources.list
> - lines = "\n".join(apt_replacement_repositories) + "\n"
> + if apt_replacement_repositories or additional_apt_repositories:
> + sources_list_path = "/etc/apt/sources.list"
> + _, tmpfile = mkstemp()
> + try:
> + instance.pull_file(
> + source=Path(sources_list_path), destination=Path(tmpfile)
> + )
> + except Exception as e:
> + raise CommandError(str(e), retcode=1)
> + with open(sources_list_path) as f:
🙈 - will update tomorrow.
> + sources = f.read()
> + if apt_replacement_repositories:
> + sources = "\n".join(apt_replacement_repositories) + "\n"
> + if additional_apt_repositories:
> + sources = sources + "\n".join(additional_apt_repositories) + "\n"
> with emit.open_stream("Replacing /etc/apt/sources.list") as stream:
> instance.push_file_io(
> - destination=PurePath("/etc/apt/sources.list"),
> - content=io.BytesIO(lines.encode()),
> + destination=PurePath(sources_list_path),
> + content=io.BytesIO(sources.encode()),
> file_mode="0644",
> group="root",
> user="root",
> )
> +
> # update local repository information
> apt_update = ["apt", "update"]
> with emit.open_stream(f"Running {apt_update}") as stream:
--
https://code.launchpad.net/~jugmac00/lpcraft/+git/lpcraft/+merge/425829
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/lpcraft:add-additional-apt-repositories into lpcraft:main.
References