Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/copy-to-build-support
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-31 11:17:24 +0100
committerErich Eckner <git@eckner.net>2020-01-31 11:17:24 +0100
commit309f52b28e23d58a8c890f05958eb97d1581254b (patch)
treeb9e7665b6a193766774468a41b83b75fb96fbdba /bin/copy-to-build-support
parente040271149a8ca0a7d8cb9322e60ac91f3fcb21a (diff)
bin/copy-to-build-support: use intentions-queue
Diffstat (limited to 'bin/copy-to-build-support')
-rwxr-xr-xbin/copy-to-build-support98
1 files changed, 72 insertions, 26 deletions
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index 0dcc298..e4850f0 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -11,8 +11,6 @@
# TODO: remove hard-coded package suffixes
-# TODO: use the intention-queue
-
# shellcheck disable=SC2016
usage() {
>&2 echo ''
@@ -181,10 +179,19 @@ sort -u "${tmp_dir}/repo-archs" | \
while read -r repo_arch; do
mkdir "${tmp_dir}/${repo_arch}"
- failsafe_rsync \
- "${master_mirror_rsync_directory}/${repo_arch}/build-support/build-support.db."* \
- "${master_mirror_rsync_directory}/${repo_arch}/build-support/build-support.files."* \
- "${tmp_dir}/${repo_arch}/"
+ {
+ printf 'failsafe_rsync'
+ for suffix in 'db' 'files'; do
+ printf ' "%s/%s/build-support/build-support.%s."*' \
+ "${master_mirror_rsync_directory}" \
+ "${repo_arch}" \
+ "${suffix}"
+ done
+ printf ' "%s/%s/"\n' \
+ "${tmp_dir}" \
+ "${repo_arch}"
+ } \
+ | intent_something
done < \
"${tmp_dir}/repo-archs"
@@ -192,41 +199,80 @@ if [ -s "${tmp_dir}/to-copy" ]; then
mkdir "${tmp_dir}/transit/"
while read -r repo_arch; do
mkdir "${tmp_dir}/transit/${repo_arch}/"
- # shellcheck disable=SC2046
- failsafe_rsync \
- $(sed -n 's,^'"$(str_to_regex "${repo_arch}")"' ,,;T;p' "${tmp_dir}/to-copy") \
- "${tmp_dir}/transit/${repo_arch}/"
- repo-add "${tmp_dir}/${repo_arch}/build-support.db.tar.gz" \
- "${tmp_dir}/transit/${repo_arch}/"*".pkg.tar.zst"
+ {
+ printf 'failsafe_rsync '
+ sed -n '
+ s,^'"$(str_to_regex "${repo_arch}")"' ,,
+ T
+ p
+ ' "${tmp_dir}/to-copy" \
+ | tr '\n' ' '
+ printf ' "%s/transit/%s/"\n' \
+ "${tmp_dir}" \
+ "${repo_arch}"
+ printf 'repo-add'
+ printf ' "%s/%s/build-support.db.tar.gz"' \
+ "${tmp_dir}" \
+ "${repo_arch}"
+ printf ' "%s/transit/%s/"*".pkg.tar.zst"\n' \
+ "${tmp_dir}" \
+ "${repo_arch}"
+ } \
+ | intent_something
done < \
"${tmp_dir}/repo-archs"
fi
if [ -s "${tmp_dir}/sftp-command" ]; then
- failsafe_sftp < \
- "${tmp_dir}/sftp-command"
+ printf 'failsafe_sftp < "%s/sftp-command"\n' \
+ "${tmp_dir}" \
+ | intent_something
fi
while read -r repo_arch; do
- recompress_gz \
- "${tmp_dir}" \
- "${tmp_dir}/${repo_arch}/build-support."*".tar.gz" \
- "${tmp_dir}/${repo_arch}/build-support."*".tar.gz.old"
- failsafe_rsync \
- "${tmp_dir}/${repo_arch}/build-support.db."* \
- "${tmp_dir}/${repo_arch}/build-support.files."* \
- "${master_mirror_rsync_directory}/${repo_arch}/build-support/"
+ {
+ printf 'recompress_gz "%s"' \
+ "${tmp_dir}"
+ for suffix in '' '.old'; do
+ printf ' "%s/%s/build-support."*".tar.gz%s"' \
+ "${tmp_dir}" \
+ "${repo_arch}" \
+ "${suffix}"
+ done
+ printf '\n'
+ printf 'failsafe_rsync'
+ for suffix in 'db' 'files'; do
+ printf ' "%s/%s/build-support.%s."*' \
+ "${tmp_dir}" \
+ "${repo_arch}" \
+ "${suffix}"
+ done
+ printf ' "%s/%s/build-support/"\n' \
+ "${master_mirror_rsync_directory}" \
+ "${repo_arch}"
+ } \
+ | intent_something
done < \
"${tmp_dir}/repo-archs"
if [ -s "${tmp_dir}/mysql-command" ]; then
- mysql_run_query < \
- "${tmp_dir}/mysql-command" | \
- sort -u | \
- remove_old_package_versions
+ {
+ printf 'mysql_run_query \\\n'
+ printf '<"%s/mysql-command" \\\n' \
+ "${tmp_dir}"
+ printf '| sort -u \\\n'
+ printf '| remove_old_package_versions\n'
+ } \
+ | intent_something
fi
+printf 'rm -rf --one-file-system "%s"\n' \
+ "${tmp_dir}" \
+| intent_something
+
if [ -w "$1" ]; then
cat "${tmp_dir}/packages" > \
"$1"
fi
+
+execute_all_intentions