treewide: remove canonical craft libraries
This commit is contained in:
@@ -1,164 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
craft-archives,
|
||||
craft-cli,
|
||||
craft-grammar,
|
||||
craft-parts,
|
||||
craft-platforms,
|
||||
craft-providers,
|
||||
jinja2,
|
||||
fetchFromGitHub,
|
||||
gitMinimal,
|
||||
hypothesis,
|
||||
license-expression,
|
||||
nix-update-script,
|
||||
pyfakefs,
|
||||
pygit2,
|
||||
pytest-check,
|
||||
pytest-mock,
|
||||
pytest-subprocess,
|
||||
pytestCheckHook,
|
||||
pyyaml,
|
||||
responses,
|
||||
setuptools-scm,
|
||||
snap-helpers,
|
||||
freezegun,
|
||||
cacert,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-application";
|
||||
version = "5.6.5";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-application";
|
||||
tag = version;
|
||||
hash = "sha256-1TQolHJDyuUxUBv7ATI0Gqedi9y2q/sU1JAS2eYYcqc=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail "setuptools==75.9.1" "setuptools"
|
||||
|
||||
substituteInPlace craft_application/git/_utils.py \
|
||||
--replace-fail "/snap/core22/current/etc/ssl/certs" "${cacert}/etc/ssl/certs"
|
||||
'';
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
pythonRelaxDeps = [
|
||||
"pygit2"
|
||||
"requests"
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
craft-archives
|
||||
craft-cli
|
||||
craft-grammar
|
||||
craft-parts
|
||||
craft-platforms
|
||||
craft-providers
|
||||
jinja2
|
||||
license-expression
|
||||
pygit2
|
||||
pyyaml
|
||||
snap-helpers
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
freezegun
|
||||
gitMinimal
|
||||
hypothesis
|
||||
pyfakefs
|
||||
pytest-check
|
||||
pytest-mock
|
||||
pytest-subprocess
|
||||
pytestCheckHook
|
||||
responses
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
# Tests require access to /etc/os-release, which isn't accessible in
|
||||
# the test environment, so create a fake file, and modify the code
|
||||
# to look for it.
|
||||
echo 'ID=nixos' > $HOME/os-release
|
||||
echo 'NAME=NixOS' >> $HOME/os-release
|
||||
echo 'VERSION_ID="24.05"' >> $HOME/os-release
|
||||
|
||||
substituteInPlace craft_application/util/platforms.py \
|
||||
--replace-fail "os_utils.OsRelease()" "os_utils.OsRelease(os_release_file='$HOME/os-release')"
|
||||
|
||||
# Not using `--replace-fail` here only because it simplifies overriding this package in the charmcraft
|
||||
# derivation. Once charmcraft has moved to craft-application >= 5, `--replace-fail` can be added.
|
||||
substituteInPlace tests/conftest.py \
|
||||
--replace "include_lsb=False, include_uname=False, include_oslevel=False" "include_lsb=False, include_uname=False, include_oslevel=False, os_release_file='$HOME/os-release'"
|
||||
|
||||
# The project attempts to write into the user's runtime directory, usually
|
||||
# '/run/user/<uid>', which fails in the build environment. By setting this
|
||||
# variable, we redirect the runtime directory lookup to the temp directory
|
||||
# created by the 'writableTmpDirAsHomeHook'.
|
||||
export XDG_RUNTIME_DIR="$HOME"
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "craft_application" ];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
disabledTests = [
|
||||
"test_to_yaml_file"
|
||||
# Tests expecting pytest-time
|
||||
"test_monitor_builds_success"
|
||||
# Temporary fix until new release to support Python 3.13
|
||||
"test_grammar_aware_part_error"
|
||||
"test_grammar_aware_part_error[part2]"
|
||||
"test_grammar_aware_project_error[project0]"
|
||||
# Temp fix - asserts fail against error messages which have changed
|
||||
# slightly in a later revision of craft-platforms. No functional error.
|
||||
"test_platform_invalid_arch"
|
||||
"test_platform_invalid_build_arch"
|
||||
# Asserts against string output which fails when not on Ubuntu.
|
||||
"test_run_error_with_docs_url"
|
||||
# Asserts a fallback path for SSL certs that we override in a patch.
|
||||
"test_import_fallback_wrong_metadata"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
||||
# These tests have hardcoded "amd64" strings which fail on aarch64
|
||||
"test_process_grammar_build_for"
|
||||
"test_process_grammar_platform"
|
||||
"test_process_grammar_default"
|
||||
"test_create_craft_manifest"
|
||||
"test_create_project_manifest"
|
||||
"test_from_packed_artifact"
|
||||
"test_teardown_session_create_manifest"
|
||||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
# These tests assert outputs of commands that assume Ubuntu-related output.
|
||||
"tests/unit/services/test_lifecycle.py"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
||||
# Hard-coded assumptions around use of "amd64" arch strings.
|
||||
"tests/unit/services/test_project.py"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Basis for Canonical craft applications";
|
||||
homepage = "https://github.com/canonical/craft-application";
|
||||
changelog = "https://github.com/canonical/craft-application/blob/${src.tag}/docs/reference/changelog.rst";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
launchpadlib,
|
||||
lazr-restfulclient,
|
||||
lazr-uri,
|
||||
overrides,
|
||||
pydantic,
|
||||
python-debian,
|
||||
distro,
|
||||
setuptools-scm,
|
||||
pytest-check,
|
||||
pytest-mock,
|
||||
pytestCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-archives";
|
||||
version = "2.2.0";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-archives";
|
||||
tag = version;
|
||||
hash = "sha256-NXMBaY4sZT47Qi3XS5yuiXJEMKENghiXkLXnXHHYpRI=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace craft_archives/__init__.py \
|
||||
--replace-fail "dev" "${version}"
|
||||
'';
|
||||
|
||||
pythonRelaxDeps = [
|
||||
"python-debian"
|
||||
];
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
distro
|
||||
launchpadlib
|
||||
lazr-restfulclient
|
||||
lazr-uri
|
||||
overrides
|
||||
pydantic
|
||||
python-debian
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_archives" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytest-check
|
||||
pytest-mock
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Library for handling archives/repositories in Canonical craft applications";
|
||||
homepage = "https://github.com/canonical/craft-archives";
|
||||
changelog = "https://github.com/canonical/craft-archives/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
platformdirs,
|
||||
jinja2,
|
||||
overrides,
|
||||
pyyaml,
|
||||
setuptools-scm,
|
||||
pytest-check,
|
||||
pytest-mock,
|
||||
pytestCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-cli";
|
||||
version = "3.1.2";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-cli";
|
||||
tag = version;
|
||||
hash = "sha256-ryNHl/c8Pg2mGQHE9Dbd0bLU80NyCyxfhd2YQGEBN40=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail "setuptools==75.2.0" "setuptools"
|
||||
'';
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
jinja2
|
||||
overrides
|
||||
platformdirs
|
||||
pyyaml
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_cli" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytest-check
|
||||
pytest-mock
|
||||
pytestCheckHook
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "CLI builder for Canonical's CLI Guidelines";
|
||||
homepage = "https://github.com/canonical/craft-cli";
|
||||
changelog = "https://github.com/canonical/craft-cli/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
overrides,
|
||||
setuptools-scm,
|
||||
pytestCheckHook,
|
||||
pydantic,
|
||||
pyyaml,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-grammar";
|
||||
version = "2.2.0";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-grammar";
|
||||
tag = version;
|
||||
hash = "sha256-URyc+N2WSXnjurqd1ieV2mN4Uf9m0zivupRuKmH6s8Q=";
|
||||
};
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
overrides
|
||||
pydantic
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_grammar" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
pyyaml
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
# Temp fix for test incompatibility with Python 3.13
|
||||
disabledTests = [
|
||||
"test_grammar_strlist_error[value2]"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Advanced grammar for Canonical's craft-parts library";
|
||||
homepage = "https://github.com/canonical/craft-grammar";
|
||||
changelog = "https://github.com/canonical/craft-grammar/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
diff --git a/craft_parts/executor/step_handler.py b/craft_parts/executor/step_handler.py
|
||||
index 5eab915..bc26252 100644
|
||||
--- a/craft_parts/executor/step_handler.py
|
||||
+++ b/craft_parts/executor/step_handler.py
|
||||
@@ -445,7 +445,8 @@ def _create_and_run_script(
|
||||
) -> None:
|
||||
"""Create a script with step-specific commands and execute it."""
|
||||
with script_path.open("w") as run_file:
|
||||
- print("#!/bin/bash", file=run_file)
|
||||
+ import shutil
|
||||
+ print(f"#!{shutil.which('bash')}", file=run_file)
|
||||
print("set -euo pipefail", file=run_file)
|
||||
|
||||
if environment_script_path:
|
||||
diff --git a/craft_parts/plugins/java_plugin.py b/craft_parts/plugins/java_plugin.py
|
||||
index f2b4064..cb4e9e8 100644
|
||||
--- a/craft_parts/plugins/java_plugin.py
|
||||
+++ b/craft_parts/plugins/java_plugin.py
|
||||
@@ -71,9 +71,8 @@ class JavaPlugin(Plugin):
|
||||
return None, ""
|
||||
|
||||
def _find_javac(self) -> list[str]:
|
||||
- cmd = ["find", "/usr/lib/jvm", "-path", "*/bin/javac", "-print"]
|
||||
- output = subprocess.check_output(cmd, text=True)
|
||||
- return [x for x in output.split("\n") if len(x) > 0]
|
||||
+ import shutil
|
||||
+ return [shutil.which("javac")]
|
||||
|
||||
@override
|
||||
def get_build_environment(self) -> dict[str, str]:
|
||||
diff --git a/craft_parts/plugins/validator.py b/craft_parts/plugins/validator.py
|
||||
index 5b4c735..d7a446e 100644
|
||||
--- a/craft_parts/plugins/validator.py
|
||||
+++ b/craft_parts/plugins/validator.py
|
||||
@@ -142,8 +142,9 @@ class PluginEnvironmentValidator:
|
||||
print(cmd, file=env_file)
|
||||
env_file.flush()
|
||||
|
||||
+ import shutil
|
||||
proc = subprocess.run(
|
||||
- ["/bin/bash", env_file.name],
|
||||
+ [shutil.which("bash"), env_file.name],
|
||||
check=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
diff --git a/tests/unit/executor/test_step_handler.py b/tests/unit/executor/test_step_handler.py
|
||||
index 4e73c2b..a5f9374 100644
|
||||
--- a/tests/unit/executor/test_step_handler.py
|
||||
+++ b/tests/unit/executor/test_step_handler.py
|
||||
@@ -209,9 +209,10 @@ class TestStepHandlerBuiltins:
|
||||
|
||||
assert get_mode(build_script_path) == 0o755
|
||||
with open(build_script_path) as file:
|
||||
+ import shutil
|
||||
assert file.read() == dedent(
|
||||
f"""\
|
||||
- #!/bin/bash
|
||||
+ #!{shutil.which("bash")}
|
||||
set -euo pipefail
|
||||
source {environment_script_path}
|
||||
set -x
|
||||
diff --git a/tests/unit/utils/test_process.py b/tests/unit/utils/test_process.py
|
||||
index a025494..a76cfa2 100644
|
||||
--- a/tests/unit/utils/test_process.py
|
||||
+++ b/tests/unit/utils/test_process.py
|
||||
@@ -33,7 +33,8 @@ _RUN_TEST_CASES = [
|
||||
|
||||
@pytest.mark.parametrize(("out", "err"), _RUN_TEST_CASES)
|
||||
def test_run(out, err):
|
||||
- result = process.run(["/usr/bin/sh", "-c", f"echo {out};sleep 0.1;echo {err} >&2"])
|
||||
+ import shutil
|
||||
+ result = process.run([shutil.which("sh"), "-c", f"echo {out};sleep 0.1;echo {err} >&2"])
|
||||
assert result.returncode == 0
|
||||
assert result.stdout == (out + "\n").encode()
|
||||
assert result.stderr == (err + "\n").encode()
|
||||
@@ -42,8 +43,9 @@ def test_run(out, err):
|
||||
|
||||
@pytest.mark.parametrize(("out", "err"), _RUN_TEST_CASES)
|
||||
def test_run_devnull(out, err):
|
||||
+ import shutil
|
||||
result = process.run(
|
||||
- ["/usr/bin/sh", "-c", f"echo {out};echo {err} >&2"],
|
||||
+ [shutil.which("sh"), "-c", f"echo {out};echo {err} >&2"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
@@ -78,9 +80,10 @@ def test_run_selector(out, err, new_dir):
|
||||
|
||||
selector.register(sock, selectors.EVENT_READ, accept)
|
||||
|
||||
+ import shutil
|
||||
result = process.run(
|
||||
[
|
||||
- "/usr/bin/sh",
|
||||
+ shutil.which("sh"),
|
||||
"-c",
|
||||
f"echo {out};sleep 0.1;echo {err} >&2; echo -n {out}|socat - UNIX-CONNECT:{new_dir}/test.socket",
|
||||
],
|
||||
@@ -1,136 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
overrides,
|
||||
pydantic,
|
||||
pyxdg,
|
||||
pyyaml,
|
||||
requests,
|
||||
requests-unixsocket,
|
||||
pyfakefs,
|
||||
pytestCheckHook,
|
||||
pytest-check,
|
||||
pytest-mock,
|
||||
pytest-subprocess,
|
||||
requests-mock,
|
||||
hypothesis,
|
||||
jsonschema,
|
||||
lxml,
|
||||
git,
|
||||
squashfsTools,
|
||||
socat,
|
||||
setuptools-scm,
|
||||
stdenv,
|
||||
ant,
|
||||
maven,
|
||||
jdk,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-parts";
|
||||
version = "2.20.1";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-parts";
|
||||
tag = version;
|
||||
hash = "sha256-YTyoJzot7GkRp+szo+a3wx5mWWJcYj7ke7kcxri9n10=";
|
||||
};
|
||||
|
||||
patches = [ ./bash-path.patch ];
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
pythonRelaxDeps = [
|
||||
"requests"
|
||||
"urllib3"
|
||||
"pydantic"
|
||||
];
|
||||
|
||||
dependencies = [
|
||||
lxml
|
||||
overrides
|
||||
pydantic
|
||||
pyxdg
|
||||
pyyaml
|
||||
requests
|
||||
requests-unixsocket
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_parts" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
ant
|
||||
git
|
||||
hypothesis
|
||||
jdk
|
||||
jsonschema
|
||||
maven
|
||||
pyfakefs
|
||||
pytest-check
|
||||
pytest-mock
|
||||
pytest-subprocess
|
||||
pytestCheckHook
|
||||
requests-mock
|
||||
socat
|
||||
squashfsTools
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
disabledTests = [
|
||||
# Relies upon paths not present in Nix (like /bin/bash)
|
||||
"test_run_builtin_build"
|
||||
"test_run_prime"
|
||||
"test_get_build_packages_with_source_type"
|
||||
"test_get_build_packages"
|
||||
# Relies upon certain paths being present that don't make sense on Nix.
|
||||
"test_java_plugin_jre_not_17"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
||||
# This test is flaky on arm64, I think due to a mock library misbehaving
|
||||
# on arm64.
|
||||
"test_get_build_commands_is_reentrant"
|
||||
];
|
||||
|
||||
disabledTestPaths = [
|
||||
# Relies upon filesystem extended attributes, and suid/guid bits
|
||||
"tests/unit/sources/test_base.py"
|
||||
"tests/unit/packages/test_base.py"
|
||||
"tests/unit/state_manager"
|
||||
"tests/unit/test_xattrs.py"
|
||||
"tests/unit/packages/test_normalize.py"
|
||||
# Relies upon presence of apt/dpkg.
|
||||
"tests/unit/packages/test_apt_cache.py"
|
||||
"tests/unit/packages/test_deb.py"
|
||||
"tests/unit/packages/test_chisel.py"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
||||
# These tests have hardcoded "amd64" strings which fail on aarch64
|
||||
"tests/unit/executor/test_environment.py"
|
||||
"tests/unit/features/overlay/test_executor_environment.py"
|
||||
# Hard-coded assumptions about arguments relating to 'x86_64'
|
||||
"tests/unit/plugins/test_dotnet_v2_plugin.py"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Software artifact parts builder from Canonical";
|
||||
homepage = "https://github.com/canonical/craft-parts";
|
||||
changelog = "https://github.com/canonical/craft-parts/releases/tag/${src.tag}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
annotated-types,
|
||||
distro,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
hypothesis,
|
||||
pytest-check,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
setuptools-scm,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-platforms";
|
||||
version = "0.10.0";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-platforms";
|
||||
tag = version;
|
||||
hash = "sha256-86dUeMb3yL1ilbHxmknFaRH4Ce9AEl+5rSVW0WGaZV8=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace craft_platforms/__init__.py --replace-fail "dev" "${version}"
|
||||
'';
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
annotated-types
|
||||
distro
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
hypothesis
|
||||
pytestCheckHook
|
||||
pytest-check
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_platforms" ];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
disabledTests = [
|
||||
# Attempts to get distro information, and expects "ubuntu-ish"
|
||||
# information to be returned, which doesn't work under NixOS
|
||||
"test_fuzz_get_platforms_build_plan_single_base"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Manage platforms and architectures for charm applications";
|
||||
homepage = "https://github.com/canonical/craft-platforms";
|
||||
changelog = "https://github.com/canonical/craft-platforms/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
packaging,
|
||||
platformdirs,
|
||||
pydantic,
|
||||
pyyaml,
|
||||
requests-unixsocket,
|
||||
setuptools-scm,
|
||||
pytest-check,
|
||||
pytest-mock,
|
||||
pytestCheckHook,
|
||||
responses,
|
||||
freezegun,
|
||||
pytest-subprocess,
|
||||
logassert,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-providers";
|
||||
version = "3.0.0";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-providers";
|
||||
tag = version;
|
||||
hash = "sha256-8StnxyuvyK9HRl1smbhJFz1qZxyNOWnzELG0ku0dh8k=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# This lib will try to inject snaps *from the host system* into the build
|
||||
# system. This patch short-circuits that logic and ensures that snaps are
|
||||
# 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.
|
||||
./inject-snaps.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace craft_providers/lxd/installer.py \
|
||||
--replace-fail "/var/snap/lxd/common/lxd/unix.socket" "/var/lib/lxd/unix.socket"
|
||||
|
||||
substituteInPlace craft_providers/__init__.py \
|
||||
--replace-fail "dev" "${version}"
|
||||
|
||||
# The urllib3 incompat: https://github.com/msabramo/requests-unixsocket/pull/69
|
||||
# This is already patched in nixpkgs.
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail "setuptools==80.9.0" "setuptools"
|
||||
'';
|
||||
|
||||
pythonRelaxDeps = [ "requests" ];
|
||||
|
||||
build-system = [ setuptools-scm ];
|
||||
|
||||
dependencies = [
|
||||
packaging
|
||||
platformdirs
|
||||
pydantic
|
||||
pyyaml
|
||||
requests-unixsocket
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_providers" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
freezegun
|
||||
logassert
|
||||
pytest-check
|
||||
pytest-mock
|
||||
pytest-subprocess
|
||||
pytestCheckHook
|
||||
responses
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
disabledTestPaths = [
|
||||
# Relies upon "logassert" python package which isn't in nixpkgs
|
||||
"tests/unit/bases/test_ubuntu_buildd.py"
|
||||
"tests/unit/bases/test_centos_7.py"
|
||||
"tests/unit/bases/test_almalinux.py"
|
||||
"tests/unit/actions/test_snap_installer.py"
|
||||
# Relies upon "pytest-time" python package which isn't in nixpkgs
|
||||
"tests/unit/multipass"
|
||||
"tests/unit/lxd"
|
||||
"tests/unit/test_base.py"
|
||||
"tests/unit/util/test_retry.py"
|
||||
];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Interfaces for instantiating and controlling a variety of build environments";
|
||||
homepage = "https://github.com/canonical/craft-providers";
|
||||
changelog = "https://github.com/canonical/craft-providers/releases/tag/${src.tag}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
diff --git i/craft_providers/base.py w/craft_providers/base.py
|
||||
index 00f56ec..302f359 100644
|
||||
--- i/craft_providers/base.py
|
||||
+++ w/craft_providers/base.py
|
||||
@@ -655,40 +655,24 @@ class Base(ABC):
|
||||
),
|
||||
)
|
||||
|
||||
- if snap.channel:
|
||||
- try:
|
||||
- snap_installer.install_from_store(
|
||||
- executor=executor,
|
||||
- snap_name=snap.name,
|
||||
- channel=snap.channel,
|
||||
- classic=snap.classic,
|
||||
- )
|
||||
- except SnapInstallationError as error:
|
||||
- raise BaseConfigurationError(
|
||||
- brief=(
|
||||
- f"failed to install snap {snap.name!r} from store"
|
||||
- f" channel {snap.channel!r} in target environment."
|
||||
- ),
|
||||
- details=error.details,
|
||||
- resolution=(
|
||||
- "Check Snap store status at https://status.snapcraft.io"
|
||||
- ),
|
||||
- ) from error
|
||||
- else:
|
||||
- try:
|
||||
- snap_installer.inject_from_host(
|
||||
- executor=executor,
|
||||
- snap_name=snap.name,
|
||||
- classic=snap.classic,
|
||||
- )
|
||||
- except SnapInstallationError as error:
|
||||
- raise BaseConfigurationError(
|
||||
- brief=(
|
||||
- f"failed to inject host's snap {snap.name!r} "
|
||||
- "into target environment."
|
||||
- ),
|
||||
- details=error.details,
|
||||
- ) from error
|
||||
+ try:
|
||||
+ snap_installer.install_from_store(
|
||||
+ executor=executor,
|
||||
+ snap_name=snap.name,
|
||||
+ channel=snap.channel,
|
||||
+ classic=snap.classic,
|
||||
+ )
|
||||
+ except SnapInstallationError as error:
|
||||
+ raise BaseConfigurationError(
|
||||
+ brief=(
|
||||
+ f"failed to install snap {snap.name!r} from store"
|
||||
+ f" channel {snap.channel!r} in target environment."
|
||||
+ ),
|
||||
+ details=error.details,
|
||||
+ resolution=(
|
||||
+ "Check Snap store status at https://status.snapcraft.io"
|
||||
+ ),
|
||||
+ ) from error
|
||||
|
||||
def wait_until_ready(self, executor: Executor) -> None:
|
||||
"""Wait until base instance is ready.
|
||||
@@ -1,91 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
nix-update-script,
|
||||
setuptools,
|
||||
setuptools-scm,
|
||||
pytest-check,
|
||||
pytest-httpx,
|
||||
pytest-mock,
|
||||
pyyaml,
|
||||
pytestCheckHook,
|
||||
annotated-types,
|
||||
httpx,
|
||||
jaraco-classes,
|
||||
keyring,
|
||||
macaroonbakery,
|
||||
overrides,
|
||||
pydantic,
|
||||
pyxdg,
|
||||
requests,
|
||||
requests-toolbelt,
|
||||
typing-extensions,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "craft-store";
|
||||
version = "3.3.0";
|
||||
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canonical";
|
||||
repo = "craft-store";
|
||||
tag = version;
|
||||
hash = "sha256-ige4R5nwlfeSDyhzw0TDQMMIcExIJQuFAFvbNEpreSs=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
--replace-fail "setuptools==75.8.0" "setuptools"
|
||||
'';
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
setuptools-scm
|
||||
];
|
||||
|
||||
pythonRelaxDeps = [ "httpx" ];
|
||||
|
||||
dependencies = [
|
||||
annotated-types
|
||||
httpx
|
||||
jaraco-classes
|
||||
keyring
|
||||
macaroonbakery
|
||||
overrides
|
||||
pydantic
|
||||
pyxdg
|
||||
requests
|
||||
requests-toolbelt
|
||||
typing-extensions
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "craft_store" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytest-check
|
||||
pytest-httpx
|
||||
pytest-mock
|
||||
pytestCheckHook
|
||||
pyyaml
|
||||
];
|
||||
|
||||
enabledTestPaths = [ "tests/unit" ];
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
description = "Interfaces for communicating with Canonical Stores (e.g. Snap Store)";
|
||||
homepage = "https://github.com/canonical/craft-store";
|
||||
changelog = "https://github.com/canonical/craft-store/releases/tag/${version}";
|
||||
license = lib.licenses.lgpl3Only;
|
||||
maintainers = with lib.maintainers; [
|
||||
adhityaravi
|
||||
bepri
|
||||
dstathis
|
||||
];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -3063,22 +3063,6 @@ self: super: with self; {
|
||||
|
||||
cpyparsing = callPackage ../development/python-modules/cpyparsing { };
|
||||
|
||||
craft-application = callPackage ../development/python-modules/craft-application { };
|
||||
|
||||
craft-archives = callPackage ../development/python-modules/craft-archives { };
|
||||
|
||||
craft-cli = callPackage ../development/python-modules/craft-cli { };
|
||||
|
||||
craft-grammar = callPackage ../development/python-modules/craft-grammar { };
|
||||
|
||||
craft-parts = callPackage ../development/python-modules/craft-parts { };
|
||||
|
||||
craft-platforms = callPackage ../development/python-modules/craft-platforms { };
|
||||
|
||||
craft-providers = callPackage ../development/python-modules/craft-providers { };
|
||||
|
||||
craft-store = callPackage ../development/python-modules/craft-store { };
|
||||
|
||||
cram = callPackage ../development/python-modules/cram { };
|
||||
|
||||
cramjam = callPackage ../development/python-modules/cramjam { };
|
||||
|
||||
Reference in New Issue
Block a user