Changeset 3b63c8c for common/common-functions
- Timestamp:
- 07/26/2006 06:42:01 PM (18 years ago)
- Branches:
- experimental
- Children:
- 613d46b
- Parents:
- 1504208
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
common/common-functions
r1504208 r3b63c8c 53 53 ${BOLD} -B, --book VER${OFF} 54 54 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 57 61 58 62 ${BOLD} -D --directory DIR${OFF} … … 84 88 use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book 85 89 86 ${BOLD} -C, --compar asion TYPE${OFF}90 ${BOLD} -C, --comparison TYPE${OFF} 87 91 do iterative comparison analysis. This extends the total build time 88 92 considerably because the entire final system will rebuild itself … … 91 95 ICA = do ICA as designed by Greg Schafer 92 96 farce = do the farce analysis designed by Ken Moffat 93 both = perfo m both ICA and farce analysis97 both = perform both ICA and farce analysis 94 98 95 99 ${BOLD} -F, --fstab FILE${OFF} … … 105 109 106 110 ${BOLD} -R --rebuild${OFF} 107 clean the build directory before perfo ming any other task. The directory111 clean the build directory before performing any other task. The directory 108 112 is cleaned only if it was populated by a previous jhalfs-X run. 109 113 -EOF- … … 128 132 -EOF- 129 133 134 [[ ${PROGNAME} = "clfs2" ]] && 135 cat <<- -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 130 146 [[ ${PROGNAME} = "hlfs" ]] && 131 147 cat <<- -EOF- … … 208 224 } 209 225 226 227 #----------------------------------# 228 wrt_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 ( 237 cat << 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 243 EOF 244 ) >> $MKFILE.tmp 245 } 246 247 #----------------------------# 248 get_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 } 210 261 211 262 #----------------------------------# … … 266 317 267 318 #----------------------------------# 319 wrt_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 ( 328 cat << 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 333 EOF 334 ) >> $MKFILE.tmp 335 } 336 337 338 #----------------------------------# 268 339 wrt_unpack2() { # 269 340 #----------------------------------# … … 361 432 cat << EOF 362 433 @( 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 435 EOF 436 ) >> $MKFILE.tmp 437 } 438 439 440 #----------------------------------# 441 wrt_run_as_clfs_su() { # Execute script inside time { }, footer to log file 442 #----------------------------------# 443 local this_script=$1 444 local file=$2 445 ( 446 cat << 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 449 EOF 450 ) >> $MKFILE.tmp 451 } 452 453 454 #----------------------------------# 455 wrt_run_as_clfs_root() { # Some scripts must be run as root.. 456 #----------------------------------# 457 local this_script=$1 458 local file=$2 459 ( 460 cat << EOF 461 @( time { export CLFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\ 363 462 echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script 364 463 EOF … … 536 635 rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var} 537 636 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} 539 638 echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n" 540 639 rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d` … … 559 658 hlfs) svn_root="HLFS" ;; 560 659 clfs) svn_root="cross-lfs" ;; 660 clfs2) svn_root="cross-lfs" ;; 561 661 *) echo "BOOK not defined in function <get_book>" 562 662 exit 1 ;; … … 567 667 if [ -d ${PROGNAME}-$LFSVRS ] ; then 568 668 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 571 673 echo -ne "done\n" 572 # Set the canonical book version573 674 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 575 681 get_sources 576 682 else 577 683 echo -ne "done\n" 578 # Set the canonical book version579 cd $JHALFSDIR580 VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`581 684 extract_commands 582 685 fi 583 686 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 588 688 echo -ne "done\n" 589 # Set the canonical book version590 cd $JHALFSDIR591 VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`592 689 extract_commands 593 690 fi 691 594 692 else 595 693 echo -ne "Using $BOOK as book's sources ...\n" 596 # Set the canonical book version597 cd $JHALFSDIR598 VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@<!ENTITY version "@@;s@">@@'`599 694 extract_commands 600 695 fi 696 echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n" 601 697 } 602 698 … … 610 706 611 707 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 613 714 614 715 # Start clean … … 634 735 -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 635 736 ;; 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 ;; 636 750 hlfs) 637 751 echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation" … … 668 782 669 783 # 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 675 785 676 786 # Done. Moving on... 677 787 get_sources 678 788 } 789 790 #----------------------------# 791 create_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 679 815 680 816 #----------------------------# … … 794 930 795 931 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 exec tion 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. 798 934 echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}" 799 935 RUNMAKE=0 800 936 fi 801 937 } 802 803 938 804 939 #----------------------------# … … 816 951 echo " ...OK" 817 952 ;; 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 ;; 818 961 hlfs) 819 962 echo -n "Creating HLFS <${MODEL}> specific URLs file"
Note:
See TracChangeset
for help on using the changeset viewer.