index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-05-31 12:15:11 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-31 12:15:11 +0200 |
commit | 13a67a1ab8d15a77c539b5e141dd208eca4e96fd (patch) | |
tree | 978a84745e9d276a6a34c4821e4febbe77d870a3 /bin/return-assignment | |
parent | 26e44f205c0db16d1e74427e5320b6a56ae320a4 (diff) |
-rwxr-xr-x | bin/return-assignment | 27 |
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 |