diff --git a/scripts/pkgmeek b/scripts/pkgmeek index 345ba11..6aa8c50 100755 --- a/scripts/pkgmeek +++ b/scripts/pkgmeek @@ -88,7 +88,7 @@ done ; } # '-us', '-eo', or '-utd' by proceeding to those steps [ "$PKGMK_DOWNLOAD_ONLY" = "no" ] || [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ] \ || [ "$PKGMK_UPDATE_SIG" = "yes" ] || [ "$PKGMK_EXTRACT_ONLY" = "yes" ] \ - || [ "$PKGMK_MTIME_ONLY" = "yes" ] || exit 0 + || [ "$PKGMK_MTIME_ONLY" = "yes" ] || { cleanup_work; exit 0; } # If '-utd' was requested, check the modification times and then exit. check_pkg_mtime; pkg_utd=$? @@ -116,12 +116,12 @@ if [ "$PKGMK_UPDATE_FOOTPRINT" = "yes" ]; then { error "outdated package. Use '-f' to force the footprint update."; exit "$E_FOOTPRINT"; } cat_footprint > "$PKGMK_ROOT/.footprint" && info "footprint created." \ - || { error "Failed to write the footprint."; exit "$E_DIRPERM"; } + || { error "Failed to write the footprint."; cleanup_work; exit "$E_DIRPERM"; } fi # Updating signatures (option -us) requires only sources and footprint, not a built package. if [ "$PKGMK_UPDATE_SIG" = "yes" ]; then cat_signature > "$PKGMK_ROOT/.signature" && info "Signature successfully created." \ - || { info "Could not create signature."; exit "$E_DIRPERM"; } + || { info "Could not create signature."; cleanup_work; exit "$E_DIRPERM"; } fi # Exit after fulfilling any *explicit* requests for (signed) manifests @@ -132,8 +132,10 @@ readonly cs_fail_msg="Use '--ignore-signature' to override, if you have determin [ "$PKGMK_IGNORE_SIG" = "yes" ] || { check_signature "pre-build" | parse_signify_output; case $? in 0) info "Sources successfully authenticated." ;; - 1) error "Signature file missing or corrupted." ; echo "$cs_fail_msg" ; exit $E_SIGNATURE ;; - 2) error "Failed to authenticate remote sources using signify." ; echo "$cs_fail_msg" ; exit $E_SIGNATURE ;; + 1) error "Signature file missing or corrupted." + echo "$cs_fail_msg" ; cleanup_work; exit $E_SIGNATURE ;; + 2) error "Failed to authenticate remote sources using signify." + echo "$cs_fail_msg" ; cleanup_work; exit $E_SIGNATURE ;; esac; } [ "$PKGMK_CHECK_SIG" = "no" ] || { cleanup_work; exit 0; } # no need to continue if the user only requested -cs @@ -149,7 +151,7 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then done [ $errUZ = 0 ] && info "Sources successfully unpacked." || \ - { error "Failed to unpack all sources."; exit "$E_UNPACK"; } + { error "Failed to unpack all sources."; cleanup_work; exit "$E_UNPACK"; } [ "$PKGMK_EXTRACT_ONLY" = "no" ] || exit 0 # The actual build step! (use fakeroot when building daemon ports as an ordinary user, @@ -365,7 +367,7 @@ fetch_url() { giturl="${u#__git__}" # Did the port maintainer specify a branch other than 'master'? tag="${giturl##*\#}" - [ -z "$tag" ] || { giturl="${giturl%\#*}"; + [ "$tag" = "$giturl" ] || { giturl="${giturl%\#*}"; CLONE_ARGS="-c advice.detachedHead=false --branch $tag"; } # # Has this project been downloaded before?