snapcraft: upgrade to core22

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
Olivier Gayot 2023-03-03 14:34:38 +01:00
parent 18346e3f74
commit 9b18f45700
9 changed files with 51 additions and 36 deletions

View File

@ -23,7 +23,7 @@ jobs:
fail-fast: true fail-fast: true
matrix: matrix:
image: image:
- ubuntu-daily:focal # match the core snap we're running against - ubuntu-daily:jammy # match the core snap we're running against
- ubuntu-daily:lunar # latest - ubuntu-daily:lunar # latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
export PYTHONPATH=$PYTHONPATH:$SNAP/lib/python3.8/site-packages export PYTHONPATH=$PYTHONPATH:$SNAP/lib/python3.10/site-packages
$PYTHON -m subiquity "$@" $PYTHON -m subiquity "$@"

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
export PYTHONPATH=$PYTHONPATH:$SNAP/lib/python3.8/site-packages export PYTHONPATH=$PYTHONPATH:$SNAP/lib/python3.10/site-packages
$PYTHON -m subiquity.cmd.server $PYTHON -m subiquity.cmd.server

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
port=tty1 port=tty1
export PYTHONPATH=$SNAP/lib/python3.8/site-packages export PYTHONPATH=$SNAP/lib/python3.10/site-packages
if [ -n "$1" ]; then if [ -n "$1" ]; then
port=$1 port=$1

View File

@ -52,12 +52,12 @@ do_mount $old old
add_overlay old new add_overlay old new
rm -rf new/lib/python3.8/site-packages/curtin rm -rf new/lib/python3.10/site-packages/curtin
rm -rf new/lib/python3.8/site-packages/subiquity rm -rf new/lib/python3.10/site-packages/subiquity
rm -rf new/lib/python3.8/site-packages/subiquitycore rm -rf new/lib/python3.10/site-packages/subiquitycore
(cd "${src}" && ./scripts/update-part.py curtin) (cd "${src}" && ./scripts/update-part.py curtin)
rsync -a --chown 0:0 $src/subiquity $src/subiquitycore $src/curtin/curtin new/lib/python3.8/site-packages rsync -a --chown 0:0 $src/subiquity $src/subiquitycore $src/curtin/curtin new/lib/python3.10/site-packages
snapcraft pack new --output $new snapcraft pack new --output $new

View File

