From d0d9e90e3057311cc1b38517d79e0827407d6bc5 Mon Sep 17 00:00:00 2001 From: Manuel Canales Esparcia Date: Sun, 13 Aug 2006 10:01:14 +0000 Subject: [PATCH] Merged r2925:2931 from trunk --- BLFS/blfs-parser.sh | 9 ------ BLFS/{libs/func_makefile => gen-makefile.sh} | 34 +++++++++++++------- BLFS/libs/constants.inc | 5 --- BLFS/libs/func_dependencies | 25 +++----------- BLFS/libs/func_parser | 8 ++--- BLFS/libs/scripts.xsl | 18 +++++++---- BLFS/makefile.conf | 22 +++++++++++++ 7 files changed, 64 insertions(+), 57 deletions(-) rename BLFS/{libs/func_makefile => gen-makefile.sh} (88%) mode change 100644 => 100755 create mode 100644 BLFS/makefile.conf diff --git a/BLFS/blfs-parser.sh b/BLFS/blfs-parser.sh index 1d9f61d..60cfe20 100755 --- a/BLFS/blfs-parser.sh +++ b/BLFS/blfs-parser.sh @@ -34,11 +34,6 @@ source libs/func_dependencies source libs/func_parser [[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit -#--------------------- -# Makefile module -source libs/func_makefile -[[ $? > 0 ]] && echo -e "\n\tERROR: func_makefile did not load..\n" && exit - #-------------------------# @@ -106,9 +101,6 @@ inline_doc } - - - #------- MAIN -------- if [[ ! -f packages ]] ; then echo -e "\tNo packages file has been found.\n" @@ -122,4 +114,3 @@ generate_dependency_tree generate_TARGET_xml generate_target_book create_build_scripts -generate_Makefile \ No newline at end of file diff --git a/BLFS/libs/func_makefile b/BLFS/gen-makefile.sh old mode 100644 new mode 100755 similarity index 88% rename from BLFS/libs/func_makefile rename to BLFS/gen-makefile.sh index 933f3c5..037ab08 --- a/BLFS/libs/func_makefile +++ b/BLFS/gen-makefile.sh @@ -1,16 +1,22 @@ -##### -# -# +#!/bin/bash # # $Id$ -##### +# +set -e + + # TEMPORARY VARIABLES.. development use only -declare MKFILE=devMakefile +declare MKFILE=Makefile declare PREV_PACKAGE="" declare BUILD_SCRIPTS=scripts declare TRACKING_DIR=/var/lib/jhalfs/BLFS +HEADER="# This file is automatically generated by jhalfs +# YOU MAY NEED TO EDIT THIS FILE MANUALLY +# +# Generated on `date \"+%F %X %Z\"`" + #----------------------------------# __wrt_target() { # Create target and initialize log file @@ -32,11 +38,9 @@ EOF #----------------------------------# __write_build_cmd() { # #----------------------------------# - local this_script=$1 - local file=$2 ( cat << EOF - @( time { ${BUILD_SCRIPTS}/${file} >>logs/${this_script} 2>&1 ; } ) 2>>logs/${this_script} + @source ../makefile.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 EOF ) >> $MKFILE.tmp } @@ -48,7 +52,7 @@ __wrt_touch() { # ( cat << EOF @touch \$@ && \\ - touch \$(TRACKING_DIR)/${pkg_name#*-} && \\ + touch \$(TRACKING_DIR)/${pkg_name#*-?-} && \\ sleep .25 && \\ echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) @@ -71,7 +75,7 @@ __write_entry() { # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. __wrt_target "${script_name}" "$PREV_PACKAGE" - __write_build_cmd "${script_name}" "${script_name}" + __write_build_cmd # Include a touch of the target name so make can check # if it's already been made. @@ -94,7 +98,7 @@ generate_Makefile () { # >$MKFILE >$MKFILE.tmp - + for package_script in scripts/* ; do this_script=`basename $package_script` if [ ! -e $TRACKING_DIR/${this_script#*-} ]; then @@ -111,7 +115,7 @@ generate_Makefile () { # cat << EOF $HEADER -PACKAGE= "`basename $PKGXML .xml`" +PACKAGE= "`basename $PWD`" TRACKING_DIR= $TRACKING_DIR BOLD= "" @@ -147,3 +151,9 @@ EOF rm $MKFILE.tmp } + +generate_Makefile + +cp ../progress_bar.sh . + +mkdir -p logs diff --git a/BLFS/libs/constants.inc b/BLFS/libs/constants.inc index 3a3745a..9e44487 100644 --- a/BLFS/libs/constants.inc +++ b/BLFS/libs/constants.inc @@ -33,8 +33,3 @@ declare -r STAR_BORDER="${BOLD}************************************************* # bold yellow > < pair declare -r R_arrow=$'\e[1;33m>\e[0m' declare -r L_arrow=$'\e[1;33m<\e[0m' - -HEADER="# This file is automatically generated by jhalfs -# DO NOT EDIT THIS FILE MANUALLY -# -# Generated on `date \"+%F %X %Z\"`" diff --git a/BLFS/libs/func_dependencies b/BLFS/libs/func_dependencies index 53272dc..bd7aabf 100644 --- a/BLFS/libs/func_dependencies +++ b/BLFS/libs/func_dependencies @@ -62,7 +62,7 @@ inline_doc ENTRY_START="" - echo -en "\tGenerating $TARGET dependencies tree ..." + echo -e "\tGenerating $TARGET dependencies tree ..." mkdir dependencies @@ -120,18 +120,13 @@ inline_doc ;; esac - #------------------P--- - # Start with a clean depure.txt file - > depure.txt - #--------------------- # If have dependencies, write its XInclude and find sub-dependencies if [[ -f dependencies/$TARGET.dep ]]; then - echo -e "Start loop for PKG $TARGET\n" >> depure.txt mkdir xincludes && do_dependencies $TARGET fi - echo "done" + echo -e "\n\t... done" } @@ -166,13 +161,10 @@ inline_doc local saveIFS=$IFS local DEP_LV=$DEP_LEVEL local line line2 DEP - echo -e "\tPKG is $PKG" >> depure.txt - echo -e "\tDEP_LEVEL for $PKG is $DEP_LV\n" >> depure.txt #------------------ # If a premade xinclude file exists, use it. If not, create one if [[ -f xincludes/$PKG.xinc ]] ; then - echo -e "\tReusing xinclude file for PKG $PKG" >> depure.txt IFS=$'\x0A' for line in `cat xincludes/$PKG.xinc` ; do IFS=$saveIFS @@ -218,7 +210,6 @@ inline_doc esac #------------------ - echo -e "\tDEP for $PKG is $DEP" >> depure.txt # Prevent circular dependencies # If all dependencies are circular, the creation of the *.dep file # must be skipped, not placed here, to avoid that the script will bomb @@ -259,10 +250,8 @@ inline_doc esac #------------------ - echo -e "\tDEP_LEVEL for $DEP is $DEP_LV" >> depure.txt # XML file of dependency package DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2` - echo -e "\t\tDEP_XML is $DEP_XML\n" >> depure.txt case $DEP in x-window-system | alsa ) ;; # No page for that (proper link must be created when generating the book) xorg7 ) ;; # This page will be dump in the xorg7.xinc file @@ -309,7 +298,6 @@ inline_doc if [[ -f dependencies/$DEP.dep ]] ; then # If a premade xinclude file esist, include it if [[ -f xincludes/$DEP.xinc ]] ; then - echo -e "\tReusing xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt IFS=$'\x0A' for line2 in `cat xincludes/$DEP.xinc` ; do IFS=$saveIFS @@ -321,7 +309,6 @@ inline_doc #------------------ # Create the xinclude file else - echo -e "\nStart new loop for PKG $DEP (to solve $PKG)\n" >> depure.txt # # >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<< # @@ -329,13 +316,12 @@ inline_doc # However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables. # set +e - [[ "${VERBOSITY}" > 0 ]] && echo -ne "\nrecursive call: $((++cntr)) ${spaceSTR:0:$cntr} ${RED}$DEP${OFF}" + [[ "${VERBOSITY}" > 0 ]] && echo -ne "\ncall: $((++cntr))${spaceSTR:0:$cntr}${RED}$DEP${OFF}" do_dependencies $DEP - [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr ${spaceSTR:0:$((cntr--))} ${GREEN}$DEP${OFF}\tUsing the new xinclude file for PKG $DEP (to solve $PKG)" + [[ "${VERBOSITY}" > 0 ]] && echo -ne "\n ret: $cntr${spaceSTR:0:$((cntr--))}${GREEN}$DEP${OFF} Using $DEP Xinc to solve $PKG" set -e # Include it when done - echo -e "\tUsing the new xinclude file for PKG $DEP (to solve $PKG)\n" >> depure.txt IFS=$'\x0A' for line2 in `cat xincludes/$DEP.xinc` ; do IFS=$saveIFS @@ -357,7 +343,6 @@ inline_doc #------------------ mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc - echo -e "Using the new xinclude file for PKG $PKG" >> depure.txt IFS=$'\x0A' for line in `cat xincludes/$PKG.xinc` ; do IFS=$saveIFS @@ -366,6 +351,4 @@ inline_doc # Write the XInclude echo -e "$line" >> $TARGET-index.xml.tmp done - - echo -e "\nEnd loop for PKG $PKG\n" >> depure.txt } diff --git a/BLFS/libs/func_parser b/BLFS/libs/func_parser index ed37b1e..2f97be8 100644 --- a/BLFS/libs/func_parser +++ b/BLFS/libs/func_parser @@ -22,7 +22,7 @@ generate_TARGET_xml() { # inline_doc local - echo -en "\tGenerating $TARGET-index.xml ..." + echo -en "\n\tGenerating $TARGET-index.xml ..." #--------------------- # Header to $TARGET-index.xml @@ -98,7 +98,7 @@ generate_target_book() { # inline_doc local filename # output filename - echo -en "\tGenerating the HTML book for <$TARGET> from the xml files located in <$BLFS_XML>..." + echo -en "\n\tGenerating <$TARGET> HTML book from <$BLFS_XML> xml files ..." xsltproc --xinclude --nonet \ --stringparam mail_server $MAIL_SERVER \ --stringparam xwindow $X11 \ @@ -138,11 +138,11 @@ inline_doc # Log separator echo -e "\n\tScripts generation depuration and errors:\n" >> xsltproc.log - echo -en "\tGenerating the build scripts ..." + echo -en "\n\tGenerating the build scripts ..." xsltproc --xinclude --nonet \ -o ./scripts/ ../libs/scripts.xsl \ $TARGET-index.xml >> xsltproc.log 2>&1 - echo "done" + echo -e "done\n" # Make the scripts executable. chmod -R +x scripts diff --git a/BLFS/libs/scripts.xsl b/BLFS/libs/scripts.xsl index 391a65b..9daacba 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/libs/scripts.xsl @@ -83,7 +83,7 @@ - + #!/bin/sh set -e @@ -102,7 +102,7 @@ cd ~/sources/$PKG_DIR - rm -rf $UNPACKDIR + rm -rf $UNPACKDIR unpacked @@ -131,9 +131,15 @@ - tar -xvf $PACKAGE > unpacked - UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` - cd $UNPACKDIR + +if [[ -e unpacked ]] ; then + UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` + rm -rf $UNPACKDIR +fi +tar -xvf $PACKAGE > unpacked +UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` +cd $UNPACKDIR + @@ -304,7 +310,7 @@ elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then cp $SRC_ARCHIVE/$PACKAGE $PACKAGE else - wget $FTP_SERVER/BLFS/conglomeration/$PKG_DIR/$PACKAGE + wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE diff --git a/BLFS/makefile.conf b/BLFS/makefile.conf new file mode 100644 index 0000000..30c2472 --- /dev/null +++ b/BLFS/makefile.conf @@ -0,0 +1,22 @@ +##### +# +# Configuration file for the BLFS module +# +# $Id$ +# +# Set default SRC_ARCHIVE and FTP_DIR +# +##### + + +#--- The local repository for packages/file +# Any missing file will be downloaded and archived here, +# if the user has the right priviledges. +export SRC_ARCHIVE=$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/