From ebea71db535e461b5002702847e7105efe01fc0f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 17 Mar 2017 21:03:09 +0100 Subject: bin/get-package-updates: point 2, 3, 6 done --- bin/get-package-updates | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/get-package-updates b/bin/get-package-updates index 57bb17b..1b95d7b 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -8,21 +8,33 @@ set -e lock_file="/tmp/get-package-updates.lock" +# TODO: +# include repository of package customizations + +declare -A repo_paths +repo_paths["packages"]="/usr/src/archlinux/packages" +repo_paths["community"]="/usr/src/archlinux/community" + +base_dir="$(dirname "$(readlink -f "$0")")/.." + # Create a lock file for build list. exec 9>"${lock_file}" flock -n 9 || exit # Update git repositories (official packages, community packages and the repository of package customizations). -# TODO: -# include repository of package customizations -for repo in packages community; do - git -C /usr/src/archlinux/${repo} pull +for repo in "${repo_paths[@]}"; do + git -C "${repo}" pull done -# TODO: -# Read previous git revision numbers from files. +# Read previous git revision numbers from files. + +declare -A old_repo_revisions + +for repo in "${!repo_paths[@]}"; do + old_repo_revisions["${repo}"]="$(cat ${base_dir}/work/${repo}.revision)" +done # TODO: # Check modified packages from the last update, and put them to the build list. @@ -33,7 +45,11 @@ done # TODO: # Put the list in the proper build order. -# TODO: -# Write the current git revision numbers to files. +# Write the current git revision numbers to files. + +for repo in "${!repo_paths[@]}"; do + git -C "${repo_paths["${repo}"]}" rev-parse HEAD > \ + "${base_dir}/work/${repo}.revision" +done rm -f "${lock_file}" -- cgit v1.2.3-54-g00ecf