diff options
-rwxr-xr-x | bin/bootstrap-mysql | 2 | ||||
-rwxr-xr-x | bin/get-package-updates | 40 | ||||
-rwxr-xr-x | bin/mysql-functions | 39 | ||||
-rwxr-xr-x | bin/seed-build-list | 2 |
4 files changed, 22 insertions, 61 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql index 5acc2e2..1a50496 100755 --- a/bin/bootstrap-mysql +++ b/bin/bootstrap-mysql @@ -475,7 +475,7 @@ find "${work_dir}/package-states" \ tr ' ' '.' < \ "${work_dir}/build-list" | \ while read -r state_file; do - mysql_generate_package_metadata "${state_file}" + mysql_generate_package_metadata 'build-list' "${state_file}" done # shellcheck disable=SC2016 diff --git a/bin/get-package-updates b/bin/get-package-updates index a8dc710..8322e6d 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -337,7 +337,7 @@ done | \ )" } | \ ${mysql_command} - mysql_generate_package_metadata "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}" + mysql_generate_package_metadata 'build-list' "${package}" "${git_revision}" "${new_repo_revisions__archlinux32}" "${repository}" continue fi @@ -358,44 +358,6 @@ while read -r package git_revision mod_git_revision repository; do generate_package_metadata "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" done < "${work_dir}/build-list.new" -{ - # shellcheck disable=SC2016 - { - printf 'SELECT DISTINCT ' - printf 'replace(to_base64(`package_sources`.`%s`),"\\n",""),' \ - 'pkgbase' 'git_revision' 'mod_git_revision' - printf 'replace(to_base64(`upstream_repositories`.`name`),"\\n","")' - printf ' FROM `binary_packages`' - printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ - 'repositories' 'repositories' 'binary_packages' 'repository' \ - 'build_assignments' 'build_assignments' 'binary_packages' 'build_assignment' \ - 'package_sources' 'package_sources' 'build_assignments' 'package_source' \ - 'upstream_repositories' 'upstream_repositories' 'package_sources' 'upstream_package_repository' - printf ' WHERE `repositories`.`name` in ("build-list","deletion-list")' - } | \ - ${mysql_command} --raw --batch | \ - sed ' - 1d - y/\t/ / - ' | \ - while read -r a b c d; do - printf '%s ' \ - "$(printf '%s' "${a}" | base64 -d)" \ - "$(printf '%s' "${b}" | base64 -d)" \ - "$(printf '%s' "${c}" | base64 -d)" \ - "$(printf '%s' "${d}" | base64 -d)" | \ - sed 's/ /\n/' - done | \ - grep -vxF '' | \ - sed 'p' - cat "${work_dir}/build-list.new" -} | \ - sort | \ - uniq -u | \ - while read -r package git_revision mod_git_revision repository; do - mysql_generate_package_metadata "${package}" "${git_revision}" "${mod_git_revision}" "${repository}" - done - echo 'apply blacklisting' # ignore blacklisted packages and dependent packages # this is the first time when all the information is available and up to date diff --git a/bin/mysql-functions b/bin/mysql-functions index 64f1915..19fb773 100755 --- a/bin/mysql-functions +++ b/bin/mysql-functions @@ -190,15 +190,16 @@ mysql_add_install_target() { ${mysql_command} } -# mysql_generate_package_metadata $package $git_revision $mod_git_revision $repository +# mysql_generate_package_metadata $current_repository $package $git_revision $mod_git_revision $repository # or -# mysql_generate_package_metadata $package.$git_revision.$mod_git_revision.$repository -# if sub_pkgrel should be determined automatically and the package is on the build-list +# mysql_generate_package_metadata $current_repository $package.$git_revision.$mod_git_revision.$repository +# if sub_pkgrel should be determined automatically # and # mysql_generate_package_metadata $sub_pkgrel $current_repository $package $git_revision $mod_git_revision $repository # or # mysql_generate_package_metadata $sub_pkgrel $current_repository $package.$git_revision.$mod_git_revision.$repository -# if $sub_pkgrel should be forced and the package is currently in $current_repository +# if $sub_pkgrel should be forced + # generate the meta data of a package (dependencies, built packages, ...) in the database mysql_generate_package_metadata() { @@ -207,10 +208,6 @@ mysql_generate_package_metadata() { case "$1" in ''|*[!0-9]*) unset forced_sub_pkgrel - current_repository=$( - printf 'build-list' | \ - base64 -w0 - ) ;; *) forced_sub_pkgrel=$( @@ -218,21 +215,12 @@ mysql_generate_package_metadata() { base64 -w0 ) shift - current_repository=$( - printf '%s' "$1" | \ - base64 -w0 - ) - shift ;; esac - package="$1" - git_revision="$2" - mod_git_revision="$3" - repository="$4" - temp_dir=$(mktemp -d 'tmp.mysql-functions.mysql_generate_package_metadata.XXXXXXXXXX' --tmpdir) - trap 'rm -rf --one-file-system "${temp_dir}"' EXIT + current_repository="$1" + package="$2" - if [ $# -eq 1 ]; then + if [ $# -eq 2 ]; then # second form repository="${package##*.}" package="${package%.*}" @@ -240,8 +228,15 @@ mysql_generate_package_metadata() { package="${package%.*}" git_revision="${package##*.}" package="${package%.*}" + else + git_revision="$3" + mod_git_revision="$4" + repository="$5" fi + temp_dir=$(mktemp -d 'tmp.mysql-functions.mysql_generate_package_metadata.XXXXXXXXXX' --tmpdir) + trap 'rm -rf --one-file-system "${temp_dir}"' EXIT + printf '.' >&2 if ! make_source_info "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${temp_dir}/SRCINFO"; then printf '"make_source_info %s %s %s %s %s" failed.\n' "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${temp_dir}/SRCINFO" @@ -276,6 +271,10 @@ mysql_generate_package_metadata() { printf '.' >&2 # now we encode everything in base64 + current_repository=$( + printf '%s' "${current_repository}" | \ + base64 -w0 + ) pkgbase=$( printf '%s' "${pkgbase}" | \ base64 -w0 diff --git a/bin/seed-build-list b/bin/seed-build-list index e17242c..b049560 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -305,7 +305,7 @@ if ${update}; then tee -a "${work_dir}/build-list" while read -r git_revision mod_git_revision repository pkgbase; do - mysql_generate_package_metadata "${pkgbase}" "${git_revision}" "${mod_git_revision}" "${repository}" + mysql_generate_package_metadata 'build-list' "${pkgbase}" "${git_revision}" "${mod_git_revision}" "${repository}" done < \ "${tmp_dir}/build-list.new" |