Commit 5fd0c10e authored by Natanael Copa's avatar Natanael Copa

abuild: implement new format for triggers variable

it contains a list with all triggers for all subpackages.

separate trigger script from path list with '='
separate paths in path list with ':'

example:

pkgname="foo"
subpackages="foo-libs foo-dev"
triggers="foo.trigger=/usr:/usr/lib/foo
	foo-libs.trigger=/usr:/usr/share/foo"
parent f597a6e6
...@@ -128,14 +128,22 @@ sanitycheck() { ...@@ -128,14 +128,22 @@ sanitycheck() {
*) die "$i: unknown install script suffix" *) die "$i: unknown install script suffix"
esac esac
if ! subpackages_has "$n" && [ "$n" != "$pkgname" ]; then if ! subpackages_has "$n" && [ "$n" != "$pkgname" ]; then
die "$i: install script does not match pkgname or any subpackages" die "$i: install script does not match pkgname or any subpackage"
fi fi
[ -e "$startdir/$i" ] || die "install script $startdir/$i is missing" [ -e "$startdir/$i" ] || die "install script $i is missing"
done done
[ -n "${triggers%%:*}" ] && [ ! -e "$startdir"/${triggers%%:*} ] \ for i in $triggers; do
&& die "trigger script $startdir/${triggers%%:*} is missing" local f=${i%=*}
local p=${f%.trigger}
[ "$f" = "$i" ] && die "$f: triggers must contain '='"
[ "$p" = "$f" ] && die "$f: triggers scripts must have .trigger suffix"
if ! subpackages_has "$p" && [ "$p" != "$pkgname" ]; then
die "$p: trigger script does not match pkgname or any subpackage"
fi
[ -e "$startdir"/$f ] || die "trigger script $f is missing"
done
if [ -n "$source" ]; then if [ -n "$source" ]; then
for i in $source; do for i in $source; do
if install_has "$i"; then if install_has "$i"; then
...@@ -543,8 +551,9 @@ EOF ...@@ -543,8 +551,9 @@ EOF
local i deps local i deps
deps="$depends" deps="$depends"
if [ "$pkgname" != "busybox" ] && ! depends_has busbox; then if [ "$pkgname" != "busybox" ] && ! depends_has busbox; then
for i in $install ${triggers%%:*}; do for i in $install $triggers; do
if head -n 1 "$startdir/$i" | grep '^#!/bin/sh' >/dev/null ; then local s=${i%=*}
if head -n 1 "$startdir/$s" | grep '^#!/bin/sh' >/dev/null ; then
msg "Script found. busybox added as a dependency for $pkg" msg "Script found. busybox added as a dependency for $pkg"
deps="$deps busybox" deps="$deps busybox"
break break
...@@ -577,22 +586,26 @@ EOF ...@@ -577,22 +586,26 @@ EOF
for i in $provides; do for i in $provides; do
echo "provides = $i" >> "$pkginfo" echo "provides = $i" >> "$pkginfo"
done done
if [ -n "$triggers" ]; then for i in $triggers; do
echo "triggers = ${triggers#*:}" >> "$pkginfo" local f=${i%=*}
fi local dirs=${i#*=}
[ "${f%.trigger}" != "$name" ] && continue
echo "triggers = ${dirs//:/ }" >> "$pkginfo"
done
if [ -n "$install_if" ]; then if [ -n "$install_if" ]; then
echo "install_if = $(echo $install_if)" >> "$pkginfo" echo "install_if = $(echo $install_if)" >> "$pkginfo"
fi fi
local metafiles=".PKGINFO" local metafiles=".PKGINFO"
for i in $install ${triggers%%:*}; do for i in $install $triggers; do
local n=${i%.*} local f=${i%=*}
local n=${f%.*}
if [ "$n" != "$pkgname" ]; then if [ "$n" != "$pkgname" ]; then
continue continue
fi fi
script=${i#$name} script=${f#$name}
msg "Adding $script" msg "Adding $script"
cp "$startdir/$i" "$controldir/$script" || return 1 cp "$startdir/$f" "$controldir/$script" || return 1
chmod +x "$controldir/$script" chmod +x "$controldir/$script"
metafiles="$metafiles $script" metafiles="$metafiles $script"
done done
...@@ -846,7 +859,6 @@ update_abuildrepo() { ...@@ -846,7 +859,6 @@ update_abuildrepo() {
# predefined splitfunc doc # predefined splitfunc doc
default_doc() { default_doc() {
depends="$depends_doc" depends="$depends_doc"
triggers="$triggers_doc"
pkgdesc="$pkgdesc (documentation)" pkgdesc="$pkgdesc (documentation)"
arch=${arch_doc:-"noarch"} arch=${arch_doc:-"noarch"}
...@@ -895,7 +907,6 @@ mod() { ...@@ -895,7 +907,6 @@ mod() {
default_dev() { default_dev() {
local i= j= local i= j=
depends="$pkgname $depends_dev" depends="$pkgname $depends_dev"
triggers="$triggers_dev"
pkgdesc="$pkgdesc (development files)" pkgdesc="$pkgdesc (development files)"
for i in $origsubpackages; do for i in $origsubpackages; do
...@@ -1437,7 +1448,6 @@ fi ...@@ -1437,7 +1448,6 @@ fi
if [ -n "$subpkgname" ]; then if [ -n "$subpkgname" ]; then
origsubpackages="$subpackages" origsubpackages="$subpackages"
subpackages= subpackages=
triggers=
fi fi
pkgdir="$pkgbasedir/$pkgname" pkgdir="$pkgbasedir/$pkgname"
controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname} controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname}
......
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