From c57c2b8a90976c8570469b1e2569d117677a4c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 5 Jan 2023 09:13:55 +0700 Subject: [PATCH] do-extract: change cwd to $extractdir to check number of files In order to simplify the next change, to simplify the processing steps for PHP and/or Macintosh metadata. --- common/hooks/do-extract/00-distfiles.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh index 14503de3ed7..22fcb2eec24 100644 --- a/common/hooks/do-extract/00-distfiles.sh +++ b/common/hooks/do-extract/00-distfiles.sh @@ -163,13 +163,14 @@ hook() { esac done + cd "$extractdir" # find "$extractdir" -mindepth 1 -maxdepth 1 -printf '1\n' | wc -l # However, it requires GNU's find num_dirs=0 - for f in "$extractdir"/* "$extractdir"/.*; do + for f in * .*; do if [ -e "$f" ] || [ -L "$f" ]; then case "$f" in - */. | */..) ;; + . | ..) ;; *) innerdir="$f" num_dirs=$(( num_dirs + 1 )) @@ -178,6 +179,8 @@ hook() { fi done rm -rf "$wrksrc" + innerdir="$extractdir/$innerdir" + cd "$XBPS_BUILDDIR" if [ "$num_dirs" = 1 ] && [ -d "$innerdir" ] && [ -z "$create_wrksrc" ]; then # rename the subdirectory (top-level of distfiles) to $wrksrc mv "$innerdir" "$wrksrc" &&