index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2018-01-24 16:15:40 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2018-01-24 16:15:40 +0100 |
commit | ff768f012bfef1bf264d06214aead70a58c0ff90 (patch) | |
tree | 00fae2f78283cf61698b2b8fd2474a1f6a5802c8 /bin/db-update | |
parent | d5280828118b27372c5ea9be1c0cd8e55c818ff0 (diff) | |
parent | cb4eedcdca4fc5f58e83abe2aadc9abb59b4918c (diff) |
-rwxr-xr-x | bin/db-update | 60 |
diff --git a/bin/db-update b/bin/db-update index 827dc05..fe45f41 100755 --- a/bin/db-update +++ b/bin/db-update @@ -20,6 +20,12 @@ # track packages in stable, too # know _exactly_ in which repository the packages are +# TODO: fully integrate database (in other scripts too) - e.g. rely on +# info in db instead of state-files + +# TODO: add possibility to manually clone a (binary) package (e.g. +# for build-support) - this should also be possible via email + # shellcheck disable=SC2039 # shellcheck source=conf/default.conf . "${0%/*}/../conf/default.conf" @@ -160,7 +166,7 @@ move_packages() { exit 2 fi done < \ - "${tmp_dir}/tmp/${package}.parts" + "${tmp_dir}/tmp/${package}.parts_and_signatures" mkdir -p "${tmp_dir}/tmp/${from_repo}" mkdir -p "${tmp_dir}/tmp/${to_repo}" @@ -323,9 +329,55 @@ move_packages() { done < \ "${tmp_dir}/tmp/packages" - if ! ${no_action}; then - ${dummynator} trigger_mirror_refreshs - fi + # shellcheck disable=SC2016 + while read -r package; do + while read -r part; do + printf 'UPDATE `binary_packages`' + printf ' JOIN `repositories` ON `binary_packages`.`repository`=`repositories`.`id`' + printf ' JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`' + printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`=from_base64("%s"))' \ + "$( + base64_encode_each < \ + "${tmp_dir}/tmp/${package}.to_repo" + )" + printf ' WHERE' + printf ' `repositories`.`name`=from_base64("%s")' \ + "$( + base64_encode_each < \ + "${tmp_dir}/tmp/${package}.from_repo" + )" + printf '%s\n' "${part}" | \ + sed ' + s/\.pkg\.tar\.xz$// + s/-\([^-.]\+\)\(-[^-]\+\)$/-\1.0\2/ + s/-\([^-:]\+\)\(\(-[^-]\+\)\{2\}\)$/-0:\1\2/ + s/^\(.\+\)-\([^-:]\+\):\([^-:]\+\)-\([^-.]\+\)\.\([^-.]\+\)-\([^-]\+\)$/\1\n\2\n\3\n\4\n\5\n\6/ + ' | \ + base64_encode_each | \ + tr '\n' ' ' | \ + sed ' + s,\(\S\+\) \(\S\+\) \(\S\+\) \(\S\+\) \(\S\+\) \(\S\+\) $,'"$( + printf ' AND `binary_packages`.`%s`=from_base64("%s")' \ + 'pkgname' '\1' \ + 'epoch' '\2' \ + 'pkgver' '\3' \ + 'pkgrel' '\4' \ + 'sub_pkgrel' '\5' + printf ' AND `architectures`.`name`=from_base64("\\6")' + )"', + ' + printf ';\n' + done < \ + "${tmp_dir}/tmp/${package}.parts" + done < \ + "${tmp_dir}/tmp/packages" | \ + if ${no_action}; then + sed 's|^|mysql: |' + else + ${mysql_command} + fi + + ${dummynator} trigger_mirror_refreshs rm -rf --one-file-system "${tmp_dir:?}/tmp" |