diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2021-01-02 17:52:02 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2021-01-02 17:57:01 +0100 |
commit | c918bf2467372b83b8b2e1dfa514f11796315232 (patch) | |
tree | 28539c0b92992509f4d3ddd4c5d48bb93e932d13 /build-aux/build-debian.sh | |
parent | 0805c75a80c6aca041f99da68d6743f214a2e013 (diff) | |
download | blogc-c918bf2467372b83b8b2e1dfa514f11796315232.tar.gz blogc-c918bf2467372b83b8b2e1dfa514f11796315232.tar.bz2 blogc-c918bf2467372b83b8b2e1dfa514f11796315232.zip |
build: debian: split jobs
Diffstat (limited to 'build-aux/build-debian.sh')
-rwxr-xr-x | build-aux/build-debian.sh | 131 |
1 files changed, 61 insertions, 70 deletions
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 |