diff options
-rwxr-xr-x | abuild | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -27,9 +27,9 @@ default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg" # functions msg() { - local sub= - [ -n "$subpkgname" ] && sub=" ($pkgname)" - [ -z "$quiet" ] && echo ">>> ${subpkgname:-$pkgname}$sub:" "$@" >&2 + local fake="${FAKEROOTKEY:+(fakeroot) }" + local name="${subpkgname:-$pkgname}" + [ -z "$quiet" ] && echo ">>> ${fake}${name}:" "$@" >&2 } warning() { @@ -44,6 +44,7 @@ die() { # check if apkbuild is basicly sane sanitycheck() { + msg "Checking sanity of $APKBUILD..." [ -z "$pkgname" ] && die "Missing pkgname in APKBUILD" [ -z "${pkgname##* *}" ] && die "pkgname contains spaces" [ -z "$pkgver" ] && die "Missing pkgver in APKBUILD" @@ -61,7 +62,6 @@ sanitycheck() { # common spelling errors [ -n "$depend" ] && die "APKBUILD contains 'depend'. It should be depends" [ -n "$makedepend" ] && die "APKBUILD contains 'makedepend'. It should be makedepends" - return 0 } @@ -76,6 +76,7 @@ md5check() { if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then die "Number of md5sums does not correspond to number of sources" fi + msg "Checking md5sums..." cd "$srcdir" && echo "$md5sums" | md5sum -c } @@ -120,8 +121,10 @@ unpack() { local s="$SRCDEST/${u##*/}" # $(basename $s) case "$s" in *.tar.gz|*.tgz) + msg "Unpacking $s..." tar -C "$srcdir" -zxf "$s" || return 1;; *.tar.bz2) + msg "Unpacking $s..." tar -C "$srcdir" -jxf "$s" || return 1;; esac done @@ -129,6 +132,7 @@ unpack() { # cleanup source and package dir clean() { + msg "Cleaning temporary build dirs..." rm -rf "$srcdir" rm -rf "$pkgdir" local i @@ -142,14 +146,16 @@ cleancache() { local s for s in $source; do case "$s" in - http:/*|ftp:/*) - rm -f "$SRCDEST/$(basename $s)";; + http://*|ftp://*) + msg "Cleaning downloaded ${s##*/}..." + rm -f "$SRCDEST/${s##*/}";; esac done } cleanpkg() { local i + msg "Cleaning built packages..." for i in $pkgname $subpackages; do local p="$i-$pkgver-$pkgrel" rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" @@ -158,7 +164,7 @@ cleanpkg() { runpart() { local part=$1 - msg "$part" + [ -n "$DEBUG" ] && msg "$part" $part || die "$part failed" } @@ -185,6 +191,7 @@ subpkg() { for i in $subpackages; do local func=$(get_split_func $i) # call abuild recursively, setting subpkg{dir,name} + msg "Running split function $func..." subpkgdir="$startdir/pkg-$func" subpkgname="$i" \ $0 $func package || return 1 done @@ -195,10 +202,11 @@ package_apk() { [ -z "${name##* *}" ] && die "package name contains spaces" local dir=${subpkgdir:-$pkgdir} local pkg="$name-$pkgver-r$pkgrel.apk" + local sub [ ! -d "$dir" ] && die "Missing $dir" cd "$dir" - msg "Creating $pkg" + msg "Creating ${subpkgname:+sub}package $pkg..." local builddate=$(date -u "+%s") local size=$(du -sk | awk '{print $1 * 1024}') @@ -304,6 +312,7 @@ dev() { # build and package in fakeroot rootpkg() { cd "$startdir" + msg "Entering fakeroot..." fakeroot $0 build subpkg package } @@ -315,6 +324,7 @@ srcpkg() { files="$files $prefix/${i##*/}" done mkdir -p "$PKGDEST" + msg "Creating source package $p.src.tar.gz..." (cd .. && tar -zcf "$PKGDEST/$p.src.tar.gz" $files) } @@ -336,6 +346,7 @@ up2date() { # note: this must run in a subshell find_aport() { local i + msg "Searching for $1 in aports tree..." cd ../.. for i in */*/APKBUILD; do . $i @@ -359,7 +370,7 @@ builddeps() { # sudo apk_add $dep && continue pkg=$(find_aport $dep) || die "failed to find dependency $dep" # recursively build deps - msg "entering ${pkg%/*}" + msg "Entering ${pkg%/*}" cd ${pkg%/*} $0 -r || return 1 sudo apk_add $pkg @@ -395,6 +406,7 @@ usage() { checksum() { local s files + fetch for s in $source; do files="$files ${s##*/}" done |