Page MenuHomeFreeBSD

packages: Make create-sets.sh more robust
ClosedPublic

Authored by ivy on Tue, Apr 28, 1:40 AM.
Tags
None
Referenced Files
F156918409: D56676.id.diff
Sun, May 17, 8:43 AM
Unknown Object (File)
Sat, May 16, 12:29 PM
Unknown Object (File)
Fri, May 15, 6:10 AM
Unknown Object (File)
Fri, May 15, 3:40 AM
Unknown Object (File)
Thu, May 14, 3:45 PM
Unknown Object (File)
Thu, May 14, 7:31 AM
Unknown Object (File)
Thu, May 14, 4:43 AM
Unknown Object (File)
Thu, May 14, 3:40 AM
Subscribers

Details

Summary

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
Sponsored by: https://www.patreon.com/bsdivy

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ivy requested review of this revision.Tue, Apr 28, 1:40 AM
sjg added inline comments.
release/packages/create-sets.sh
29

the quotes are unnecessary fwiw

48–49

again fwiw the outer quotes are not required
is the switch to 2 steps just to aid debugging ? i don't see _tmp used elsewhere

release/packages/create-sets.sh
48–49

the reason is that this does not trigger set -e:

set -- $(nonesuch)

while this does:

_tmp=$(nonesuch)
set -- $_tmp

so we need this to fail properly if $(nonesuch) fails, which in this case it will if $PKG_CMD isn't found for some reason.

This revision is now accepted and ready to land.Tue, Apr 28, 7:30 PM
This revision was automatically updated to reflect the committed changes.