From 82a1ba0c78d984e40d4ff659edb4f98501add108 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Wed, 6 May 2020 10:48:25 +0200 Subject: [PATCH] Build tinyipa on focal Use new ubuntu-focal nodeset to build tinyipa images. This is needed to prepare to build tinyipa images based on tinycore 11.x because we need the new kernel 5.x version to be able to chroot. Main changes: - patching tce-load to conform to new squashfs options in the new kernel - installing python3-pip instead of python-pip Story: 2007753 Task: 39943 Change-Id: I3d8a1ab84cae3c7185eb4f9bfefe239fab49a012 --- .zuul.yaml | 2 ++ tinyipa/build-instance-images.sh | 4 ++++ tinyipa/build-tinyipa.sh | 4 ++++ tinyipa/finalise-tinyipa.sh | 4 ++++ tinyipa/install-deps.sh | 8 ++++---- tinyipa/patches/tce-load_squashfs.patch | 20 ++++++++++++++++++++ 6 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 tinyipa/patches/tce-load_squashfs.patch diff --git a/.zuul.yaml b/.zuul.yaml index 102041c..6dad8e4 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -16,6 +16,7 @@ - job: name: ironic-python-agent-build-image-tinyipa parent: ironic-python-agent-build-image-base + nodeset: ubuntu-focal vars: image_type: 'tinyipa' @@ -64,6 +65,7 @@ - job: name: ironic-python-agent-check-image-tinyipa parent: ironic-python-agent-check-image-base + nodeset: ubuntu-focal vars: image_type: 'tinyipa' diff --git a/tinyipa/build-instance-images.sh b/tinyipa/build-instance-images.sh index 0fd0221..4368363 100755 --- a/tinyipa/build-instance-images.sh +++ b/tinyipa/build-instance-images.sh @@ -22,6 +22,10 @@ setup_tce $DST_DIR # NOTE(rpittau) change ownership of the tce info dir to prevent writing issues sudo chown $TC:$STAFF $DST_DIR/usr/local/tce.installed +# NOTE(rpittau) patch tce-load to adapt to changes in squashfs module in +# latest kernel +sudo patch ${DST_DIR}/usr/bin/tce-load < patches/tce-load_squashfs.patch + $TC_CHROOT_CMD tce-load -wci grub2-multi.tcz cleanup_tce $DST_DIR diff --git a/tinyipa/build-tinyipa.sh b/tinyipa/build-tinyipa.sh index d14f8f2..6fc1454 100755 --- a/tinyipa/build-tinyipa.sh +++ b/tinyipa/build-tinyipa.sh @@ -170,6 +170,10 @@ fi # NOTE(rpittau) change ownership of the tce info dir to prevent writing issues sudo chown $TC:$STAFF $BUILDDIR/usr/local/tce.installed +# NOTE(rpittau) patch tce-load to adapt to changes in squashfs module in +# latest kernel +sudo patch ${BUILDDIR}/usr/bin/tce-load < patches/tce-load_squashfs.patch + while read line; do sudo chroot --userspec=$TC:$STAFF $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy tce-load -wci $line done < <(paste $WORKDIR/build_files/$PY_REQS $WORKDIR/build_files/buildreqs.lst) diff --git a/tinyipa/finalise-tinyipa.sh b/tinyipa/finalise-tinyipa.sh index 1b4e319..37d40b4 100755 --- a/tinyipa/finalise-tinyipa.sh +++ b/tinyipa/finalise-tinyipa.sh @@ -102,6 +102,10 @@ fi # NOTE(rpittau) change ownership of the tce info dir to prevent writing issues sudo chown $TC:$STAFF $FINALDIR/usr/local/tce.installed +# NOTE(rpittau) patch tce-load to adapt to changes in squashfs module in +# latest kernel +sudo patch ${FINALDIR}/usr/bin/tce-load < patches/tce-load_squashfs.patch + while read line; do $TC_CHROOT_CMD tce-load -wic $line done < <(paste $WORKDIR/build_files/finalreqs.lst $WORKDIR/build_files/$PY_REQS) diff --git a/tinyipa/install-deps.sh b/tinyipa/install-deps.sh index 1c05554..22b831c 100755 --- a/tinyipa/install-deps.sh +++ b/tinyipa/install-deps.sh @@ -1,9 +1,9 @@ #!/bin/bash -COMMON_PACKAGES="wget python-pip unzip sudo gawk" -APT_PACKAGES="${COMMON_PACKAGES} squashfs-tools" -YUM_PACKAGES="${COMMON_PACKAGES} squashfs-tools" -ZYPPER_PACKAGES="${COMMON_PACKAGES} squashfs" +COMMON_PACKAGES="wget unzip sudo gawk" +APT_PACKAGES="${COMMON_PACKAGES} python3-pip squashfs-tools" +YUM_PACKAGES="${COMMON_PACKAGES} python-pip squashfs-tools" +ZYPPER_PACKAGES="${COMMON_PACKAGES} python-pip squashfs" echo "Installing dependencies:" diff --git a/tinyipa/patches/tce-load_squashfs.patch b/tinyipa/patches/tce-load_squashfs.patch new file mode 100644 index 0000000..36ceed1 --- /dev/null +++ b/tinyipa/patches/tce-load_squashfs.patch @@ -0,0 +1,20 @@ +--- tce-load 2020-05-11 14:53:49.281851377 +0200 ++++ tce-load-new 2020-05-11 14:54:33.300890003 +0200 +@@ -81,7 +81,7 @@ + + copyInstall() { + [ -d /mnt/test ] || sudo /bin/mkdir -p /mnt/test +- sudo /bin/mount $1 /mnt/test -t squashfs -o loop,ro,bs=4096 ++ sudo /bin/mount $1 /mnt/test -t squashfs -o loop,ro + if [ "$?" == 0 ]; then + if [ "$(ls -A /mnt/test)" ]; then + yes "$FORCE" | sudo /bin/cp -ai /mnt/test/. / 2>/dev/null +@@ -135,7 +135,7 @@ + else + [ -d /tmp/tcloop/"$APPNAME" ] || sudo /bin/mkdir -p /tmp/tcloop/"$APPNAME" + awk -v appname="/tmp/tcloop/$APPNAME" ' { if ( $2 == appname ) exit 1 }' /etc/mtab +- [ "$?" == 1 ] || sudo /bin/mount "$THISAPP" /tmp/tcloop/"$APPNAME" -t squashfs -o loop,ro,bs=4096 2>&1 ++ [ "$?" == 1 ] || sudo /bin/mount "$THISAPP" /tmp/tcloop/"$APPNAME" -t squashfs -o loop,ro 2>&1 + [ "$?" == 0 ] || abort_to_saved_dir + [ "`find /tmp/tcloop/${APPNAME} -mindepth 1 -maxdepth 2 | wc -l`" -le 1 ] && EMPTYEXT=1 +