Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-31 10:52:31 +0200
committerErich Eckner <git@eckner.net>2018-05-31 10:52:31 +0200
commit105d3a57f96300b824c818f36397eeee75005963 (patch)
tree3526c0457c389e6756001e2726f1494ed1b983b8 /bin
parentd83aecc92e8bbb847b49fc2be4ba4facd1f17795 (diff)
bin/return-assignment: update -> insert + delete = prepare for multi-arch
Diffstat (limited to 'bin')
-rwxr-xr-xbin/return-assignment73
1 files changed, 51 insertions, 22 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 24a12bf..51f5717 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -500,17 +500,22 @@ while read -r package_id package_name; do
done < \
"${tmp_dir}/package-ids"
-# TODO: once we honestly want to have multiple architectures, this needs
-# to be changed fundamentally
-
# move packages
-${master_mirror_rsync_command} \
- "${master_mirror_rsync_directory}/i686/${destination}/${destination}.db."* \
- "${master_mirror_rsync_directory}/i686/${destination}/${destination}.files."* \
- .
-# shellcheck disable=SC2086
-repo-add "${destination}.db.tar.gz" ${packages}
-# repo-add -v -s -k "${repo_key}" "${destination}.db.tar.gz" ${packages}
+
+# shellcheck disable=SC2041
+for arch in 'i686'; do
+
+ mkdir "${arch}"
+ ${master_mirror_rsync_command} \
+ "${master_mirror_rsync_directory}/i686/${destination}/${destination}.db."* \
+ "${master_mirror_rsync_directory}/i686/${destination}/${destination}.files."* \
+ "${arch}/"
+
+ # shellcheck disable=SC2086
+ repo-add "${arch}/${destination}.db.tar.gz" ${packages}
+ # repo-add -v -s -k "${repo_key}" "${destination}.db.tar.gz" ${packages}
+
+done
# upload the packages into /pool
${master_mirror_rsync_command} \
@@ -526,12 +531,16 @@ find . \( -name '*.pkg.tar.xz' -o -name '*.pkg.tar.xz.sig' \) -printf '%f\n' | \
done
# upload the database and the symlinks into /$arch/$repo
-${master_mirror_rsync_command} -l \
- "${destination}.db."* \
- "${destination}.files."* \
- ./*".pkg.tar.xz" \
- ./*".pkg.tar.xz.sig" \
- "${master_mirror_rsync_directory}/i686/${destination}/"
+
+# shellcheck disable=SC2041
+for arch in 'i686'; do
+ ${master_mirror_rsync_command} -l \
+ "${arch}/${destination}.db."* \
+ "${arch}/${destination}.files."* \
+ ./*".pkg.tar.xz" \
+ ./*".pkg.tar.xz.sig" \
+ "${master_mirror_rsync_directory}/${arch}/${destination}/"
+done
trigger_mirror_refreshs
@@ -591,15 +600,35 @@ 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/,$/;/
+ '
+ printf 'COMMIT;\n'
+
# remove from build-list
+ printf 'DELETE FROM `binary_packages_in_repositories`'
+ printf ' WHERE `binary_packages_in_repositories`.`package` IN ('
+ cut -d' ' -f1 < \
+ "${tmp_dir}/package-ids" | \
+ base64_encode_each | \
+ sed '
+ s/^/from_base64("/
+ s/$/"),/
+ $ s/,$//
+ '
+ printf ') AND `binary_packages_in_repositories`.`repository`=%s;\n' \
+ "${repository_ids__any_build_list}"
+ printf 'COMMIT;\n'
+
+ # update package information
printf 'UPDATE `binary_packages`'
- mysql_join_binary_packages_binary_packages_in_repositories
printf ' SET'
- printf ' `binary_packages_in_repositories`.`repository`=from_base64("%s"),' \
- "$(
- printf '%s' "${destination_id}" | \
- base64 -w0
- )"
printf ' `binary_packages`.`has_issues`=0,'
printf ' `binary_packages`.`is_tested`=0,'
printf ' `binary_packages`.`last_moved`=NOW()'