Ignore:
Timestamp:
07/26/2006 06:42:01 PM (18 years ago)
Author:
Manuel Canales Esparcia <manuel@…>
Branches:
experimental
Children:
613d46b
Parents:
1504208
Message:

Updated experimental branch to current trunk code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/common-functions

    r1504208 r3b63c8c  
    5353${BOLD}  -B, --book VER${OFF}
    5454        use VER version of the book as the system to build.
    55         Supported versions are: dev*, trunk, SVN
    56         These are aliases for the Development version of {C,H}LFS
     55        Supported VER values are:
     56          dev*, trunk, SVN = aliases for the Development version of {C,H}LFS
     57          branch-NAME = a branch of name NAME
     58          VERSION = the version of a stable released book
     59        To know what branches and stable books work with this version of jhalfs
     60        please see http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks
    5761
    5862${BOLD}  -D  --directory DIR${OFF}
     
    8488        use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book
    8589
    86 ${BOLD}  -C, --comparasion TYPE${OFF}
     90${BOLD}  -C, --comparison TYPE${OFF}
    8791         do iterative comparison analysis. This extends the total build time
    8892         considerably because the entire final system will rebuild itself
     
    9195           ICA   = do ICA as designed by Greg Schafer
    9296           farce = do the farce analysis designed by Ken Moffat
    93            both  = perfom both ICA and farce analysis
     97           both  = perform both ICA and farce analysis
    9498
    9599${BOLD}  -F, --fstab FILE${OFF}
     
    105109
    106110${BOLD}  -R --rebuild${OFF}
    107         clean the build directory before perfoming any other task. The directory
     111        clean the build directory before performing any other task. The directory
    108112        is cleaned only if it was populated by a previous jhalfs-X run.
    109113-EOF-
     
    128132-EOF-
    129133
     134[[ ${PROGNAME} = "clfs2" ]] &&
     135cat <<- -EOF-
     136
     137${BOLD}  -A, --arch ARCH ${OFF}
     138        Select the TARGET architecture, valid selections are:
     139           32bit builds
     140        arm
     141           64bit builds
     142
     143        64bit multi-lib
     144-EOF-
     145
    130146[[ ${PROGNAME} = "hlfs" ]] &&
    131147cat <<- -EOF-
     
    208224}
    209225
     226
     227#----------------------------------#
     228wrt_target_boot() {                # Create target and initialize log file
     229#----------------------------------#
     230  local i=$1
     231  local PREV=$2
     232  case $i in
     233    iteration* ) local LOGFILE=$this_script.log ;;
     234             * ) local LOGFILE=$this_script ;;
     235  esac
     236(
     237cat << EOF
     238
     239$i:  $PREV
     240        @\$(call echo_message, Building)
     241        @./progress_bar.sh \$@ &
     242        @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE
     243EOF
     244) >> $MKFILE.tmp
     245}
     246
     247#----------------------------#
     248get_package_tarball_name() { #
     249#----------------------------#
     250  local script_name=$1
     251
     252   # The use of 'head' is necessary to limit the return value to the FIRST match..
     253   # hopefully this will not cause problems.
     254   #
     255   case $script_name in
     256     tcl)   echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
     257     *)     echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;;
     258   esac
     259
     260}
    210261
    211262#----------------------------------#
     
    266317
    267318#----------------------------------#
     319wrt_unpack_clfs() {                # Unpack and set 'ROOT' var
     320#----------------------------------#
     321  local FILE=$1
     322  local optSAVE_PREVIOUS=$2
     323
     324  if [ "${optSAVE_PREVIOUS}" != "1" ]; then
     325    wrt_remove_existing_dirs "$FILE"
     326  fi
     327(
     328cat << EOF
     329        @\$(call unpack,$FILE)
     330        @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
     331        echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
     332        chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
     333EOF
     334) >> $MKFILE.tmp
     335}
     336
     337
     338#----------------------------------#
    268339wrt_unpack2() {                    #
    269340#----------------------------------#
     
    361432cat << EOF
    362433        @( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
     434        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
     435EOF
     436) >> $MKFILE.tmp
     437}
     438
     439
     440#----------------------------------#
     441wrt_run_as_clfs_su() {             # Execute script inside time { }, footer to log file
     442#----------------------------------#
     443  local this_script=$1
     444  local file=$2
     445(
     446cat << EOF
     447        @( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
     448        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
     449EOF
     450) >> $MKFILE.tmp
     451}
     452
     453
     454#----------------------------------#
     455wrt_run_as_clfs_root() {           # Some scripts must be run as root..
     456#----------------------------------#
     457  local this_script=$1
     458  local file=$2
     459(
     460cat << EOF
     461        @( time { export CLFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
    363462        echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
    364463EOF
     
    536635      rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var}
    537636      echo -ne "Cleaning $JHALFSDIR...\n"
    538       rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
     637      rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh}
    539638      echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n"
    540639      rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
     
    559658      hlfs) svn_root="HLFS" ;;
    560659      clfs) svn_root="cross-lfs" ;;
     660      clfs2) svn_root="cross-lfs" ;;
    561661      *) echo "BOOK not defined in function <get_book>"
    562662          exit 1 ;;
     
    567667    if [ -d ${PROGNAME}-$LFSVRS ] ; then
    568668      cd ${PROGNAME}-$LFSVRS
    569       if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/${PROGNAME}-commands && \
    570       test -f $JHALFSDIR/packages ; then
     669      if LC_ALL=C svn up | grep -q At && \
     670         test -d $JHALFSDIR/${PROGNAME}-commands && \
     671         test -f $JHALFSDIR/pkg_tarball_list ; then
     672        # Set the canonical book version
    571673        echo -ne "done\n"
    572         # Set the canonical book version
    573674        cd $JHALFSDIR
    574         VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
     675        case $PROGNAME in
     676          clfs | clfs2)
     677            VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
     678          *)
     679            VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
     680        esac
    575681        get_sources
    576682      else
    577683        echo -ne "done\n"
    578         # Set the canonical book version
    579         cd $JHALFSDIR
    580         VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
    581684        extract_commands
    582685      fi
    583686    else
    584       case $LFSVRS in
    585         development)
    586            svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;;
    587       esac
     687      svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1
    588688      echo -ne "done\n"
    589       # Set the canonical book version
    590       cd $JHALFSDIR
    591       VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
    592689      extract_commands
    593690    fi
     691
    594692  else
    595693    echo -ne "Using $BOOK as book's sources ...\n"
    596     # Set the canonical book version
    597     cd $JHALFSDIR
    598     VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
    599694    extract_commands
    600695  fi
     696  echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n"
    601697}
    602698
     
    610706
    611707  cd $JHALFSDIR
    612   VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`
     708  case $PROGNAME in
     709    clfs | clfs2 )
     710      VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//') ;;
     711    *)
     712      VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //'  -e 's/<\/.*//')  ;;
     713  esac
    613714
    614715  # Start clean
     
    634735                 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
    635736      ;;
     737
     738    clfs2)
     739        echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture"
     740        xsltproc --nonet \
     741                 --xinclude \
     742                 --stringparam testsuite $TEST \
     743                 --stringparam vim-lang $VIMLANG \
     744                 --stringparam timezone $TIMEZONE \
     745                 --stringparam page $PAGE \
     746                 --stringparam lang $LANG \
     747                 --stringparam keymap $KEYMAP \
     748                 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1
     749      ;;
    636750    hlfs)
    637751        echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation"
     
    668782
    669783  # Create the packages file. We need it for proper Makefile creation
    670   rm -f packages
    671   echo -n "Creating <${PROGNAME}> specific packages file"
    672   grep "\-version " $BOOK/packages.ent | sed -e 's@<!ENTITY @@' \
    673                                              -e 's@">@"@' > packages
    674   echo " ...OK"
     784  create_package_list
    675785
    676786  # Done. Moving on...
    677787  get_sources
    678788}
     789
     790#----------------------------#
     791create_package_list() {      #
     792#----------------------------#
     793
     794  # Create the packages file. We need it for proper Makefile creation
     795  rm -f pkg_tarball_list
     796  echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH"
     797  case ${PROGNAME} in
     798    clfs | clfs2)
     799        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
     800                 $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1
     801      ;;
     802    hlfs)
     803        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
     804                 $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
     805      ;;
     806    lfs)
     807        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
     808                 $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
     809      ;;
     810  esac
     811  echo " ...OK"
     812
     813}
     814
    679815
    680816#----------------------------#
     
    794930
    795931  if [[ -s MISSING_FILES.DMP ]]; then
    796     echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
    797       # Do not allow the automatic exection of the Makefile.
     932    echo  -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n"
     933      # Do not allow the automatic execution of the Makefile.
    798934    echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}"
    799935    RUNMAKE=0
    800936  fi
    801937}
    802 
    803938
    804939#----------------------------#
     
    816951        echo " ...OK"
    817952      ;;
     953    clfs2)
     954        echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
     955        xsltproc --nonet --xinclude \
     956                 --stringparam server $SERVER \
     957                 -o $BUILDDIR/sources/urls.lst urls.xsl \
     958                 $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
     959        echo " ...OK"
     960      ;;
    818961    hlfs)
    819962        echo -n "Creating HLFS <${MODEL}> specific URLs file"
Note: See TracChangeset for help on using the changeset viewer.