index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-06-15 15:20:39 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-06-15 15:20:39 +0200 |
commit | 5b49e70d5606f36667a55291d5345e95d42674fd (patch) | |
tree | c4b7ea9958c2cc4a7300d318b5386e9b8db6d1b6 /bin/get-package-updates | |
parent | 2c4bd582619e6ab73d613b000128886232dbafc9 (diff) |
-rwxr-xr-x | bin/get-package-updates | 62 |
diff --git a/bin/get-package-updates b/bin/get-package-updates index 09f2958..b78187e 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # check for packages that need to be built, and build a list in the proper build order # Details: @@ -71,36 +71,35 @@ fi delete_package() { echo "$1" >> \ "${work_dir}/deletion-list.new" - sed -i "/^${1//./\\.} /d" "${work_dir}/build-list.new" + sed -i "/^$(str_to_regex "${1}") /d" "${work_dir}/build-list.new" } # Update git repositories (official packages, community packages and the repository of package customizations). -for repo in "${repo_paths[@]}"; do +for repo in ${repo_names}; do + eval repo_path='$repo_paths__'"${repo}" # TODO: # this is somewhat redundant and slow -- improve it! - git -C "${repo}" checkout -f master - git -C "${repo}" clean -xdf - git -C "${repo}" fetch + git -C "${repo_path}" checkout -f master + git -C "${repo_path}" clean -xdf + git -C "${repo_path}" fetch if ${pull}; then - git -C "${repo}" reset --hard origin/master + git -C "${repo_path}" reset --hard origin/master fi done # Read previous git revision numbers from files. -declare -A old_repo_revisions -declare -A new_repo_revisions - -for repo in "${!repo_paths[@]}"; do - old_repo_revisions["${repo}"]="$( +for repo in ${repo_names}; do + eval "old_repo_revisions__${repo}='$( cat "${work_dir}/${repo}.revision" 2> /dev/null || \ echo NONE - )" - new_repo_revisions["${repo}"]="$( - git -C "${repo_paths["${repo}"]}" rev-parse HEAD | \ + )'" + eval repo_path='$repo_paths__'"${repo}" + eval "new_repo_revisions__${repo}='$( + git -C "${repo_path}" rev-parse HEAD | \ tee "${work_dir}/${repo}.revision.new" - )" + )'" done # Create a lock file for build list. @@ -125,15 +124,18 @@ cp \ "${work_dir}/deletion-list" \ "${work_dir}/deletion-list.new" -for repo in "${!repo_paths[@]}"; do +for repo in ${repo_names}; do + eval repo_path='$repo_paths__'"${repo}" + eval old_repo_revision='$old_repo_revisions__'"${repo}" + eval new_repo_revision='$new_repo_revisions__'"${repo}" ( # if old revision unknown, mimic "git diff"-output - if [ "${old_repo_revisions["${repo}"]}" = "NONE" ]; then - git -C "${repo_paths["${repo}"]}" archive --format=tar HEAD | \ + if [ "${old_repo_revision}" = "NONE" ]; then + git -C "${repo_path}" archive --format=tar HEAD | \ tar -t | \ sed 's|^|A\t|' else - git -C "${repo_paths["${repo}"]}" diff --no-renames --name-status "${old_repo_revisions["${repo}"]}" HEAD + git -C "${repo_path}" diff --no-renames --name-status "${old_repo_revision}" HEAD fi ) | \ # only track changes in PKGBUILDs @@ -143,10 +145,12 @@ for repo in "${!repo_paths[@]}"; do # to the one of an original source repository sed 's|^\(.\t\)\([^/]\+\)/\([^/]\+\)/\(.\+\)$|\2 \1\3/repos/\2-x86_64/\4|' | \ while read -r pkg_repo rest; do - echo "${new_repo_revisions["$(find_git_repository_to_package_repository "${pkg_repo}")"]} ${rest}" + printf '%s %s\n' \ + "$(eval printf '$new_repo_revisions__%s' "$(find_git_repository_to_package_repository "${pkg_repo}")")" \ + "${rest}" done else - sed "s|^|${new_repo_revisions["${repo}"]} |" + sed "s|^|${new_repo_revision} |" fi | \ grep '^\S\+ .\s[^/]\+/repos/[^/]\+/PKGBUILD$' | \ # ignore i686 @@ -161,10 +165,10 @@ done | \ # new or modified PKGBUILD "A"|"M") - sed -i "/^${package//./\\.} /d" "${work_dir}/build-list.new" - echo "${package} ${git_revision} ${new_repo_revisions["archlinux32"]} ${repository}" >> \ + sed -i "/^$(str_to_regex "${package}") /d" "${work_dir}/build-list.new" + echo "${package} ${git_revision} ${new_repo_revisions__archlinux32} ${repository}" >> \ "${work_dir}/build-list.new" - sed -i "/^${package//./\\.}\$/d" "${work_dir}/deletion-list.new" + sed -i "/^$(str_to_regex "${package}")\$/d" "${work_dir}/deletion-list.new" ;; # deleted PKGBUILD @@ -205,7 +209,7 @@ echo 'apply blacklisting' black_listed='' black_listed_new="$( - cat "${repo_paths["archlinux32"]}/blacklist" + cat "${repo_paths__archlinux32}/blacklist" ls "${work_dir}/package-infos/" | \ grep '^lib32-.*\.depends' | \ sed ' @@ -324,11 +328,9 @@ fi rm -rf --one-file-system "${work_dir}/build-list.loops" ( - echo "build-list.loops" "build-list.new" "build-list" "deletion-list" - echo "${!repo_paths[@]}" | \ - sed 's@\( \|$\)@.revision\1@g' + printf '%s\n' "build-list.loops" "build-list.new" "build-list" "deletion-list" + printf '%s.revision\n' ${repo_names} ) | \ - tr ' ' '\n' | \ while read -r file; do mv "${work_dir}/${file}.new" "${work_dir}/${file}" done |