pkgmeek: clean up the tmp files of a check_manifest() operation

This commit is contained in:
John McQuah 2022-06-02 12:28:39 -04:00
parent f11ecff34b
commit 1c40c4f6fb
1 changed files with 6 additions and 5 deletions

View File

@ -46,7 +46,7 @@ validate_pkgfile || exit $E_PKGFILE
package="${name}#${version}-${release}.pkg.tar.${PKGMK_COMPRESSION_MODE}"
declare -a _local_
for (( s=0; s<${#source[@]}; s++ )); do
if [[ ${source[$s]} =~ ^(http|https|ssh|git)://.*/(.+)\.git ]]; then
if [[ ${source[$s]} =~ ^(http|https|ssh|git)://.*/(.+)\.git$ ]]; then
_local_[$s]="${BASH_REMATCH[2]}"
elif [[ ${source[$s]} =~ ^(http|https|ftp|file)://.*/(.+) ]]; then
_local_[$s]="${BASH_REMATCH[2]}"
@ -76,11 +76,11 @@ here="${_local_[$u]}"; url="${source[$u]}";
# appropriate name in the current directory
[ -e "$here" ] || [ "$src_dir" = "" ] || [ ! -e "$src_dir/$here" ] || ln -sf "$src_dir/$here" ;
[ -e "$here" ] || [ ! -e "$PKGMK_ROOT/$here" ] || ln -sf "$PKGMK_ROOT/$here" . ;
[ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || {
[ -e "$here" ] || [[ $url =~ ^(https|ssh|git)://.*/(.+)\.git$ ]] || {
if "$PKGMK_DOWNLOAD_PROG" -O "$here" "$url"; then
[ "$src_dir" = "" ] || { mv "$here" "$src_dir"/ && ln -sf "$src_dir/$here" . ; };
fi; };
[ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git ]] || \
[ -e "$here" ] || [[ ! $url =~ ^(https|ssh|git)://.*/(.+)\.git$ ]] || \
( "$PKGMK_GIT_COMMAND" clone "$url" "$here" ) ;
# but if not, exit with an informative error message
[ -e "$here" ] || { error "failed to download $here. Check connection and try again.";
@ -182,8 +182,8 @@ if [ "$pkg_utd" = 0 ] || [ "$PKGMK_FORCE" = "yes" ]; then
esac
done
find pkg -type f -path '*/man/man*/*' | grep -v '.gz$' | xargs -r -I{} gzip -9 '{}'
find pkg -xtype l -path '*/man/man*/*' -print0 \
find pkg -type f | grep "/man/man*/" | grep -v '.gz$' | xargs -r -I{} gzip -9 '{}'
find pkg -xtype l | grep "/man/man*/" \
| xargs -x -r -n1 sh -c "ln -sf \"\$(readlink -n '{}')\" '{}'"
[ $UID = 0 ] || fake_uid="--uid 0 --gid 0"
@ -428,6 +428,7 @@ check_manifest() {
else
warning ".$1 not found, creating new."; mv "$FILE" "$TRUTH"
fi
rm -f "$FILE" "${FILE%tmp}orig" "${FILE%tmp}diff"
return $retval
}