From d08dbc018f8c74ec280e048fb7a2af118ba0b063 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Tue, 5 Mar 2024 10:06:39 +0100 Subject: [PATCH 1/3] kas: add per-MACHINE config file (kirkstone) Bulk of the logic is in the common file. The aarch64 and x86_64 files include it while also setting MACHINE to a specific value. This way one can easily kas build something without having to know how to compose the files by hand. Signed-off-by: Zygmunt Krynicki --- kas-poky-snapd.aarch64.yml | 5 +++ kas-poky-snapd.common.yml | 77 ++++++++++++++++++++++++++++++++++++++ kas-poky-snapd.x86_64.yml | 5 +++ 3 files changed, 87 insertions(+) create mode 100644 kas-poky-snapd.aarch64.yml create mode 100644 kas-poky-snapd.common.yml create mode 100644 kas-poky-snapd.x86_64.yml diff --git a/kas-poky-snapd.aarch64.yml b/kas-poky-snapd.aarch64.yml new file mode 100644 index 0000000..7bd113c --- /dev/null +++ b/kas-poky-snapd.aarch64.yml @@ -0,0 +1,5 @@ +header: + version: 8 + includes: + - kas-poky-snapd.common.yml +machine: qemuarm64 diff --git a/kas-poky-snapd.common.yml b/kas-poky-snapd.common.yml new file mode 100644 index 0000000..9867a13 --- /dev/null +++ b/kas-poky-snapd.common.yml @@ -0,0 +1,77 @@ +header: + version: 8 + +distro: poky +target: + - snapd-demo-image + +repos: + meta-snapd: + + poky: + url: https://git.yoctoproject.org/git/poky + path: layers/poky + refspec: kirkstone + layers: + meta: + meta-poky: + meta-yocto-bsp: + + meta-openembedded: + url: http://git.openembedded.org/meta-openembedded + path: layers/meta-openembedded + refspec: kirkstone + layers: + meta-oe: + meta-python: + meta-networking: + meta-perl: + meta-filesystems: + + meta-security: + url: http://git.yoctoproject.org/git/meta-security + path: layers/meta-security + refspec: kirkstone + +bblayers_conf_header: + standard: | + POKY_BBLAYERS_CONF_VERSION = "2" + BBPATH = "${TOPDIR}" + BBFILES ?= "" +local_conf_header: + reduce_diskspace: | + INHERIT += "rm_work" + RM_WORK_EXCLUDE += "snapd" + standard: | + CONF_VERSION = "2" + PACKAGE_CLASSES = "package_ipk" + SDKMACHINE = "x86_64" + USER_CLASSES = "buildstats" + PATCHRESOLVE = "noop" + debug-tweaks: | + EXTRA_IMAGE_FEATURES = "debug-tweaks" + distro: | + DISTRO_FEATURES:append = " apparmor security usrmerge" + systemd: | + INIT_MANAGER = "systemd" + DISTRO_FEATURES:append = " systemd" + diskmon: | + BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + HALT,${TMPDIR},100M,1K \ + HALT,${DL_DIR},100M,1K \ + HALT,${SSTATE_DIR},100M,1K \ + HALT,/tmp,10M,1K" + snapd: | + CORE_IMAGE_EXTRA_INSTALL += " \ + packagegroup-snapd \ + bash \ + " + image-tweaks: | + # some room for installing snaps + IMAGE_ROOTFS_EXTRA_SPACE = "512000" + # snapd assumes root's home is /root + ROOT_HOME = "/root" diff --git a/kas-poky-snapd.x86_64.yml b/kas-poky-snapd.x86_64.yml new file mode 100644 index 0000000..71ff136 --- /dev/null +++ b/kas-poky-snapd.x86_64.yml @@ -0,0 +1,5 @@ +header: + version: 8 + includes: + - kas-poky-snapd.common.yml +machine: qemux86-64 From aef71d4fb1d904a266dc180daba2a4517221d2b1 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Mon, 4 Mar 2024 08:45:31 +0000 Subject: [PATCH 2/3] ci: add workflow with smoke-build with kas The workflow is a straightforward kas build with worker-local state used as download and sstate-cache directories. Signed-off-by: Zygmunt Krynicki --- .github/workflows/pull_request.yml | 54 ++++++++++++++++++++++++++ .github/workflows/push.yml | 61 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 .github/workflows/pull_request.yml create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..7db70bc --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,54 @@ +name: Smoke build +on: + pull_request: + branches: ["master", "kirkstone"] + +jobs: + build: + strategy: + matrix: + kas: + - kas-poky-snapd.aarch64.yml + - kas-poky-snapd.x86_64.yml + # TODO: use large runners when available + runs-on: [self-hosted, Linux] + timeout-minutes: 240 + name: ${{ matrix.kas }} + env: + # On non-ephemeral workers, downloads and sstate is cached. + DL_DIR: /srv/meta-snapd/kirkstone/downloads + SSTATE_DIR: /srv/meta-snapd/kirkstone/sstate-cache + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install build dependencies + run: | + sudo apt-get update + sudo -E DEBIAN_FRONTEND=noninteractive apt install -y kas chrpath diffstat bzip2 cpp g++ gcc lz4 make rpcsvc-proto + kas --version + - name: Setup DL_DIR and SSTATE_DIR + run: | + sudo mkdir -p "$DL_DIR" + sudo mkdir -p "$SSTATE_DIR" + sudo chown $(id -u).$(id -g) "$DL_DIR" "$SSTATE_DIR" + # This hack makes DL_DIR and SSTATE_DIR overrides compatible with kas 2.6.3 in Ubuntu 22.04 + mkdir -p build/conf + printf 'DL_DIR = "%s"\n' "$DL_DIR" >build/conf/auto.conf + printf 'SSTATE_DIR = "%s"\n' "$SSTATE_DIR" >> build/conf/auto.conf + - name: Use tmpfs for TMPDIR + run: | + mkdir -p build/tmp + if [ "$(LANG=C free --total --giga | awk -e '/Total/ { print $2 }')" -gt 64 ]; then + sudo mount -o size=64G -t tmpfs none build/tmp + fi + - name: Run kas checkout + run: | + kas checkout ${{ matrix.kas }} + - name: Run kas build + run: | + kas build ${{ matrix.kas }} --target snapd-demo-image + - name: Unmount tmpfs + if: always() + run: | + # Lazy umount as apparently something may be using this still? + sudo umount -l build/tmp || true diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..dc3a4e4 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,61 @@ +name: Reference build +on: + push: + branches: ["master", "kirkstone"] + +jobs: + build: + strategy: + matrix: + kas: + - kas-poky-snapd.aarch64.yml + - kas-poky-snapd.x86_64.yml + # TODO: use large runners when available + runs-on: [self-hosted, Linux] + timeout-minutes: 240 + name: ${{ matrix.kas }} + env: + # On non-ephemeral workers, downloads and sstate is cached. + DL_DIR: /srv/meta-snapd/kirkstone/downloads + SSTATE_DIR: /srv/meta-snapd/kirkstone/sstate-cache + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install build dependencies + run: | + sudo apt-get update + sudo -E DEBIAN_FRONTEND=noninteractive apt install -y kas chrpath diffstat bzip2 cpp g++ gcc lz4 make rpcsvc-proto + kas --version + - name: Setup DL_DIR and SSTATE_DIR + run: | + sudo mkdir -p "$DL_DIR" + sudo mkdir -p "$SSTATE_DIR" + sudo chown $(id -u).$(id -g) "$DL_DIR" "$SSTATE_DIR" + # This hack makes DL_DIR and SSTATE_DIR overrides compatible with kas 2.6.3 in Ubuntu 22.04 + mkdir -p build/conf + printf 'DL_DIR = "%s"\n' "$DL_DIR" >build/conf/auto.conf + printf 'SSTATE_DIR = "%s"\n' "$SSTATE_DIR" >> build/conf/auto.conf + - name: Use tmpfs for TMPDIR + run: | + mkdir -p build/tmp + if [ "$(LANG=C free --total --giga | awk -e '/Total/ { print $2 }')" -gt 64 ]; then + sudo mount -o size=64G -t tmpfs none build/tmp + fi + - name: Run kas checkout + run: | + kas checkout ${{ matrix.kas }} + - name: Run kas build + run: | + kas build ${{ matrix.kas }} --target snapd-demo-image + - uses: actions/upload-artifact@v4 + with: + name: image-${{ matrix.kas }} + path: build/tmp/deploy/images + if-no-files-found: warn + retention-days: 1 + compression-level: 0 + - name: Unmount tmpfs + if: always() + run: | + # Lazy umount as apparently something may be using this still? + sudo umount -l build/tmp || true From e1c0d923893f866dcec06be60f9c00c5056f0d22 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Thu, 7 Mar 2024 18:18:21 +0100 Subject: [PATCH 3/3] snapd: update to 2.61.3 Signed-off-by: Zygmunt Krynicki --- recipes-support/snapd/snapd-2.61.2.inc | 6 ------ recipes-support/snapd/snapd-2.61.3.inc | 6 ++++++ recipes-support/snapd/snapd-git.inc | 4 ++-- .../{snapd-native_2.61.2.bb => snapd-native_2.61.3.bb} | 2 +- recipes-support/snapd/snapd_2.61.2.bb | 2 -- recipes-support/snapd/snapd_2.61.3.bb | 2 ++ 6 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 recipes-support/snapd/snapd-2.61.2.inc create mode 100644 recipes-support/snapd/snapd-2.61.3.inc rename recipes-support/snapd/{snapd-native_2.61.2.bb => snapd-native_2.61.3.bb} (96%) delete mode 100644 recipes-support/snapd/snapd_2.61.2.bb create mode 100644 recipes-support/snapd/snapd_2.61.3.bb diff --git a/recipes-support/snapd/snapd-2.61.2.inc b/recipes-support/snapd/snapd-2.61.2.inc deleted file mode 100644 index 5536b14..0000000 --- a/recipes-support/snapd/snapd-2.61.2.inc +++ /dev/null @@ -1,6 +0,0 @@ -SRC_URI = "https://${GO_IMPORT}/releases/download/${PV}/snapd_${PV}.vendor.tar.xz" - -SRC_URI[md5sum] = "06b54b66fc2090903f89548dae45351e" -SRC_URI[sha256sum] = "d000725250a4d9c8a931b74df9733479a2851d03fe1e663a81fcb61b21509702" - -S = "${WORKDIR}/${PN}-${PV}" diff --git a/recipes-support/snapd/snapd-2.61.3.inc b/recipes-support/snapd/snapd-2.61.3.inc new file mode 100644 index 0000000..15dcca8 --- /dev/null +++ b/recipes-support/snapd/snapd-2.61.3.inc @@ -0,0 +1,6 @@ +SRC_URI = "https://${GO_IMPORT}/releases/download/${PV}/snapd_${PV}.vendor.tar.xz" + +SRC_URI[md5sum] = "407a07be765fc817c7030ce606e74944" +SRC_URI[sha256sum] = "90d427ca0a0e1306e647c6091176fba678522e2af04228aa274a34d011c82123" + +S = "${WORKDIR}/${PN}-${PV}" diff --git a/recipes-support/snapd/snapd-git.inc b/recipes-support/snapd/snapd-git.inc index 45cb05a..582e74c 100644 --- a/recipes-support/snapd/snapd-git.inc +++ b/recipes-support/snapd/snapd-git.inc @@ -1,12 +1,12 @@ PR = "r0" -BASEPV = "2.61.2" +BASEPV = "2.61.3" SRC_URI = "git://github.com/snapcore/snapd.git;protocol=https;branch=release/${BASEPV};destsuffix=git/" PV = "${BASEPV}+git${SRCPV}" S = "${WORKDIR}/git" -SRCREV = "a9c308a6cdb90b8d0e66b57d5f007b1a8bd7cdf1" +SRCREV = "12e48ef9a63b92964a57e549107c648887b040eb" DEFAULT_PREFERENCE ??= "-1" diff --git a/recipes-support/snapd/snapd-native_2.61.2.bb b/recipes-support/snapd/snapd-native_2.61.3.bb similarity index 96% rename from recipes-support/snapd/snapd-native_2.61.2.bb rename to recipes-support/snapd/snapd-native_2.61.3.bb index c937aad..e6cdde1 100644 --- a/recipes-support/snapd/snapd-native_2.61.2.bb +++ b/recipes-support/snapd/snapd-native_2.61.3.bb @@ -5,7 +5,7 @@ HOMEPAGE = "https://www.snapcraft.io" LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://${WORKDIR}/snapd-${PV}/COPYING;md5=d32239bcb673463ab874e80d47fae504" -require snapd-2.61.2.inc +require snapd-2.61.3.inc S = "${WORKDIR}/snapd-${PV}" RDEPENDS_${PN} += " \ diff --git a/recipes-support/snapd/snapd_2.61.2.bb b/recipes-support/snapd/snapd_2.61.2.bb deleted file mode 100644 index 12a9e15..0000000 --- a/recipes-support/snapd/snapd_2.61.2.bb +++ /dev/null @@ -1,2 +0,0 @@ -include snapd.inc -include snapd-2.61.2.inc diff --git a/recipes-support/snapd/snapd_2.61.3.bb b/recipes-support/snapd/snapd_2.61.3.bb new file mode 100644 index 0000000..c367c50 --- /dev/null +++ b/recipes-support/snapd/snapd_2.61.3.bb @@ -0,0 +1,2 @@ +include snapd.inc +include snapd-2.61.3.inc