From c918bf2467372b83b8b2e1dfa514f11796315232 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 2 Jan 2021 17:52:02 +0100 Subject: build: debian: split jobs --- .github/workflows/yatr.yaml | 18 +++++- .yatr.yml | 14 ++++- build-aux/build-debian.sh | 131 +++++++++++++++++++++----------------------- 3 files changed, 89 insertions(+), 74 deletions(-) diff --git a/.github/workflows/yatr.yaml b/.github/workflows/yatr.yaml index 74b23d2..6b1cc64 100644 --- a/.github/workflows/yatr.yaml +++ b/.github/workflows/yatr.yaml @@ -28,7 +28,19 @@ jobs: - target: dist-srpm compiler: gcc image: ubuntu-20.04 - - target: debian + - target: deb-buster-amd64 + compiler: gcc + image: ubuntu-20.04 + - target: deb-bullseye-amd64 + compiler: gcc + image: ubuntu-20.04 + - target: deb-sid-amd64 + compiler: gcc + image: ubuntu-20.04 + - target: deb-focal-amd64 + compiler: gcc + image: ubuntu-20.04 + - target: deb-groovy-amd64 compiler: gcc image: ubuntu-20.04 - target: static @@ -53,7 +65,7 @@ jobs: if [[ "x${{ matrix.image }}" = xubuntu-* ]]; then sudo gem install ronn sudo apt-get update -y - if [[ "x${{ matrix.target }}" = *check* ]] || [[ "x${{ matrix.target }}" = xvalgrind ]] || [[ "x${{ matrix.target }}" = xdebian ]]; then + if [[ "x${{ matrix.target }}" = *check* ]] || [[ "x${{ matrix.target }}" = xvalgrind ]] || [[ "x${{ matrix.target }}" = xdeb-* ]]; then sudo apt-get install -y libcmocka-dev fi if [[ "x${{ matrix.target }}" = xvalgrind ]]; then @@ -68,7 +80,7 @@ jobs: if [[ "x${{ matrix.target }}" = xwin64 ]]; then sudo apt-get install -y gcc-mingw-w64-x86-64 fi - if [[ "x${{ matrix.target }}" = xdebian ]]; then + if [[ "x${{ matrix.target }}" = xdeb-* ]]; then sudo apt-get install -y cowbuilder debhelper pbuilder reprepro fi elif [[ "x${{ matrix.image }}" = xmacos-* ]]; then diff --git a/.yatr.yml b/.yatr.yml index 6825968..ceb3d5c 100644 --- a/.yatr.yml +++ b/.yatr.yml @@ -65,6 +65,18 @@ targets: - --disable-make - --disable-runserver task_script: build-aux/build-windows.sh - debian: + deb-buster-amd64: + task_script: build-aux/build-debian.sh + archive_extract_filter: "blogc-deb-*.tar.xz" + deb-bullseye-amd64: + task_script: build-aux/build-debian.sh + archive_extract_filter: "blogc-deb-*.tar.xz" + deb-sid-amd64: + task_script: build-aux/build-debian.sh + archive_extract_filter: "blogc-deb-*.tar.xz" + deb-focal-amd64: + task_script: build-aux/build-debian.sh + archive_extract_filter: "blogc-deb-*.tar.xz" + deb-groovy-amd64: task_script: build-aux/build-debian.sh archive_extract_filter: "blogc-deb-*.tar.xz" diff --git a/build-aux/build-debian.sh b/build-aux/build-debian.sh index 798179d..803849d 100755 --- a/build-aux/build-debian.sh +++ b/build-aux/build-debian.sh @@ -6,14 +6,37 @@ export DEBEMAIL="rafael+deb@rafaelmartins.eng.br" export DEBFULLNAME="Automatic Builder (github-actions)" export DEB_BUILD_OPTIONS="noddebs" -download_pbuilder_chroots() { - local arch="amd64" - local os="$(uname -s | tr '[:upper:]' '[:lower:]')" - +export DIST="$(echo "${TARGET}" | cut -d- -f2)" + +ARCH="$(echo "${TARGET}" | cut -d- -f3)" + +REV= +case ${DIST} in + buster) + REV="1~10buster" + ;; + bullseye) + REV="1~11bullseye" + ;; + sid) + REV="1~sid" + ;; + focal) + REV="1~11.0focal" + ;; + groovy) + REV="1~11.1groovy" + ;; + *) + echo "error: unsupported dist: ${DIST}" + exit 1 + ;; +esac + +download_pbuilder_chroot() { local index="$(wget -q -O- https://distfiles.rgm.io/pbuilder-chroots/LATEST/)" - local archive="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroots-${os}-${arch}-.*\)\.sha512.*/\1/p")" - local folder="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroots-${os}-${arch}-.*\)\.tar.*\.sha512.*/\1/p")" - local p="$(echo "${folder}" | sed "s/pbuilder-chroots-${os}-${arch}-\(.*\)/pbuilder-chroots-\1/")" + local archive="$(echo "${index}" | sed -n "s/.*\(pbuilder-chroot-${DIST}-${ARCH}-.*\)\.sha512.*/\1/p")" + local p="$(echo "${index}" | sed -n "s/.*pbuilder-chroot-${DIST}-${ARCH}-\(.*\)\.tar.*\.sha512.*/pbuilder-chroots-\1/p")" pushd "${SRCDIR}" > /dev/null @@ -21,24 +44,23 @@ download_pbuilder_chroots() { sha512sum --check --status "${archive}.sha512" sudo rm -rf /tmp/pbuilder - fakeroot tar --checkpoint=.1000 -xf "${archive}" -C /tmp + mkdir /tmp/pbuilder + fakeroot tar --checkpoint=1000 -xf "${archive}" -C /tmp/pbuilder popd > /dev/null } create_reprepro_conf() { - for dist in "$@"; do - echo "Origin: blogc" - echo "Label: blogc" - echo "Codename: ${dist}" - echo "Architectures: source amd64" - echo "Components: main" - echo "Description: Apt repository containing blogc snapshots" - echo - done + echo "Origin: blogc" + echo "Label: blogc" + echo "Codename: ${DIST}" + echo "Architectures: source amd64" + echo "Components: main" + echo "Description: Apt repository containing blogc snapshots" + echo } -download_pbuilder_chroots +download_pbuilder_chroot ${MAKE_CMD:-make} dist-xz @@ -46,73 +68,42 @@ MY_P="${PN}_${PV}" mv ${P}.tar.xz "${BUILDDIR}/${MY_P}.orig.tar.xz" -for dir in /tmp/pbuilder/*/base.cow; do - export DIST="$(basename "$(dirname "${dir}")" | cut -d- -f1)" - RES="${BUILDDIR}/deb/${DIST}" - mkdir -p "${RES}" - - rm -rf "${BUILDDIR}/${P}" - tar -xf "${BUILDDIR}/${MY_P}.orig.tar.xz" -C "${BUILDDIR}" - cp -r "${SRCDIR}/debian" "${BUILDDIR}/${P}/" - - REV= - case ${DIST} in - buster) - REV="1~10buster" - ;; - bullseye) - REV="1~11bullseye" - ;; - sid) - REV="1~sid" - ;; - focal) - REV="1~11.0focal" - ;; - groovy) - REV="1~11.1groovy" - ;; - *) - echo "error: unsupported dist: ${DIST}" - exit 1 - ;; - esac - - pushd "${BUILDDIR}/${P}" > /dev/null - - dch \ - --distribution "${DIST}" \ - --newversion "${PV}-${REV}" \ - "Automated build for ${DIST}" - - pdebuild \ - --pbuilder cowbuilder \ - --buildresult "${RES}" \ - -- --basepath "${dir}" +RES="${BUILDDIR}/deb/${DIST}" +mkdir -p "${RES}" - popd > /dev/null +rm -rf "${BUILDDIR}/${P}" +tar -xf "${BUILDDIR}/${MY_P}.orig.tar.xz" -C "${BUILDDIR}" +cp -r "${SRCDIR}/debian" "${BUILDDIR}/${P}/" + +pushd "${BUILDDIR}/${P}" > /dev/null -done +dch \ + --distribution "${DIST}" \ + --newversion "${PV}-${REV}" \ + "Automated build for ${DIST}" -DISTS="$(ls -1 "${BUILDDIR}/deb")" +pdebuild \ + --pbuilder cowbuilder \ + --buildresult "${RES}" \ + -- --basepath "/tmp/pbuilder/${DIST}-${ARCH}/base.cow" + +popd > /dev/null mkdir -p "${BUILDDIR}/deb-repo/conf" -create_reprepro_conf ${DISTS} > "${BUILDDIR}/deb-repo/conf/distributions" +create_reprepro_conf > "${BUILDDIR}/deb-repo/conf/distributions" pushd "${BUILDDIR}/deb-repo" > /dev/null -for dist in ${DISTS}; do - reprepro include "${dist}" "../deb/${dist}"/*.changes -done +reprepro include "${DIST}" "../deb/${DIST}"/*.changes popd > /dev/null tar \ - -cJf "blogc-deb-repo-${PV}.tar.xz" \ + -cJf "blogc-deb-repo-${DIST}-${ARCH}-${PV}.tar.xz" \ --exclude ./deb-repo/conf \ --exclude ./deb-repo/db \ ./deb-repo tar \ - -cJf "blogc-deb-${PV}.tar.xz" \ + -cJf "blogc-deb-${DIST}-${ARCH}-${PV}.tar.xz" \ ./deb -- cgit v1.2.3-18-g5258