summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2020-11-28 21:34:46 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2020-11-28 21:34:46 +0000
commitf7a6def99a3d14dbc0a1b0af407306701fe236e1 (patch)
tree5bf2b577613e3ad81be88fb7aee577434d88be67
parent9f703d3222a6a8d52ac560035fb1a988d2f9bff7 (diff)
parentbea4965bb14fc4d1a44432e107205472a65e74d2 (diff)
downloadabuild-f7a6def99a3d14dbc0a1b0af407306701fe236e1.tar.gz
abuild-f7a6def99a3d14dbc0a1b0af407306701fe236e1.tar.bz2
abuild-f7a6def99a3d14dbc0a1b0af407306701fe236e1.tar.xz
abuild-f7a6def99a3d14dbc0a1b0af407306701fe236e1.zip
Merge branch 'apkfoundry' into 'master'3.4.2
Add interposition fixes for use with APK Foundry See merge request adelie/abuild!5
-rw-r--r--abuild-keygen.in2
-rw-r--r--abuild.in36
-rw-r--r--abump.in7
-rw-r--r--apkgrel.in5
-rw-r--r--buildlab.in12
-rw-r--r--checkapk.in5
-rw-r--r--functions.sh.in11
7 files changed, 46 insertions, 32 deletions
diff --git a/abuild-keygen.in b/abuild-keygen.in
index afdb1ab..42cd3f9 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -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))"
diff --git a/abuild.in b/abuild.in
index 7daa366..6bb087a 100644
--- a/abuild.in
+++ b/abuild.in
@@ -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
@@ -26,6 +25,7 @@ fi
: ${APK:="/sbin/apk"}
: ${ADDUSER:="abuild-adduser"}
: ${ADDGROUP:="abuild-addgroup"}
+: ${ABUILD_FETCH:="abuild-fetch"}
apk_opt_wait="--wait 30"
@@ -336,7 +336,7 @@ uri_fetch() {
local uri="$1"
mkdir -p "$SRCDEST"
msg "Fetching $uri"
- abuild-fetch -d "$SRCDEST" "$uri"
+ $ABUILD_FETCH -d "$SRCDEST" "$uri"
}
is_remote() {
@@ -818,12 +818,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 +1565,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
@@ -2166,7 +2166,7 @@ rootbld() {
fi
[ "$CBUILD" = "$CHOST" ] || die "rootbld: cross-building not supported currently"
- apk info -eq abuild-rootbld || die "rootbld: abuild-rootbld package not installed"
+ $APK info -eq abuild-rootbld || die "rootbld: abuild-rootbld package not installed"
logcmd "chroot building building $repo/$pkgname-$pkgver-r$pkgrel"
@@ -2201,7 +2201,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 +2209,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 +2424,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 +2468,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
@@ -2558,12 +2558,18 @@ fi
APKBUILD=$(readlink -f "$APKBUILD")
startdir="${APKBUILD%/*}"
-srcdir=${srcdir:-"$startdir/src"}
-pkgbasedir=${pkgbasedir:-"$startdir/pkg"}
repo=${startdir%/*}
repo=${repo##*/}
+if [ -n "$ABUILD_TMP" ]; then
+ srcdir="$ABUILD_TMP/$repo/${startdir##*/}/src"
+ pkgbasedir="$ABUILD_TMP/$repo/${startdir##*/}/pkg"
+else
+ srcdir="${ABUILD_SRCDIR:-"$startdir/src"}"
+ pkgbasedir="${ABUILD_PKGBASEDIR:-"$startdir/pkg"}"
+fi
+
SRCDEST=${SRCDEST:-$startdir}
BUILD_ROOT=
diff --git a/abump.in b/abump.in
index ee2df1e..d88d032 100644
--- a/abump.in
+++ b/abump.in
@@ -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,8 @@ cvelist=
fixes=
[ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR"
-git rev-parse 2>/dev/null || die "not in a git tree"
+[ "$ABUILD_GIT" != "true" ] || die "can't locate git command"
+$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" -- "$@")
diff --git a/apkgrel.in b/apkgrel.in
index fd63271..31fe27b 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -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,8 @@ 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" != "true" ] || die "can't locate git command"
+ $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;;
diff --git a/buildlab.in b/buildlab.in
index e8d3d09..1b56ffc 100644
--- a/buildlab.in
+++ b/buildlab.in
@@ -106,8 +106,8 @@ do_chroot_action() {
update_chroot() {
local path="$1"
- apk --root $path --repositories "$path"/etc/apk/repositories update
- apk --root $path --repositories "$path"/etc/apk/repositories upgrade -a
+ $APK --root $path --repositories "$path"/etc/apk/repositories update
+ $APK --root $path --repositories "$path"/etc/apk/repositories upgrade -a
}
prepare_chroot() {
@@ -139,19 +139,19 @@ prepare_chroot() {
msg "Updating package lists..."
- apk --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories update
+ $APK --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories update
msg "Installing alpine-base..."
- apk --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb alpine-base
+ $APK --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb alpine-base
msg "Installing abuild..."
- apk --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb abuild
+ $APK --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb abuild
msg "Installing build-base..."
- apk --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb build-base
+ $APK --arch $buildarch --root $path --repositories "$path"/etc/apk/repositories add --initdb build-base
msg "Adding abuild user..."
diff --git a/checkapk.in b/checkapk.in
index 4f9b27a..01773c9 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -15,6 +15,7 @@ if ! [ -f "$datadir/functions.sh" ]; then
fi
. "$datadir/functions.sh"
+: ${APK_FETCH:="apk"}
usage() {
cat >&2 <<-__EOF__
@@ -67,12 +68,12 @@ for i in $pkgname $subpackages; do
# generate a temp repositories file with only the http(s) repos
grep -E "^https?:" /etc/apk/repositories > $tmpdir/repositories
- oldpkg=$(apk fetch --repositories-file $tmpdir/repositories --simulate 2>&1 | sed 's/^Downloading //')
+ oldpkg=$($APK_FETCH fetch --repositories-file $tmpdir/repositories --simulate 2>&1 | sed 's/^Downloading //')
if [ "${oldpkg}" = "${pkg}" ]; then
die "the built package ($_pkgname) is already in the repo"
fi
- apk fetch --quiet --repositories-file $tmpdir/repositories --stdout $_pkgname \
+ $APK_FETCH fetch --quiet --repositories-file $tmpdir/repositories --stdout $_pkgname \
| tar -ztf - | grep -v '^\.SIGN\.' | sort > filelist-$_pkgname-old \
|| die "failed to download old pkg, maybe run 'apk update'?"
diff --git a/functions.sh.in b/functions.sh.in
index 557f9a8..1295ee2 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -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