Browse Source

pkg: Switch from find -exec to find | xargs

This ensures that the script fails early if one of the subcommands fails
Dorian Stoll 1 year ago
parent
commit
01f7028bcf

+ 3 - 3
.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
     ;;

+ 8 - 7
.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
     ;;

+ 4 - 4
.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
     ;;

+ 1 - 1
.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

+ 1 - 1
.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

+ 1 - 1
.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