@ -1,5 +1,5 @@
name: subiquity name: subiquity
base: core20 base: core22
version: git version: git
summary: Ubuntu installer summary: Ubuntu installer
description: The Ubuntu server installer description: The Ubuntu server installer
@ -21,7 +21,7 @@ apps:
SUBIQUITY_ROOT_ORIG: $SUBIQUITY_ROOT SUBIQUITY_ROOT_ORIG: $SUBIQUITY_ROOT
SUBIQUITY_ROOT: $SNAP SUBIQUITY_ROOT: $SNAP
PYTHON_ORIG: $PYTHON PYTHON_ORIG: $PYTHON
PYTHON: $SNAP/usr/bin/python3.8 PYTHON: $SNAP/usr/bin/python3.10
probert: probert:
command: bin/probert command: bin/probert
subiquity-server: subiquity-server:
@ -31,8 +31,8 @@ apps:
environment: environment:
PYTHONIOENCODING: utf-8 PYTHONIOENCODING: utf-8
SUBIQUITY_ROOT: $SNAP SUBIQUITY_ROOT: $SNAP
PYTHON: $SNAP/usr/bin/python3.8 PYTHON: $SNAP/usr/bin/python3.10
PY3OR2_PYTHON: $SNAP/usr/bin/python3.8 PY3OR2_PYTHON: $SNAP/usr/bin/python3.10
PATH: $PATH:$SNAP/bin:$SNAP/sbin PATH: $PATH:$SNAP/bin:$SNAP/sbin
subiquity-service: subiquity-service:
command: usr/bin/subiquity-service command: usr/bin/subiquity-service
@ -48,7 +48,7 @@ apps:
SUBIQUITY_ROOT_ORIG: $SUBIQUITY_ROOT SUBIQUITY_ROOT_ORIG: $SUBIQUITY_ROOT
SUBIQUITY_ROOT: $SNAP SUBIQUITY_ROOT: $SNAP
PYTHON_ORIG: $PYTHON PYTHON_ORIG: $PYTHON
PYTHON: $SNAP/usr/bin/python3.8 PYTHON: $SNAP/usr/bin/python3.10
os-prober: os-prober:
command: usr/bin/os-prober command: usr/bin/os-prober
environment: environment:
@ -64,13 +64,19 @@ parts:
source-commit: b1f4da3bec92356e8ef389c1c581cfdcd1b36c42 source-commit: b1f4da3bec92356e8ef389c1c581cfdcd1b36c42
override-pull: | override-pull: |
snapcraftctl pull craftctl default
PACKAGED_VERSION="$(git describe --long --abbrev=9 --match=[0-9][0-9]*)" PACKAGED_VERSION="$(git describe --long --abbrev=9 --match=[0-9][0-9]*)"
sed -e "s,@@PACKAGED_VERSION@@,$PACKAGED_VERSION,g" -i curtin/version.py sed -e "s,@@PACKAGED_VERSION@@,$PACKAGED_VERSION,g" -i curtin/version.py
override-build: &pyinstall | override-build: &pyinstall |
# We install without dependencies because all dependencies come from # We install without dependencies because all dependencies come from
# archive packages. # archive packages.
pip3 install --prefix=$SNAPCRAFT_PART_INSTALL --no-dependencies . # XXX: On core22, running `pip3 install --prefix xxx` does not do the
# right thing. The package ends up installed in xxx/local and the modules
# get installed to dist-packages instead of site-packages.
# See https://discuss.python.org/t/18240
# As a workaround, we use a fake user install to get the package
# installed in the expected place.
PYTHONUSERBASE="$CRAFT_PART_INSTALL" pip3 install --user --no-dependencies .
build-packages: build-packages:
- python3-pip - python3-pip
@ -97,8 +103,8 @@ parts:
- cloud-init - cloud-init
- iso-codes - iso-codes
- libpython3-stdlib - libpython3-stdlib
- libpython3.8-minimal - libpython3.10-minimal
- libpython3.8-stdlib - libpython3.10-stdlib
- libsystemd0 - libsystemd0
- lsb-release - lsb-release
- ntfs-3g - ntfs-3g
@ -119,7 +125,7 @@ parts:
- python3-urwid - python3-urwid
- python3-yaml - python3-yaml
- python3-yarl - python3-yarl
- python3.8-minimal - python3.10-minimal
- ssh-import-id - ssh-import-id
- ubuntu-advantage-tools - ubuntu-advantage-tools
@ -128,7 +134,10 @@ parts:
bin/subiquity-service: usr/bin/subiquity-service bin/subiquity-service: usr/bin/subiquity-service
bin/subiquity-server: usr/bin/subiquity-server bin/subiquity-server: usr/bin/subiquity-server
bin/subiquity-cmd: usr/bin/subiquity-cmd bin/subiquity-cmd: usr/bin/subiquity-cmd
$SNAPCRAFT_PART_BUILD/system_setup/ubuntu-wsl-setup: bin/ubuntu-wsl-setup $CRAFT_PART_BUILD/system_setup/ubuntu-wsl-setup: bin/ubuntu-wsl-setup
build-attributes:
- enable-patchelf
users-and-groups: users-and-groups:
plugin: nil plugin: nil
@ -138,7 +147,7 @@ parts:
override-build: | override-build: |
echo "get passwd/user-default-groups" | \ echo "get passwd/user-default-groups" | \
debconf-communicate user-setup | \ debconf-communicate user-setup | \
cut -d ' ' -f 2- > $SNAPCRAFT_PART_INSTALL/users-and-groups cut -d ' ' -f 2- > $CRAFT_PART_INSTALL/users-and-groups
stage: stage:
- users-and-groups - users-and-groups
@ -148,7 +157,7 @@ parts:
source: https://git.launchpad.net/ubuntu/+source/user-setup source: https://git.launchpad.net/ubuntu/+source/user-setup
source-type: git source-type: git
override-build: cp -a reserved-usernames $SNAPCRAFT_PART_INSTALL/ override-build: cp -a reserved-usernames $CRAFT_PART_INSTALL/
stage: stage:
- reserved-usernames - reserved-usernames
@ -161,9 +170,9 @@ parts:
- python3-attr - python3-attr
- python3-yaml - python3-yaml
override-build: | override-build: |
PYTHONPATH=$SNAPCRAFT_PROJECT_DIR/ $SNAPCRAFT_PROJECT_DIR/scripts/make-kbd-info.py PYTHONPATH=$CRAFT_PROJECT_DIR/ $CRAFT_PROJECT_DIR/scripts/make-kbd-info.py
cp $SNAPCRAFT_PROJECT_DIR/kbds/keyboard-configuration.yaml \ cp $CRAFT_PROJECT_DIR/kbds/keyboard-configuration.yaml \
$SNAPCRAFT_PART_INSTALL/kbds/keyboard-configuration.yaml $CRAFT_PART_INSTALL/kbds/keyboard-configuration.yaml
stage: stage:
- kbds/ - kbds/
@ -188,7 +197,7 @@ parts:
sed -i 's/^path-exclude.*LC_MESSAGES.*/#\0/g' /etc/dpkg/dpkg.cfg.d/excludes sed -i 's/^path-exclude.*LC_MESSAGES.*/#\0/g' /etc/dpkg/dpkg.cfg.d/excludes
apt-get -y install --reinstall iso-codes apt-get -y install --reinstall iso-codes
} || true } || true
$SNAPCRAFT_PROJECT_DIR/scripts/make-language-lists $SNAPCRAFT_PROJECT_DIR/po > $SNAPCRAFT_PART_INSTALL/languagelist $CRAFT_PROJECT_DIR/scripts/make-language-lists $CRAFT_PROJECT_DIR/po > $CRAFT_PART_INSTALL/languagelist
stage: stage:
- languagelist - languagelist
@ -211,6 +220,9 @@ parts:
- python3-dev - python3-dev
- python3-pip - python3-pip
build-attributes:
- enable-patchelf
os-prober: os-prober:
plugin: nil plugin: nil
@ -225,4 +237,7 @@ parts:
override-build: | override-build: |
./debian/rules build ./debian/rules build
fakeroot ./debian/rules install fakeroot ./debian/rules install
cp -a debian/os-prober/{usr,var} $SNAPCRAFT_PART_INSTALL cp -a debian/os-prober/{usr,var} $CRAFT_PART_INSTALL
build-attributes:
- enable-patchelf

