abuild: simplify optional git usage
set git=true if git is missing so all git commands are ignored. This simplifies the code a bit
This commit is contained in:
parent
6fc2f40a0d
commit
fd97176583
16
abuild.in
16
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"
|
||||
|
|
Loading…
Reference in New Issue