From 301a6fe5ba80cace0eda8d92f4c2dadb99cc8a5d Mon Sep 17 00:00:00 2001 From: Sheng Yu Date: Wed, 28 Feb 2024 12:07:11 -0500 Subject: [PATCH 1/3] fix: deprecate enable-manifest and manifest-image-information `--enable-manifest` and `--manifest-image-information` no longer supported in core24. --- snapcraft/commands/core22/lifecycle.py | 4 ++-- snapcraft/commands/core22/lint.py | 2 +- snapcraft/parts/lifecycle.py | 12 ++++++++++++ tests/unit/commands/test_lint.py | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/snapcraft/commands/core22/lifecycle.py b/snapcraft/commands/core22/lifecycle.py index fe02d0af8d..9917582f9e 100644 --- a/snapcraft/commands/core22/lifecycle.py +++ b/snapcraft/commands/core22/lifecycle.py @@ -53,14 +53,14 @@ def fill_parser(self, parser: "argparse.ArgumentParser") -> None: "--enable-manifest", action="store_true", default=utils.strtobool(os.getenv("SNAPCRAFT_BUILD_INFO", "n")), - help="Generate snap manifest", + help="Generate snap manifest (Deprecated)", ) parser.add_argument( "--manifest-image-information", type=str, metavar="image-info", default=os.getenv("SNAPCRAFT_IMAGE_INFO"), - help="Set snap manifest image-info", + help="Set snap manifest image-info (Deprecated)", ) parser.add_argument( "--bind-ssh", diff --git a/snapcraft/commands/core22/lint.py b/snapcraft/commands/core22/lint.py index 3705519f0c..d57ec7160a 100644 --- a/snapcraft/commands/core22/lint.py +++ b/snapcraft/commands/core22/lint.py @@ -375,7 +375,7 @@ def _load_lint_filters(self, project: Optional[models.Project]) -> models.Lint: ) emit.verbose( "To include 'snapcraft.yaml' in a snap file, use the parameter " - "'--enable-manifest' when building the snap." + "'--enable-manifest' when building the snap. (Deprecated)" ) return lint_config diff --git a/snapcraft/parts/lifecycle.py b/snapcraft/parts/lifecycle.py index 255de747d2..61cf3dec5b 100644 --- a/snapcraft/parts/lifecycle.py +++ b/snapcraft/parts/lifecycle.py @@ -322,6 +322,10 @@ def _generate_metadata( emit.progress("Generated snap metadata", permanent=True) if parsed_args.enable_manifest: + emit.progress( + "'--enable-manifest' is deprecated, and will be removed in core24.", + permanent=True, + ) _generate_manifest( project, lifecycle=lifecycle, @@ -414,9 +418,17 @@ def _run_in_provider( # noqa PLR0915 if getattr(parsed_args, "enable_manifest", False): cmd.append("--enable-manifest") + emit.progress( + "'--enable-manifest' is deprecated, and will be removed in core24.", + permanent=True, + ) image_information = getattr(parsed_args, "manifest_image_information", None) if image_information: cmd.extend(["--manifest-image-information", image_information]) + emit.progress( + "'--manifest-image-information' is deprecated, and will be removed in core24.", + permanent=True, + ) cmd.append("--build-for") cmd.append(project.get_build_for()) diff --git a/tests/unit/commands/test_lint.py b/tests/unit/commands/test_lint.py index dd858cbbd0..e1752420a7 100644 --- a/tests/unit/commands/test_lint.py +++ b/tests/unit/commands/test_lint.py @@ -478,7 +478,7 @@ def test_lint_managed_mode_without_snapcraft_yaml( call( "verbose", "To include 'snapcraft.yaml' in a snap file, use the parameter " - "'--enable-manifest' when building the snap.", + "'--enable-manifest' when building the snap. (Deprecated)", ), ] ) From 6d5a8f2ace679ddae100feb66a9475c8ec75bf25 Mon Sep 17 00:00:00 2001 From: Sheng Yu Date: Wed, 28 Feb 2024 17:00:33 -0500 Subject: [PATCH 2/3] fix: hide deprecated arguments --- snapcraft/commands/core22/lifecycle.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snapcraft/commands/core22/lifecycle.py b/snapcraft/commands/core22/lifecycle.py index 9917582f9e..541674f62e 100644 --- a/snapcraft/commands/core22/lifecycle.py +++ b/snapcraft/commands/core22/lifecycle.py @@ -50,17 +50,17 @@ def fill_parser(self, parser: "argparse.ArgumentParser") -> None: help="Shell into the environment if the build fails", ) parser.add_argument( - "--enable-manifest", + "--enable-manifest", # Deprecated and removed in core24 action="store_true", default=utils.strtobool(os.getenv("SNAPCRAFT_BUILD_INFO", "n")), - help="Generate snap manifest (Deprecated)", + help=argparse.SUPPRESS, ) parser.add_argument( - "--manifest-image-information", + "--manifest-image-information", # Deprecated and removed in core24 type=str, metavar="image-info", default=os.getenv("SNAPCRAFT_IMAGE_INFO"), - help="Set snap manifest image-info (Deprecated)", + help=argparse.SUPPRESS, ) parser.add_argument( "--bind-ssh", From ac23b1d9574a2b58a90f1dd862ffacdcbbf28c0f Mon Sep 17 00:00:00 2001 From: Sheng Yu Date: Thu, 29 Feb 2024 12:02:20 -0500 Subject: [PATCH 3/3] fix: remove deprecated lint notice --- snapcraft/commands/core22/lint.py | 4 ---- tests/unit/commands/test_lint.py | 5 ----- 2 files changed, 9 deletions(-) diff --git a/snapcraft/commands/core22/lint.py b/snapcraft/commands/core22/lint.py index d57ec7160a..5c2f761e6e 100644 --- a/snapcraft/commands/core22/lint.py +++ b/snapcraft/commands/core22/lint.py @@ -373,9 +373,5 @@ def _load_lint_filters(self, project: Optional[models.Project]) -> models.Lint: "Not loading lint filters from 'snapcraft.yaml' because the file " "does not exist inside the snap file." ) - emit.verbose( - "To include 'snapcraft.yaml' in a snap file, use the parameter " - "'--enable-manifest' when building the snap. (Deprecated)" - ) return lint_config diff --git a/tests/unit/commands/test_lint.py b/tests/unit/commands/test_lint.py index e1752420a7..117ddb8dd4 100644 --- a/tests/unit/commands/test_lint.py +++ b/tests/unit/commands/test_lint.py @@ -475,11 +475,6 @@ def test_lint_managed_mode_without_snapcraft_yaml( "Not loading lint filters from 'snapcraft.yaml' because the file does " "not exist inside the snap file.", ), - call( - "verbose", - "To include 'snapcraft.yaml' in a snap file, use the parameter " - "'--enable-manifest' when building the snap. (Deprecated)", - ), ] )