abuild: auto add bb to deps when install. added -P option.

-P lets user specify the REPODEST on cmd line
This commit is contained in:
Natanael Copa 2009-02-11 14:07:08 +00:00
parent 78e0ab1faa
commit bcb440d4fe
1 changed files with 19 additions and 11 deletions

30
abuild
View File

@ -30,11 +30,6 @@ default_cmds="sanitycheck builddeps clean fetch unpack rootpkg"
ABUILD_CONF=${ABUILD_CONF:-"/etc/abuild.conf"}
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
# If REPODEST is set then it will override the PKGDEST
if [ -n "$REPODEST" ]; then
PKGDEST="$REPODEST/$repo"
fi
# source functions
datadir=/usr/share/abuild
@ -284,15 +279,20 @@ builddate = $builddate
packager = ${PACKAGER:-"Unknown"}
size = $size
EOF
local i
local i deps
deps="$depends"
if [ -n "$install" ] && head -n 1 "$srcdir/$install" | grep '^#' >/dev/null && ! depends_has busybox ; then
msg "Adding busybox to depends since we have an install script"
deps="$deps busybox"
fi
for i in $license; do
echo "license = $i" >>.PKGINFO
done
for i in $replaces; do
echo "replaces = $i" >>.PKGINFO
done
for i in $depends; do
for i in $deps; do
echo "depend = $i" >>.PKGINFO
done
for i in $conflicts; do
@ -527,7 +527,7 @@ builddeps() {
local pkg=${i%:*}
msg "Entering $dir"
cd "$dir" || return 1
$0 -i $pkg || return 1
$0 -k -i $pkg || return 1
uninstall_after="$pkg $uninstall_after"
done
}
@ -654,7 +654,8 @@ newaport() {
usage() {
echo "$(basename $0) $abuild_ver"
echo "usage: ${0##*/} [options] [-i PKG] [-p PKGDEST] [-s SRCDEST] [cmd] ..."
echo "usage: ${0##*/} [options] [-i PKG] [-P REPODEST] [-p PKGDEST]"
echo " [-s SRCDEST] [cmd] ..."
echo " ${0##*/} [-c] -n PKGNAME[-PKGVER]"
echo "Options:"
echo " -f Force specified cmd, even if they are already done"
@ -662,6 +663,7 @@ usage() {
echo " -i Install PKG after successul build"
echo " -k Keep built packages, even if APKBUILD or sources are newer"
echo " -p Set package destination directory"
echo " -P Set PKGDEST to REPODEST/<repo>, where repo is the parents dir name"
echo " -q Quiet"
echo " -r Install missing dependencies from system repository (using sudo)"
echo " -R Recursively build and install missing dependencies (using sudo)"
@ -694,7 +696,7 @@ usage() {
APKBUILD="${APKBUILD:-./APKBUILD}"
unset force
unset recursive
while getopts "cfhi:kin:p:qrRs:u" opt; do
while getopts "cfhi:kin:p:P:qrRs:u" opt; do
case $opt in
'c') cpinitd=1;;
'f') force=1;;
@ -703,6 +705,7 @@ while getopts "cfhi:kin:p:qrRs:u" opt; do
'k') keep=1;;
'n') newname=$OPTARG;;
'p') PKGDEST=$OPTARG;;
'P') REPODEST=$OPTARG;;
'q') quiet=1;;
'r') install_deps=1;;
'R') recursive=1;;
@ -713,6 +716,11 @@ while getopts "cfhi:kin:p:qrRs:u" opt; do
done
shift $(( $OPTIND - 1 ))
# If REPODEST is set then it will override the PKGDEST
if [ -n "$REPODEST" ]; then
PKGDEST="$REPODEST/$repo"
fi
# source the buildfile
if [ -z "$newname" ]; then
[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)"