58fa8e3192
Termux doesn't require things like 'sudo', 'chroot', 'adduser/addgroup' for installing or building packages. Furthermore, Termux is single-user environment.
207 lines
5.7 KiB
Diff
207 lines
5.7 KiB
Diff
diff -uNr abuild-3.2.0/abuild.in abuild-3.2.0.mod/abuild.in
|
|
--- abuild-3.2.0/abuild.in 2018-06-22 10:24:10.000000000 +0300
|
|
+++ abuild-3.2.0.mod/abuild.in 2018-11-18 15:51:27.863075393 +0200
|
|
@@ -1,4 +1,4 @@
|
|
-#!/bin/ash -e
|
|
+#!/bin/bash -e
|
|
|
|
# abuild - build apk packages (light version of makepkg)
|
|
# Copyright (c) 2008-2015 Natanael Copa <ncopa@alpinelinux.org>
|
|
@@ -21,11 +21,7 @@
|
|
. "$datadir/functions.sh"
|
|
|
|
# defaults
|
|
-: ${FAKEROOT:="fakeroot"}
|
|
-: ${SUDO_APK:="abuild-apk"}
|
|
: ${APK:="apk"}
|
|
-: ${ADDUSER:="abuild-adduser"}
|
|
-: ${ADDGROUP:="abuild-addgroup"}
|
|
|
|
apk_opt_wait="--wait 30"
|
|
|
|
@@ -544,26 +540,6 @@
|
|
return 0
|
|
}
|
|
|
|
-mkusers() {
|
|
- local i
|
|
- for i in $pkggroups; do
|
|
- if ! getent group $i >/dev/null; then
|
|
- msg "Creating group $i"
|
|
- $ADDGROUP -S $i || return 1
|
|
- fi
|
|
- done
|
|
- for i in $pkgusers; do
|
|
- if ! getent passwd $i >/dev/null; then
|
|
- local gopt=
|
|
- msg "Creating user $i"
|
|
- if getent group $i >/dev/null; then
|
|
- gopt="-G $i"
|
|
- fi
|
|
- $ADDUSER -S -D -H $gopt $i || return 1
|
|
- fi
|
|
- done
|
|
-}
|
|
-
|
|
# helper to update config.sub to a recent version
|
|
update_config_sub() {
|
|
find . -name config.sub | (local changed=false; while read f; do
|
|
@@ -933,7 +909,7 @@
|
|
|
|
echo "# Generated by $(basename $0) $program_version" >"$pkginfo"
|
|
if [ -n "$FAKEROOTKEY" ]; then
|
|
- echo "# using $($FAKEROOT -v)" >> "$pkginfo"
|
|
+ echo "# using $(fakeroot -v)" >> "$pkginfo"
|
|
fi
|
|
echo "# $(date -u)" >> "$pkginfo"
|
|
cat >> "$pkginfo" <<-EOF
|
|
@@ -1502,14 +1478,11 @@
|
|
}
|
|
|
|
build_abuildrepo() {
|
|
- local d apk _build=build _check=check_fakeroot
|
|
+ local d apk _build=build _check=check
|
|
if ! is_function package; then
|
|
# if package() is missing then build is called from rootpkg
|
|
_build=true
|
|
fi
|
|
- if options_has "!checkroot"; then
|
|
- _check=check
|
|
- fi
|
|
if ! want_check; then
|
|
_check=true
|
|
fi
|
|
@@ -1524,7 +1497,6 @@
|
|
fetch
|
|
unpack
|
|
prepare
|
|
- mkusers
|
|
$_build
|
|
$_check
|
|
rootpkg
|
|
@@ -1747,33 +1719,17 @@
|
|
type "$1" 2>&1 | head -n 1 | egrep -q "is a (shell )?function"
|
|
}
|
|
|
|
-do_fakeroot() {
|
|
- if [ -n "$FAKEROOT" ]; then
|
|
- $FAKEROOT -- "$@"
|
|
- else
|
|
- "$@"
|
|
- fi
|
|
-}
|
|
-
|
|
-# wrap check() with fakeroot
|
|
-check_fakeroot() {
|
|
- cd "$startdir"
|
|
- [ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
|
|
- do_fakeroot "$abuild_path" $color_opt $keep_build check
|
|
-}
|
|
-
|
|
-# build and package in fakeroot
|
|
+# build and package
|
|
rootpkg() {
|
|
local _package=package
|
|
if ! is_function package; then
|
|
- # if package() is missing then run 'build' in fakeroot instead
|
|
+ # if package() is missing then run 'build' instead
|
|
warning "No package() function in APKBUILD"
|
|
_package=build
|
|
fi
|
|
cd "$startdir"
|
|
rm -rf "$pkgdir"
|
|
- [ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
|
|
- do_fakeroot "$abuild_path" $color_opt $keep_build \
|
|
+ "$abuild_path" $color_opt $keep_build \
|
|
$_package \
|
|
prepare_subpackages \
|
|
prepare_language_packs \
|
|
@@ -2096,7 +2052,7 @@
|
|
$install_deps $recursive $upgrade $color_opt \
|
|
abuildindex || return 1
|
|
done
|
|
- $SUDO_APK add --upgrade --repository "$REPODEST/$repo" \
|
|
+ $APK add --upgrade --repository "$REPODEST/$repo" \
|
|
$apk_opt_wait \
|
|
--virtual .makedepends-$pkgname $builddeps \
|
|
|| return 1
|
|
@@ -2125,14 +2081,11 @@
|
|
}
|
|
|
|
rootbld_actions() {
|
|
- local part _build=build _check=check_fakeroot
|
|
+ local part _build=build _check=check
|
|
if ! is_function package; then
|
|
# if package() is missing then build is called from rootpkg
|
|
_build=true
|
|
fi
|
|
- if options_has "!checkroot"; then
|
|
- _check=check
|
|
- fi
|
|
if ! want_check; then
|
|
_check=true
|
|
fi
|
|
@@ -2163,8 +2116,6 @@
|
|
|
|
msg "Preparing build chroot..."
|
|
|
|
- mkusers
|
|
-
|
|
BUILD_ROOT=$(mktemp -d /var/tmp/abuild.XXXXXXXXXX)
|
|
local aportsgit=${APORTSDIR:-${startdir}}
|
|
|
|
@@ -2205,7 +2156,7 @@
|
|
) < "$repo_template" > "$BUILD_ROOT/etc/apk/repositories"
|
|
|
|
calcdeps
|
|
- $SUDO_APK add --initdb --root "$BUILD_ROOT" --update \
|
|
+ $APK add --initdb --root "$BUILD_ROOT" --update \
|
|
abuild alpine-base build-base git $hostdeps $builddeps
|
|
|
|
local bwrap_opts=""
|
|
@@ -2346,22 +2297,22 @@
|
|
|
|
local _quiet="$1"
|
|
[ -z "$_quiet" ] && msg "Installing for build:$builddeps"
|
|
- $SUDO_APK add $_quiet $apk_opt_wait --repository "$REPODEST/$repo" \
|
|
+ $APK add $_quiet $apk_opt_wait --repository "$REPODEST/$repo" \
|
|
--virtual .makedepends-$pkgname \
|
|
$builddeps \
|
|
|| return 1
|
|
if [ -n "$CBUILDROOT" ]; then
|
|
[ -z "$_quiet" ] && msg "Installing for host:$hostdeps"
|
|
- $SUDO_APK add $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" --repository "$REPODEST/$repo" $apk_opt_wait \
|
|
+ $APK add $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" --repository "$REPODEST/$repo" $apk_opt_wait \
|
|
--no-scripts --virtual .makedepends-$pkgname $hostdeps || return 1
|
|
fi
|
|
}
|
|
|
|
undeps() {
|
|
local _quiet="$@"
|
|
- $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname || :
|
|
+ $APK del $_quiet $apk_opt_wait .makedepends-$pkgname || :
|
|
if [ -n "$CBUILDROOT" ]; then
|
|
- $SUDO_APK del $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" $apk_opt_wait \
|
|
+ $APK del $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" $apk_opt_wait \
|
|
--no-scripts .makedepends-$pkgname || :
|
|
fi
|
|
}
|
|
@@ -2481,7 +2432,7 @@
|
|
package Install project into $pkgdir
|
|
prepare Apply patches
|
|
rootbld Build package in clean chroot
|
|
- rootpkg Run 'package', the split functions and create apks as fakeroot
|
|
+ rootpkg Run 'package', the split functions and create apks
|
|
sanitycheck Basic sanity check of APKBUILD
|
|
snapshot Create a \$giturl or \$svnurl snapshot and upload to \$disturl
|
|
sourcecheck Check if remote source package exists upstream
|
|
@@ -2563,7 +2514,7 @@
|
|
if [ -z "$REPODEST" ]; then
|
|
warning "REPODEST is not set and is now required. Defaulting to ~/packages"
|
|
[ -n "$PKGDEST" ] && die "PKGDEST is no longer supported."
|
|
- REPODEST="~/packages"
|
|
+ REPODEST="$HOME/packages"
|
|
fi
|
|
|
|
# for recursive action
|