packages: Make create-sets.sh more robust
Use ${PKG_CMD} rather than bare 'pkg' to fix the build when pkg is
not in the tools path. Provide a default in case it's not set for
some reason (e.g., running the script by hand).
Since set -- $(...) does not trigger an exit from set -e if the
command fails, this failure was silent and resulted in sets not
being built correctly if we failed to run pkg. Use a temporary
variable, which does trigger set -e, to fail correctly.
MFC after: 2 weeks
Reviewed by: sjg
Sponsored by: https://www.patreon.com/bsdivy
Differential Revision: https://reviews.freebsd.org/D56676
This commit is contained in:
@@ -26,6 +26,8 @@ if [ $# -lt 3 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
: ${PKG_CMD:="pkg"}
|
||||||
|
|
||||||
srcdir="$1"; shift
|
srcdir="$1"; shift
|
||||||
wstagedir="$1"; shift
|
wstagedir="$1"; shift
|
||||||
repodir="$1"; shift
|
repodir="$1"; shift
|
||||||
@@ -43,7 +45,8 @@ for pkg in "$repodir"/*.pkg; do
|
|||||||
# packages.
|
# packages.
|
||||||
{ echo "$pkg" | grep -q '-'; } || continue
|
{ echo "$pkg" | grep -q '-'; } || continue
|
||||||
|
|
||||||
set -- $(pkg query -F "$pkg" '%At %n %Av' | grep '^set ')
|
_tmp="$(${PKG_CMD} query -F "$pkg" '%At %n %Av' | grep '^set ')"
|
||||||
|
set -- $_tmp
|
||||||
pkgname="$2"
|
pkgname="$2"
|
||||||
sets="$(echo "$3" | tr , ' ')"
|
sets="$(echo "$3" | tr , ' ')"
|
||||||
for set in $sets; do
|
for set in $sets; do
|
||||||
|
|||||||
Reference in New Issue
Block a user