summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-04-13 14:34:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-04-17 16:52:54 +0000
commitfd97176583ed7a13d4fd63ecbad3d436fe14d0b2 (patch)
treeca6369382fbe6d802c10972597708b07fac9fcb8
parent6fc2f40a0da60f076a4b1981832221f57ab2669c (diff)
downloadabuild-fd97176583ed7a13d4fd63ecbad3d436fe14d0b2.tar.gz
abuild-fd97176583ed7a13d4fd63ecbad3d436fe14d0b2.tar.bz2
abuild-fd97176583ed7a13d4fd63ecbad3d436fe14d0b2.tar.xz
abuild-fd97176583ed7a13d4fd63ecbad3d436fe14d0b2.zip
abuild: simplify optional git usage
set git=true if git is missing so all git commands are ignored. This simplifies the code a bit
-rw-r--r--abuild.in16
1 files changed, 5 insertions, 11 deletions
diff --git a/abuild.in b/abuild.in
index db74f2d..a10bca3 100644
--- a/abuild.in
+++ b/abuild.in
@@ -12,7 +12,7 @@ sysconfdir=@sysconfdir@
datadir=@datadir@
abuild_path=$(readlink -f $0)
-git_path=$(command -v git || true)
+git=$(command -v git) || git=true
if ! [ -f "$datadir/functions.sh" ]; then
echo "$datadir/functions.sh: not found" >&2
@@ -809,14 +809,12 @@ prepare_language_packs() {
# echo '-dirty' if git is not clean
git_dirty() {
- [ -z "$git_path" ] && return
- [ $(git status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty"
+ [ $($git status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty"
}
# echo last commit hash id
git_last_commit() {
- [ -z "$git_path" ] && return
- git log --format=oneline -n 1 "$startdir" | awk '{print $1}'
+ $git log --format=oneline -n 1 "$startdir" | awk '{print $1}'
}
get_maintainer() {
@@ -1546,11 +1544,7 @@ update_abuildrepo_index() {
subpkg_unset
if [ -z "$DESCRIPTION" ]; then
- if [ -n "$git_path" ]; then
- DESCRIPTION="$repo $(cd $startdir && git describe)"
- else
- DESCRIPTION="$repo"
- fi
+ DESCRIPTION="$repo $(cd $startdir && $git describe)"
fi
for i in $allarch; do
@@ -2404,7 +2398,7 @@ snapshot() {
# clone git repo and archive
if [ -n "$giturl" ]; then
local _version=${verbase:-0}_git${_date}
- [ -z "$git_path" ] && die "Missing git! Install git to support git clone."
+ [ "$git" = "true" ] && die "Missing git! Install git to support git clone."
local _rev="${reporev:-HEAD}"
[ "$_rev" = "HEAD" ] && local _depth="--depth=1"
msg "Creating git snapshot: $pkgname-$_version"