diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2008-11-07 20:54:09 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2008-11-07 20:54:09 +0000 |
commit | 237528a2d009394a2075373ae5acd2db9deeae27 (patch) | |
tree | a0ca70d6115491745904774bca90327c20feec5d | |
parent | 56741bede26dd2954309219dea0325b504b99012 (diff) | |
download | abuild-237528a2d009394a2075373ae5acd2db9deeae27.tar.gz abuild-237528a2d009394a2075373ae5acd2db9deeae27.tar.bz2 abuild-237528a2d009394a2075373ae5acd2db9deeae27.tar.xz abuild-237528a2d009394a2075373ae5acd2db9deeae27.zip |
implement recursive build and install
note that the package release now include -r again.
-rwxr-xr-x | abuild | 56 |
1 files changed, 39 insertions, 17 deletions
@@ -23,8 +23,7 @@ pkgrel=0 SRCDEST=${SRCDEST:-$startdir} PKGDEST=${PKGDEST:-$startdir} -default_cmds="sanitycheck makedepcheck clean fetch md5check unpack rootpkg" -all_cmds="checksum fetch unpack rootpkg build package cleancache clean srcpkg" +default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg" # functions msg() { @@ -66,18 +65,6 @@ sanitycheck() { return 0 } -# check if we have needed packages to build this thing -makedepcheck() { - local i - local missing= - for i in $makedepends; do - apk_info -e $i || missing="$missing $i" - done - [ -z "$missing" ] && return 0 - warning "Missing makedepends: $missing" - return 1 -} - md5check() { if [ -z "$source" ]; then return 0 @@ -203,7 +190,7 @@ package_apk() { local name=${subpkgname:-$pkgname} [ -z "${name##* *}" ] && die "package name contains spaces" local dir=${subpkgdir:-$pkgdir} - local pkg="$name-$pkgver-$pkgrel.apk" + local pkg="$name-$pkgver-r$pkgrel.apk" [ ! -d "$dir" ] && die "Missing $dir" cd "$dir" @@ -218,7 +205,7 @@ package_apk() { echo "# $(date -u)" >> .PKGINFO cat >> .PKGINFO <<EOF pkgname = $name -pkgver = $pkgver-$pkgrel +pkgver = $pkgver-r$pkgrel pkgdesc = $pkgdesc url = $url builddate = $builddate @@ -342,12 +329,46 @@ up2date() { return 0 } +# note: this must run in a subshell +find_aport() { + local i + cd ../.. + for i in */*/APKBUILD; do + . $i + local j + for j in $pkgname $subpackages; do + if [ "${j%%:*}" = "$1" ]; then + echo "$PWD/${i%/APKBUILD}/$1-$pkgver-r$pkgrel.apk" + return 0 + fi + done + done + return 1 +} + +# recursively build and install dependencies +builddeps() { + local dep pkg + for dep in $depends $makedepends; do + apk_info -e $dep && continue + [ -z "$recursive" ] && die "Missing dependency $dep. Use -r to build recursively" + # sudo apk_add $dep && continue + pkg=$(find_aport $dep) || die "failed to find dependency $dep" + # recursively build deps + msg "entering ${pkg%/*}" + cd ${pkg%/*} + $0 -r || return 1 + sudo apk_add $pkg + done +} + usage() { echo "$(basename $0) $myver" echo "usage: $0 [options] [cmd] ..." echo "Options:" echo " -h Show this help" echo " -f Force specified cmd, even if they are already done" + echo " -r Recursively build and install dependencies (using sudo)" echo " -q Quiet" echo "" echo "Commands:" @@ -379,11 +400,12 @@ checksum() { APKBUILD="${APKBUILD:-./APKBUILD}" -while getopts "hfq" opt; do +while getopts "hfqr" opt; do case $opt in 'h') usage;; 'f') force=1;; 'q') quiet=1;; + 'r') recursive=1;; esac done shift $(( $OPTIND - 1 )) |