Verified Commit 54d6a4a1 authored by Max Rees's avatar Max Rees

Use $ABUILD_GIT for git from abuild.conf / environment

parent 5a162fad
......@@ -25,7 +25,7 @@ get_privkey_file() {
# if PACKAGER does not contain a valid email address, then ask git
if [ -z "$emailaddr" ] || [ "${emailaddr##*@}" = "$emailaddr" ]; then
emailaddr=$(git config --get user.email 2>/dev/null)
emailaddr=$($ABUILD_GIT config --get user.email 2>/dev/null)
fi
default_name="${emailaddr:-$USER}-$(printf "%x" $(date +%s))"
......
......@@ -12,7 +12,6 @@ sysconfdir=@sysconfdir@
datadir=@datadir@
abuild_path=$(readlink -f $0)
git=$(command -v git) || git=true
if ! [ -f "$datadir/functions.sh" ]; then
echo "$datadir/functions.sh: not found" >&2
......@@ -818,12 +817,12 @@ prepare_language_packs() {
# echo '-dirty' if git is not clean
git_dirty() {
[ $($git status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty"
[ $($ABUILD_GIT status -s "$startdir" | wc -l) -ne 0 ] && echo "-dirty"
}
# echo last commit hash id
git_last_commit() {
$git log --format=oneline -n 1 "$startdir" | awk '{print $1}'
$ABUILD_GIT log --format=oneline -n 1 "$startdir" | awk '{print $1}'
}
get_maintainer() {
......@@ -1565,7 +1564,7 @@ update_abuildrepo_index() {
subpkg_unset
if [ -z "$DESCRIPTION" ]; then
DESCRIPTION="$repo $(cd $startdir && $git describe 2>/dev/null || true)"
DESCRIPTION="$repo $(cd $startdir && $ABUILD_GIT describe 2>/dev/null || true)"
fi
for i in $allarch; do
......@@ -2201,7 +2200,7 @@ rootbld() {
fi
local version="edge" buildhost="edge" gitref
if gitref="$(expr "$(git symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then
if gitref="$(expr "$($ABUILD_GIT symbolic-ref --short HEAD)" : '\([0-9]\+\(\.[0-9]\+\)*\)-')"; then
version=v${gitref}
buildhost="$(printf '%s' "$gitref" | sed 's/[.]/-/')"
fi
......@@ -2209,10 +2208,10 @@ rootbld() {
local repo_template="$aportsgit/$repo/.rootbld-repositories"
[ -s "$repo_template" ] || die "rootbld: $repo_template does not exist"
(
for key in $(git config --list --name-only); do
for key in $($ABUILD_GIT config --list --name-only); do
k=${key#abuild.}
[ $k != $key ] && \
eval "export $k=\"$(git config --get $key)\""
eval "export $k=\"$($ABUILD_GIT config --get $key)\""
done
export mirror version
......@@ -2424,12 +2423,12 @@ snapshot() {
# clone git repo and archive
if [ -n "$giturl" ]; then
local _version="${verbase:-0}_git${_date}"
[ "$git" = "true" ] && die "Missing git! Install git to support git clone."
[ "$ABUILD_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"
git clone $_depth --bare $giturl $pkgname-$_version || return 1
git --git-dir $pkgname-$_version archive \
$ABUILD_GIT clone $_depth --bare $giturl $pkgname-$_version || return 1
$ABUILD_GIT --git-dir $pkgname-$_version archive \
--format=$_format \
-o $pkgname-$_version.$_format \
--prefix=$pkgname-$_version/ $_rev \
......@@ -2468,7 +2467,7 @@ usage() {
-A Print CARCH and exit
-c Enable colored output
-d Disable dependency checking
-D Set APKINDEX description (default: \$repo \$(git describe))
-D Set APKINDEX description (default: \$repo \$(\$ABUILD_GIT describe))
-f Force specified cmd (skip checks: apk up to date, arch, libc)
-F Force run as root
-h Show this help
......
......@@ -76,8 +76,8 @@ fixes #${fixes#\#}
$ABUILD $abuild_opts checksum all
git add APKBUILD
git commit -m"$message"
$ABUILD_GIT add APKBUILD
$ABUILD_GIT commit -m"$message"
)
rc=$?
if [ $rc -gt 0 ]; then
......@@ -111,7 +111,7 @@ cvelist=
fixes=
[ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR"
git rev-parse 2>/dev/null || die "not in a git tree"
$ABUILD_GIT rev-parse 2>/dev/null || die "not in a git tree"
args=$(getopt -o f:s:Rkqh --long fixes:,security:,recursive,keep,quiet,help \
-n "$program" -- "$@")
......
......@@ -45,7 +45,7 @@ do_add () {
local f= old=
for f; do
[ -n "$only_clean_git" ] \
&& [ -n "$(git diff --name-only "${f%/*}")" ] \
&& [ -n "$($ABUILD_GIT diff --name-only "${f%/*}")" ] \
&& continue
old=$(show_plain "$f")
case $old in
......@@ -107,7 +107,7 @@ while true; do
-z|--zero) setto=0; cmd=do_set;;
-a|--add) cmd=do_add;;
-g|--clean-git) # verify that we're in a git tree
git rev-parse 2>/dev/null || die "not in a git tree"
$ABUILD_GIT rev-parse 2>/dev/null || die "not in a git tree"
cmd=do_add
only_clean_git=1;;
-s|--set) setto=$2; shift; cmd=do_set;;
......
......@@ -65,7 +65,7 @@ hostspec_to_libc() {
readconfig() {
local _APORTSDIR _BUILDDIR _PKGDEST _SRCPKGDEST _REPODEST _SRCDEST
local _CARCH _CHOST _CTARGET _CPPFLAGS _CFLAGS _CXXFLAGS _LDFLAGS
local _JOBS _MAKEFLAGS _PACKAGER _USE_COLORS
local _JOBS _MAKEFLAGS _PACKAGER _USE_COLORS _ABUILD_GIT
local gitbase=
[ -n "${APORTSDIR+x}" ] && _APORTSDIR=$APORTSDIR
[ -n "${BUILDDIR+x}" ] && _BUILDDIR=$BUILDDIR
......@@ -84,20 +84,25 @@ readconfig() {
[ -n "${MAKEFLAGS+x}" ] && _MAKEFLAGS=$MAKEFLAGS
[ -n "${PACKAGER+x}" ] && _PACKAGER=$PACKAGER
[ -n "${USE_COLORS+x}" ] && _USE_COLORS="$USE_COLORS"
[ -n "${ABUILD_GIT+x}" ] && _ABUILD_GIT=$ABUILD_GIT
: ${ABUILD_CONF:=$sysconfdir/abuild.conf}
: ${ABUILD_USERDIR:=$HOME/.abuild}
: ${ABUILD_USERCONF:=$ABUILD_USERDIR/abuild.conf}
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
[ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF"
ABUILD_GIT=${_ABUILD_GIT-$ABUILD_GIT}
if [ -z "$ABUILD_GIT" ]; then
ABUILD_GIT=$(command -v git) || ABUILD_GIT=true
fi
APORTSDIR=${_APORTSDIR-$APORTSDIR}
gitbase=$(git rev-parse --show-toplevel 2>/dev/null) || true # already is -P
gitbase=$($ABUILD_GIT rev-parse --show-toplevel 2>/dev/null) || true # already is -P
if [ -d "$APORTSDIR" ]; then
APORTSDIR=$(cd "$APORTSDIR"; pwd -P)
elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then
APORTSDIR=$(cd "$HOME/aports"; pwd -P)
else
if [ -n "$gitbase" ]; then
case $(git config remote.origin.url) in
case $($ABUILD_GIT config remote.origin.url) in
*/aports) APORTSDIR=$gitbase ;;
*) APORTSDIR= ;;
esac
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment