do-extract: don't add layer for Macintosh and php metadata

Some softwares insisted on have some manifest in top-level directory,
like package.xml for php packages. Some other packages was zipped on
macOS, which will insert some macOS metadata files into zoom.

See-also: dc73556cf3 and its parents.
See-also: 94fe74e506

Those files doesn't justify the need of adding a layer automatically
in extraction step.

Let's move them up.
This commit is contained in:
Đoàn Trần Công Danh 2022-11-09 18:54:00 +07:00 committed by Đoàn Trần Công Danh
parent c57c2b8a90
commit 9371fe8339
1 changed files with 20 additions and 0 deletions

View File

@ -178,6 +178,26 @@ hook() {
esac
fi
done
# Special case for num_dirs = 2, and it contains metadata
if [ "$num_dirs" != 2 ] || [ "$create_wrksrc" ]; then
:
elif grep -q 'xmlns="http://pear[.]php[.]net/dtd/package' package.xml 2>/dev/null
then
# PHP modules' metadata
rm -f package.xml
for f in */; do innerdir="$f"; done
num_dirs=1
else
for f in *; do
# AppleDouble encoded Macintosh file
if [ -e "$f" ] && [ -e "._$f" ]; then
rm -f "._$f"
num_dirs=1
innerdir="$f"
break
fi
done
fi
rm -rf "$wrksrc"
innerdir="$extractdir/$innerdir"
cd "$XBPS_BUILDDIR"