diff options
author | Erich Eckner <git@eckner.net> | 2017-03-28 23:07:53 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-03-28 23:07:53 +0200 |
commit | ef2ffdcc4a69f8ccbcb8862588c4dc3a95655471 (patch) | |
tree | 40dfe68e57716c858b2a27d9964e37ee5bdd3595 /bin/get-package-updates | |
parent | 7bc5b3029c04dba59f81af8bfb665944a17a188f (diff) | |
download | builder-ef2ffdcc4a69f8ccbcb8862588c4dc3a95655471.tar.xz |
bin/get-package-updates: do initialization correctly if work/*.revision doesn't exist
Diffstat (limited to 'bin/get-package-updates')
-rwxr-xr-x | bin/get-package-updates | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates index 5f2ca88..399b665 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -49,7 +49,7 @@ done declare -A old_repo_revisions for repo in "${!repo_paths[@]}"; do - old_repo_revisions["${repo}"]="$(cat ${base_dir}/work/${repo}.revision)" + old_repo_revisions["${repo}"]="$(cat ${base_dir}/work/${repo}.revision || echo NONE)" done # Check modified packages from the last update, and put them to the build list. @@ -64,7 +64,15 @@ for repo in "${!repo_paths[@]}"; do current_HEAD="$( git -C "${repo_paths["${repo}"]}" rev-parse HEAD )" - git -C "${repo_paths["${repo}"]}" diff --name-status "${old_repo_revisions["${repo}"]}" HEAD | \ + ( + if [ "${old_repo_revisions["${repo}"]}" == "NONE" ]; then + git -C "${repo_paths["${repo}"]}" archive --format=tar HEAD | \ + tar -t | \ + sed 's|^|A\t|' + else + git -C "${repo_paths["${repo}"]}" diff --name-status "${old_repo_revisions["${repo}"]}" HEAD + fi + ) | \ grep '^.\s[^/]\+/repos/[^/]\+/PKGBUILD$' | \ sed 's|^\(.\)\t\([^/]\+\)/repos/\([^/]\+\)-[^/-]\+/PKGBUILD$|\1 \2 '"${current_HEAD}"' \3|' | \ grep -v '\(staging\|testing\)$' |