mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-27 09:44:20 +00:00
Don't print 'git: not found' errors
abuild, as packaged in Alpine Linux, does not depend on git. But when you use it without git, it will print out errors like the following: /usr/bin/abuild: line 2554: git: not found With this commit, it saves the git_path in the beginning (just like abuild_path). Later in the code it does not try to run git if that variable is empty. Notably `abuild rootbld` is already checking whether `abuild-rootbld` is installed, and that subpackage of `abuild` does already depend on `git`. So no additional check was added before using `git ` inside `rootbld`. Fixes #32
This commit is contained in:
parent
6981f3a6ae
commit
4501a6cc5e
19
abuild.in
19
abuild.in
@ -12,6 +12,7 @@ sysconfdir=@sysconfdir@
|
|||||||
datadir=@datadir@
|
datadir=@datadir@
|
||||||
|
|
||||||
abuild_path=$(readlink -f $0)
|
abuild_path=$(readlink -f $0)
|
||||||
|
git_path=$(command -v git || true)
|
||||||
|
|
||||||
if ! [ -f "$datadir/functions.sh" ]; then
|
if ! [ -f "$datadir/functions.sh" ]; then
|
||||||
echo "$datadir/functions.sh: not found" >&2
|
echo "$datadir/functions.sh: not found" >&2
|
||||||
@ -805,13 +806,13 @@ prepare_language_packs() {
|
|||||||
|
|
||||||
# echo '-dirty' if git is not clean
|
# echo '-dirty' if git is not clean
|
||||||
git_dirty() {
|
git_dirty() {
|
||||||
if [ $(git status -s "$startdir" | wc -l) -ne 0 ]; then
|
[ -z "$git_path" ] && return
|
||||||
echo "-dirty"
|
[ $(git status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# echo last commit hash id
|
# echo last commit hash id
|
||||||
git_last_commit() {
|
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}'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1524,7 +1525,14 @@ update_abuildrepo_index() {
|
|||||||
done
|
done
|
||||||
subpkg_unset
|
subpkg_unset
|
||||||
|
|
||||||
[ -z "$DESCRIPTION" ] && DESCRIPTION="$repo $(cd $startdir && git describe || true)"
|
if [ -z "$DESCRIPTION" ]; then
|
||||||
|
if [ -n "$git_path" ]; then
|
||||||
|
DESCRIPTION="$repo $(cd $startdir && git describe)"
|
||||||
|
else
|
||||||
|
DESCRIPTION="$repo"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
for i in $allarch; do
|
for i in $allarch; do
|
||||||
cd "$REPODEST/$repo/$i"
|
cd "$REPODEST/$repo/$i"
|
||||||
local index=$i/APKINDEX.tar.gz
|
local index=$i/APKINDEX.tar.gz
|
||||||
@ -2376,8 +2384,7 @@ snapshot() {
|
|||||||
# clone git repo and archive
|
# clone git repo and archive
|
||||||
if [ -n "$giturl" ]; then
|
if [ -n "$giturl" ]; then
|
||||||
local _version=${verbase:-0}_git${_date}
|
local _version=${verbase:-0}_git${_date}
|
||||||
command -v git >/dev/null || \
|
[ -z "$git_path" ] && die "Missing git! Install git to support git clone."
|
||||||
die "Missing git! Install git to support git clone."
|
|
||||||
local _rev="${reporev:-HEAD}"
|
local _rev="${reporev:-HEAD}"
|
||||||
[ "$_rev" = "HEAD" ] && local _depth="--depth=1"
|
[ "$_rev" = "HEAD" ] && local _depth="--depth=1"
|
||||||
msg "Creating git snapshot: $pkgname-$_version"
|
msg "Creating git snapshot: $pkgname-$_version"
|
||||||
|
Loading…
Reference in New Issue
Block a user