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