Commit e4a3c05d authored by Linux User's avatar Linux User

better messages. always run fetch before checksum.

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