From 4263d83ee658de160f6c4d76ee24dd861baf97c1 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 18 Sep 2025 11:20:45 +0100 Subject: [PATCH] snapcraft: remove package --- pkgs/by-name/sn/snapcraft/esm-test.patch | 14 -- .../sn/snapcraft/lxd-socket-path.patch | 13 -- pkgs/by-name/sn/snapcraft/package.nix | 213 ------------------ .../sn/snapcraft/set-channel-for-nix.patch | 23 -- .../sn/snapcraft/snapcraft-data-dirs.patch | 16 -- pkgs/top-level/aliases.nix | 1 + 6 files changed, 1 insertion(+), 279 deletions(-) delete mode 100644 pkgs/by-name/sn/snapcraft/esm-test.patch delete mode 100644 pkgs/by-name/sn/snapcraft/lxd-socket-path.patch delete mode 100644 pkgs/by-name/sn/snapcraft/package.nix delete mode 100644 pkgs/by-name/sn/snapcraft/set-channel-for-nix.patch delete mode 100644 pkgs/by-name/sn/snapcraft/snapcraft-data-dirs.patch diff --git a/pkgs/by-name/sn/snapcraft/esm-test.patch b/pkgs/by-name/sn/snapcraft/esm-test.patch deleted file mode 100644 index e2c3e4d32815..000000000000 --- a/pkgs/by-name/sn/snapcraft/esm-test.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git i/tests/unit/test_application.py w/tests/unit/test_application.py -index d5da2454c..2a9bcd6f9 100644 ---- i/tests/unit/test_application.py -+++ w/tests/unit/test_application.py -@@ -391,7 +391,8 @@ def test_esm_error(snapcraft_yaml, base, monkeypatch, capsys): - _, err = capsys.readouterr() - - assert re.match( -- rf"^Base {base!r} is not supported by this version of Snapcraft.\n" -+ rf"^Running snapcraft without a command will not be possible in future releases. Use 'snapcraft pack' instead.\n" -+ rf"Base {base!r} is not supported by this version of Snapcraft.\n" - rf"Recommended resolution: Use Snapcraft .* from the '.*' channel of snapcraft where {base!r} was last supported.\n" - r"For more information, check out: .*/reference/bases\n", - err, diff --git a/pkgs/by-name/sn/snapcraft/lxd-socket-path.patch b/pkgs/by-name/sn/snapcraft/lxd-socket-path.patch deleted file mode 100644 index af732c1e0fbb..000000000000 --- a/pkgs/by-name/sn/snapcraft/lxd-socket-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git i/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py w/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py -index 5fa4f898b..41264ebb0 100644 ---- i/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py -+++ w/snapcraft_legacy/internal/build_providers/_lxd/_lxd.py -@@ -142,7 +142,7 @@ class LXD(Provider): - build_provider_flags=build_provider_flags, - ) - # This endpoint is hardcoded everywhere lxc/lxd-pkg-snap#33 -- lxd_socket_path = "/var/snap/lxd/common/lxd/unix.socket" -+ lxd_socket_path = "/var/lib/lxd/unix.socket" - endpoint = "http+unix://{}".format(urllib.parse.quote(lxd_socket_path, safe="")) - try: - self._lxd_client: pylxd.Client = pylxd.Client(endpoint=endpoint) diff --git a/pkgs/by-name/sn/snapcraft/package.nix b/pkgs/by-name/sn/snapcraft/package.nix deleted file mode 100644 index c2f088fa6d3b..000000000000 --- a/pkgs/by-name/sn/snapcraft/package.nix +++ /dev/null @@ -1,213 +0,0 @@ -{ - fetchFromGitHub, - gitMinimal, - glibc, - lib, - makeWrapper, - nix-update-script, - python312Packages, - squashfsTools, - cacert, - stdenv, - writableTmpDirAsHomeHook, -}: - -python312Packages.buildPythonApplication rec { - pname = "snapcraft"; - version = "8.11.2"; - - pyproject = true; - - src = fetchFromGitHub { - owner = "canonical"; - repo = "snapcraft"; - tag = version; - hash = "sha256-Rc3OSRTTpYA7WKI/WEvCdq1SQnkO91FXzQscV2b93TI="; - }; - - patches = [ - # We're using a later version of `craft-cli` than expected, which - # adds an extra deprecation warning to the CLI output, meaning that - # an expected error message looks slightly different. This patch corrects - # that by checking for the updated error message and can be dropped in a - # later release of snapcraft. - ./esm-test.patch - # Snapcraft is only officially distributed as a snap, as is LXD. The socket - # path for LXD must be adjusted so that it's at the correct location for LXD - # on NixOS. This patch will likely never be accepted upstream. - ./lxd-socket-path.patch - # Snapcraft will try to inject itself as a snap *from the host system* into - # the build system. This patch short-circuits that logic and ensures that - # Snapcraft is installed on the build system from the snap store - because - # there is no snapd on NixOS hosts that can be used for the injection. This - # patch will likely never be accepted upstream. - ./set-channel-for-nix.patch - # Certain paths (for extensions, schemas) are packaged in the snap by the - # upstream, so the paths are well-known, except here where Snapcraft is - # *not* in a snap, so this patch changes those paths to point to the correct - # place in the Nix store. This patch will likely never be accepted upstream. - ./snapcraft-data-dirs.patch - ]; - - postPatch = '' - substituteInPlace snapcraft/__init__.py --replace-fail "dev" "${version}" - - substituteInPlace snapcraft_legacy/__init__.py \ - --replace-fail '__version__ = _get_version()' '__version__ = "${version}"' - - substituteInPlace snapcraft/elf/elf_utils.py \ - --replace-fail 'arch_linker_path = Path(arch_config.dynamic_linker)' \ - 'return str(Path("${glibc}/lib/ld-linux-x86-64.so.2"))' - - substituteInPlace pyproject.toml \ - --replace-fail 'setuptools>=69.0,<80.9.0' 'setuptools' \ - --replace-fail 'gnupg' 'python-gnupg' - ''; - - nativeBuildInputs = [ makeWrapper ]; - - dependencies = with python312Packages; [ - attrs - catkin-pkg - click - craft-application - craft-archives - craft-cli - craft-grammar - craft-parts - craft-platforms - craft-providers - craft-store - python-debian - docutils - jsonschema - launchpadlib - lazr-restfulclient - lxml - macaroonbakery - mypy-extensions - overrides - packaging - progressbar - pyelftools - pygit2 - pylxd - pymacaroons - python-apt - python-gnupg - pyxdg - pyyaml - raven - requests-toolbelt - requests-unixsocket2 - simplejson - snap-helpers - tabulate - toml - tinydb - typing-extensions - urllib3 - validators - ]; - - build-system = with python312Packages; [ setuptools-scm ]; - - pythonRelaxDeps = [ - "click" - "craft-parts" - "craft-providers" - "cryptography" - "docutils" - "jsonschema" - "pygit2" - "requests" - "urllib3" - "validators" - ]; - - postInstall = '' - wrapProgram $out/bin/snapcraft --prefix PATH : ${squashfsTools}/bin - ''; - - preCheck = '' - # _pygit2.GitError: OpenSSL error: failed to load certificates: error:00000000:lib(0)::reason(0) - export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt - ''; - - nativeCheckInputs = - with python312Packages; - [ - pytest-check - pytest-cov-stub - pytest-mock - pytest-subprocess - pytestCheckHook - responses - setuptools - writableTmpDirAsHomeHook - ] - ++ [ - gitMinimal - squashfsTools - ]; - - enabledTestPaths = [ "tests/unit" ]; - - disabledTests = [ - "test_bin_echo" - "test_classic_linter_filter" - "test_classic_linter" - "test_complex_snap_yaml" - "test_core24_try_command" - "test_get_base_configuration_snap_channel" - "test_get_base_configuration_snap_instance_name_default" - "test_get_base_configuration_snap_instance_name_not_running_as_snap" - "test_get_build_commands" - "test_get_extensions_data_dir" - "test_get_os_platform_alternative_formats" - "test_get_os_platform_linux" - "test_get_os_platform_windows" - "test_lifecycle_pack_components_with_output" - "test_lifecycle_pack_components" - "test_lifecycle_write_component_metadata" - "test_parse_info_integrated" - "test_patch_elf" - "test_project_platform_unknown_name" - "test_remote_builder_init" - "test_setup_assets_remote_icon" - "test_snap_command_fallback" - "test_validate_architectures_supported" - "test_validate_architectures_unsupported" - # Disabled because we're uisng a later version of a library than - # specified which changes the behaviour in a non-breaking way, apart - # from when a test is looking for a specific error message - "test_esm_error[core]" - "test_esm_error[core18]" - ] - ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "test_load_project" ]; - - disabledTestPaths = [ - "tests/unit/commands/test_remote.py" - "tests/unit/elf" - "tests/unit/linters/test_classic_linter.py" - "tests/unit/linters/test_library_linter.py" - "tests/unit/parts/test_parts.py" - "tests/unit/services" - ]; - - passthru.updateScript = nix-update-script { }; - - meta = { - mainProgram = "snapcraft"; - description = "Build and publish Snap packages"; - homepage = "https://github.com/canonical/snapcraft"; - changelog = "https://github.com/canonical/snapcraft/releases/tag/${version}"; - license = lib.licenses.gpl3Only; - maintainers = with lib.maintainers; [ - adhityaravi - bepri - dstathis - ]; - platforms = lib.platforms.linux; - }; -} diff --git a/pkgs/by-name/sn/snapcraft/set-channel-for-nix.patch b/pkgs/by-name/sn/snapcraft/set-channel-for-nix.patch deleted file mode 100644 index 99dc04c2b8bc..000000000000 --- a/pkgs/by-name/sn/snapcraft/set-channel-for-nix.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git i/snapcraft/providers.py w/snapcraft/providers.py -index 41ab6e8f1..ceaf7539b 100644 ---- i/snapcraft/providers.py -+++ w/snapcraft/providers.py -@@ -177,14 +177,15 @@ def get_base_configuration( - # injecting a snap on a non-linux system is not supported, so default to - # install snapcraft from the store's stable channel - snap_channel = get_managed_environment_snap_channel() -- if sys.platform != "linux" and not snap_channel: -+ import platform -+ if snap_channel is None and (sys.platform != "linux" or "NixOS" in platform.version()): - emit.progress( -- "Using snapcraft from snap store channel 'latest/stable' in instance " -+ "Using snapcraft from snap store channel 'latest/beta' in instance " - "because snap injection is only supported on Linux hosts.", - permanent=True, - ) - snap_name = "snapcraft" -- snap_channel = "stable" -+ snap_channel = "beta" - elif is_snapcraft_running_from_snap(): - # Use SNAP_INSTANCE_NAME for snapcraft's snap name, as it may not be - # 'snapcraft' if the '--name' parameter was used to install snapcraft. diff --git a/pkgs/by-name/sn/snapcraft/snapcraft-data-dirs.patch b/pkgs/by-name/sn/snapcraft/snapcraft-data-dirs.patch deleted file mode 100644 index 3f9ac77fa555..000000000000 --- a/pkgs/by-name/sn/snapcraft/snapcraft-data-dirs.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/snapcraft_legacy/internal/common.py b/snapcraft_legacy/internal/common.py -index b3d40c265..c68c24d53 100644 ---- a/snapcraft_legacy/internal/common.py -+++ b/snapcraft_legacy/internal/common.py -@@ -36,7 +36,10 @@ from snapcraft_legacy.internal import errors - - SNAPCRAFT_FILES = ["parts", "stage", "prime"] - --_DEFAULT_PLUGINDIR = os.path.join(sys.prefix, "share", "snapcraft", "plugins") -+# Get the path to the Nix store entry for Snapcraft at runtime -+drv = os.path.realpath(__file__).split("/")[3] -+ -+_DEFAULT_PLUGINDIR = os.path.join(os.sep, "nix", "store", drv, "share", "snapcraft", "plugins") - _plugindir = _DEFAULT_PLUGINDIR - - _BASE_DIR = Path(__file__).parents[2] diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 7f738e43f47c..a723797e6fc1 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -2297,6 +2297,7 @@ mapAliases { slurm-llnl = slurm; # renamed July 2017 sm64ex-coop = throw "'sm64ex-coop' was removed as it was archived upstream. Consider migrating to 'sm64coopdx'"; # added 2024-11-23 smartgithg = smartgit; # renamed March 2025 + snapcraft = throw "snapcraft was removed in Sep 25 following removal of LXD from nixpkgs"; # added 2025-09-18 snapTools = throw "snapTools was removed because makeSnap produced broken snaps and it was the only function in snapTools. See https://github.com/NixOS/nixpkgs/issues/100618 for more details."; # Added 2024-03-04 snort2 = throw "snort2 has been removed as it is deprecated and unmaintained by upstream. Consider using snort (snort3) package instead."; # 2025-05-21 soldat-unstable = opensoldat; # Added 2022-07-02