1 # vim: set ts=4 sw=4 et:
3 # This hook executes the following tasks:
4 # - Warns if the main package is in subpackages=
5 # - Warns if a subpackage is unreachable (never appears in subpackages=)
10 # Run this only against the main package
11 if [ "$pkgname" != "$sourcepkg" ]; then
15 if [ -z "$subpackages" ]; then
19 subpkgs
=$
(get_subpkgs
)
21 # Sort the strings so they can be compare for equality
22 subpkgs
="$(printf '%s\n' $subpkgs | sort)"
23 subpackages
="$(printf '%s\n' $subpackages | sort)"
25 if [ "$subpackages" = "$subpkgs" ]; then
29 # sed supports comment but let's put them here
30 # 1: print everything between pairs of <""> in subpackages[+]?="..."
31 # 2: multiline subpackages="...\n..."
32 # 2.1: For any line in the middle, i.e. no <"> exists, print it
33 # 2.2: For the first line, print everything after <">
34 # 2.3: For last line, print everything before <">
35 matches
="$(sed -n -e 's/subpackages.*"\
(.
*\
)"[^"]*$
/\
1/p
' \
36 -e '/subpackages
[^
"]*"[^
"]*$/,/"/{
40 }' $XBPS_SRCPKGDIR/$pkgname/template |
46 *) msg_warn
"${s}_package() defined but will never be built.\n" ;;
52 msg_warn
"$pkgname is sourcepkg but is in subpackages=.\n" ;;