mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-23 15:33:28 +00:00
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"
This commit is contained in:
parent
f597a6e68c
commit
5fd0c10e8c
42
abuild.in
42
abuild.in
@ -128,14 +128,22 @@ sanitycheck() {
|
||||
*) die "$i: unknown install script suffix"
|
||||
esac
|
||||
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
|
||||
[ -e "$startdir/$i" ] || die "install script $startdir/$i is missing"
|
||||
[ -e "$startdir/$i" ] || die "install script $i is missing"
|
||||
done
|
||||
|
||||
[ -n "${triggers%%:*}" ] && [ ! -e "$startdir"/${triggers%%:*} ] \
|
||||
&& die "trigger script $startdir/${triggers%%:*} is missing"
|
||||
for i in $triggers; do
|
||||
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
|
||||
for i in $source; do
|
||||
if install_has "$i"; then
|
||||
@ -543,8 +551,9 @@ EOF
|
||||
local i deps
|
||||
deps="$depends"
|
||||
if [ "$pkgname" != "busybox" ] && ! depends_has busbox; then
|
||||
for i in $install ${triggers%%:*}; do
|
||||
if head -n 1 "$startdir/$i" | grep '^#!/bin/sh' >/dev/null ; then
|
||||
for i in $install $triggers; do
|
||||
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"
|
||||
deps="$deps busybox"
|
||||
break
|
||||
@ -577,22 +586,26 @@ EOF
|
||||
for i in $provides; do
|
||||
echo "provides = $i" >> "$pkginfo"
|
||||
done
|
||||
if [ -n "$triggers" ]; then
|
||||
echo "triggers = ${triggers#*:}" >> "$pkginfo"
|
||||
fi
|
||||
for i in $triggers; do
|
||||
local f=${i%=*}
|
||||
local dirs=${i#*=}
|
||||
[ "${f%.trigger}" != "$name" ] && continue
|
||||
echo "triggers = ${dirs//:/ }" >> "$pkginfo"
|
||||
done
|
||||
if [ -n "$install_if" ]; then
|
||||
echo "install_if = $(echo $install_if)" >> "$pkginfo"
|
||||
fi
|
||||
|
||||
local metafiles=".PKGINFO"
|
||||
for i in $install ${triggers%%:*}; do
|
||||
local n=${i%.*}
|
||||
for i in $install $triggers; do
|
||||
local f=${i%=*}
|
||||
local n=${f%.*}
|
||||
if [ "$n" != "$pkgname" ]; then
|
||||
continue
|
||||
fi
|
||||
script=${i#$name}
|
||||
script=${f#$name}
|
||||
msg "Adding $script"
|
||||
cp "$startdir/$i" "$controldir/$script" || return 1
|
||||
cp "$startdir/$f" "$controldir/$script" || return 1
|
||||
chmod +x "$controldir/$script"
|
||||
metafiles="$metafiles $script"
|
||||
done
|
||||
@ -846,7 +859,6 @@ update_abuildrepo() {
|
||||
# predefined splitfunc doc
|
||||
default_doc() {
|
||||
depends="$depends_doc"
|
||||
triggers="$triggers_doc"
|
||||
pkgdesc="$pkgdesc (documentation)"
|
||||
arch=${arch_doc:-"noarch"}
|
||||
|
||||
@ -895,7 +907,6 @@ mod() {
|
||||
default_dev() {
|
||||
local i= j=
|
||||
depends="$pkgname $depends_dev"
|
||||
triggers="$triggers_dev"
|
||||
pkgdesc="$pkgdesc (development files)"
|
||||
|
||||
for i in $origsubpackages; do
|
||||
@ -1437,7 +1448,6 @@ fi
|
||||
if [ -n "$subpkgname" ]; then
|
||||
origsubpackages="$subpackages"
|
||||
subpackages=
|
||||
triggers=
|
||||
fi
|
||||
pkgdir="$pkgbasedir/$pkgname"
|
||||
controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname}
|
||||
|
Loading…
Reference in New Issue
Block a user