mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-23 23:42:35 +00:00
abuild: install makedeps from system repo with -r and build with -R
The -r option will only install deps from system repo and fail if any is missing. The -R option will parse the aports tree and try build the missing packages and then install the newly built package.
This commit is contained in:
parent
9cc011ddc7
commit
d95b0a295a
45
abuild
45
abuild
@ -22,6 +22,8 @@ SRCDEST=${SRCDEST:-$startdir}
|
||||
PKGDEST=${PKGDEST:-$startdir}
|
||||
BUILD_BASE="binutils gcc make patch uclibc-dev"
|
||||
|
||||
SUDO=${SUDO:-"sudo"}
|
||||
|
||||
default_cmds="sanitycheck builddeps clean fetch unpack rootpkg"
|
||||
|
||||
# read config
|
||||
@ -57,7 +59,7 @@ set_xterm_title() {
|
||||
cleanup() {
|
||||
set_xterm_title ""
|
||||
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
|
||||
sudo apk del $uninstall_after
|
||||
$SUDO apk del $uninstall_after
|
||||
fi
|
||||
}
|
||||
|
||||
@ -446,12 +448,14 @@ depparse_aports() {
|
||||
}
|
||||
|
||||
deptrace() {
|
||||
local deps="$@"
|
||||
[ -z "$deps" ] && deps="$BUILD_BASE $depends $makedepends"
|
||||
( depparse_aports
|
||||
if [ -z "$upgrade" ]; then
|
||||
# list installed pkgs and prefix with 'i '
|
||||
apk info -q | sort | sed 's/^/i /'
|
||||
fi
|
||||
) | awk -v pkgs="$BUILD_BASE $depends $makedepends" '
|
||||
) | awk -v pkgs="$deps" '
|
||||
|
||||
function depgraph(pkg, a, i) {
|
||||
if (visited[pkg])
|
||||
@ -477,17 +481,28 @@ deptrace() {
|
||||
|
||||
# build and install dependencies
|
||||
builddeps() {
|
||||
local deps alldeps pkg i dir ver
|
||||
local deps alldeps pkg i dir ver missing
|
||||
msg "Building dependencies..."
|
||||
deps="$BUILD_BASE $depends $makedepends"
|
||||
if [ -z "$recursive" ]; then
|
||||
for i in $deps; do
|
||||
apk info -e $i || die "Missing dependency $i. Use -r to build recursively"
|
||||
done
|
||||
for i in $deps; do
|
||||
if ! apk info -e $i; then
|
||||
if [ -z "$install_deps" ] && [ -z "$recursive" ]; then
|
||||
die "Missing dependency $i. Use -r to autoinstall or -R to build"
|
||||
fi
|
||||
missing="$missing $i"
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "$missing" ] && return 0
|
||||
|
||||
if [ -n "$install_deps" ] && $SUDO apk add $missing; then
|
||||
uninstall_after="$missing $uninstall_after"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for i in $(deptrace); do
|
||||
|
||||
[ -z "$recursive" ] && return 1
|
||||
|
||||
for i in $(deptrace $missing); do
|
||||
# i = pkg:dir
|
||||
local dir=${i#*:}
|
||||
local pkg=${i%:*}
|
||||
@ -557,7 +572,7 @@ post_add() {
|
||||
post_add $i || return 1
|
||||
fi
|
||||
done
|
||||
sudo apk add -u "$pkgf" || die "Failed to install $1"
|
||||
$SUDO apk add -u "$pkgf" || die "Failed to install $1"
|
||||
}
|
||||
|
||||
# create new aport from templates
|
||||
@ -602,9 +617,10 @@ usage() {
|
||||
echo " -k Keep built packages, even if APKBUILD or sources are newer"
|
||||
echo " -p Set package destination directory"
|
||||
echo " -q Quiet"
|
||||
echo " -r Recursively build and install missing dependencies (using sudo)"
|
||||
echo " -r Install missing dependencies from system repository (using sudo)"
|
||||
echo " -R Recursively build and install missing dependencies (using sudo)"
|
||||
echo " -s Set source package destination directory"
|
||||
echo " -u Recursively build and upgrade dependencies (using sudo)"
|
||||
echo " -u Recursively build and upgrade all dependencies (using sudo)"
|
||||
echo ""
|
||||
echo " -n Create a new APKBUILD in a directory named PKGNAME"
|
||||
echo " -c Copy a sample init.d, conf.d and install script to new directory"
|
||||
@ -632,7 +648,7 @@ usage() {
|
||||
APKBUILD="${APKBUILD:-./APKBUILD}"
|
||||
unset force
|
||||
unset recursive
|
||||
while getopts "cfhi:kin:p:qrs:u" opt; do
|
||||
while getopts "cfhi:kin:p:qrRs:u" opt; do
|
||||
case $opt in
|
||||
'c') cpinitd=1;;
|
||||
'f') force=1;;
|
||||
@ -642,7 +658,8 @@ while getopts "cfhi:kin:p:qrs:u" opt; do
|
||||
'n') newname=$OPTARG;;
|
||||
'p') PKGDEST=$OPTARG;;
|
||||
'q') quiet=1;;
|
||||
'r') recursive=1;;
|
||||
'r') install_deps=1;;
|
||||
'R') recursive=1;;
|
||||
's') SRCDEST=$OPTARG;;
|
||||
'u') upgrade=1
|
||||
recursive=1;;
|
||||
|
Loading…
Reference in New Issue
Block a user