1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-12-23 23:50:51 +01:00

Don't keep build directory

Use $PKGBUILDDIR for building packages. Delete it again after
the deploy is done. If the build fails, the script aborts and it
is kept. If the build and deploy pass, there is no reason to keep
it around.

Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
David Oberhollenzer 2018-02-16 18:45:25 +01:00
parent 30aa5ce395
commit 05ae80634c
5 changed files with 17 additions and 19 deletions

3
mk.sh
View file

@ -23,7 +23,7 @@ PKGLOGDIR="$BUILDROOT/$BOARD/log"
PKGDOWNLOADDIR="$BUILDROOT/download"
PACKAGELIST="$BUILDROOT/$BOARD/pkglist"
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGBUILDDIR" "$PKGLOGDIR"
mkdir -p "$PKGDOWNLOADDIR" "$PKGSRCDIR" "$PKGLOGDIR"
mkdir -p "$PKGDEPLOYDIR" "$TCDIR/bin"
export PATH="$TCDIR/bin:$PATH"
@ -71,6 +71,7 @@ while read pkg; do
run_pkg_command "build"
run_pkg_command "deploy"
rm -rf "$PKGBUILDDIR"
restore_toolchain
done < "$PACKAGELIST"

View file

@ -67,20 +67,21 @@ dir_filelist() {
build() {
local INPUT="$1"
local OUTPUT="$2"
local DEPLOY="$3"
# populate with default directory structure
for dir in dev proc sys bin lib newroot images; do
mkdir -p "$OUTPUT/$dir"
mkdir -p "$DEPLOY/$dir"
done
ln -s "/bin" "$OUTPUT/sbin"
ln -s "/bin" "$DEPLOY/sbin"
# add init script
cp "$SCRIPTDIR/pkg/initrd/initrd.skel" "$OUTPUT/init"
chmod +x "$OUTPUT/init"
cp "$SCRIPTDIR/pkg/initrd/initrd.skel" "$DEPLOY/init"
chmod +x "$DEPLOY/init"
# 'install' packages to initrd
cp -r ${PKGDEPLOYDIR}/bbstatic/* "$OUTPUT"
cp -r ${PKGDEPLOYDIR}/bbstatic/* "$DEPLOY"
}
deploy() {
@ -88,9 +89,11 @@ deploy() {
local BUILD="$2"
local DEPLOY="$3"
local LSTFILE="$DEPLOY/initrd.list"
local LSTFILE="$BUILD/initrd.list"
dir_filelist "$BUILD" > "$LSTFILE"
dir_filelist "$DEPLOY" > "$LSTFILE"
echo "dir /dev 0755 0 0" >> "$LSTFILE"
echo "nod /dev/console 600 0 0 c 5 1" >> "$LSTFILE"
mv "$LSTFILE" "$DEPLOY"
}

View file

@ -34,7 +34,5 @@ deploy() {
local BUILD="$2"
local DEPLOY="$3"
pushd "$PKGBUILDDIR" > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" "$PKGNAME"
popd > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" *
}

View file

@ -36,7 +36,5 @@ deploy() {
local BUILD="$2"
local DEPLOY="$3"
pushd "$PKGBUILDDIR" > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" "$PKGNAME"
popd > /dev/null
tar czf "$DEPLOY/$PKGNAME.tar.gz" *
}

View file

@ -1,7 +1,6 @@
run_pkg_command() {
local FUNCTION="$1"
local DEPLOYDIR="$PKGDEPLOYDIR/$PKGNAME"
local OUT="$PKGBUILDDIR/${PKGNAME}"
local CHECKFILE="$PKGLOGDIR/.${PKGNAME}-${FUNCTION}"
echo "$PKGNAME - $FUNCTION"
@ -13,14 +12,13 @@ run_pkg_command() {
local LOGFILE="$PKGLOGDIR/${PKGNAME}-${FUNCTION}.log"
local SRC="$PKGSRCDIR/$SRCDIR"
mkdir -p "$DEPLOYDIR" "$OUT" "${DEPLOYDIR}-dev"
mkdir -p "$DEPLOYDIR" "$PKGBUILDDIR" "${DEPLOYDIR}-dev"
pushd "$OUT" > /dev/null
$FUNCTION "$SRC" "$OUT" "$DEPLOYDIR" "${DEPLOYDIR}-dev" &>> "$LOGFILE" < /dev/null
pushd "$PKGBUILDDIR" > /dev/null
$FUNCTION "$SRC" "$PKGBUILDDIR" "$DEPLOYDIR" "${DEPLOYDIR}-dev" &>> "$LOGFILE" < /dev/null
popd > /dev/null
(rmdir "$DEPLOYDIR" || true) 2> /dev/null ;
(rmdir "$OUT" || true) 2> /dev/null ;
(rmdir "${DEPLOYDIR}-dev" || true) 2> /dev/null ;
touch "$CHECKFILE"