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>2018-06-07 10:25:14 +0200
committerErich Eckner <git@eckner.net>2018-06-07 10:25:14 +0200
commitc12e353813441c5f7441fcb6b6f4c7c0ab941822 (patch)
treeefc882e34cba91392860c0dce50e1f6c32e2bf94 /bin/copy-to-build-support
parent9d190005c83db5546916154cae792e6d52704a26 (diff)
bin/copy-to-build-support: enable separate repositories for each architecture
Diffstat (limited to 'bin/copy-to-build-support')
-rwxr-xr-xbin/copy-to-build-support59
1 files changed, 38 insertions, 21 deletions
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index 016d4c0..cf5061a 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -2,8 +2,6 @@
# copy the given package(s) into build-support
-# TODO: enable separate repositories for each architecture
-
# shellcheck disable=SC2119,SC2120
# shellcheck source=../lib/load-configuration
@@ -76,7 +74,7 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
export TMPDIR="${tmp_dir}"
sed -n '
- s/.\+/\0 \0/
+ s/ \S\+/\0 \0/
T
s/\.pkg\.tar\.xz$//
s/\(-[0-9]\+\)\(-[^- ]\+\)$/\1.0\2/
@@ -84,7 +82,7 @@ sed -n '
s/-\([^-: ]\+\):\([^-: ]\+\)-\([^-. ]\+\).\([^-. ]\+\)-\([^- ]\+\)$/ \1 \2 \3 \4 \5/
p
' "$1" | \
- while read -r package pkgname epoch pkgver pkgrel sub_pkgrel architecture; do
+ while read -r repo_arch package pkgname epoch pkgver pkgrel sub_pkgrel architecture; do
# shellcheck disable=SC2016
id=$(
@@ -112,14 +110,16 @@ sed -n '
printf '%s\n' "${package}" >> \
"${tmp_dir}/packages"
for suffix in '' '.sig'; do
- printf 'ln -s "pool/%s%s" "i686/build-support/%s%s"\n' \
+ printf 'ln -s "pool/%s%s" "%s/build-support/%s%s"\n' \
"${package}" \
"${suffix}" \
+ "${repo_arch}" \
"${package}" \
"${suffix}"
done >> \
"${tmp_dir}/sftp-command"
- printf '%s/pool/%s\n' \
+ printf '%s %s/pool/%s\n' \
+ "${repo_arch}" \
"${master_mirror_rsync_directory}" \
"${package}" | \
sed '
@@ -127,6 +127,9 @@ sed -n '
s/$/.sig/
' >> \
"${tmp_dir}/to-copy"
+ printf '%s\n' \
+ "${repo_arch}" >> \
+ "${tmp_dir}/repo-archs"
# shellcheck disable=SC2016
{
@@ -134,26 +137,37 @@ sed -n '
printf ' (`repository`,`package`,`is_to_be_deleted`)'
# shellcheck disable=SC2154
printf ' VALUES (%s,%s,0);\n' \
- "${repository_ids__i686_build_support}" \
+ "$(eval echo '"${repository_ids__'"${repo_arch}"'_build_support}"')" \
"${id}"
printf 'SELECT LAST_INSERT_ID();\n'
} >> \
"${tmp_dir}/mysql-command"
done
-${master_mirror_rsync_command} \
- "${master_mirror_rsync_directory}/i686/build-support/build-support.db."* \
- "${master_mirror_rsync_directory}/i686/build-support/build-support.files."* \
- "${tmp_dir}/"
+sort -u "${tmp_dir}/repo-archs" | \
+ sponge "${tmp_dir}/repo-archs"
+
+while read -r repo_arch; do
+ mkdir "${tmp_dir}/${repo_arch}"
+ ${master_mirror_rsync_command} \
+ "${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}/"
+done < \
+ "${tmp_dir}/repo-archs"
if [ -s "${tmp_dir}/to-copy" ]; then
mkdir "${tmp_dir}/transit/"
- # shellcheck disable=SC2046
- ${master_mirror_rsync_command} \
- $(cat "${tmp_dir}/to-copy") \
- "${tmp_dir}/transit/"
- repo-add "${tmp_dir}/build-support.db.tar.gz" \
- "${tmp_dir}/transit/"*".pkg.tar.xz"
+ while read -r repo_arch; do
+ mkdir "${tmp_dir}/transit/${repo_arch}/"
+ # shellcheck disable=SC2046
+ ${master_mirror_rsync_command} \
+ $(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.xz"
+ done < \
+ "${tmp_dir}/repo-archs"
fi
if [ -s "${tmp_dir}/sftp-command" ]; then
@@ -161,10 +175,13 @@ if [ -s "${tmp_dir}/sftp-command" ]; then
"${tmp_dir}/sftp-command"
fi
-${master_mirror_rsync_command} \
- "${tmp_dir}/build-support.db."* \
- "${tmp_dir}/build-support.files."* \
- "${master_mirror_rsync_directory}/i686/build-support/"
+while read -r repo_arch; do
+ ${master_mirror_rsync_command} \
+ "${tmp_dir}/${repo_arch}/build-support.db."* \
+ "${tmp_dir}/${repo_arch}/build-support.files."* \
+ "${master_mirror_rsync_directory}/${repo_arch}/build-support/"
+done < \
+ "${tmp_dir}/repo-archs"
if [ -s "${tmp_dir}/mysql-command" ]; then
mysql_run_query < \