summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-17 21:01:45 +0200
committerErich Eckner <git@eckner.net>2018-07-17 21:01:45 +0200
commitdd78c162723e9a039e141ca799e52c1f0356e39f (patch)
treea321521fa6c1be1d96d6c05178a5aeed1252bf6d
parenta3616cc31b917ac28184012d2ff6ca3f50b92fda (diff)
downloadbuilder-dd78c162723e9a039e141ca799e52c1f0356e39f.tar.xz
lib/common-functions: find_pkgbuilds(): fail if git commit is not available
-rwxr-xr-xbin/build-packages2
-rwxr-xr-xlib/common-functions13
2 files changed, 13 insertions, 2 deletions
diff --git a/bin/build-packages b/bin/build-packages
index bf7987d..6c951dd 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -11,8 +11,6 @@
# TODO: report back memory and hdd stats to the build master on successful build
-# TODO: FAIL IF GIT COMMITS CANNOT BE FOUND!
-
# shellcheck disable=SC2016
usage() {
>&2 echo ''
diff --git a/lib/common-functions b/lib/common-functions
index 4e5bd45..0cacf18 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -24,6 +24,19 @@ find_pkgbuilds() {
local repo_path
eval 'repo_path="${repo_paths__'"${git_repository}"'}"'
+ if [ ! "$(git -C "${repo_path}" cat-file -t "${git_revision}" 2> /dev/null)" = "commit" ]; then
+ >&2 printf 'Repository %s does not contain commit %s, but it should.\n' \
+ "${git_repository}" \
+ "${git_revision}"
+ return 2
+ fi
+
+ if [ ! "$(git -C "${repo_paths__archlinux32}" cat-file -t "${mod_git_revision}" 2> /dev/null)" = "commit" ]; then
+ >&2 printf 'Repository archlinux32 does not contain commit %s, but it should.\n' \
+ "${mod_git_revision}"
+ return 2
+ fi
+
PKGBUILD=$(
git -C "${repo_path}" archive "${git_revision}" -- "${package}/repos/${repository}-*/PKGBUILD" 2> /dev/null | \
tar -t 2> /dev/null | \