pkgmeek: refactor how the --no-strip option is handled

pkgmeek: refactor how the --no-strip option is handled
This commit is contained in:
John McQuah 2023-02-17 13:07:46 -05:00
parent f2ccd4184a
commit 8836cc870a

View File

@ -155,7 +155,8 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then
|| { error "Unsuccessful build!"; cleanup_work; exit "$E_BUILD"; }
# Strip binaries
[ -f "$PKGMK_ROOT/.nostrip" ] && ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip"
[ -n "$ns_filter" ] || [ ! -f "$PKGMK_ROOT/.nostrip" ] \
|| ns_filter="| grep -v -f $PKGMK_ROOT/.nostrip"
{ while read -r f; do
case $(file -b "$f") in
*ELF*executable*not\ stripped*) strip --strip-all "$f" ;;
@ -254,7 +255,7 @@ parse_options() {
-if|--ignore-footprint) PKGMK_IGNORE_FOOTPRINT="yes" ;;
-in|--ignore-new) PKGMK_IGNORE_NEW="yes" ;;
-is|--ignore-signature) PKGMK_IGNORE_SIG="yes" ;;
-ns|--no-strip) echo ".*" >> "$PKGMK_ROOT/.nostrip" ;;
-ns|--no-strip) ns_filter="-false" ;;
-f|--force) PKGMK_FORCE="yes" ;;
-kw|--keep-work) PKGMK_KEEP_WORK="yes" ;;
-i|--install) PKGMK_INSTALL_COMMAND="/usr/bin/pkgadd" ;;
@ -359,7 +360,7 @@ fetch_url() {
[ -x "$PKGMK_GIT_COMMAND" ] || return 1;
#
giturl="${u#__git__}"
# Did the port maintainer specify a branch other than 'master'?
# Did the port maintainer specify a branch other than 'main'?
tag="${giturl##*\#}"
[ "$tag" = "$giturl" ] || { giturl="${giturl%\#*}";
CLONE_ARGS="-c advice.detachedHead=false --branch $tag"; }
@ -510,12 +511,14 @@ cat_signature() {
}
refresh_signature() {
[ -e ".signature" ] && [ ! -w ".signature" ] || {
error ".signature not writable."; return $E_DIRPERM; }
[ -e ".signature" ] || { error "missing .signature, cannot refresh."; return $E_SIGNATURE; }
[ -w ".signature" ] || { error ".signature not writable."; return $E_DIRPERM; }
local REPO
if [ -z "$PKGMK_PRIVATEKEY" ]; then
REPO=${PWD##*/}; REPO=${REPO%.git};
REPO="$(dirname "$PWD")"
REPO="${REPO##*/}"
REPO="${REPO%.git}"
[ -r "/etc/ports/${REPO}.sec" ] && \
PKGMK_PRIVATEKEY="/etc/ports/${REPO}.sec" || \
{ error "No suitable secret key found. Specify one explicitly with '-sk'."; return $E_SIGNATURE; }
@ -524,11 +527,9 @@ refresh_signature() {
if ! tail -n +3 ".signature" | /usr/bin/signify -S -e -x - -q \
-s "$PKGMK_PRIVATEKEY" -m - > .signature.tmp ; then
rm .signature.tmp
error "Refreshing signature failed"
return $E_SIGNATURE
error "Refreshing signature failed"; return $E_SIGNATURE
else
mv .signature.tmp .signature
info "Signature refreshed."
mv .signature.tmp .signature; info "Signature refreshed."
fi
}