2024-04-18 11:36:54 +00:00
|
|
|
{
|
|
|
|
fetchFromGitHub,
|
|
|
|
git,
|
|
|
|
glibc,
|
|
|
|
lib,
|
|
|
|
makeWrapper,
|
|
|
|
nix-update-script,
|
2024-10-04 10:30:24 +00:00
|
|
|
python3Packages,
|
2024-04-18 11:36:54 +00:00
|
|
|
squashfsTools,
|
|
|
|
stdenv,
|
|
|
|
}:
|
2024-07-24 14:51:43 +00:00
|
|
|
|
2024-10-04 10:30:24 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2024-04-18 11:36:54 +00:00
|
|
|
pname = "snapcraft";
|
2024-11-20 09:47:55 +00:00
|
|
|
version = "8.5.0";
|
2024-04-18 11:36:54 +00:00
|
|
|
|
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "canonical";
|
|
|
|
repo = "snapcraft";
|
|
|
|
rev = "refs/tags/${version}";
|
2024-11-20 09:47:55 +00:00
|
|
|
hash = "sha256-u5LO29LnAJrU8fafa1EA4ii5g8sO8REfuf/7lzI7x5k=";
|
2024-04-18 11:36:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# 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
|
|
|
|
# In certain places, Snapcraft expects an /etc/os-release file to determine
|
|
|
|
# host info which doesn't exist in our test environment. This is a
|
|
|
|
# relatively naive patch which helps the test suite pass - without it *many*
|
|
|
|
# of the tests fail. This patch will likely never be accepted upstream.
|
|
|
|
./os-platform.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 setup.py \
|
|
|
|
--replace-fail 'version=determine_version()' 'version="${version}"' \
|
|
|
|
--replace-fail 'gnupg' 'python-gnupg'
|
|
|
|
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace-fail 'gnupg==2.3.1' 'python-gnupg'
|
|
|
|
|
|
|
|
substituteInPlace snapcraft/__init__.py \
|
|
|
|
--replace-fail '__version__ = _get_version()' '__version__ = "${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"))'
|
2024-07-09 11:46:08 +00:00
|
|
|
|
2024-07-24 13:33:17 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
2024-08-23 13:12:04 +00:00
|
|
|
--replace-fail '"pytest-cov>=4.0",' ""
|
2024-04-18 11:36:54 +00:00
|
|
|
'';
|
|
|
|
|
2024-07-24 13:33:17 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2024-04-18 11:36:54 +00:00
|
|
|
|
2024-10-04 10:30:24 +00:00
|
|
|
dependencies = with python3Packages; [
|
2024-04-18 11:36:54 +00:00
|
|
|
attrs
|
|
|
|
catkin-pkg
|
|
|
|
click
|
|
|
|
craft-application
|
|
|
|
craft-archives
|
|
|
|
craft-cli
|
|
|
|
craft-grammar
|
|
|
|
craft-parts
|
2024-10-04 10:30:24 +00:00
|
|
|
craft-platforms
|
2024-04-18 11:36:54 +00:00
|
|
|
craft-providers
|
|
|
|
craft-store
|
|
|
|
debian
|
|
|
|
docutils
|
|
|
|
jsonschema
|
|
|
|
launchpadlib
|
|
|
|
lazr-restfulclient
|
|
|
|
lxml
|
|
|
|
macaroonbakery
|
|
|
|
mypy-extensions
|
2024-07-24 13:33:17 +00:00
|
|
|
overrides
|
|
|
|
packaging
|
2024-04-18 11:36:54 +00:00
|
|
|
progressbar
|
|
|
|
pyelftools
|
|
|
|
pygit2
|
|
|
|
pylxd
|
2024-07-24 13:33:17 +00:00
|
|
|
pymacaroons
|
2024-04-18 11:36:54 +00:00
|
|
|
python-apt
|
|
|
|
python-gnupg
|
2024-07-24 13:33:17 +00:00
|
|
|
pyxdg
|
|
|
|
pyyaml
|
2024-04-18 11:36:54 +00:00
|
|
|
raven
|
|
|
|
requests-toolbelt
|
2024-11-20 09:47:55 +00:00
|
|
|
requests-unixsocket2
|
2024-04-18 11:36:54 +00:00
|
|
|
simplejson
|
|
|
|
snap-helpers
|
|
|
|
tabulate
|
2024-07-24 13:33:17 +00:00
|
|
|
toml
|
2024-04-18 11:36:54 +00:00
|
|
|
tinydb
|
2024-07-24 13:33:17 +00:00
|
|
|
typing-extensions
|
|
|
|
urllib3
|
|
|
|
validators
|
2024-04-18 11:36:54 +00:00
|
|
|
];
|
|
|
|
|
2024-10-04 10:30:24 +00:00
|
|
|
build-system = with python3Packages; [ setuptools ];
|
2024-04-18 11:36:54 +00:00
|
|
|
|
|
|
|
pythonRelaxDeps = [
|
|
|
|
"docutils"
|
|
|
|
"jsonschema"
|
|
|
|
"pygit2"
|
|
|
|
"urllib3"
|
2024-07-24 13:33:17 +00:00
|
|
|
"validators"
|
2024-04-18 11:36:54 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/snapcraft --prefix PATH : ${squashfsTools}/bin
|
|
|
|
'';
|
|
|
|
|
2024-07-09 11:46:08 +00:00
|
|
|
nativeCheckInputs =
|
2024-10-04 10:30:24 +00:00
|
|
|
with python3Packages;
|
2024-07-09 11:46:08 +00:00
|
|
|
[
|
|
|
|
pytest-check
|
2024-08-23 13:12:04 +00:00
|
|
|
pytest-cov-stub
|
2024-07-09 11:46:08 +00:00
|
|
|
pytest-mock
|
|
|
|
pytest-subprocess
|
|
|
|
pytestCheckHook
|
|
|
|
responses
|
|
|
|
setuptools
|
|
|
|
]
|
|
|
|
++ [
|
|
|
|
git
|
|
|
|
squashfsTools
|
|
|
|
];
|
2024-04-18 11:36:54 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
mkdir -p check-phase
|
|
|
|
export HOME="$(pwd)/check-phase"
|
|
|
|
'';
|
|
|
|
|
|
|
|
pytestFlagsArray = [ "tests/unit" ];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
"test_bin_echo"
|
|
|
|
"test_classic_linter_filter"
|
|
|
|
"test_classic_linter"
|
|
|
|
"test_complex_snap_yaml"
|
2024-07-24 13:33:17 +00:00
|
|
|
"test_core24_try_command"
|
2024-04-18 11:36:54 +00:00
|
|
|
"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"
|
2024-10-07 16:49:43 +00:00
|
|
|
"test_get_build_commands"
|
2024-04-18 11:36:54 +00:00
|
|
|
"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_remote_builder_init"
|
|
|
|
"test_setup_assets_remote_icon"
|
|
|
|
"test_snap_command_fallback"
|
|
|
|
"test_validate_architectures_supported"
|
|
|
|
"test_validate_architectures_unsupported"
|
2024-07-09 11:46:08 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "test_load_project" ];
|
2024-04-18 11:36:54 +00:00
|
|
|
|
|
|
|
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; [ jnsgruk ];
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|