mirror of
https://github.com/pygos/build.git
synced 2024-11-22 02:59:47 +01:00
Make "download" a package function
This commit moves the "fetch_package" utility function to the package skeleton and turns it into an overrideable function called "download". Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
parent
a646707dc0
commit
2dc8bd9cd6
5 changed files with 35 additions and 32 deletions
1
mk.sh
1
mk.sh
|
@ -46,7 +46,6 @@ popd > /dev/null
|
||||||
export BUILD_PATH_PREFIX_MAP="$PKGSRCDIR=src:$BUILDROOT=build"
|
export BUILD_PATH_PREFIX_MAP="$PKGSRCDIR=src:$BUILDROOT=build"
|
||||||
|
|
||||||
############################# include utilities ##############################
|
############################# include utilities ##############################
|
||||||
source "$SCRIPTDIR/util/download.sh"
|
|
||||||
source "$SCRIPTDIR/util/pkgcmd.sh"
|
source "$SCRIPTDIR/util/pkgcmd.sh"
|
||||||
source "$SCRIPTDIR/util/misc.sh"
|
source "$SCRIPTDIR/util/misc.sh"
|
||||||
source "$SCRIPTDIR/util/override.sh"
|
source "$SCRIPTDIR/util/override.sh"
|
||||||
|
|
|
@ -16,8 +16,6 @@ build_package() {
|
||||||
rm -f "$REPODIR/${f}.pkg"
|
rm -f "$REPODIR/${f}.pkg"
|
||||||
done
|
done
|
||||||
|
|
||||||
fetch_package
|
|
||||||
|
|
||||||
rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
|
rm -rf "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
|
||||||
mkdir -p "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
|
mkdir -p "$SYSROOT" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
|
||||||
|
|
||||||
|
@ -25,6 +23,7 @@ build_package() {
|
||||||
pkg install -omD $DEPENDS
|
pkg install -omD $DEPENDS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
run_pkg_command "download"
|
||||||
run_pkg_command "build"
|
run_pkg_command "build"
|
||||||
run_pkg_command "deploy"
|
run_pkg_command "deploy"
|
||||||
deploy_dev_cleanup
|
deploy_dev_cleanup
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
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
|
|
||||||
}
|
|
|
@ -14,6 +14,39 @@ pkg_scan_dir() {
|
||||||
find -H "$1" -type f -printf "file \"%p\" 0%m 0 0\\n"
|
find -H "$1" -type f -printf "file \"%p\" 0%m 0 0\\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() {
|
prepare() {
|
||||||
apply_patches
|
apply_patches
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
include_pkg() {
|
include_pkg() {
|
||||||
PKGNAME="$1" # globally visible package name
|
PKGNAME="$1" # globally visible package name
|
||||||
|
|
||||||
unset -f build deploy prepare check_update
|
unset -f build deploy download prepare check_update
|
||||||
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS SUBPKG
|
unset -v VERSION TARBALL URL SRCDIR SHA256SUM DEPENDS SUBPKG
|
||||||
source "$SCRIPTDIR/util/emptypkg.sh"
|
source "$SCRIPTDIR/util/emptypkg.sh"
|
||||||
source "$SCRIPTDIR/pkg/$PKGNAME/build"
|
source "$SCRIPTDIR/pkg/$PKGNAME/build"
|
||||||
|
|
Loading…
Reference in a new issue