Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/copy-to-build-support55
-rwxr-xr-xbin/return-assignment27
2 files changed, 28 insertions, 54 deletions
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index f4647e1..a42ca31 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -70,7 +70,6 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
export TMPDIR="${tmp_dir}"
-to_copy='build_assignment epoch pkgver pkgrel sub_pkgrel has_issues is_tested pkgname architecture'
sed -n '
s/.\+/\0 \0/
T
@@ -85,10 +84,8 @@ sed -n '
# shellcheck disable=SC2016
id=$(
{
- printf 'SELECT `binary_packages`.`id`,`repositories`.`name`'
+ printf 'SELECT `binary_packages`.`id`'
printf ' FROM `binary_packages`'
- mysql_join_binary_packages_binary_packages_in_repositories
- mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
printf ' WHERE'
printf ' `binary_packages`.`%s`=from_base64("%s") AND' \
@@ -101,29 +98,24 @@ sed -n '
"$(printf '%s' "${architecture}" | base64 -w0)"
printf ' LIMIT 1;\n'
} | \
- mysql_run_query | \
- tr '\t' ' '
+ mysql_run_query
)
if [ -z "${id}" ]; then
continue
fi
- repository="${id#* }"
- id="${id%% *}"
- printf '%s\n' "${id}" >> \
- "${tmp_dir}/package-ids"
+ printf '%s\n' "${package}" >> \
+ "${tmp_dir}/packages"
for suffix in '' '.sig'; do
- printf 'ln "i686/%s/%s%s" "i686/build-support/%s%s"\n' \
- "${repository}" \
+ printf 'ln -s "pool/%s%s" "i686/build-support/%s%s"\n' \
"${package}" \
"${suffix}" \
"${package}" \
"${suffix}"
done >> \
"${tmp_dir}/sftp-command"
- printf '%s/i686/%s/%s\n' \
+ printf '%s/pool/%s\n' \
"${master_mirror_rsync_directory}" \
- "${repository}" \
"${package}" | \
sed '
p
@@ -133,25 +125,13 @@ sed -n '
# shellcheck disable=SC2016
{
- printf 'INSERT IGNORE INTO `binary_packages` ('
- # shellcheck disable=SC2086
- printf ',`%s`' ${to_copy} | \
- sed 's/^,//'
- printf ')'
- printf ' SELECT'
- # shellcheck disable=SC2086
- printf ',`binary_packages`.`%s`' ${to_copy} | \
- sed 's/^,//'
- printf ' FROM `binary_packages`'
- mysql_join_binary_packages_architectures
- printf ' WHERE'
- printf ' `binary_packages`.`id`=%s;\n' \
- "${id}"
printf 'INSERT IGNORE INTO `binary_packages_in_repositories`'
printf ' (`repository`,`package`)'
# shellcheck disable=SC2154
- printf ' SELECT %s,LAST_INSERT_ID();\n' \
- "${repository_ids__i686_build_support}"
+ printf ' VALUES (%s,%s);\n' \
+ "${repository_ids__i686_build_support}" \
+ "${id}"
+ printf 'SELECT LAST_INSERT_ID();\n'
} >> \
"${tmp_dir}/mysql-command"
done
@@ -183,17 +163,14 @@ ${master_mirror_rsync_command} \
if [ -s "${tmp_dir}/mysql-command" ]; then
mysql_run_query < \
- "${tmp_dir}/mysql-command"
-fi
-
-if [ -s "${tmp_dir}/package-ids" ]; then
- while read -r package_id; do
- remove_old_package_versions "${package_id}"
- done < \
- "${tmp_dir}/package-ids"
+ "${tmp_dir}/mysql-command" | \
+ sort -u | \
+ while read -r bpir_id; do
+ remove_old_package_versions "${bpir_id}"
+ done
fi
if [ -w "$1" ]; then
- cat "${tmp_dir}/package-ids" > \
+ cat "${tmp_dir}/packages" > \
"$1"
fi
diff --git a/bin/return-assignment b/bin/return-assignment
index 51f5717..75f45f0 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -600,15 +600,14 @@ trigger_mirror_refreshs
)"
printf 'COMMIT;\n'
- # insert into appropriate repositories
- printf 'INSERT INTO `binary_packages_in_repositories` (`package`,`repository`) VALUES '
- cut -d' ' -f1 < \
- "${tmp_dir}/package-ids" | \
- sed '
- s/^/(/
- s/$/,'"${destination_id}"'),/
- $ s/,$/;/
- '
+ # insert into appropriate repositories and retrieve ids
+ while read -r package_id _; do
+ printf 'INSERT INTO `binary_packages_in_repositories` (`package`,`repository`) VALUES '
+ printf '(%s,%s);\n' \
+ "${package_id}" "${destination_id}"
+ printf 'SELECT LAST_INSERT_ID();\n'
+ done < \
+ "${tmp_dir}/package-ids"
printf 'COMMIT;\n'
# remove from build-list
@@ -670,10 +669,8 @@ trigger_mirror_refreshs
printf ');\n'
printf 'DROP TEMPORARY TABLE `loops_to_delete`;\n'
} | \
- mysql_run_query
-
-cut -d' ' -f1 < \
- "${tmp_dir}/package-ids" | \
- while read -r package_id; do
- remove_old_package_versions "${package_id}"
+ mysql_run_query | \
+ sort -u | \
+ while read -r bpir_id; do
+ remove_old_package_versions "${bpir_id}"
done