Commit df8e468f authored by Natanael Copa's avatar Natanael Copa

abuild: implement triggers

and install scripts should not be in $source
parent 8e52bdff
......@@ -102,8 +102,19 @@ sanitycheck() {
[ -z "$url" ] && die "Missing url in APKBUILD"
[ -z "$license" ] && die "Missing license in APKBULID"
for i in $install; do
[ -e "$startdir/$i" ] || die "install script $startdir/$i is missing"
done
[ -n "${triggers%%:*}" ] && [ ! -e "$startdir"/${triggers%%:*} ] \
&& die "trigger script $startdir/${triggers%%:*} is missing"
if [ -n "$source" ]; then
for i in $source; do
if install_has "$i"; then
warning "You should not have \$install in source"
continue
fi
md5sums_has ${i##*/} || die "${i##*/} is missing in md5sums"
case "$i" in
https://*) makedepends_has wget || die "wget must be in makedepends when source has https://" ;;
......@@ -113,7 +124,7 @@ sanitycheck() {
if [ -n "$md5sums" ]; then
for i in $(echo "$md5sums" | awk '{ print $2 }'); do
source_has $i || die "$i is missing in source"
source_has $i || die "$i exists in md5sums but is missing in source"
done
fi
......@@ -320,8 +331,8 @@ EOF
local i deps
deps="$depends"
if [ "$pkgname" != "busybox" ] && ! depends_has busbox; then
for i in $install; do
if head -n 1 "$srcdir/$i" | grep '^#!/bin/sh' >/dev/null ; then
for i in $install ${triggers%%:*}; do
if head -n 1 "$startdir/$i" | grep '^#!/bin/sh' >/dev/null ; then
msg "Script found. busybox added as a dependency for $pkg"
deps="$deps busybox"
break
......@@ -347,19 +358,22 @@ EOF
for i in $backup; do
echo "backup = $i" >> "$pkginfo"
done
if [ -n "$triggers" ]; then
echo "triggers = ${triggers#*:}" >> "$pkginfo"
fi
local metafiles=".PKGINFO"
for i in $install; do
for i in $install ${triggers%%:*}; do
script=${i#$name}
case "$script" in
.pre-install|.post-install|.pre-upgrade|.post-upgrade|.pre-deinstall|.post-deinstall)
.pre-install|.post-install|.pre-upgrade|.post-upgrade|.pre-deinstall|.post-deinstall|.trigger)
msg "Adding $script"
;;
*) error "$script: Invalid install script"
*) error "$script: Invalid install/trigger script"
return 1
;;
esac
cp "$srcdir/$i" "$controldir/$script" || return 1
cp "$startdir/$i" "$controldir/$script" || return 1
chmod +x "$controldir/$script"
metafiles="$metafiles $script"
done
......@@ -510,6 +524,7 @@ apkcache() {
default_doc() {
depends="$depends_doc"
install="$install_doc"
triggers="$triggers_doc"
local i
for i in doc man info html sgml licenses gtk-doc; do
if [ -d "$pkgdir/usr/share/$i" ]; then
......@@ -556,6 +571,7 @@ mod() {
default_dev() {
depends="$pkgname $depends_dev"
install="$install_dev"
triggers="$triggers_dev"
cd "$pkgdir" || return 0
for i in usr/include usr/lib/pkgconfig usr/share/aclocal\
usr/share/gettext usr/bin/*-config \
......@@ -855,6 +871,10 @@ md5sums_has() {
list_has "$1" $md5sums
}
install_has() {
list_has "$1" $install
}
# install package after build
post_add() {
local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk"
......
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