From 2fedf493f4421b58d048954d6a714857dd3178a6 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Mon, 14 Aug 2006 20:59:05 +0000 Subject: [PATCH] Merged r2942:2948 from trunk. --- BLFS/TODO | 34 +++++------ BLFS/{makefile.conf => envars.conf} | 10 +++- BLFS/gen-makefile.sh | 2 +- BLFS/libs/scripts.xsl | 8 +-- README.BLFS | 21 +++---- blfs | 88 +++++++++++++++++++++++++---- common/func_validate_configs.sh | 5 ++ 7 files changed, 121 insertions(+), 47 deletions(-) rename BLFS/{makefile.conf => envars.conf} (64%) diff --git a/BLFS/TODO b/BLFS/TODO index 39a7b63..31b8d73 100644 --- a/BLFS/TODO +++ b/BLFS/TODO @@ -11,27 +11,21 @@ Makefiles similars to the current ones for {C,H}LFS. What remains to do: -1. - To make the top-level blfs script functional. That script should to create - the working directory (selected at command line) - a. Copy all BLFS/* files to it, - b. Fetch the BLFS sources (output directory selected at command line or - based on the book version), - c. Run the packages.sh script. - -2. - To develop the XSL code needed to create the build scripts. - Almost done. A lot of book-versus-scripts and testing is needed. - We need yet to figure out how to handle Perl modules installation and - other pages that have commands to install more that one package +-- To review the XSL code needed to create the build scripts. + A lot of book-versus-scripts and testing is needed. + We need yet to figure out if we can to to handle Perl modules installation + and other pages that have commands to install more that one package (e.g., Gnat in GCC Java-bin in Java, sane-backends and sane-frontends - in Sane, etc) + in Sane, etc) or not-estandart installations, like Xorg7 -3. - To develop the code to create the Makefile. - Should be a separate script to be run manually after the user has - review and edited the target build scripts. - Must make the build scripts executables and set the SRC_ARCHIVE and - FTP_SERVER envars. - Work in progress. +-- Test the method used to track already installed packages by previous runs. + See if the packages version can be watched also. -4. - To find a way to track already installed packages by previous runs, to can - skip them when creating the book/scripts/Makefile for a new target. +-- Integrate the menuconfig based package selection, trying to make use of the + installed packages traking system. +-- Bugs hunting. + +-- Improve README.BLFS. + +-- Develop a script to make cofee. \ No newline at end of file diff --git a/BLFS/makefile.conf b/BLFS/envars.conf similarity index 64% rename from BLFS/makefile.conf rename to BLFS/envars.conf index 30c2472..e4b5a48 100644 --- a/BLFS/makefile.conf +++ b/BLFS/envars.conf @@ -4,7 +4,7 @@ # # $Id$ # -# Set default SRC_ARCHIVE and FTP_DIR +# Set default envars used in the build scripts # ##### @@ -14,9 +14,15 @@ # if the user has the right priviledges. export SRC_ARCHIVE=$SRC_ARCHIVE -# --- Server used if the file isn't found in SRC_ARCHIVE. +#--- Server used if the file isn't found in SRC_ARCHIVE. # As a last resort, the file will dowloaded from upstream, if possible. # # The server path MUST be set as listed in # http://www.linuxfromscratch.org/blfs/download.html export FTP_SERVER=ftp://anduin.linuxfromscratch.org/BLFS/ + + +#--- The sources directory. +# Full path to the top level directory where packages will be stored, +# unpacked, and compiled. +export SRC_DIR=$HOME/sources diff --git a/BLFS/gen-makefile.sh b/BLFS/gen-makefile.sh index 037ab08..a6e577a 100755 --- a/BLFS/gen-makefile.sh +++ b/BLFS/gen-makefile.sh @@ -40,7 +40,7 @@ __write_build_cmd() { # #----------------------------------# ( cat << EOF - @source ../makefile.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 + @source ../envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 EOF ) >> $MKFILE.tmp } diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl index 6f37254..086e054 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/libs/scripts.xsl @@ -97,14 +97,14 @@ PKG_DIR= - + SRC_DIR=$SRC_DIR - cd ~/sources/$PKG_DIR + cd $SRC_DIR/$PKG_DIR rm -rf $UNPACKDIR unpacked @@ -125,8 +125,8 @@ - mkdir -p ~/sources/$PKG_DIR - cd ~/sources/$PKG_DIR + mkdir -p $SRC_DIR/$PKG_DIR + cd $SRC_DIR/$PKG_DIR diff --git a/README.BLFS b/README.BLFS index 7e8ba54..1c43919 100644 --- a/README.BLFS +++ b/README.BLFS @@ -14,7 +14,7 @@ $Id$ general rule you will need to review and edit the scripts while reading the book. - NOTE:: The code is yet under development a may contains several bugs + NOTE:: The code is still under development and may contains several bugs 2. USAGE:: @@ -37,7 +37,7 @@ $Id$ TODO developers notes packages auto-generated file with packages info alternatives.conf configuration files for alternative packages - makefile.conf envars needed when running the generated Makefile + envars.conf envars needed when running the build scripts update_book.sh update the XML book sources and regenerate packages file and GNOME and KDE dependencies tree blfs-parser.sh generates linear BLFS books and build scripts @@ -54,16 +54,17 @@ $Id$ 2.3 PARSING THE BOOK:: Next step is to create a book and build scripts in dependencies build order for a target package. A target package can be any of the ones listed in the - packages file. That is done using the blfs-parser.sh script, but we are triying + packages file. That is done using the blfs-parser.sh script, but we are trying to make a menuconfig based system. The script need three arguments: package name as listed in packages file - dependencies level 1 for required, 2 for required an recommendedand, + dependencies level 1 for required, + 2 for required an recommended 3 for required, recommended, and optional - sudo usage y if sudo will be used (you will build as normal user) - n if sudo isn't needed (you will build as root) + sudo usage y if sudo will be used (you want build as a normal user) + n if sudo isn't needed (you want build as root) For example: @@ -82,12 +83,12 @@ $Id$ packages (i.e., for non-BLFS packages) can be inserted in an easy way. 2.4 CREATING THE MAKEFILE - When the build scripts will be ready to be run, the Makefile can be - created. Be sure that you are into the "package" directory and run + When the build scripts are ready to be run, the Makefile can be + created. Be sure that you cd into the "package" directory and run - ../gen_makefile.sh + ../gen_makefile.sh - Review the Makefile and if all look sane, start the build. + Review the Makefile and if all look sane, start the build. (Text is needed for the installed packages tracking system and like) diff --git a/blfs b/blfs index d522792..90d10ec 100755 --- a/blfs +++ b/blfs @@ -3,6 +3,35 @@ set -e +# From common/common-functions +# VT100 colors +declare -r BLACK=$'\e[1;30m' +declare -r DK_GRAY=$'\e[0;30m' + +declare -r RED=$'\e[31m' +declare -r GREEN=$'\e[32m' +declare -r YELLOW=$'\e[33m' +declare -r BLUE=$'\e[34m' +declare -r MAGENTA=$'\e[35m' +declare -r CYAN=$'\e[36m' +declare -r WHITE=$'\e[37m' + +declare -r OFF=$'\e[0m' +declare -r BOLD=$'\e[1m' +declare -r REVERSE=$'\e[7m' +declare -r HIDDEN=$'\e[8m' + +declare -r tab_=$'\t' +declare -r nl_=$'\n' + +declare -r DD_BORDER="${BOLD}==============================================================================${OFF}" +declare -r SD_BORDER="${BOLD}------------------------------------------------------------------------------${OFF}" +declare -r STAR_BORDER="${BOLD}******************************************************************************${OFF}" + +# bold yellow > < pair +declare -r R_arrow=$'\e[1;33m>\e[0m' +declare -r L_arrow=$'\e[1;33m<\e[0m' + #>>>>>>>>>>>>>>>ERROR TRAPPING >>>>>>>>>>>>>>>>>>>> #-----------------------# @@ -34,36 +63,75 @@ trap simple_error ERR trap 'echo -e "\n\n${RED}INTERRUPT${OFF} trapped\n" && exit 2' 1 2 3 15 17 18 23 #>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -VERBOSITY=1 +# envars not sourced from configuration file + PROGNAME=$(basename $0) +COMMON_DIR="common" + VERBOSITY=1 [[ $VERBOSITY > 0 ]] && echo -n "Loading config params from ..." source configuration [[ $? > 0 ]] && echo "file:configuration did not load.." && exit 1 [[ $VERBOSITY > 0 ]] && echo "OK" +[[ $VERBOSITY > 0 ]] && echo -n "Loading function ..." +source $COMMON_DIR/func_validate_configs.sh +[[ $? > 0 ]] && echo " function module did not load.." && exit 2 +[[ $VERBOSITY > 0 ]] && echo "OK" +[[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}" + +# Be sure that we have a configuration file [[ -z $BOOK_BLFS ]] && echo -e "\nNo BLFS configuration found. Please configure it." && exit 1 -TREE=trunk/BOOK +# Set default book version +BRANCH_ID=${BRANCH_ID:=development} -if [[ ! -z ${BRANCH_ID} ]]; then - case $BRANCH_ID in - dev* | SVN | trunk ) TREE=trunk/BOOK ;; - branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;; - * ) TREE=tags/${BRANCH_ID}/BOOK ;; - esac +# Set the SVN tree +case $BRANCH_ID in + dev* | SVN | trunk ) TREE=trunk/BOOK ;; + *EDIT* ) echo " You forgot to set the branch or stable book version." + echo " Please rerun make and fix the configuration." + exit 2 + ;; + branch-* ) TREE=branches/${BRANCH_ID#branch-}/BOOK ;; + * ) TREE=tags/${BRANCH_ID}/BOOK ;; +esac + +# For consistency with other books +validate_config +echo "${SD_BORDER}${nl_}" +echo -n "Are you happy with these settings? yes/no (no): " +read ANSWER +if [ x$ANSWER != "xyes" ] ; then + echo "${nl_}Fix the configuration options and rerun the script.${nl_}" + exit 1 fi +echo "${nl_}${SD_BORDER}${nl_}" +# Install the files [[ ! -d $BLFS_ROOT ]] && mkdir -p $BLFS_ROOT cp -r BLFS/* $BLFS_ROOT -cp common/progress_bar.sh $BLFS_ROOT +cp $COMMON_DIR/progress_bar.sh $BLFS_ROOT # cp -r menu $BLFS_ROOT +# Start the work cd $BLFS_ROOT +# Clean-up +rm -rf libs/.svn + +# Fix BLFS_XML harcoded values sed -i 's,blfs-xml,'$BLFS_XML',' update_book.sh sed -i 's,blfs-xml,'$BLFS_XML',' libs/book.xsl -./update_book.sh $BLFS_XML get $TREE +# Fetch book sources and create packages and GNOME/KDE dependencies files +if [[ -d $BLFS_XML ]] ; then + ./update_book.sh +else + ./update_book.sh $BLFS_XML get $TREE +fi + +# Generate Config.in and run the menuconfig interfaz +# ./gen_config.sh # make diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index ffd68ba..f93231d 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -92,6 +92,7 @@ inline_doc local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP" + local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML" local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \${OFF}' @@ -264,6 +265,10 @@ inline_doc validate_file -z -e -s KEYMAP=${save_param} ;; + + # BLFS params. No validation is required/allowed, IMHO + BRANCH_ID | BLFS_ROOT | BLFS_XML) echo "`eval echo $PARAM_VALS`" ;; + esac done set -e