summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-03-17 21:03:09 +0100
committerErich Eckner <git@eckner.net>2017-03-17 21:03:09 +0100
commitebea71db535e461b5002702847e7105efe01fc0f (patch)
treed86280645237f0ebcd53ad0731acf617c078f965 /bin
parenta4b28c7c1ee6eff408ff6122a147aceb6a61ec3d (diff)
downloadbuilder-ebea71db535e461b5002702847e7105efe01fc0f.tar.xz
bin/get-package-updates: point 2, 3, 6 done
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-package-updates32
1 files changed, 24 insertions, 8 deletions
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}"