1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 19:19:46 +01:00

Cleanup directories before and after building a package

In case a package build fails, we can simply restart the build script without
having to do manual cleanup of the intermediate directories.

Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
This commit is contained in:
David Oberhollenzer 2019-03-06 10:03:41 +01:00
parent 8fa44569d8
commit e497ba164c
2 changed files with 3 additions and 5 deletions

6
mk.sh
View file

@ -92,8 +92,8 @@ while read pkg; do
if [ ! -e "$PKGLOGDIR/.$pkg" ]; then if [ ! -e "$PKGLOGDIR/.$pkg" ]; then
include_pkg "$pkg" include_pkg "$pkg"
rm -rf "$TCDIR/$TARGET" rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
mkdir -p "$TCDIR/$TARGET" mkdir -p "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
if [ ! -z "$DEPENDS" ]; then if [ ! -z "$DEPENDS" ]; then
pkg install -omD -r "$TCDIR/$TARGET" -R "$REPODIR" $DEPENDS pkg install -omD -r "$TCDIR/$TARGET" -R "$REPODIR" $DEPENDS
@ -110,7 +110,7 @@ while read pkg; do
-l "$PKGDEPLOYDIR/${f}.files" -l "$PKGDEPLOYDIR/${f}.files"
done done
rm -rf "$PKGBUILDDIR" "$PKGDEPLOYDIR" rm -rf "$TCDIR/$TARGET" "$PKGBUILDDIR" "$PKGDEPLOYDIR"
touch "$PKGLOGDIR/.$pkg" touch "$PKGLOGDIR/.$pkg"
fi fi
done < "$PACKAGELIST" done < "$PACKAGELIST"

View file

@ -17,8 +17,6 @@ run_pkg_command() {
echo "$PKGNAME - $FUNCTION" echo "$PKGNAME - $FUNCTION"
mkdir -p "$PKGBUILDDIR" "$PKGDEPLOYDIR"
pushd "$PKGBUILDDIR" > /dev/null pushd "$PKGBUILDDIR" > /dev/null
$FUNCTION "$SRC" &>> "$LOGFILE" < /dev/null $FUNCTION "$SRC" &>> "$LOGFILE" < /dev/null
popd > /dev/null popd > /dev/null