чување c9b0856da582abb63725f850064c791266cd63b1
родитељ d569ccf6f1e683da1d0e941345155a9056621b17
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Fri, 19 Aug 2022 19:48:23 +0200
Add SRCCRDIRS; add various archive handling
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 1, додавања: 36(+), брисања: 6(-)
diff --git a/lib/package.mk b/lib/package.mk
@@ -23,6 +23,8 @@ package-fetch:QV:
cd "$SRCBASEDIR"
sums=$SHA512SUMS
dirs=$SRCDIRS
+ todirs=$SRCTODIRS
+ crdirs=$SRCCRDIRS
for srctarball in $SRCTARBALLS; do
currentsum=${sums%% *}
sums=${sums#* }
@@ -30,8 +32,10 @@ package-fetch:QV:
dirs=${dirs#* }
currenttodir=${todirs%% *}
todirs=${todirs#* }
+ currentcrdir=${crdirs%% *}
+ crdirs=${crdirs#* }
tbfile="${srctarball##*/}"
- if [ -n "$currenttodir"] && [ -d "$SRCPKGDIR/$currenttodir" ]
+ if [ -n "$currenttodir" ] && [ -d "$SRCPKGDIR/$currenttodir" ]
then
continue
elif [ -n "$currentdir" ] && [ -d "$SRCPKGDIR/$currentdir" ]
@@ -40,7 +44,7 @@ package-fetch:QV:
fi
if [ ! -e "$SRCPKGDIR/$tbfile" ]; then
printf " CURL\t%s\n" "$tbfile"
- $CURL "$srctarball" > "$SRCPKGDIR/$tbfile"
+ $CURL -L "$srctarball" > "$SRCPKGDIR/$tbfile"
if [ -n "$currentsum" ]; then
printf " SHA\t%s %s\n" -c "$tbfile"
if ! printf "%s %s/%s\n" $currentsum \
@@ -53,11 +57,37 @@ package-fetch:QV:
fi
fi
fi
- printf " TAR\t%s\n" "$tbfile"
- xz -dc "$SRCPKGDIR/$tbfile" | $TAR -xf -
+ case $tbfile in
+ *.tar.gz|*.tgz)
+ utility=TGZ
+ cmd='gunzip -dc';;
+ *.tar.bz2|*.tbz)
+ utility=TBZ
+ cmd='bunzip2 -dc';;
+ *.tar.xz|*.txz)
+ utility=TXZ
+ cmd='xz -dc';;
+ *.zip) utility=ZIP;;
+ *) printf "Unsupported archive format: %s\n" \
+ $tbfile
+ exit 1;;
+ esac
+ printf " %s\t%s\n" $utility "$tbfile"
+ if [ "$utility" = "ZIP" ]; then
+ todir=$PKG
+ if [ -n "$currentcrdir" ]; then
+ printf " MKDIR\t%s\n" "$currentcrdir"
+ mkdir -p "$currentcrdir"
+ todir=$currentcrdir
+ fi
+ unzip -d "$todir" "$SRCPKGDIR/$tbfile"
+ else
+ $cmd "$SRCPKGDIR/$tbfile" | $TAR -xf -
+ fi
+ unset utility cmd todir
if [ -n "$currenttodir" ]; then
- printf " MV\t%s/%s\n" "$SRCPKGDIR" "$currenttodir"
- mv "$SRCPKGDIR/$currentdir" "$SRCPKGDIR/$currenttodir"
+ printf " MV\t%s/%s\n" "$SRCBASEDIR" "$currenttodir"
+ mv "$SRCBASEDIR/$currentdir" "$SRCBASEDIR/$currenttodir"
fi
done
for srcrepo in $SRCREPOS; do