1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-14 15:37:11 +01:00
build/util/emptypkg.sh
David Oberhollenzer 21342dee8e Cleanup: move path filtering into pkg_scan_dir
Instead of prefixing the search path with $PKGDEPLOYDIR and then
stripping the prefix off again every single time, do that inside
the pkg_scan_dir function.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
2020-04-16 15:16:58 +02:00

71 lines
1.2 KiB
Bash

apply_patches() {
local PATCH
for PATCH in $SCRIPTDIR/pkg/$PKGNAME/*.patch; do
if [ -f $PATCH ]; then
patch -p1 < $PATCH
fi
done
}
pkg_scan_dir() {
local sp="$PKGDEPLOYDIR/$1"
find -H "$sp" -type d -printf "dir \"%p\" 0%m 0 0\\n" | tail -n +2 |\
sed "s#$PKGDEPLOYDIR/##g"
find -H "$sp" -type l -printf "slink \"%p\" 0%m 0 0 %l\\n" |\
sed "s#$PKGDEPLOYDIR/##g"
find -H "$sp" -type f -printf "file \"%p\" 0%m 0 0\\n" |\
sed "s#$PKGDEPLOYDIR/##g"
}
fetch_package() {
echo "$PKGNAME - download"
if [ -z "$TARBALL" ]; then
return
fi
if [ ! -e "$PKGDOWNLOADDIR/$TARBALL" ]; then
curl -o "$PKGDOWNLOADDIR/$TARBALL" --silent --show-error \
-L "$URL/$TARBALL"
fi
echo "$SHA256SUM $PKGDOWNLOADDIR/${TARBALL}" | sha256sum -c --quiet "-"
if [ ! -e "$PKGSRCDIR/$SRCDIR" ]; then
local LOGFILE="$PKGLOGDIR/${PKGNAME}-prepare.log"
echo "$PKGNAME - unpack"
tar -C "$PKGSRCDIR" -xf "$PKGDOWNLOADDIR/$TARBALL"
pushd "$PKGSRCDIR/$SRCDIR" > /dev/null
echo "$PKGNAME - prepare"
prepare "$SCRIPTDIR/pkg/$PKGNAME" &>> "$LOGFILE" < /dev/null
popd > /dev/null
gzip -f "$LOGFILE"
fi
}
download() {
fetch_package
}
prepare() {
apply_patches
}
build() {
return
}
deploy() {
return
}
check_update() {
return
}