View File

@ -46,8 +46,8 @@ class TestLoggedCommandRunner(SubiTestCase):
runner = LoggedCommandRunner(ident="my-id", use_systemd_user=False) runner = LoggedCommandRunner(ident="my-id", use_systemd_user=False)
environ = { environ = {
"PATH": "/snap/subiquity/x1/bin", "PATH": "/snap/subiquity/x1/bin",
"PYTHONPATH": "/usr/lib/python3.8/site-packages", "PYTHONPATH": "/usr/lib/python3.10/site-packages",
"PYTHON": "/snap/subiquity/x1/usr/bin/python3.8", "PYTHON": "/snap/subiquity/x1/usr/bin/python3.10",
"TARGET_MOUNT_POINT": "/target", "TARGET_MOUNT_POINT": "/target",
"SNAP": "/snap/subiquity/x1", "SNAP": "/snap/subiquity/x1",
"SAMPLE": "should-not-be-exported", "SAMPLE": "should-not-be-exported",
@ -64,8 +64,8 @@ class TestLoggedCommandRunner(SubiTestCase):
"--property", "SyslogIdentifier=my-id", "--property", "SyslogIdentifier=my-id",
"--property", "PrivateMounts=yes", "--property", "PrivateMounts=yes",
"--setenv", "PATH=/snap/subiquity/x1/bin", "--setenv", "PATH=/snap/subiquity/x1/bin",
"--setenv", "PYTHONPATH=/usr/lib/python3.8/site-packages", "--setenv", "PYTHONPATH=/usr/lib/python3.10/site-packages",
"--setenv", "PYTHON=/snap/subiquity/x1/usr/bin/python3.8", "--setenv", "PYTHON=/snap/subiquity/x1/usr/bin/python3.10",
"--setenv", "TARGET_MOUNT_POINT=/target", "--setenv", "TARGET_MOUNT_POINT=/target",
"--setenv", "SNAP=/snap/subiquity/x1", "--setenv", "SNAP=/snap/subiquity/x1",
"--", "--",
@ -76,7 +76,7 @@ class TestLoggedCommandRunner(SubiTestCase):
runner = LoggedCommandRunner(ident="my-id", use_systemd_user=True) runner = LoggedCommandRunner(ident="my-id", use_systemd_user=True)
# Make sure unset variables are ignored # Make sure unset variables are ignored
environ = { environ = {
"PYTHONPATH": "/usr/lib/python3.8/site-packages", "PYTHONPATH": "/usr/lib/python3.10/site-packages",
} }
with patch.dict(os.environ, environ, clear=True): with patch.dict(os.environ, environ, clear=True):
cmd = runner._forge_systemd_cmd( cmd = runner._forge_systemd_cmd(
@ -89,7 +89,7 @@ class TestLoggedCommandRunner(SubiTestCase):
"--property", "SyslogIdentifier=my-id", "--property", "SyslogIdentifier=my-id",
"--user", "--user",
"--pipe", "--pipe",
"--setenv", "PYTHONPATH=/usr/lib/python3.8/site-packages", "--setenv", "PYTHONPATH=/usr/lib/python3.10/site-packages",
"--", "--",
"/bin/ls", "/root", "/bin/ls", "/root",
] ]

View File

@ -49,11 +49,11 @@ class TestOrigEnviron(SubiTestCase):
'SUBIQUITY_ROOT_ORIG': '', 'SUBIQUITY_ROOT_ORIG': '',
'SUBIQUITY_ROOT': snap, 'SUBIQUITY_ROOT': snap,
'PYTHON_ORIG': '', 'PYTHON_ORIG': '',
'PYTHON': f'{snap}/usr/bin/python3.8', 'PYTHON': f'{snap}/usr/bin/python3.10',
'PYTHONPATH_ORIG': '', 'PYTHONPATH_ORIG': '',
'PYTHONPATH': f'{snap}/stuff/things', 'PYTHONPATH': f'{snap}/stuff/things',
'PY3OR2_PYTHON_ORIG': '', 'PY3OR2_PYTHON_ORIG': '',
'PY3OR2_PYTHON': f'{snap}/usr/bin/python3.8', 'PY3OR2_PYTHON': f'{snap}/usr/bin/python3.10',
'PATH_ORIG': '/usr/bin:/bin', 'PATH_ORIG': '/usr/bin:/bin',
'PATH': '/usr/bin:/bin:/snap/bin' 'PATH': '/usr/bin:/bin:/snap/bin'
} }

View File

@ -344,11 +344,11 @@ PATH="${PATH}:${SNAP_CORE_DIR}/usr/sbin:${SNAP_CORE_DIR}/usr/bin:${SNAP_CORE_DIR
# configure python environment # configure python environment
export PYTHONIOENCODING=utf-8 export PYTHONIOENCODING=utf-8
PYTHONPATH=$SNAP/lib/python3.8/site-packages PYTHONPATH=$SNAP/lib/python3.10/site-packages
PYTHONPATH=$SNAP/usr/lib/python3/site-packages:$PYTHONPATH PYTHONPATH=$SNAP/usr/lib/python3/site-packages:$PYTHONPATH
PYTHONPATH=$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH PYTHONPATH=$SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
export PYTHONPATH export PYTHONPATH
export PYTHON=$SNAP/usr/bin/python3.8 export PYTHON=$SNAP/usr/bin/python3.10
export SNAP_PYTHON=$PYTHON export SNAP_PYTHON=$PYTHON
# ensure curtin points at PYTHON # ensure curtin points at PYTHON
export PY3OR2_PYTHON=$PYTHON export PY3OR2_PYTHON=$PYTHON