Commit 237528a2 authored by Natanael Copa's avatar Natanael Copa

implement recursive build and install

note that the package release now include -r again.
parent 56741bed
......@@ -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 ))
......
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