Le 23/02/2012 23:19, Peter Palmer a écrit :
Hi,

here a tiny fist patch (from myself) to fix the SBU report that wasn't
running (current jhalfs svn and CLFS-1.2). I'm new to lfs/jhalfs
development so I hope the format and everything is right and usable.

Schedule of changes:

1. Variables needed initailising as perl was tipping over trying to
substract without that, i.e.:
INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`

2. The other change affects the selection of the very first entry of
the $LOGS directory. In CLFS this was a script that run in fractions
of a second... SBU is supposed to be based on the compilation time of
binutils though.

I think both issues are related: if binutils is the first entry in the logs
directory, it gives BASELOG="xxx-binutils". Then the construct:
  if [ "$log" != "$BASELOG" ] ; then
    INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
  [...]
  fi
avoids to use non initialized DU1PREV.

Of course, in the case of CLFS, the first entry is not binutils
and all gets wrong.
Now, your patch implies that the installed file usage is not printed
for the script preceding binutils, and that grand total is
not updated.

I propose the attached patch.

Regards
Pierre


Index: jhalfs-trunk/common/create-sbu_du-report.sh
===================================================================
--- jhalfs-trunk.orig/common/create-sbu_du-report.sh	2012-02-09 11:41:14.000000000 +0100
+++ jhalfs-trunk/common/create-sbu_du-report.sh	2012-02-24 14:07:05.909904267 +0100
@@ -51,7 +51,8 @@
 BUILDLOGS="`grep -l "^Totalseconds:" ${LOGSDIR}/*`"
 
 # Match the first timed log to extract the SBU unit value from it
-BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
+FIRSTLOG=`grep -l "^Totalseconds:" $LOGSDIR/* | head -n1`
+BASELOG=`grep -l "^Totalseconds:" $LOGSDIR/???-binutils | head -n1`
 echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
 SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
 echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds.\n"
@@ -91,7 +92,7 @@
 
 # Append installed files disk usage to the previous entry,
 # except for the first parsed log
-  if [ "$log" != "$BASELOG" ] ; then
+  if [ "$log" != "$FIRSTLOG" ] ; then
     INSTALL=`perl -e 'print ('$DU1' - '$DU1PREV')';`
     INSTALLMB=`perl -e 'printf "%.3f" , ('$DU1MB' - '$DU1MBPREV')';`
     echo -e "Installed files disk usage:\t\t\t\t$INSTALL KB or $INSTALLMB MB\n" >> $REPORT
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to