diff --git a/constraints.txt b/constraints.txt new file mode 100644 index 0000000000..039eb0db27 --- /dev/null +++ b/constraints.txt @@ -0,0 +1 @@ +cython<3 diff --git a/requirements-devel.txt b/requirements-devel.txt index 9f60915fa8..c25c80eb5d 100644 --- a/requirements-devel.txt +++ b/requirements-devel.txt @@ -11,7 +11,7 @@ click==8.1.3 codespell==2.2.4 colorama==0.4.6 coverage==7.2.5 -craft-archives==1.1.2 +craft-archives==1.1.3 craft-cli==2.0.0 craft-grammar==1.1.1 craft-parts==1.21.1 diff --git a/requirements.txt b/requirements.txt index ba4458dff1..7335675b4a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ cffi==1.15.1 chardet==5.1.0 charset-normalizer==3.1.0 click==8.1.3 -craft-archives==1.1.2 +craft-archives==1.1.3 craft-cli==2.0.0 craft-grammar==1.1.1 craft-parts==1.21.1 @@ -51,7 +51,7 @@ python-dateutil==2.8.2 python-debian==0.1.49 pytz==2023.3 pyxdg==0.28 -PyYAML==6.0 +PyYAML==6.0.1 raven==6.10.0 requests==2.31.0 requests-toolbelt==1.0.0 diff --git a/patches/ctypes_init.diff b/snap/local/patches/python/ctypes_init.diff similarity index 100% rename from patches/ctypes_init.diff rename to snap/local/patches/python/ctypes_init.diff diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index c2139c1089..b030615d69 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -123,7 +123,7 @@ parts: # Apply patches echo "Patching ctypes..." - patch -s -b "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}" "${SNAPCRAFT_PROJECT_DIR}/patches/ctypes_init.diff" + patch -s -b "${PYTHON_PACKAGE_PATH}/${CTYPES_INIT}" "${SNAPCRAFT_PROJECT_DIR}/snap/local/patches/python/ctypes_init.diff" # Save patches to allow rebuilding mkdir -p patched/ctypes @@ -144,6 +144,8 @@ parts: # Limited to < 66 because we need `pkg_resources` and because `python-apt` # does not build with the latest. - setuptools<66 + python-constraints: + - constraints.txt python-requirements: - requirements.txt organize: diff --git a/tests/spread/core22/package-repo-archs/armhf.yaml b/tests/spread/core22/package-repo-archs/armhf.yaml new file mode 100644 index 0000000000..de3376e9ee --- /dev/null +++ b/tests/spread/core22/package-repo-archs/armhf.yaml @@ -0,0 +1,38 @@ +name: test-archs +version: '1.0' +summary: test package repos with different architectures +description: test package repos with different architectures +grade: stable +confinement: strict +base: core22 +architectures: + - build-on: amd64 + +package-repositories: + # The repo that contains libpython3.11-minimal:armhf + - type: apt + formats: [deb] + architectures: [armhf] + components: [main] + suites: [jammy] + key-id: F23C5A6CF475977595C89F51BA6932366A755776 + url: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu + # Also add the armhf arch for the "ports" repo, to fetch python's deps. We + # need to do this because the default archives don't have armhf. + - type: apt + architectures: [ armhf ] + components: [ main ] + suites: [ jammy, jammy-security, jammy-updates ] + key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C + url: http://ports.ubuntu.com/ubuntu-ports + +parts: + mypart: + plugin: nil + build-packages: + - file + stage-packages: + - libpython3.11-minimal:armhf + override-build: | + file ${CRAFT_PART_INSTALL}/usr/lib/arm-linux-gnueabihf/libssl.so.3 | grep "ARM" + craftctl default diff --git a/tests/spread/core22/package-repo-archs/i386.yaml b/tests/spread/core22/package-repo-archs/i386.yaml new file mode 100644 index 0000000000..b2e99953f4 --- /dev/null +++ b/tests/spread/core22/package-repo-archs/i386.yaml @@ -0,0 +1,33 @@ +name: test-archs +version: '1.0' +summary: test package repos with different architectures +description: test package repos with different architectures +grade: stable +confinement: strict +base: core22 +architectures: + - build-on: amd64 + +package-repositories: + # The repo that contains libpython3.11-minimal:i386 + - type: apt + formats: [deb] + architectures: [i386] + components: [main] + suites: [jammy] + key-id: F23C5A6CF475977595C89F51BA6932366A755776 + url: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu + # We don't need to add the i386 architecture for the official archives, + # because the host building this (amd64) is compatible so Snapcraft will add + # the i386 platform "globally". + +parts: + mypart: + plugin: nil + build-packages: + - file + stage-packages: + - libpython3.11-minimal:i386 + override-build: | + file ${CRAFT_PART_INSTALL}/usr/lib/i386-linux-gnu/libssl.so.3 | grep "ELF 32-bit" + craftctl default diff --git a/tests/spread/core22/package-repo-archs/task.yaml b/tests/spread/core22/package-repo-archs/task.yaml new file mode 100644 index 0000000000..766587e9db --- /dev/null +++ b/tests/spread/core22/package-repo-archs/task.yaml @@ -0,0 +1,19 @@ +summary: Test using package-repositories with different architectures on core22 + +environment: + SNAP_ARCH/i386: i386 + SNAP_ARCH/armhf: armhf + SNAPCRAFT_BUILD_ENVIRONMENT: "" + +restore: | + snapcraft clean + +execute: | + # The task works by copying one of the arch-specific yaml files as + # "snapcraft.yaml", and then building it. + rm -rf snap/ + mkdir snap + cp "$SNAP_ARCH".yaml snap/snapcraft.yaml + + # The part's build script does the checking. + snapcraft build --verbose --use-lxd