Added logging capabilities.

This commit is contained in:
Manuel Canales Esparcia 2005-09-29 22:05:00 +00:00
parent 07f47df141
commit a5e49c6fba

37
jhalfs
View file

@ -121,7 +121,8 @@ SVN="svn://svn.linuxfromscratch.org"
HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration
if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi
JHALFSDIR=$BUILDDIR/jhalfs JHALFSDIR=$BUILDDIR/jhalfs
LOG=build.log LOGDIR=$JHALFSDIR/logs
LOG=000-jhalfs.log
MKFILE=$JHALFSDIR/Makefile MKFILE=$JHALFSDIR/Makefile
XSL=dump-commands.xsl XSL=dump-commands.xsl
if [ -z $TEST ] ; then TEST=0 ; fi if [ -z $TEST ] ; then TEST=0 ; fi
@ -151,9 +152,9 @@ get_book() {
fi fi
else else
if [ $LFSVRS = development ] ; then if [ $LFSVRS = development ] ; then
svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$JHALFSDIR/$LOG 2>&1 svn co $SVN/LFS/trunk/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
else else
svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$JHALFSDIR/$LOG 2>&1 svn co $SVN/LFS/branches/$LFSVRS/BOOK lfs-$LFSVRS >>$LOGDIR/$LOG 2>&1
fi fi
echo -ne "done\n" echo -ne "done\n"
extract_commands extract_commands
@ -172,7 +173,7 @@ extract_commands() {
# Dump the commands in shell script form from the LFS book. # Dump the commands in shell script form from the LFS book.
xsltproc --nonet --xinclude --stringparam testsuite $TEST -o ./commands/ \ xsltproc --nonet --xinclude --stringparam testsuite $TEST -o ./commands/ \
$XSL lfs-$LFSVRS/index.xml >>$JHALFSDIR/$LOG 2>&1 $XSL lfs-$LFSVRS/index.xml >>$LOGDIR/$LOG 2>&1
# Grab the patches and package names. # Grab the patches and package names.
cd $JHALFSDIR cd $JHALFSDIR
@ -301,7 +302,7 @@ build_Makefile() {
# Insert instructions for unpacking the package and to set # Insert instructions for unpacking the package and to set
# the PKGDIR variable. # the PKGDIR variable.
echo -e "\t\$(call unpack-lfs,$FILE) && \\" >> $MKFILE.tmp echo -e "\t\$(call unpack-lfs,$FILE)" >> $MKFILE.tmp
echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp echo -e "\tROOT=\`head -n1 /tmp/unpacked | sed 's@/.*@@'\` && \\" >> $MKFILE.tmp
echo -e "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp echo -e "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp
@ -309,13 +310,10 @@ build_Makefile() {
fi fi
# Insert the script run # Insert the script run
echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" && \\" >> $MKFILE.tmp echo -e "\tsu - lfs -c \". /home/lfs/.bashrc && $JHALFSDIR/commands/$file\" >\$(LOGDIR)/$i.log 2>&1 && \\" >> $MKFILE.tmp
# Include a touch of the target name so make can check # Remove the build directory(ies).
# if it's already been made. # (How could it be deleted even if the package build fails?)
echo -e "\ttouch \$@" >> $MKFILE.tmp
# Remove the build directory(ies), including if the build has failed.
if [ "$vrs" != "" ] ; then if [ "$vrs" != "" ] ; then
echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp
echo -e "\tif [ -e \$(LFS)\$(SRC)/*-build ]; then \\" >> $MKFILE.tmp echo -e "\tif [ -e \$(LFS)\$(SRC)/*-build ]; then \\" >> $MKFILE.tmp
@ -323,11 +321,16 @@ build_Makefile() {
echo -e "\tfi;" >> $MKFILE.tmp echo -e "\tfi;" >> $MKFILE.tmp
fi fi
# Include a touch of the target name so make can check
# if it's already been made.
echo -e "\ttouch \$@" >> $MKFILE.tmp
done done
# Stick a variable and some defines at the top of the real makefile # Stick variables and some defines at the top of the real makefile
echo "export SRC := /sources" > $MKFILE echo "export SRC := /sources" > $MKFILE
echo "export LFS := $BUILDDIR" >> $MKFILE echo "export LFS := $BUILDDIR" >> $MKFILE
echo -e "export LOGDIR := $LOGDIR\n" >> $MKFILE
echo "define unpack-lfs" >> $MKFILE echo "define unpack-lfs" >> $MKFILE
echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE
echo -e "endef\n" >> $MKFILE echo -e "endef\n" >> $MKFILE
@ -359,8 +362,8 @@ build_Makefile() {
# to make the scripts executables, and to create a clean environment # to make the scripts executables, and to create a clean environment
# for the lfs user. # for the lfs user.
echo "020-creatingtoolsdir:" >> $MKFILE echo "020-creatingtoolsdir:" >> $MKFILE
echo -e "\tmkdir \$(LFS)/tools && \\" >> $MKFILE echo -e "\tmkdir -v \$(LFS)/tools && \\" >> $MKFILE
echo -e "\tln -s \$(LFS)/tools / && \\" >> $MKFILE echo -e "\tln -sv \$(LFS)/tools / && \\" >> $MKFILE
echo -e "\ttouch \$@\n" >> $MKFILE echo -e "\ttouch \$@\n" >> $MKFILE
echo "021-addinguser:" >> $MKFILE echo "021-addinguser:" >> $MKFILE
@ -398,7 +401,11 @@ if [ ! -d $JHALFSDIR ] ; then
mkdir -p $JHALFSDIR mkdir -p $JHALFSDIR
fi fi
>$JHALFSDIR/$LOG if [ ! -d $LOGDIR ] ; then
mkdir $LOGDIR
fi
>$LOGDIR/$LOG
if [ "$PWD" != "$JHALFSDIR" ] ; then if [ "$PWD" != "$JHALFSDIR" ] ; then
cp $0 $XSL $JHALFSDIR/ cp $0 $XSL $JHALFSDIR/