Commit d87b10b9 authored by Natanael Copa's avatar Natanael Copa

abuild: implement getpkgver, default_fetch and default_unpack

to make life easier for volatile packages
parent 78ca93d2
......@@ -178,7 +178,7 @@ is_remote() {
return 1
}
fetch() {
default_fetch() {
local s
mkdir -p "$srcdir"
for s in $source; do
......@@ -191,8 +191,12 @@ fetch() {
done
}
fetch() {
default_fetch
}
# unpack the sources
unpack() {
default_unpack() {
local u
md5check || return 1
mkdir -p "$srcdir"
......@@ -216,6 +220,10 @@ unpack() {
done
}
unpack() {
default_unpack
}
# cleanup source and package dir
clean() {
msg "Cleaning temporary build dirs..."
......@@ -236,6 +244,7 @@ cleancache() {
cleanpkg() {
local i
getpkgver || return 1
msg "Cleaning built packages..."
for i in $pkgname $subpackages; do
local p="${i%:*}-$pkgver-r$pkgrel"
......@@ -248,6 +257,7 @@ cleanpkg() {
# clean all packages except current
cleanoldpkg() {
local i j
getpkgver || return 1
msg "Cleaning all packages except $pkgver-r$pkgrel..."
for i in $pkgname $subpackages; do
for j in "$PKGDEST"/${i%:*}-[0-9]*.apk; do
......@@ -282,6 +292,14 @@ runpart() {
}
# override those in your build script
getpkgver() {
# this func is supposed to be overridden by volatile packages
if [ "$pkgver" = "volatile" ]; then
error "Please provide a getpkgver() function in your APKBUILD"
return 1
fi
}
prepare() {
:
}
......@@ -315,6 +333,7 @@ prepare_subpackages() {
}
prepare_metafiles() {
getpkgver || return 1
local name=${subpkgname:-$pkgname}
[ -z "${name##* *}" ] && die "package name contains spaces"
local dir=${subpkgdir:-$pkgdir}
......@@ -411,8 +430,7 @@ prepare_tracedeps() {
prepare_package() {
msg "Preparing ${subpkgname:+sub}package ${subpkgname:-$pkgname}..."
stripbin
prepare_metafiles
prepare_tracedeps
prepare_metafiles && prepare_tracedeps
}
pkginfo_val() {
......@@ -465,6 +483,7 @@ trace_apk_deps() {
create_apks() {
local file
getpkgver || return 1
for file in "$pkgbasedir"/.control.*/.PKGINFO; do
local dir="${file%/.PKGINFO}"
local name=$(pkginfo_val pkgname $file)
......@@ -635,6 +654,7 @@ rootpkg() {
}
srcpkg() {
getpkgver || return 1
local p="$pkgname-$pkgver-$pkgrel"
local prefix="${startdir##*/}"
local i files="$prefix/APKBUILD"
......@@ -648,6 +668,7 @@ srcpkg() {
# check if package is up to date
apk_up2date() {
getpkgver || return 1
local pkg="$PKGDEST/$pkgname-$pkgver-r$pkgrel.apk"
local i s
cd "$startdir"
......@@ -672,6 +693,7 @@ apk_up2date() {
cache_up2date() {
local i apk
getpkgver || return 1
for i in $pkgname $subpackages; do
apk="${i%:*}-$pkgver-r$pkgrel.apk"
[ "$apkcache"/APKINDEX.tar.gz -nt "$apkcache"/$apk ] || return 1
......@@ -842,6 +864,7 @@ stripbin() {
# simply list target apks
listpkg() {
local i
getpkgver || return 1
for i in $pkgname $subpackages; do
echo "${i%:*}-$pkgver-r$pkgrel.apk"
done
......@@ -909,6 +932,7 @@ install_has() {
# install package after build
post_add() {
getpkgver || return 1
local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk"
local deps i
if ! subpackages_has $1 && [ "$1" != "$pkgname" ]; then
......
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