launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28993
[Merge] ~jugmac00/lpcraft:rename-apt-replace-repositories into lpcraft:main
Jürgen Gmach has proposed merging ~jugmac00/lpcraft:rename-apt-replace-repositories into lpcraft:main with ~jugmac00/lpcraft:provide-additional-repositories-via-cli as a prerequisite.
Commit message:
Deprecate ``--apt-replace-repositories``
... and introduce ``--replace-package-repositories``
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jugmac00/lpcraft/+git/lpcraft/+merge/428115
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~jugmac00/lpcraft:rename-apt-replace-repositories into lpcraft:main.
diff --git a/NEWS.rst b/NEWS.rst
index cc1afac..f450fb1 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -18,6 +18,9 @@ Version history
but no ``properties`` key under that.
=======
- Enable providing additional repositories via CLI.
+
+- Deprecate ``--apt-replace-repositories``, introduce
+ ``--replace-package-repositories``.
>>>>>>> NEWS.rst
0.0.24 (2022-08-05)
diff --git a/docs/cli-interface.rst b/docs/cli-interface.rst
index 38a98f1..3edffa0 100644
--- a/docs/cli-interface.rst
+++ b/docs/cli-interface.rst
@@ -19,11 +19,6 @@ This command runs all jobs listed via pipelines from a configuration file.
lpcraft run optional arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ``--apt-replace-repositories SOURCE_LINE``, e.g.
- ``lpcraft run --apt-replace-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
-
- This option is repeatable.
-
- ``--package-repository`` (provide an additional repository), e.g.
``lpcraft run --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
This option is repeatable.
@@ -33,6 +28,12 @@ lpcraft run optional arguments
This option is repeatable.
+- ``--replace-package-repositories SOURCE_LINE``, e.g.
+ ``lpcraft run --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted"``
+
+ This option is repeatable.
+
+
- ``--secrets``, e.g.
``lpcraft run --secrets="<path-to-configuration-file>"``
@@ -62,11 +63,6 @@ where ``test`` is the job name and ``0`` is the index of the job/matrix.
lpcraft run-one optional arguments
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ``--apt-replace-repositories SOURCE_LINE``, e.g.
- ``lpcraft run-one --apt-replace-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
-
- This option is repeatable.
-
- ``--package-repository`` (provide an additional repository), e.g.
``lpcraft run-one --package-repository "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
This option is repeatable.
@@ -76,6 +72,11 @@ lpcraft run-one optional arguments
This option is repeatable.
+- ``--replace-package-repositories SOURCE_LINE``, e.g.
+ ``lpcraft run-one --replace-package-repositories "deb http://archive.ubuntu.com/ubuntu/ focal main restricted" test 0``
+
+ This option is repeatable.
+
- ``--secrets``, e.g.
``lpcraft run-one --secrets="<path-to-configuration-file>" test 0``
diff --git a/lpcraft/commands/run.py b/lpcraft/commands/run.py
index 1da9f8c..85c277c 100644
--- a/lpcraft/commands/run.py
+++ b/lpcraft/commands/run.py
@@ -290,12 +290,12 @@ def _install_apt_packages(
instance: lxd.LXDInstance,
host_architecture: str,
remote_cwd: Path,
- apt_replacement_repositories: Optional[List[str]],
+ replace_package_repositories: Optional[List[str]],
package_repositories: List[str],
environment: Optional[Dict[str, Optional[str]]],
secrets: Optional[Dict[str, str]],
) -> None:
- if apt_replacement_repositories or package_repositories:
+ if replace_package_repositories or package_repositories:
sources_list_path = "/etc/apt/sources.list"
with NamedTemporaryFile(mode="w+") as tmpfile:
@@ -308,8 +308,8 @@ def _install_apt_packages(
raise CommandError(str(e), retcode=1)
sources = tmpfile.read()
- if apt_replacement_repositories:
- sources = "\n".join(apt_replacement_repositories) + "\n"
+ if replace_package_repositories:
+ sources = "\n".join(replace_package_repositories) + "\n"
if package_repositories:
sources += "\n" + "\n".join(package_repositories)
if secrets:
@@ -405,7 +405,7 @@ def _run_job(
job_index: int,
provider: Provider,
output: Optional[Path],
- apt_replacement_repositories: Optional[List[str]],
+ replace_package_repositories: Optional[List[str]],
package_repositories: List[str],
env_from_cli: Optional[List[str]] = None,
plugin_settings: Optional[List[str]] = None,
@@ -498,7 +498,7 @@ def _run_job(
instance=instance,
host_architecture=host_architecture,
remote_cwd=remote_cwd,
- apt_replacement_repositories=apt_replacement_repositories,
+ replace_package_repositories=replace_package_repositories,
package_repositories=package_repositories,
environment=environment,
secrets=secrets,
@@ -588,6 +588,13 @@ class RunCommand(BaseCommand):
parser.add_argument(
"--apt-replace-repositories",
action="append",
+ default=[],
+ help="(deprecated) Overwrite /etc/apt/sources.list.",
+ )
+ parser.add_argument(
+ "--replace-package-repositories",
+ action="append",
+ default=[],
help="Overwrite /etc/apt/sources.list.",
)
parser.add_argument(
@@ -618,6 +625,11 @@ class RunCommand(BaseCommand):
def run(self, args: Namespace) -> int:
"""Run the command."""
+ if getattr(args, "apt_replace_repositories"):
+ emit.message(
+ "Warning: `--apt-replace-repositories` is deprecated - "
+ "Please use `--replace-package-repositories instead"
+ )
config = Config.load(args.config)
provider = get_provider()
@@ -655,8 +667,9 @@ class RunCommand(BaseCommand):
job_index,
provider,
args.output_directory,
- apt_replacement_repositories=(
+ replace_package_repositories=(
args.apt_replace_repositories
+ + args.replace_package_repositories
),
package_repositories=package_repositories, # noqa: E501
env_from_cli=args.set_env,
@@ -731,6 +744,13 @@ class RunOneCommand(BaseCommand):
parser.add_argument(
"--apt-replace-repositories",
action="append",
+ default=[],
+ help="(deprecated) Overwrite /etc/apt/sources.list.",
+ )
+ parser.add_argument(
+ "--replace-package-repositories",
+ action="append",
+ default=[],
help="Overwrite /etc/apt/sources.list.",
)
parser.add_argument(
@@ -761,6 +781,11 @@ class RunOneCommand(BaseCommand):
def run(self, args: Namespace) -> int:
"""Run the command."""
+ if getattr(args, "apt_replace_repositories"):
+ emit.message(
+ "Warning: `--apt-replace-repositories` is deprecated - "
+ "Please use `--replace-package-repositories instead"
+ )
config = Config.load(args.config)
jobs = config.jobs.get(args.job, [])
@@ -792,7 +817,10 @@ class RunOneCommand(BaseCommand):
args.index,
provider,
args.output_directory,
- apt_replacement_repositories=args.apt_replace_repositories,
+ replace_package_repositories=(
+ args.apt_replace_repositories
+ + args.replace_package_repositories
+ ),
package_repositories=package_repositories,
env_from_cli=args.set_env,
plugin_settings=args.plugin_setting,