summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-31 12:15:11 +0200
committerErich Eckner <git@eckner.net>2018-05-31 12:15:11 +0200
commit13a67a1ab8d15a77c539b5e141dd208eca4e96fd (patch)
tree978a84745e9d276a6a34c4821e4febbe77d870a3 /bin/return-assignment
parent26e44f205c0db16d1e74427e5320b6a56ae320a4 (diff)
downloadbuilder-13a67a1ab8d15a77c539b5e141dd208eca4e96fd.tar.xz
lib/common-functions: remove_old_package_versions() acts now on binary_packages_in_repositories
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment27
1 files changed, 12 insertions, 15 deletions
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