From 01f7028bcff49d7a0255fe9d45ff47e3e658689b Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Tue, 1 Aug 2023 21:25:36 +0200 Subject: [PATCH] pkg: Switch from find -exec to find | xargs This ensures that the script fails early if one of the subcommands fails --- .github/scripts/package/arch.sh | 6 +++--- .github/scripts/package/debian.sh | 15 ++++++++------- .github/scripts/package/fedora.sh | 8 ++++---- .github/scripts/repository/arch.sh | 2 +- .github/scripts/repository/debian.sh | 2 +- .github/scripts/repository/fedora.sh | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/scripts/package/arch.sh b/.github/scripts/package/arch.sh index d7d44be8d..21ab798cb 100644 --- a/.github/scripts/package/arch.sh +++ b/.github/scripts/package/arch.sh @@ -53,7 +53,7 @@ build-packages) # Prepare release mkdir release - find . -name '*.pkg.tar.zst' -type f -exec mv {} release \; + find . -name '*.pkg.tar.zst' -type f -print0 | xargs -0 -I '{}' mv {} release popd || exit 1 ;; @@ -69,8 +69,8 @@ sign-packages) echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes # sign packages - find . -name '*.pkg.tar.zst' -type f -exec \ - gpg --detach-sign --batch --no-tty -u "${GPG_KEY_ID}" {} \; + find . -name '*.pkg.tar.zst' -type f -print0 | xargs -0 -I '{}' \ + gpg --detach-sign --batch --no-tty -u "${GPG_KEY_ID}" {} popd || exit 1 ;; diff --git a/.github/scripts/package/debian.sh b/.github/scripts/package/debian.sh index caf9585eb..bc9f3cc58 100644 --- a/.github/scripts/package/debian.sh +++ b/.github/scripts/package/debian.sh @@ -76,7 +76,8 @@ build-packages) pushd linux || exit 1 # apply surface build/packaging patches - find .. -name '*.patch' -type f -exec git apply --index --reject {} \; + find .. -name '*.patch' -type f -print0 | xargs -0 -I '{}' \ + git apply --index --reject {} git add . git commit --allow-empty -m "Apply linux-surface packaging patches" @@ -84,8 +85,8 @@ build-packages) KERNEL_MAJORVER="${KERNEL_VERSION%.*}" # apply surface patches - find "../../../../patches/${KERNEL_MAJORVER}" -name '*.patch' -type f -exec \ - git apply --index --reject {} \; + find "../../../../patches/${KERNEL_MAJORVER}" -name '*.patch' -type f -print0 | xargs -0 -I '{}' \ + git apply --index --reject {} git add . git commit --allow-empty -m "Apply linux-surface patches" @@ -124,8 +125,8 @@ build-packages) mkdir release - find . -name 'linux-libc-dev*.deb' -type f -exec rm {} \; - find . -name '*.deb' -type f -exec cp {} release \; + find . -name 'linux-libc-dev*.deb' -type f -print0 | xargs -0 -I '{}' rm {} + find . -name '*.deb' -type f -print0 | xargs -0 -I '{}' cp {} release popd || exit 1 ;; @@ -141,8 +142,8 @@ sign-packages) echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes # sign packages - find . -name '*.deb' -type f -exec \ - dpkg-sig -g "--batch --no-tty" --sign builder -k "${GPG_KEY_ID}" {} \; + find . -name '*.deb' -type f -print0 | xargs -0 -I '{}' \ + dpkg-sig -g "--batch --no-tty" --sign builder -k "${GPG_KEY_ID}" {} popd || exit 1 ;; diff --git a/.github/scripts/package/fedora.sh b/.github/scripts/package/fedora.sh index aed0360e0..a95fcacb4 100644 --- a/.github/scripts/package/fedora.sh +++ b/.github/scripts/package/fedora.sh @@ -51,8 +51,8 @@ build-packages) rm -rf kernel-ark # Build binary RPM packages - find srpm -name '*.src.rpm' -type f -exec rpmbuild -rb \ - --define "_topdir ${PWD}/rpmbuild" --define "_rpmdir ${PWD}/out" {} \; + find srpm -name '*.src.rpm' -type f -print0 | xargs -0 -I '{}' \ + rpmbuild -rb --define "_topdir ${PWD}/rpmbuild" --define "_rpmdir ${PWD}/out" {} popd || exit 1 ;; @@ -68,8 +68,8 @@ sign-packages) echo "${GPG_KEY}" | base64 -d | gpg --import --no-tty --batch --yes # sign packages - find . -name '*.rpm' -type f -exec \ - rpm --resign {} --define "_gpg_name ${GPG_KEY_ID}" \; + find . -name '*.rpm' -type f -print0 | xargs -0 -I '{}' \ + rpm --resign {} --define "_gpg_name ${GPG_KEY_ID}" popd || exit 1 ;; diff --git a/.github/scripts/repository/arch.sh b/.github/scripts/repository/arch.sh index 3dd634ef7..76bf5544f 100644 --- a/.github/scripts/repository/arch.sh +++ b/.github/scripts/repository/arch.sh @@ -41,7 +41,7 @@ pacman -S base-devel git openssl git clone -b "${BRANCH_STAGING}" "${REPO}" repo # copy packages -find arch-latest -type f -exec cp {} repo/arch \; +find arch-latest -type f -print0 | xargs -0 -I '{}' cp {} repo/arch pushd repo/arch || exit 1 # convert packages into references diff --git a/.github/scripts/repository/debian.sh b/.github/scripts/repository/debian.sh index aaad1f458..99d352eab 100644 --- a/.github/scripts/repository/debian.sh +++ b/.github/scripts/repository/debian.sh @@ -41,7 +41,7 @@ apt-get install git openssl git clone -b "${BRANCH_STAGING}" "${REPO}" repo # copy packages -find debian-latest -type f -exec cp {} repo/debian \; +find debian-latest -type f -print0 | xargs -0 -I '{}' cp {} repo/debian pushd repo/debian || exit 1 # convert packages into references diff --git a/.github/scripts/repository/fedora.sh b/.github/scripts/repository/fedora.sh index f489203b5..1a02efd60 100644 --- a/.github/scripts/repository/fedora.sh +++ b/.github/scripts/repository/fedora.sh @@ -47,7 +47,7 @@ dnf install git findutils openssl git clone -b "${BRANCH_STAGING}" "${REPO}" repo # copy packages -find "fedora-${FEDORA}-latest" -type f -exec cp {} "repo/fedora/f${FEDORA}" \; +find "fedora-${FEDORA}-latest" -type f -print0 | xargs -0 -I '{}' cp {} "repo/fedora/f${FEDORA}" pushd "repo/fedora/f${FEDORA}" || exit 1 # convert packages into references