From a5e49c6fbacb8389f584ced2d5b7c86a3cd79ea7 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Thu, 29 Sep 2005 22:05:00 +0000 Subject: [PATCH] Added logging capabilities. --- jhalfs | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/jhalfs b/jhalfs index 09d71b0..72f0adc 100755 --- a/jhalfs +++ b/jhalfs @@ -121,7 +121,8 @@ SVN="svn://svn.linuxfromscratch.org" HTTP=http://ftp.lfs-matrix.net/pub/lfs/lfs-packages/conglomeration if [ -z $BUILDDIR ] ; then BUILDDIR=/mnt/lfs ; fi JHALFSDIR=$BUILDDIR/jhalfs -LOG=build.log +LOGDIR=$JHALFSDIR/logs +LOG=000-jhalfs.log MKFILE=$JHALFSDIR/Makefile XSL=dump-commands.xsl if [ -z $TEST ] ; then TEST=0 ; fi @@ -151,9 +152,9 @@ get_book() { fi else 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 - 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 echo -ne "done\n" extract_commands @@ -172,7 +173,7 @@ extract_commands() { # Dump the commands in shell script form from the LFS book. 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. cd $JHALFSDIR @@ -301,7 +302,7 @@ build_Makefile() { # Insert instructions for unpacking the package and to set # 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 "\tchown -R lfs \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp echo -e "\techo \"PKGDIR=\$(LFS)\$(SRC)/\$\$ROOT\" > envars && \\" >> $MKFILE.tmp @@ -309,13 +310,10 @@ build_Makefile() { fi # 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 - # if it's already been made. - echo -e "\ttouch \$@" >> $MKFILE.tmp - - # Remove the build directory(ies), including if the build has failed. + # Remove the build directory(ies). + # (How could it be deleted even if the package build fails?) if [ "$vrs" != "" ] ; then echo -e "\trm -r \$(LFS)\$(SRC)/\$\$ROOT && \\" >> $MKFILE.tmp echo -e "\tif [ -e \$(LFS)\$(SRC)/*-build ]; then \\" >> $MKFILE.tmp @@ -323,11 +321,16 @@ build_Makefile() { echo -e "\tfi;" >> $MKFILE.tmp fi + # Include a touch of the target name so make can check + # if it's already been made. + echo -e "\ttouch \$@" >> $MKFILE.tmp + 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 LFS := $BUILDDIR" >> $MKFILE + echo -e "export LOGDIR := $LOGDIR\n" >> $MKFILE echo "define unpack-lfs" >> $MKFILE echo -e "\t@cd \$(LFS)\$(SRC) ; tar -xvjf \$(1) > /tmp/unpacked" >> $MKFILE echo -e "endef\n" >> $MKFILE @@ -359,8 +362,8 @@ build_Makefile() { # to make the scripts executables, and to create a clean environment # for the lfs user. echo "020-creatingtoolsdir:" >> $MKFILE - echo -e "\tmkdir \$(LFS)/tools && \\" >> $MKFILE - echo -e "\tln -s \$(LFS)/tools / && \\" >> $MKFILE + echo -e "\tmkdir -v \$(LFS)/tools && \\" >> $MKFILE + echo -e "\tln -sv \$(LFS)/tools / && \\" >> $MKFILE echo -e "\ttouch \$@\n" >> $MKFILE echo "021-addinguser:" >> $MKFILE @@ -398,7 +401,11 @@ if [ ! -d $JHALFSDIR ] ; then mkdir -p $JHALFSDIR fi ->$JHALFSDIR/$LOG +if [ ! -d $LOGDIR ] ; then + mkdir $LOGDIR +fi + +>$LOGDIR/$LOG if [ "$PWD" != "$JHALFSDIR" ] ; then cp $0 $XSL $JHALFSDIR/