Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/build-packages
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-13 15:03:34 +0100
committerErich Eckner <git@eckner.net>2020-02-13 15:03:34 +0100
commit7c700bd3f678409fd05b93694ccfbc73c74f17ec (patch)
tree217a29d277019e542c277d24dacae7a314c07396 /bin/build-packages
parent3c48e3d1b30b3d88fbbaf2d619092bcf9161fd04 (diff)
bin/build-packages: remove hard-coded package suffixes
Diffstat (limited to 'bin/build-packages')
-rwxr-xr-xbin/build-packages66
1 files changed, 27 insertions, 39 deletions
diff --git a/bin/build-packages b/bin/build-packages
index 6b4e6d6..f090fa6 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -27,8 +27,6 @@
# TODO: releave some locking conditions - meta goal: be able to run multiple
# build slaves on one host from within one archlinux32/builder repository
-# TODO: remove hard-coded package suffixes
-
# TODO: save build-logs in case of success, too - only the build is
# guaranteed to have been successful, maybe the package is broken.
@@ -488,12 +486,8 @@ while [ "${count}" -ne 0 ] && \
build_command='staging-'"${arch}"'-build'
fi
- find . -maxdepth 1 -type f \( \
- -name '*.pkg.tar.xz' \
- -o -name '*.pkg.tar.xz.sig' \
- -o -name '*.pkg.tar.zst' \
- -o -name '*.pkg.tar.zst.sig' \
- \) \
+ find . -maxdepth 1 -type f \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(\.sig\)\?' \
-exec rm {} \;
echo 'checking-source' > "${tmp_dir}/.ping-build-master"
@@ -662,7 +656,7 @@ while [ "${count}" -ne 0 ] && \
# build successful
>&2 printf ' ok.\n'
if [ "${build_command}" = 'makepkg' ]; then
- find . -maxdepth 1 -type f -name '*.pkg.tar.zst' \
+ find . -maxdepth 1 -type f -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \
-exec sh -c 'namcap "$1" > "$1-namcap.log"' '_' '{}' \;
fi
tar_content_dir=$(mktemp -d "${tmp_dir}/tar-content.XXXXXX")
@@ -670,7 +664,9 @@ while [ "${count}" -ne 0 ] && \
# remove unexpected packages
if [ -n "${expected_packages}" ]; then
{
- find . -maxdepth 1 -type f -name '*.pkg.tar.zst' -printf '%f\n'
+ find . -maxdepth 1 -type f \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \
+ -printf '%f\n'
printf '%s\n' "${expected_packages}" | \
sed 'p'
} | \
@@ -683,7 +679,8 @@ while [ "${count}" -ne 0 ] && \
done
fi
>&2 printf 'signing package(s)\n'
- find . -maxdepth 1 -type f -name '*.pkg.tar.zst' \
+ find . -maxdepth 1 -type f \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \
-execdir gpg --local-user="${package_key}" --detach-sign '{}' \; \
-execdir mv '{}' '{}.sig' '{}-namcap.log' "${tar_content_dir}/" \; \
-printf '%f\n' | \
@@ -692,7 +689,7 @@ while [ "${count}" -ne 0 ] && \
{
pacman -Spdd --print-format '%l' --noconfirm "${pkg_file%-*-*-*}" 2>/dev/null | \
sed '
- s|/[^/]\+\.pkg\.tar\.zst$||
+ s@/[^/]\+\.pkg\.\('"${package_compression_suffix_regex}"'\)$@@
'
# shellcheck disable=SC2016
curl -Ss 'https://www.archlinux.org/mirrorlist/?country=all&protocol=https&tier=1&use_mirror_status=on' | \
@@ -707,9 +704,9 @@ while [ "${count}" -ne 0 ] && \
sed '
s|$|/'"${pkg_file}"'|
s/\.[0-9]\+\(-[^-]\+\)$/\1/
- s/-'"${arch}"'\+\(\.pkg\.tar\.zst\)$/-x86_64\1/
+ s/-'"${arch}"'\+\(\.pkg\.\('"${package_compression_suffix_regex}"'\)\)$/-x86_64\1/
p
- s/\.zst/.xz/
+ s/\.pkg\.\('"${package_compression_suffix_regex}"'\)$/.pkg.xz/
' | \
shuf -n 100 | \
while read -r url; do
@@ -723,7 +720,7 @@ while [ "${count}" -ne 0 ] && \
done
>&2 printf 'searching for provided libraries\n'
find "${tar_content_dir}" -maxdepth 1 \
- -name '*.pkg.tar.zst' \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' \
-printf '%p\n' | \
while read -r pkgfile; do
pacman -Qqlp "${pkgfile}" | \
@@ -742,10 +739,10 @@ while [ "${count}" -ne 0 ] && \
>&2 printf 'searching for required and more provided libraries\n'
package_content_dir=$(mktemp -d "${tmp_dir}/package-content.XXXXXX")
find "${tar_content_dir}" -maxdepth 1 \
- -name '*.pkg.tar.zst' | \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)' | \
while read -r pkgfile; do
if printf '%s\n' "${pkgfile}" | \
- grep -vq -- '-any\.pkg\.tar\.zst$'; then
+ grep -vq -- '-any\.pkg\.\('"${package_compression_suffix_regex}"'\)$'; then
# we do not check "any" packages for linked libraries
# (why do they have them in the first place?)
mkdir "${package_content_dir}/${pkgfile##*/}"
@@ -895,14 +892,18 @@ while [ "${count}" -ne 0 ] && \
>&2 printf ' ok.\n'
>&2 printf 'smoothen namcap log ...'
# now we generate diffs from the namcap.logs
- find . "${tar_content_dir}/" -maxdepth 1 -type f -name '*.pkg.tar.zst-namcap.log' -printf '%p\n' | \
+ find . "${tar_content_dir}/" -maxdepth 1 -type f \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log' \
+ -printf '%p\n' | \
while read -r log; do
smoothen_namcap_log "${log}"
done
- find "${tar_content_dir}/" -maxdepth 1 -type f -name '*.pkg.tar.zst-namcap.log' -printf '%f\n' | \
+ find "${tar_content_dir}/" -maxdepth 1 -type f \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log' \
+ -printf '%f\n' | \
sed '
- s|\(^.*\)-'"${arch}"'\(\.pkg\.tar\.zst-namcap\.log\)$|\0 \1-x86_64\2|
- s|^.*-any\.pkg\.tar\.zst-namcap\.log$|\0 \0|
+ s|\(^.*\)-'"${arch}"'\(\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log\)$|\0 \1-x86_64\2|
+ s|^.*-any\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log$|\0 \0|
' | \
while read -r log x86_64_log; do
if [ -f "${x86_64_log}" ]; then
@@ -920,27 +921,17 @@ while [ "${count}" -ne 0 ] && \
echo 'uploading' > "${tmp_dir}/.ping-build-master"
if ${upload_to_build_master}; then
find "${tar_content_dir}/" -maxdepth 1 \
- \( \
- -name '*.pkg.tar.zst-namcap.log' -o \
- -name '*.pkg.tar.zst.so.needs' -o \
- -name '*.pkg.tar.zst.so.provides' \
- \) \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(-namcap\.log\|\.so\.needs\|\.so\.provides\)' \
-execdir gzip '{}' \;
else
find "${tar_content_dir}/" -maxdepth 1 \
- -name '*.pkg.tar.zst-namcap.log' \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)-namcap\.log' \
-execdir grep -HF '' '{}' \;
fi
# shellcheck disable=SC2046
tar -cf 'package.tar' -C "${tar_content_dir}" -- $(
find "${tar_content_dir}/" -maxdepth 1 \
- \( \
- -name '*.pkg.tar.zst' -o \
- -name '*.pkg.tar.zst.sig' -o \
- -name '*.pkg.tar.zst-namcap.log.gz' -o \
- -name '*.pkg.tar.zst.so.needs.gz' -o \
- -name '*.pkg.tar.zst.so.provides.gz' \
- \) \
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(\|\.sig\|-namcap\.log\.gz\|\.so\.needs\.gz\|\.so\.provides\.gz\)' \
-printf '%f\n'
) || \
{
@@ -951,11 +942,8 @@ while [ "${count}" -ne 0 ] && \
# shellcheck disable=SC2046
rsync $(
find "${tar_content_dir}/" -maxdepth 1 \
- \( \
- -name '*.pkg.tar.zst' -o \
- -name '*.pkg.tar.zst.sig' \
- \) \
- -printf '%p\n'
+ -regex '.*\.pkg\.\('"${package_compression_suffix_regex}"'\)\(\.sig\)\?' \
+ -printf '%p\n'
) "rsync://mirror.archlinux32.org/transfer32/" || true
fi
while ${upload_to_build_master}; do