Changeset 03b24b2


Ignore:
Timestamp:
02/19/2022 02:08:37 PM (2 years ago)
Author:
Pierre Labastie <pierre.labastie@…>
Branches:
ablfs-more, legacy, trunk
Children:
3faf067
Parents:
0f3b1c3
Message:

Various fixes for create-sbu_du-report.sh

  • Check that there is enough material to calculate a SBU (!)
  • Prevent an error if REALSBU does not occur in jhalfs.config
  • Remove double square bracket: they change semantics and I cannot memorize what the change is (but e.g. file* is not expanded even if there is some filexxx in the dir).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/create-sbu_du-report.sh

    r0f3b1c3 r03b24b2  
    1010
    1111# Make sure that we have a directory as first argument
    12 [[ ! -d "$LOGSDIR" ]] && \
     12[ ! -d "$LOGSDIR" ] && \
    1313  echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version] [date]\n" && exit
    1414
    1515# Make sure that the first argument is a jhalfs logs directory
    16 [[ ! -f "$LOGSDIR"/000-masterscript.log ]] && \
     16[ ! -f "$LOGSDIR"/000-masterscript.log ] && \
    1717  echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit
    1818
     19# Make sure something has been built otherwise no need for report :)
     20[ ! -f "$LOGSDIR"/???-binutils-pass1* ] && \
     21  echo -e "\nLooks like nothing has been built yet. Aborting report.\n" && exit
     22
    1923# If this script is run manually, the book version may be unknown
    20 [[ -z "$VERSION" ]] && VERSION=unknown
    21 [[ -z "$DATE" ]] && DATE=$(date --iso-8601)
     24[ -z "$VERSION" ] && VERSION=unknown
     25[ -z "$DATE" ] && DATE=$(date --iso-8601)
    2226
    2327# If there is iteration logs directories, copy the logs inside iteration-1
    2428# to the top level dir
    25 [[ -d "$LOGSDIR"/build_1 ]] && \
     29[ -d "$LOGSDIR"/build_1 ] && \
    2630  cp $LOGSDIR/build_1/* $LOGSDIR
    2731
     
    2933REPORT="$VERSION"-SBU_DU-"$DATE".report
    3034
    31 [ -f $REPORT ] && : >$REPORT
     35[ -f "$REPORT" ] && : >$REPORT
    3236
    3337# Dump generation time stamp and book version
     
    6064popd
    6165# Get the -j value of the SBU
    62 if [ $(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT") = y ]; then
     66if [ "$(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT")" = y ]; then
    6367    J_VALUE="1"
    6468else
     
    6771# if jhalfs.config does not exist, or OPTIMIZE is 0, then J_VALUE is
    6872# still empty. Assume 1 in that case
    69 if [ -z "$J_VALUE" ]; then J_VALUE=1; fi
    70 echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n"
     73echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds at -j${J_VALUE:=1}.\n"
    7174echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n" >> "$REPORT"
    7275
Note: See TracChangeset for help on using the changeset viewer.