From 42c69f3c1bdf6358ad1ab632997d3a12fd11dd4f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 30 May 2018 10:23:57 +0200 Subject: lib/mysql-functions: mysql_retrieve_repository_ids() -> mysql_retrieve_static_information() ... and it will be called automatically by lib/load-configuration --- bin/copy-to-build-support | 1 - bin/get-package-updates | 2 -- bin/seed-build-list | 1 - lib/load-configuration | 5 +++-- lib/mysql-functions | 16 ++++------------ 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support index ef08d7d..dc45d07 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}" -mysql_retrieve_repository_ids to_copy='build_assignment epoch pkgver pkgrel sub_pkgrel has_issues is_tested pkgname architecture' sed -n ' s/.\+/\0 \0/ diff --git a/bin/get-package-updates b/bin/get-package-updates index ec25899..83d8181 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -107,8 +107,6 @@ if [ -s "${work_dir}/build-master-sanity" ]; then exit fi -mysql_retrieve_repository_ids - # TODO: How should new deletion-list packages be handled? # - packages deleted upstream should be marked as to-be-deleted if # existent and otherwise be ignored diff --git a/bin/seed-build-list b/bin/seed-build-list index 389fdcf..809a5fd 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -388,7 +388,6 @@ printf 'CREATE TEMPORARY TABLE `pkgbases` (`pkgbase` VARCHAR(64), `repository` V sort -u | \ tr '\t' ' ' | \ if ${update}; then - mysql_retrieve_repository_ids while read -r pkgbase git_rev mod_git_rev repo; do printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" | \ sed 's/ $/\n/' diff --git a/lib/load-configuration b/lib/load-configuration index f70daeb..4edea90 100755 --- a/lib/load-configuration +++ b/lib/load-configuration @@ -26,13 +26,14 @@ if pgrep -x mysqld >/dev/null 2>&1; then i_am_the_master=true # shellcheck source=../lib/mysql-functions . "${base_dir}/lib/mysql-functions" - # TODO: maybe we should load some infos from the db in this case? - # e.g. mysql_retrieve_repository_ids + + mysql_retrieve_static_information else i_am_the_master=false fi # TODO: some of this should be read from the database instead +# (in mysql_retrieve_static_information) repo_names='packages community archlinux32' repo_paths__packages="${work_dir}/repos/packages" repo_paths__community="${work_dir}/repos/community" diff --git a/lib/mysql-functions b/lib/mysql-functions index 99ad9ce..12de251 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -204,11 +204,6 @@ mysql_add_package_source() { mysql_generate_package_metadata() { - # retrieve repository_ids if not yet done - if [ -z "${repository_ids__any_build_list}" ]; then - mysql_retrieve_repository_ids - fi - ( # new shell is intentional current_repository_id="$1" package="$2" @@ -624,10 +619,6 @@ mysql_generate_package_metadata() { # do a sanity check on the mysql database mysql_sanity_check() { - # retrieve repository_ids if not yet done - if [ -z "${repository_ids__any_build_list}" ]; then - mysql_retrieve_repository_ids - fi { printf 'SELECT CONCAT("\\"any\\" build-assignment building \\"",`bp_arch`.`name`,"\\" binary package: ",`binary_packages`.`pkgname`)' printf ' FROM `binary_packages`' @@ -1046,9 +1037,10 @@ mysql_show_binary_packages_in_repositories_issues() { mysql_run_query } -# mysql_retrieve_repository_ids -# retrieve the ids of all known repositories into $repository_ids__$arch_$repo -mysql_retrieve_repository_ids() { +# mysql_retrieve_static_information +# retrieve some static information from the database: +# - ids of all known repositories -> $repository_ids__$arch_$repo +mysql_retrieve_static_information() { eval "$( { printf 'SELECT CONCAT(' -- cgit v1.2.3-54-g00ecf