From 63fc514fa4465531008488ff3e3e148ba03bffc4 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Wed, 22 Feb 2012 17:09:47 +0000 Subject: [PATCH] Initial modificaiton of BLFS tools --- BLFS/Makefile | 114 +++++-- BLFS/envars.conf | 8 +- BLFS/gen-makefile.sh | 143 ++------ BLFS/gen-special.sh | 132 ++++++++ BLFS/gen_config.sh | 288 ---------------- BLFS/gen_pkg_book.sh | 171 +++++----- BLFS/libs/book.xsl | 105 ------ BLFS/libs/dependencies.xsl | 47 --- BLFS/libs/func_dependencies | 585 ++++++++++----------------------- BLFS/libs/func_packages | 231 ------------- BLFS/libs/func_parser | 151 --------- BLFS/packdesc.dtd | 22 ++ BLFS/update_book.sh | 108 ------ BLFS/xsl/bump.xsl | 69 ++++ BLFS/xsl/dependencies.xsl | 154 +++++++++ BLFS/xsl/gen_config.xsl | 188 +++++++++++ BLFS/xsl/gen_pkg_list.xsl | 316 ++++++++++++++++++ BLFS/xsl/make_book.xsl | 268 +++++++++++++++ BLFS/{libs => xsl}/scripts.xsl | 355 +++++++++----------- README.BLFS | 164 ++++----- README.PACKAGE_MANAGEMENT | 13 + jhalfs | 4 +- 22 files changed, 1787 insertions(+), 1849 deletions(-) create mode 100755 BLFS/gen-special.sh delete mode 100755 BLFS/gen_config.sh delete mode 100644 BLFS/libs/book.xsl delete mode 100644 BLFS/libs/dependencies.xsl delete mode 100644 BLFS/libs/func_packages delete mode 100644 BLFS/libs/func_parser create mode 100644 BLFS/packdesc.dtd delete mode 100755 BLFS/update_book.sh create mode 100644 BLFS/xsl/bump.xsl create mode 100644 BLFS/xsl/dependencies.xsl create mode 100644 BLFS/xsl/gen_config.xsl create mode 100644 BLFS/xsl/gen_pkg_list.xsl create mode 100644 BLFS/xsl/make_book.xsl rename BLFS/{libs => xsl}/scripts.xsl (60%) diff --git a/BLFS/Makefile b/BLFS/Makefile index 210791a..7b3e347 100644 --- a/BLFS/Makefile +++ b/BLFS/Makefile @@ -1,40 +1,110 @@ # From the Build Scripts Written By: Jim Gifford # Modified By: Joe Ciccone +# Pierre Labastie -# $Id$ +# $Id: Makefile 36 2012-02-22 13:01:46Z labastie $ + +ifdef V + Q = +else + Q = @ +endif LANG=C LC_ALL=C +TRACKING_DIR = tracking-dir TOPDIR=$(shell pwd) -CONFIG_CONFIG_IN = Config.in -CONFIG = menu +BLFS_XML = $(TOPDIR)/blfs-xml +XSLDIR = $(TOPDIR)/xsl -all: menuconfig +RENDERTMP = $(BLFS_XML)/tmp +BLFS_FULL = $(RENDERTMP)/blfs-full.xml +PACK_LIST = $(TOPDIR)/packages.xml +MENU = $(TOPDIR)/menu +CONFIG_CONFIG_IN = $(TOPDIR)/Config.in +CONFIG_OUT = $(TOPDIR)/configuration +BOOK_XML = $(TOPDIR)/book.xml +TRACKFILE = $(TRACKING_DIR)/instpkg.xml -$(CONFIG)/conf: - $(MAKE) -B -C $(CONFIG) conf +define INITIAL_TRACK +\ +\ +\ +\ + Installed\ + +endef -$(CONFIG)/mconf: - $(MAKE) -B -C $(CONFIG) ncurses conf mconf +SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK -menuconfig: $(CONFIG)/mconf - @./update_book.sh none - @./gen_config.sh - @$(CONFIG)/mconf $(CONFIG_CONFIG_IN) - @./gen_pkg_book.sh +ALLXML := $(filter-out $(RENDERTMP)/%, \ + $(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml)) +ALLXSL := $(filter-out $(RENDERTMP)/%, \ + $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl)) -config: $(CONFIG)/conf - @$(CONFIG)/conf $(CONFIG_CONFIG_IN) +$(BOOK_XML): $(CONFIG_OUT) + $(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL) + +$(CONFIG_OUT): $(CONFIG_CONFIG_IN) $(MENU)/mconf + $(Q)$(MENU)/mconf $(CONFIG_CONFIG_IN) + +$(MENU)/mconf: + $(Q)$(MAKE) -C $(MENU) ncurses conf mconf + +$(CONFIG_CONFIG_IN): $(PACK_LIST) $(XSLDIR)/gen_config.xsl + $(Q)xsltproc --nonet -o $@ $(XSLDIR)/gen_config.xsl $(PACK_LIST) + +$(PACK_LIST): $(XSLDIR)/gen_pkg_list.xsl $(XSLDIR)/specialCases.xsl $(TRACKFILE) + $(Q)xsltproc --stringparam installed-packages $(TRACKFILE) \ + -o $@.tmp $(XSLDIR)/gen_pkg_list.xsl $(BLFS_FULL) + $(Q)xmllint --postvalid --format -o $@ $@.tmp + $(Q)rm $@.tmp + +$(TRACKFILE): $(TRACKING_DIR) + $(Q)if ! [ -f $@ ]; then \ + echo Initializing $(TRACKFILE) && \ + echo '$(INITIAL_TRACK)' > $@ && \ + $(MAKE) $(PACK_LIST) && \ + for track in $(TRACKING_DIR)/*-*; do \ + pack=$$(echo $$track | sed 's@.*/\(.*\)-[0-9c].*@\1@') && \ + xsltproc --stringparam packages $(PACK_LIST) \ + --stringparam package $$pack \ + -o track.tmp $(XSLDIR)/bump.xsl $@ && \ + sed -i 's@PACKDESC@$(TOPDIR)/packdesc.dtd@' track.tmp && \ + xmllint --format --postvalid track.tmp > $@; \ + done; \ + rm -f track.tmp; \ + fi + +$(TRACKING_DIR): + @echo Creating $(TRACKING_DIR) + $(Q)mkdir -p $@ + +$(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL) + $(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@ + +$(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL) + @echo "Validating the book..." + $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP) + $(Q)xmllint --nonet --noent --xinclude --postvalid \ + -o $@ $(BLFS_XML)/index.xml + +all: update $(BOOK_XML) + +update: $(BLFS_XML) + @echo Updating the book sources + $(Q)cd $(BLFS_XML) && svn up + +$(BLFS_XML): + @echo Getting the book sources... + $(Q)svn co $(SVN) $@ # Clean up clean: - rm -f configuration configuration.old error - - $(MAKE) -C $(CONFIG) clean + rm -f $(CONFIG_OUT) $(CONFIG_OUT).old $(TOPDIR)/packages.xml $(XSLDIR)/specialCases.xsl $(CONFIG_CONFIG_IN) book.xml + rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts + - $(MAKE) -C $(MENU) clean -clean-target: - rm -f error - - $(MAKE) -C $(CONFIG) clean - -.PHONY: all menuconfig config clean clean-target $(CONFIG)/conf $(CONFIG)/mconf +.PHONY: clean all update $(CONFIG_OUT) diff --git a/BLFS/envars.conf b/BLFS/envars.conf index d3b8986..c175589 100644 --- a/BLFS/envars.conf +++ b/BLFS/envars.conf @@ -16,7 +16,7 @@ export LC_ALL=C #--- 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 +export SRC_ARCHIVE=/sources #--- Server used if the file isn't found in SRC_ARCHIVE. # As a last resort, the file will dowloaded from upstream, if possible. @@ -25,11 +25,13 @@ export SRC_ARCHIVE=$SRC_ARCHIVE # http://www.linuxfromscratch.org/blfs/download.html export FTP_SERVER=ftp://anduin.linuxfromscratch.org/BLFS/ +# Use a server close to you for Xorg (see http://wiki.x.org/wiki/Mirrors) +export FTP_X_SERVER=ftp://mirror.cict.fr/x.org/ #--- The sources directory. # Full path to the top level directory where packages will be stored, # unpacked, and compiled. -export SRC_DIR=$HOME/sources +export SRC_DIR=/sources #======== Xorg7 envars =========== @@ -79,7 +81,7 @@ export KDE_PREFIX=/usr # expected, please rebuild without optimizations before # asking for support. -#export MAKEFLAGS="-j3" +export MAKEFLAGS="-j5" #export CFLAGS="-O3 -pipe" #export CXXFLAGS=$CFLAGS diff --git a/BLFS/gen-makefile.sh b/BLFS/gen-makefile.sh index 936ce49..948428e 100755 --- a/BLFS/gen-makefile.sh +++ b/BLFS/gen-makefile.sh @@ -5,10 +5,14 @@ set -e # TEMPORARY VARIABLES.. development use only +declare TOPDIR=$(cd ..; pwd) declare MKFILE=Makefile declare PREV_PACKAGE="" -declare BUILD_SCRIPTS=scripts -declare TRACKING_DIR=tracking-dir +declare BUILD_SCRIPTS=${TOPDIR}/scripts +declare TRACKING_FILE=tracking-dir/instpkg.xml +declare XSLDIR=${TOPDIR}/xsl +declare PACK_FILE=${TOPDIR}/packages.xml +declare BUMP=${XSLDIR}/bump.xsl HEADER="# This file is automatically generated by gen-makefile.sh # YOU MAY NEED TO EDIT THIS FILE MANUALLY @@ -38,7 +42,7 @@ __write_build_cmd() { # #----------------------------------# ( cat << EOF - @source ../envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 + @source ${TOPDIR}/envars.conf && ${BUILD_SCRIPTS}/\$@ >logs/\$@ 2>&1 EOF ) >> $MKFILE.tmp } @@ -47,50 +51,17 @@ EOF __wrt_touch() { # #----------------------------------# local pkg_name=$1 - local pkg_ver=$2 - local alsa_ver=$(grep "^alsa[[:space:]]" ../packages | cut -f3) - local kde_core_ver=$(grep "^kde-core[[:space:]]" ../packages | cut -f3) - local xorg7_ver=$(grep "^xorg7[[:space:]]" ../packages | cut -f3) - - if [[ -n "$pkg_ver" ]] ; then -( -cat << EOF - @rm -f \$(TRACKING_DIR)/${pkg_name#*-?-}-{0..9}* && \\ - touch \$(TRACKING_DIR)/${pkg_name#*-?-}-${pkg_ver} -EOF -) >> $MKFILE.tmp - fi - - case $pkg_name in - *-alsa-lib ) #this the unique mandatory package for ALSA support. -( -cat << EOF - @rm -f \$(TRACKING_DIR)/alsa-{0..9}* && \\ - touch \$(TRACKING_DIR)/alsa-${alsa_ver} -EOF -) >> $MKFILE.tmp - ;; - *-kdebase ) -( -cat << EOF - @rm -f \$(TRACKING_DIR)/kde-core-{0..9}* && \\ - touch \$(TRACKING_DIR)/kde-core-${kde_core_ver} -EOF -) >> $MKFILE.tmp - ;; - *-xorg7-driver ) # xtrerm2 and rman are optional -( -cat << EOF - @rm -f \$(TRACKING_DIR)/xorg7-{0..9}* && \\ - touch \$(TRACKING_DIR)/xorg7-${xorg7_ver} -EOF -) >> $MKFILE.tmp - ;; - esac ( cat << EOF - @touch \$@ && \\ + @xsltproc --stringparam packages ${PACK_FILE} \\ + --stringparam package ${pkg_name#*-?-} \\ + -o track.tmp \\ + ${BUMP} \$(TRACKING_FILE) && \\ + sed -i 's@PACKDESC@${TOPDIR}/packdesc.dtd@' track.tmp && \\ + xmllint --format --postvalid track.tmp > \$(TRACKING_FILE) && \\ + rm track.tmp && \\ + touch \$@ && \\ sleep .25 && \\ echo -e "\n\n "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) @@ -103,7 +74,6 @@ EOF __write_entry() { # #----------------------------# local script_name=$1 - local pkg_ver=$2 echo -n "${tab_}${tab_} entry for <$script_name>" @@ -118,7 +88,7 @@ __write_entry() { # # Include a touch of the target name so make can check # if it's already been made. - __wrt_touch "${script_name}" "${pkg_ver}" + __wrt_touch "${script_name}" # #--------------------------------------------------------------------# # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # @@ -126,50 +96,6 @@ __write_entry() { # echo " .. OK" } -#----------------------------# -__write_meta_pkg_touch() { # -#----------------------------# - local meta_pkg=$1 - local pkg_ver=$(grep "^${meta_pkg}[[:space:]]" ../packages | cut -f3) - local gnome_core_ver=$(grep "^gnome-core[[:space:]]" ../packages | cut -f3) - local kde_full_ver=$(grep "^kde-full[[:space:]]" ../packages | cut -f3) - -( -cat << EOF - -999-z-$meta_pkg: $PREV_PACKAGE - @rm -f \$(TRACKING_DIR)/${meta_pkg}-{0..9}* && \\ - touch \$(TRACKING_DIR)/${meta_pkg}-${pkg_ver} -EOF -) >> $MKFILE.tmp - - case $meta_pkg in - gnome-full ) -( -cat << EOF - @rm -f \$(TRACKING_DIR)/gnome-core-{0..9}* && \\ - touch \$(TRACKING_DIR)/gnome-core-${gnome_core_ver} -EOF -) >> $MKFILE.tmp - ;; - kde-koffice ) -( -cat << EOF - @rm -f \$(TRACKING_DIR)/kde-full-{0..9}* && \\ - touch \$(TRACKING_DIR)/kde-full-${kde_full_ver} -EOF -) >> $MKFILE.tmp - ;; - esac - -( -cat << EOF - @touch \$@ -EOF -) >> $MKFILE.tmp - -} - #----------------------------# generate_Makefile () { # #----------------------------# @@ -182,36 +108,18 @@ generate_Makefile () { # >$MKFILE.tmp - for package_script in scripts/* ; do + for package_script in ${BUILD_SCRIPTS}/* ; do this_script=`basename $package_script` - pkg_ver=$(grep "^${this_script#*-?-}[[:space:]]" ../packages | cut -f3) pkg_list="$pkg_list ${this_script}" - __write_entry "${this_script}" "${pkg_ver}" + __write_entry "${this_script}" PREV_PACKAGE=${this_script} done - PACKAGE=$(basename $PWD) - - # alsa, kde-core and xorg7 are also available dependencies, thus handled - # in another way. - case $PACKAGE in - gnome-core | \ - gnome-full | \ - kde-full | \ - kde-koffice ) pkg_list="$pkg_list 999-z-${PACKAGE}" - __write_meta_pkg_touch "${PACKAGE}" - ;; - esac - - - # Add a header, some variables and include the function file - # to the top of the real Makefile. ( cat << EOF $HEADER -PACKAGE= $PACKAGE -TRACKING_DIR= $TRACKING_DIR +TRACKING_FILE= $TRACKING_FILE BOLD= "" RED= "" @@ -228,7 +136,7 @@ define echo_message endef -define fin_message +define end_message @echo \$(BOLD) @echo -------------------------------------------------------------------------------- @echo \$(BOLD) Build complete for the package \$(BLUE)\$(PACKAGE)\$(BOLD) and its dependencies @@ -236,7 +144,7 @@ define fin_message endef all : $pkg_list - @\$(call fin_message ) + @\$(call end_message ) EOF ) > $MKFILE @@ -247,13 +155,8 @@ EOF } -if [[ -e Config.in ]] ; then - echo -e "\n\tThis script must be run from inside a target package directory.\n" - exit 1 -fi - -if [[ ! -d scripts ]] ; then - echo -e "\n\tNo ./scripts/ directory has been found.\n" +if [[ ! -d ${BUILD_SCRIPTS} ]] ; then + echo -e "\n\tThe \'${BUILD_SCRIPTS}\' directory has not been found.\n" exit 1 fi diff --git a/BLFS/gen-special.sh b/BLFS/gen-special.sh new file mode 100755 index 0000000..a564acb --- /dev/null +++ b/BLFS/gen-special.sh @@ -0,0 +1,132 @@ +#!/bin/bash + +# $Id: gen-special.sh 21 2012-02-16 15:06:19Z labastie $ + +BLFS_XML=$1 +if ! test -f ${BLFS_XML}; then + echo ${BLFS_XML} does not exist + exit 1 +fi +SPECIAL_FILE=$2 +if test -z "${SPECIAL_FILE}"; then SPECIAL_FILE=specialCases.xsl;fi +# Packages whose version does not begin with a number +EXCEPTIONS=$(grep 'ENTITY.*version[ ]*"[^0-9"&.].*[0-9]' $BLFS_XML | + sed 's@^[^"]*"\([^"]*\)".*@\1@') +# Version for X Window packages without a version in the book +XVERSION=$(grep 'ENTITY xorg7-release' $BLFS_XML | + sed 's@^[^"]*"\([^"]*\)".*@\1@') +# The case of udev +# Set PATH to be sure to find udevadm +SAVPATH=$PATH +PATH=/bin:/sbin:/usr/bin:/usr/sbin +UDEVVERSION=$(udevadm --version) + +cat >$SPECIAL_FILE << EOF + + + + + + + + + + + + $UDEVVERSION + + + + + + + + + + + + + + + + + + + $XVERSION + + + + + + + + + + + + +EOF + +for ver_ent in $EXCEPTIONS; do + id=$(grep 'xreflabel=".*'$ver_ent $BLFS_XML | sed 's@.*id="\([^"]*\)".*@\1@') + [[ -z $id ]] && continue + cat >>$SPECIAL_FILE << EOF + + + + $id + + $ver_ent + + + + + + + + + + + + +EOF +done + +cat >>$SPECIAL_FILE << EOF + + + + + + + +EOF diff --git a/BLFS/gen_config.sh b/BLFS/gen_config.sh deleted file mode 100755 index f05d347..0000000 --- a/BLFS/gen_config.sh +++ /dev/null @@ -1,288 +0,0 @@ -#!/bin/bash -# -# $Id$ -# - -export outFile=Config.in # file for reading and writing to. -export inFile=packages # file for reading and writing to. - -declare PKG_NAME -declare PKG_XML_FILE -declare PKG_DIR -declare PKG_VER -declare INST_VER -declare INST_STRING -declare SAVE_IFS=${IFS} -declare -a DIR_TREE -declare PREV_DIR1="none" -declare PREV_DIR2="none" -declare MENU_SET1="n" -declare MENU_SET2="n" - -> $outFile - -#---------------------# -# MAIN # -#---------------------# -: <. - Packages previously installed will not be included. -enddoc - -echo -en "\tGenerating Config.in from package data ..." -while [ 0 ] -do - -# read -r || break 1 - read || break 1 - - set -- $REPLY - PKG_NAME=$1 - PKG_XML_FILE=$(basename $2) - PKG_DIR=$(dirname $2) - PKG_VER=$3 - INST_VER=$4 - # These are the META packages. - if [ $PKG_DIR = "." ]; then - SET_COMMENT=y - # Do not include previously installed packages - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then - continue - fi - # Do not include installed packages newer than the book ones - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then - continue - fi - # Set installed version for updated meta-packages - [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]" - - META_PKG=$(echo ${PKG_NAME} | tr [a-z] [A-Z]) -( -cat << EOF - config CONFIG_$META_PKG - bool "$META_PKG $PKG_VER $INST_STRING" - default n - - menu "$(echo ${PKG_NAME} | tr [a-z] [A-Z]) components" - depends CONFIG_$META_PKG - -EOF -) >> $outFile - - unset INST_STRING - - # Include the dependency data for this meta package - while [ 0 ]; do - read || break 1 - PKG_NAME=${REPLY} - PKG_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f3) - INST_VER=$(grep "^${PKG_NAME}[[:space:]]" $inFile | cut -f4) - # Skip installed meta-package components - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then - continue - fi - # Do not include installed packages newer than the book ones - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then - continue - fi - # Set installed version for updated meta-packages components - [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]" -( -cat << EOF - config DEP_${META_PKG}_${PKG_NAME} - bool "$PKG_NAME ${PKG_VER} ${INST_STRING}" - default y - -EOF -) >> $outFile - unset INST_STRING - done <./libs/${PKG_NAME}.dep - echo -e "endmenu" >> $outFile - continue - fi - [[ "${SET_COMMENT}" = "y" ]] && echo "comment \"\"" >>$outFile; unset SET_COMMENT - - # Deal with targets that are part of a meta-package but that are in the same - # directory that non meta-package targets - case ${PKG_NAME} in - alsa-* | \ - xorg7-* | \ - x-config | \ - x-setup | \ - libXau | \ - libxcb | \ - libXdmcp | \ - luit | \ - xbitmaps | \ - xcb-proto | \ - xkeyboard-config | \ - mesalib | \ - libdrm ) continue ;; - esac - - # Skip installed packages - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" = "x${INST_VER}" ]]; then - continue - fi - # Do not include installed packages newer than the book ones - if [ -n "${PKG_VER}" ] && [[ "x${PKG_VER}" < "x${INST_VER}" ]]; then - continue - fi - # Set installed version for updated packages - [ -n "${INST_VER}" ] && INST_STRING="[installed ${INST_VER}]" - - IFS="/" - DIR_TREE=(${PKG_DIR}) - IFS="$SAVE_IFS" - - # Define a top level menu - if [ "$PREV_DIR1" != "${DIR_TREE[1]}" ]; then - [[ "${DIR_TREE[1]}" = "kde" ]] && continue - [[ "${DIR_TREE[1]}" = "gnome" ]] && continue - - if [ $MENU_SET1 = "y" ]; then - # Close out any open secondary menu - if [ $MENU_SET2 = "y" ]; then - echo -e "\tendmenu" >> $outFile - # Reset 'menu open' flag - MENU_SET2="n" - fi - # Close the current top level menu - echo -e "endmenu\n" >> $outFile - fi - # Open a new top level menu - echo -e "menu "$(echo ${DIR_TREE[1]:0:1} | tr [a-z] [A-Z])${DIR_TREE[1]:1}"" >> $outFile - MENU_SET1="y" - fi - - # Define a secondary menu - if [ "$PREV_DIR2" != "${DIR_TREE[2]}" ]; then - # Close out the previous open menu structure - if [ $MENU_SET2 = "y" ]; then - echo -e "\tendmenu\n" >> $outFile - fi - # Initialize a new 2nd level menu structure. - echo -e "\tmenu "$(echo ${DIR_TREE[2]:0:1} | tr [a-z] [A-Z])${DIR_TREE[2]:1}"" >> $outFile - MENU_SET2="y" - fi -( -cat << EOF - config CONFIG_$PKG_NAME - bool "$PKG_NAME ${PKG_VER} ${INST_STRING}" - default n -EOF -) >> $outFile - - unset INST_STRING - - PREV_DIR1=${DIR_TREE[1]} - PREV_DIR2=${DIR_TREE[2]} -done <"$inFile" - -if [ $MENU_SET2 = "y" ]; then echo -e "\tendmenu" >> $outFile; fi -if [ $MENU_SET1 = "y" ]; then echo "endmenu" >> $outFile; fi - -( -cat << EOF - -comment "" - -menu "Default packages for resolving dependencies" - -choice - prompt "Default print server" - config PS_cups - bool "cups" - config PS_LPRng - bool "LPRng" -endchoice -config PRINT_SERVER - string - default cups if PS_cups - default LPRng if PS_LPRng - -choice - prompt "Mail server" - config MS_sendmail - bool "sendmail" - config MS_postfix - bool "postfix" - config MS_exim - bool "exim" -endchoice -config MAIL_SERVER - string - default sendmail if MS_sendmail - default postfix if MS_postfix - default exim if MS_exim - -choice - prompt "Postscript package" - config GS_espgs - bool "espgs" - config GS_ghostscript - bool "ghostscript" -endchoice -config GHOSTSCRIPT - string - default espgs if GS_espgs - default ghostscript if GS_ghostscript - -choice - prompt "Kerberos 5" - config KER_mitkrb - bool "mitkrb" - config KER_heimdal - bool "heimdal" -endchoice -config KBR5 - string - default heimdal if KER_heimdal - default mitkrb if KER_mitkrb - -choice - prompt "Window package" - config WIN_xorg7 - bool "Xorg7" - config WIN_xfree86 - bool "xfree86" -endchoice -config X11 - string - default xorg7 if WIN_xorg7 - default xfree86 if WIN_xfree86 -endmenu - -choice - prompt "Dependency level" - default DEPLVL_2 - - config DEPLVL_1 - bool "Required dependencies only" - - config DEPLVL_2 - bool "Required and recommended dependencies" - - config DEPLVL_3 - bool "Required, recommended and optional dependencies" - -endchoice -config optDependency - int - default 1 if DEPLVL_1 - default 2 if DEPLVL_2 - default 3 if DEPLVL_3 - - -config SUDO - bool "Build as User" - default y - help - Select if sudo will be used (you want build as a normal user) - otherwise sudo is not needed (you want build as root) -EOF -) >> $outFile -echo "done" - - diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh index 9d720b2..a46a59a 100755 --- a/BLFS/gen_pkg_book.sh +++ b/BLFS/gen_pkg_book.sh @@ -6,22 +6,34 @@ # set -e -declare -r ConfigFile="configuration" -declare TARGET +TOPDIR=$1 +if test -z "TOPDIR"; then + TOPDIR=$(pwd) +fi +BLFS_FULL=$2 +if test -z "BLFS_FULL"; then + BLFS_FULL=${TOPDIR}/blfs-xml/tmp/blfs-full.xml +fi +declare -r ConfigFile="${TOPDIR}/configuration" +declare DepDir="${TOPDIR}/dependencies" +declare LibDir="${TOPDIR}/libs" +declare PackFile="${TOPDIR}/packages.xml" +declare BookXml="${TOPDIR}/book.xml" +declare MakeBook="${TOPDIR}/xsl/make_book.xsl" +declare MakeScripts="${TOPDIR}/xsl/scripts.xsl" +declare BookHtml="${TOPDIR}/book-html" +declare BLFS_XML="${TOPDIR}/blfs-xml" +declare -a TARGET declare DEP_LEVEL declare SUDO -declare PKGXML -declare BLFS_XML -declare VERBOSITY=1 #--------------------------# parse_configuration() { # #--------------------------# - local cntr - local optTARGET + local -i cntr=0 + local -a optTARGET - while [ 0 ]; do - read || break 1 + while read; do # Garbage collection case ${REPLY} in @@ -29,51 +41,28 @@ parse_configuration() { # esac case "${REPLY}" in - CONFIG_ALSA=* | \ - CONFIG_GNOME-CORE=* | \ - CONFIG_GNOME-FULL=* | \ - CONFIG_KDE-CORE=* | \ - CONFIG_KDE-FULL=* | \ - CONFIG_KDE-KOFFICE=* | \ - CONFIG_XORG7=* ) REPLY=${REPLY%=*} # Strip the trailing '=y' test.. unecessary - echo -n "${REPLY}" - if [[ $((++cntr)) > 1 ]]; then - echo " <<-- ERROR:: SELECT ONLY 1 PACKAGE AT A TIME, META-PACKAGE NOT SELECTED" - else - echo "" - optTARGET=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z]) - fi - continue ;; - # Create global variables for these parameters. optDependency=* | \ PRINT_SERVER=* | \ MAIL_SERVER=* | \ GHOSTSCRIPT=* | \ KBR5=* | \ - X11=* | \ SUDO=* ) eval ${REPLY} # Define/set a global variable.. continue ;; esac if [[ "${REPLY}" =~ ^CONFIG_ ]]; then - echo -n "$REPLY" - if [[ $((++cntr)) > 1 ]]; then - echo " <<-- ERROR SELECT ONLY 1 PACKAGE AT A TIME, WILL NOT BUILD" - else - echo "" - optTARGET=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' ) - fi + echo "$REPLY" + optTARGET[$((cntr++))]=$( echo $REPLY | sed -e 's@CONFIG_@@' -e 's@=y@@' ) fi - done <$ConfigFile + done < $ConfigFile - if [[ $optTARGET = "" ]]; then - echo -e "\n>>> NO TARGET SELECTED.. applicaton terminated" - echo -e " Run again and select a package to build\n" + if (( $cntr == 0 )); then + echo -e "\n>>> NO TARGET SELECTED.. application terminated" + echo -e " Run again and select (a) package(s) to build\n" exit 0 fi - - TARGET=$optTARGET + TARGET=(${optTARGET[*]}) DEP_LEVEL=$optDependency SUDO=${SUDO:-n} } @@ -82,43 +71,32 @@ parse_configuration() { # validate_configuration() { # #--------------------------# local -r dotSTR=".................." - local -r PARAM_LIST="TARGET DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5 X11" + local -r PARAM_LIST="DEP_LEVEL SUDO PRINT_SERVER MAIL_SERVER GHOSTSCRIPT KBR5" local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}' local config_param + local -i index for config_param in ${PARAM_LIST}; do echo -e "`eval echo $PARAM_VALS`" done + for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do + echo -e "TARGET${index}${dotSTR:6} ${L_arrow}${BOLD}${TARGET[${index}]}${OFF}${R_arrow}" + done } # -# Regenerate the META-package dependencies from the configuration file +# Generates the root of the dependency tree # #--------------------------# -regenerate_deps() { # +generate_deps() { # #--------------------------# - rm -f libs/*.dep-MOD - while [ 0 ]; do - read || break 1 - case ${REPLY} in - \#* | '') continue ;; - esac - - # Drop the "=y" - REPLY=${REPLY%=*} - if [[ "${REPLY}" =~ ^DEP_ ]]; then - META_PACKAGE=$(echo $REPLY | cut -d "_" -f2 | tr [A-Z] [a-z]) - DEP_FNAME=$(echo $REPLY | cut -d "_" -f3) - echo "${DEP_FNAME}" >>libs/${META_PACKAGE}.dep-MOD - fi - - done <$ConfigFile - # - # Replace to 'old' dependency file with a new one. - # - for dst in `ls ./libs/*.dep-MOD 2>/dev/null`; do - cp -vf $dst ${dst%-MOD} + local -i index + local DepDir=$1 + rm -f $DepDir/*.dep + echo 1 > $DepDir/root.dep + for (( index=0 ; index < ${#TARGET[*]} ; index ++ )); do + echo ${TARGET[${index}]} >> $DepDir/root.dep done } @@ -131,29 +109,23 @@ regenerate_deps() { # clean_configuration() { # #--------------------------# -tail -n 29 configuration > configuration.tmp -mv configuration.tmp configuration +tail -n 15 ${ConfigFile} > ${ConfigFile}.tmp +mv ${ConfigFile}.tmp ${ConfigFile} } #--------------------- # Constants -source libs/constants.inc +source ${LibDir}/constants.inc [[ $? > 0 ]] && echo -e "\n\tERROR: constants.inc did not load..\n" && exit #--------------------- # Dependencies module -source libs/func_dependencies +source ${LibDir}/func_dependencies [[ $? > 0 ]] && echo -e "\n\tERROR: func_dependencies did not load..\n" && exit -#--------------------- -# parser module -source libs/func_parser -[[ $? > 0 ]] && echo -e "\n\tERROR: func_parser did not load..\n" && exit - - #------- MAIN -------- -if [[ ! -f packages ]] ; then +if [[ ! -f ${PackFile} ]] ; then echo -e "\tNo packages file has been found.\n" echo -e "\tExecution aborted.\n" exit 1 @@ -170,9 +142,48 @@ if [ x$ANSWER != "xyes" ] ; then exit 1 fi echo "${nl_}${SD_BORDER}${nl_}" -regenerate_deps -generate_dependency_tree -generate_TARGET_xml -generate_target_book -create_build_scripts "${SUDO}" -clean_configuration + +rm -rf $DepDir +mkdir $DepDir +generate_deps $DepDir +pushd $DepDir > /dev/null +set +e +generate_dependency_tree root.dep +echo +LIST="$(tree_browse root.dep)" +set -e +popd > /dev/null +rm -f ${BookXml} +echo Making XML book +xsltproc --stringparam list "$LIST" \ + -o ${BookXml} \ + ${MakeBook} \ + $BLFS_FULL +echo "making HTML book (may take some time...)" +xsltproc -o ${BookHtml}/ \ + -stringparam chunk.quietly 1 \ + ${BLFS_XML}/stylesheets/blfs-chunked.xsl \ + ${BookXml} +if [ ! -d ${BookHtml}/stylesheets ] + then mkdir -p ${BookHtml}/stylesheets + cp ${BLFS_XML}/stylesheets/lfs-xsl/*.css book-html/stylesheets +fi +if [ ! -d ${BookHtml}/images ] + then mkdir -p ${BookHtml}/images + cp ${BLFS_XML}/images/*.png book-html/images +fi +for ht in ${BookHtml}/*.html + do sed -i 's@../stylesheets@stylesheets@' $ht + sed -i 's@../images@images@' $ht +done +echo -en "\n\tGenerating the build scripts ..." +rm -rf scripts +xsltproc --xinclude --nonet \ + --stringparam sudo $SUDO \ + -o ./scripts/ ${MakeScripts} \ + ${BookXml} +# Make the scripts executable. +chmod -R +x scripts +echo -e "done\n" + +#clean_configuration diff --git a/BLFS/libs/book.xsl b/BLFS/libs/book.xsl deleted file mode 100644 index 1a1c6b5..0000000 --- a/BLFS/libs/book.xsl +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - alsa-lib - - - aRts - - - kdelibs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (in the full book) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BLFS/libs/dependencies.xsl b/BLFS/libs/dependencies.xsl deleted file mode 100644 index f62a271..0000000 --- a/BLFS/libs/dependencies.xsl +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BLFS/libs/func_dependencies b/BLFS/libs/func_dependencies index c92416e..b3b2d80 100644 --- a/BLFS/libs/func_dependencies +++ b/BLFS/libs/func_dependencies @@ -2,436 +2,195 @@ # # $Id$ # -set -e -declare -i cntr=0 +# A string of spaces for indenting: declare -a spaceSTR=" " +declare -a exchange_triplet + +# In case we find a cirdular dependency, it has the form : +# parent->dependency_0->...->dependency_n->dependency_0 +# If we want to build dependency_n before dependency_0, +# no problem: we just prune the tree at dependency_n. +# If we want to build first dependency_0, we need to +# put dependency_n as a dependency of parent. The triplet +# above shall contain (parent dependency_0 dependency_n) #----------------------------# generate_dependency_tree() { # #----------------------------# : < 2 )) && (( $depth > 1 )); then dep_level=2; fi +srootlink="${rootlink[*]} " +# start of Depfile +echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF}" + +while read -u6 id_of_dep; do +# count entries in file + (( count++ )) +# Has this entry already been seen? + if [ -f ${id_of_dep}.dep ]; then # found ${id_of_dep}.dep already in tree + otherlink=($(head -n 1 ${id_of_dep}.dep)) + if [ -z "${otherlink[*]}" ] + then echo otherlink empty for $id_of_dep.dep + echo This should not happen, but happens to happen... + exit 1 + fi +# Do not use "${rootlink[*]}" =~ "${otherlink[*]}": case rootlink=(1 11) +# and otherlink=(1 1) + if [[ ${srootlink#"${otherlink[*]} "} != ${srootlink} ]]; then # circular dep +# First look for the other parent of this dependency. +# The parent has the same link without the last entry. +# We do not need otherlink anymore so just destroy the last element + unset otherlink[${#otherlink[*]}-1] + parent=$(grep ^"${otherlink[*]}"\$ -l *) + parent=${parent%.dep} + echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BLUE}Circular dependency detected:${OFF}" + echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \ +of ${BOLD}${parent}${OFF}" + echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${DepFile%.dep}${OFF} is a dependency \ +of ${BOLD}${id_of_dep}${OFF}" + echo -en "\nCirc: $depth${spaceSTR:0:$depth}${BOLD}${id_of_dep}${OFF} is a dependency \ +of ${BOLD}${DepFile%.dep}${OFF}" +# If idofdep is the parent of DepFile, we can exchange them if required +# if grep -q ${DepFile%.dep} ${id_of_dep}.dep; then +# we propose exchange always + echo -en "\nCirc: $depth${spaceSTR:0:$depth}Do you want to build ${id_of_dep} first? yes/no (no):" + read ANSWER + if [ x$ANSWER = "xyes" ] ; then # exchange: +# set triplet and return 1 + exchange_triplet=($parent $id_of_dep ${DepFile%.dep}) + return 1 + else # no exchange: prune + lines_to_remove="$lines_to_remove $id_of_dep" + fi +# else +# lines_to_remove="$lines_to_remove $id_of_dep" +# fi + else # not circular: prune + lines_to_remove="$lines_to_remove $id_of_dep" + fi + continue fi + flag=true + while [ $flag = true ]; do + flag=false + xsltproc --stringparam dependencies ${dep_level} \ + --stringparam idofdep $id_of_dep \ + -o ${id_of_dep}.dep \ + ../xsl/dependencies.xsl ../packages.xml - #--------------------- - # XML file of the target package - PKGXML=`grep "^$TARGET[[:space:]]" ../packages | cut -f2` - - #--------------------- - # The BLFS sources directory. - BLFS_XML=`echo $PKGXML | sed -e 's,/.*,,'` - - if [[ ! -d ../$BLFS_XML ]] ; then - echo -e "\tThe BLFS book sources directory is missing.\n" - echo -e "\tExecution aborted.\n" - cd .. && rmdir $TARGET - exit 1 - fi - - #--------------------- - # XInclude stuff - ENTRY_START="" - - echo -e "\tGenerating $TARGET dependencies tree ..." - - mkdir dependencies - - #--------------------- - # Create target package dependencies list - case $TARGET in - # Skip the creation when all dependencies are circular. - alsa-lib | cracklib | libexif | unixodbc ) ;; - - # Meta-packages at target level - alsa ) - cp ../libs/alsa.dep dependencies/ - ;; - gnome-core ) - cp ../libs/gnome-core.dep dependencies/ - ;; - gnome-full ) - cp ../libs/gnome-{core,full}.dep dependencies/ - ;; - kde-core ) - cp ../libs/kde-core.dep dependencies/ - ;; - kde-full ) - cp ../libs/kde-{core,full}.dep dependencies/ - ;; - kde-koffice ) - cp ../libs/kde-{core,full,koffice}.dep dependencies/ - ;; - xorg7 ) - cp ../libs/xorg7.dep dependencies/ - ;; - * ) # Default - xsltproc --stringparam dependencies $DEP_LEVEL \ - -o dependencies/$TARGET.dep \ - ../libs/dependencies.xsl ../$PKGXML - ;; - esac - - #--------------------- - # Start with a clean $TARGET-index.xml.tmp file - > $TARGET-index.xml.tmp - - #--------------------- - # Write the XInclude - case $TARGET in - # If there is no usefull XML page, skip it. - alsa | gnome-core | gnome-full | kde-core | kde-full | kde-koffice | xorg7) ;; - * ) - echo -e " $ENTRY_START$PKGXML$ENTRY_END" >> $TARGET-index.xml.tmp - ;; - esac - - #--------------------- - # If have dependencies, write its XInclude and find sub-dependencies - if [[ -f dependencies/$TARGET.dep ]]; then - mkdir xincludes && do_dependencies $TARGET - fi - - echo -e "\n\t... done" -} - - - -#-----------------------# -do_dependencies() { # Loop to find sub-dependencies :::WARNING::: THIS IS A RECURVISE FUNCTION -#-----------------------# -: <> $TARGET-index.xml.tmp - done - return - fi - - #------------------ - # Start with a clean $PKG.xinc.tmp file - > xincludes/$PKG.xinc.tmp - for DEP in `cat dependencies/$PKG.dep`; do - - # Special packages that need be remaped - case $DEP in - - db ) continue ;; # The proper version of DB is installed in LFS - - # Don't have their own XML file - hal-requirements | hal-runtime-dependencies ) continue ;; - perl-* | tk-perl ) DEP=perl-modules ;; - dbus-* ) DEP=dbus-bindings ;; - pyxml | pycairo | pygobject | pygtk | pyorbit | \ - gnome-python | gnome-python-desktop ) DEP=python-modules ;; - - # Orphan links (proper link must be created when generating the book) - arts ) DEP=aRts ;; - kde ) DEP=kde-core ;; - - # Set values for alternative packages - LPRng | cups ) DEP=$PRINT_SERVER ;; - mitkrb | heimdal ) DEP=$KBR5 ;; - gs | espgs ) DEP=$GHOSTSCRIPT ;; - server-mail ) DEP=$MAIL_SERVER ;; - x-window-system ) - case $X11 in - xorg7 ) DEP=xorg7 ;; - * ) - pkg_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f3) - inst_ver=$(grep "^${X11}[[:space:]]" ../packages | cut -f4) - [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue - [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue - ;; - esac - ;; - esac - - # If DEP has been previouly installed, skip it - pkg_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f3) - inst_ver=$(grep "^${DEP}[[:space:]]" ../packages | cut -f4) - [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" = "x${inst_ver}" ]] && continue - [ -n "${pkg_ver}" ] && [[ "x${pkg_ver}" < "x${inst_ver}" ]] && continue - - #------------------ - # 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 - # due empty *.xinc files - case $DEP in - akode ) - # Both are in the same page - [[ "$PKG" = "kdemultimedia" ]] && continue - ;; - aRts ) - # esound-->aRts-->esound - [[ "$PKG" = "esound" ]] && continue - ;; - dbus-bindings ) - # True circular dependecy - [[ "$PKG" = "dbus-bindings" ]] && continue - ;; - DocBook ) - # Used to rebuild the documentation - [[ "$PKG" = "linux-pam" ]] && continue - ;; - docbook-xsl ) - # Used to rebuild the documentation - [[ "$PKG" = "linux-pam" ]] && continue - ;; - doxygen ) - # Used to rebuild the documentation - [[ "$PKG" = "dbus" ]] && continue - [[ "$PKG" = "libdvdcss" ]] && continue - [[ "$PKG" = "libusb" ]] && continue - [[ "$PKG" = "libxcb" ]] && continue - ;; - espgs ) - # Used to rebuild the documentation - [[ "$PKG" = "$MAIL_SERVER" ]] && continue - ;; - ffmpeg ) - # alsa-plugins-->ffmpeg-->several-->alsa-plugins - [[ "$PKG" = "alsa-plugins" ]] && continue - ;; - fop ) - # Used to rebuild the documentation - [[ "$PKG" = "linux-pam" ]] && continue - ;; - graphviz ) - # Used to build the API documentation - [[ "$PKG" = "libusb" ]] && continue - ;; - GTK ) - # deprecated GTK version - [[ "$PKG" = "alsa-tools" ]] && continue - ;; - gtk2 ) - # Testsuite only - [[ "$PKG" = "cairo" ]] && continue - ;; - jadetex ) - # Runtime only - [[ "$PKG" = "docbook-utils" ]] && continue - ;; - $KBR5 ) - # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl - [[ "$PKG" = "cyrus-sasl" ]] && continue - ;; - librsvg ) - # Testsuite only - [[ "$PKG" = "cairo" ]] && continue - ;; - libxslt ) - # libxml2-->libxslt-->libxml2 - [[ "$PKG" = "libxml2" ]] && continue - ;; - Links ) - # Runtime only - [[ "$PKG" = "docbook-utils" ]] && continue - ;; - lynx ) - # Runtime only - [[ "$PKG" = "docbook-utils" ]] && continue - ;; - openldap ) - # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl - [[ "$PKG" = "cyrus-sasl" ]] && continue - ;; - poppler ) - # Testsuite only - [[ "$PKG" = "cairo" ]] && continue - ;; - postgresql ) - # cyrus-sasl-->postgresql-->$KBR5-->openldap-->cyrus-sasl - [[ "$PKG" = "cyrus-sasl" ]] && continue - ;; - python-modules ) - # True circular dependecy - [[ "$PKG" = "python-modules" ]] && continue - # libgsf-->python-modules-->several combinations-->libgsf - [[ "$PKG" = "libgsf" ]] && continue - # gimp-->python-modules-->several combinations-->gimp - [[ "$PKG" = "gimp" ]] && continue - # Used to rebuild the documentation - [[ "$PKG" = "gstreamer" ]] && continue - [[ "$PKG" = "gst-plugins-base" ]] && continue - [[ "$PKG" = "gst-plugins-good" ]] && continue - ;; - tk ) - # python-->tk-->xorg7-->several combinations-->libxslt-->python - [[ "$PKG" = "python" ]] && continue - ;; - w3m ) - # Runtime only - [[ "$PKG" = "docbook-utils" ]] && continue - # Used to rebuild the documentation - [[ "$PKG" = "linux-pam" ]] && continue - ;; - esac - - #------------------ - # XML file of dependency package - DEP_XML=`grep "^$DEP[[:space:]]" ../packages | cut -f2` - 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 - gnome-core | kde-core | kde-full ) ;; # Invented packages - * ) - # Remove the Xinclude entry if found - sed -e "s,^[[:space:]]*$ENTRY_START$DEP_XML$ENTRY_END,," \ - -e '/./!d' -i xincludes/$PKG.xinc.tmp - # Write the XInclude - echo -e " $ENTRY_START$DEP_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp - ;; - esac - - #------------------ - # If not already created, create its dependencies list - if [[ ! -f dependencies/$DEP.dep ]] ; then - case $DEP in - # Skip the creation when all dependencies are circular. - alsa-lib | cracklib | libexif | unixodbc ) ;; - # Meta-packages at dependency level - alsa ) - cp ../libs/alsa.dep dependencies/ - ;; - kde-core ) - cp ../libs/kde-core.dep dependencies/ - ;; - x-window-system ) # When X11 is not Xorg7 - echo -e "x-config\nx-setup\n$X11" > dependencies/x-window-system.dep - ;; - xorg7 ) - cp ../libs/xorg7.dep dependencies/ - ;; - * ) xsltproc --stringparam dependencies $DEP_LV \ - -o dependencies/$DEP.dep ../libs/dependencies.xsl ../$DEP_XML - ;; + if [[ -f ${id_of_dep}.dep ]]; then + sed -i "1i${rootlink[*]} $count" ${id_of_dep}.dep + generate_dependency_tree ${id_of_dep}.dep +# Test return value, in case we exchange dependencies + case $? in + 0) # Normal return + ;; + 1) # We are backing up to parent + if [[ ${exchange_triplet} == ${DepFile%.dep} ]] + then tree_erase ${id_of_dep}.dep +# Just doing a sed -i "s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile +# is not good if $DepFile contains several times the same line +# so first find the first line and then sed + lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1) + sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile + id_of_dep=${exchange_triplet[2]} + flag=true + else +# echo backing up to ${exchange_triplet} at ${DepFile%.dep} + return 1 + fi + ;; esac - fi - - #------------------ - # If needed, process its dependencies - if [[ -f dependencies/$DEP.dep ]] ; then - # If a premade xinclude file esist, include it - if [[ -f xincludes/$DEP.xinc ]] ; then - IFS=$'\x0A' - for line2 in `cat xincludes/$DEP.xinc` ; do - IFS=$saveIFS - # Remove the Xinclude entry if found - sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp - # Write the XInclude - echo -e "$line2" >> xincludes/$PKG.xinc.tmp - done - #------------------ - # Create the xinclude file - else - # - # >>>>>> THIS IS A RECURSIVE FUNCTION CALL.. BEWARE OF GREMLINS. <<<<<< - # - # If the recursion depth is not too great this is an acceptable methodology for a script language - # However, uncontrolled recursion will cause a seg-fault due to stack issues with local variables. - # - set +e - [[ "${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} Using $DEP Xinc to solve $PKG" - set -e - - # Include it when done - IFS=$'\x0A' - for line2 in `cat xincludes/$DEP.xinc` ; do - IFS=$saveIFS - # Remove the Xinclude entry if found - sed -e "s,^[[:space:]]*$line2,," -e '/./!d' -i xincludes/$PKG.xinc.tmp - # Write the XInclude - echo -e "$line2" >> xincludes/$PKG.xinc.tmp - done - fi + else + echo "${rootlink[*]} $count" > ${id_of_dep}.dep fi done - - #------------------ - if [[ "$PKG" = "xorg7" ]] ; then - # Add their XInclude - PKG_XML=${BLFS_XML}/x/installing/xorg7.xml - echo -e " $ENTRY_START$PKG_XML$ENTRY_END" >> xincludes/$PKG.xinc.tmp - fi - - #------------------ - mv xincludes/$PKG.xinc.tmp xincludes/$PKG.xinc - IFS=$'\x0A' - for line in `cat xincludes/$PKG.xinc` ; do - IFS=$saveIFS - # Remove the Xinclude entry if found. - sed -e "s,^[[:space:]]*$line,," -e '/./!d' -i $TARGET-index.xml.tmp - # Write the XInclude - echo -e "$line" >> $TARGET-index.xml.tmp - done +done +echo -en "\n End: $depth${spaceSTR:0:$depth}${GREEN}$DepFile${OFF}" +} 6<$DepFile +# It may happen that a file is created with several times +# the same line. Normally, all those lines but one +# would be flagged to be removed (or all of them if +# the dependency appeared before). a simple sed /$line/d +# destroys all the lines. We should instead remove +# only one for each appearance of it in lines_to_remove. +# so first get the number of first line and then delete +# that line +for line in $lines_to_remove + do lineno=$(sed -n /^$line\$/= $DepFile | head -n1) + sed -i ${lineno}d $DepFile +done +return 0 +} + +#---------------# +tree_browse() { # +#---------------# +local file=$1 +local f + +#echo file=$file +for f in $(grep '[^0-9 ]' $file); do +# echo f=$f + if grep -q '[^0-9 ]' ${f}.dep ; then + tree_browse ${f}.dep + fi + echo $f +done +} + +#--------------# +tree_erase() { # +#--------------# +local file=$1 +local f +local -a rootlink +local -a rootlink2 + +#echo file=$file +rootlink=($(head -n1 $file)) +for f in $(grep '[^0-9 ]' $file); do +# echo " f"=$f + if [ -f ${f}.dep ]; then + rootlink2=($(head -n1 ${f}.dep)) + if [[ "${rootlink2[*]}" =~ "${rootlink[*]}" ]] ; then + tree_erase ${f}.dep + fi + fi +done +rm -f $file } diff --git a/BLFS/libs/func_packages b/BLFS/libs/func_packages deleted file mode 100644 index c3d20ae..0000000 --- a/BLFS/libs/func_packages +++ /dev/null @@ -1,231 +0,0 @@ -#!/bin/bash -# -# $Id$ -# -set -e - -#-----------------------# -get_pkg_ver() { # Find package version for a given package ID -#-----------------------# - local pkg_id=$1 - - case ${pkg_id} in - # ALSA packages version - alsa* ) pkg_id=alsa ;; - - # KDE packages version - kdevelop ) : ;; - kde*config ) : ;; - kde* ) pkg_id=kde ;; - - # Xorg7 packages version - xorg7-server ) pkg_id=xorg-server ;; - xterm2 ) pkg_id=xterm ;; - xorg7* ) pkg_id=xorg7 ;; - - # Others (ID value don't match entity name) - wireless_tools ) pkg_id=wireless-tools ;; - bind-utils ) pkg_id=bind ;; - html-tidy ) pkg_id=tidy ;; - reiserfs ) pkg_id=reiser ;; - xfs ) pkg_id=xfsprogs ;; - esac - - xmllint --noent ./${BLFS_XML}/book/bookinfo.xml 2>/dev/null | \ - grep -i " ${pkg_id}-version " | cut -d "\"" -f2 | sed "s/ /_/g" - -} - -#-----------------------# -get_installed_ver() { # Find installed package version for a given package ID -#-----------------------# - local pkg_id=$1 - - - case ${pkg_id} in - html-tidy ) - find $TRACKING_DIR -name "${pkg_id}-cvs_[[:digit:]]*" | sed "s/.*${pkg_id}-//" - ;; - cdparanoia ) - find $TRACKING_DIR -name "${pkg_id}-III-[[:digit:]]*" | sed "s/.*${pkg_id}-//" - ;; - ffmpeg ) - find $TRACKING_DIR -name "${pkg_id}-svn_[[:digit:]]*" | sed "s/.*${pkg_id}-//" - ;; - psutils ) - find $TRACKING_DIR -name "${pkg_id}-p[[:digit:]]*" | sed "s/.*${pkg_id}-//" - ;; - * ) - find $TRACKING_DIR -name "${pkg_id}-[[:digit:]]*" | sed "s/.*${pkg_id}-//" | sed "s/ /_/g" - ;; - esac - -} - -#-----------------------# -generate_packages() { # Master packages file -#-----------------------# - local pkg_id file pkg_ver - local ALSA_VER GNOME_VER GNOME_MINOR_VER KDE_VER KDE_KOFFICE_VER XORG7_VER - - > packages.tmp - - # Extract Id and path for sect1 files - for file in `find $BLFS_XML -name "*.xml"` ; do - pkg_id=$(grep "sect1 id" $file | sed -e 's/> packages.tmp - done - - # IDs clean-up (unuseful pages or commented-out packages, could be more) - sed -i '/template/d;/ntroduction/d;/preface/d;/alsa.xml/d;/xorg.xml/d' packages.tmp - sed -i '/obsolete/d;/ispell\t/d;/postlfs-/d;/-client.xml/d;/xorg7.xml/d' packages.tmp - sed -i '/courier.xml/d;/-other\t/d;/others-/d;/other-/d;/^ash\t/d' packages.tmp - sed -i '/fw-firewall\t/d;/gcc2\t/d;/cvsserver\t/d;/svnserver\t/d' packages.tmp - sed -i '/fam\t/d;/libungif\t/d;/ncpfs\t/d;/slrn\t/d;/konq\t/d;/arts\t/d' packages.tmp - sed -i '/gst-plugins\t/d;/gimp-print\t/d;/openquicktime\t/d;/compressdoc\t/d' packages.tmp - sed -i '/errata\t/d;/foreword\t/d;/organization\t/d;/whoread\t/d' packages.tmp - - # Meta-packages version - ALSA_VER=$(get_pkg_ver alsa) - GNOME_VER=$(get_pkg_ver gnome) - GNOME_MINOR_VER=$(get_pkg_ver gnome-minor) - KDE_VER=$(get_pkg_ver kde) - KDE_INST_VER=$(get_installed_ver kde) - KDE_KOFFICE_VER=$(get_pkg_ver koffice) - XORG7_VER=$(get_pkg_ver xorg7) - - # Meta-packages installed version - ALSA_INST_VER=$(get_installed_ver alsa) - GNOME_CORE_INST_VER=$(get_installed_ver gnome-core) - GNOME_FULL_INST_VER=$(get_installed_ver gnome-full) - KDE_CORE_INST_VER=$(get_installed_ver kde-core) - KDE_FULL_INST_VER=$(get_installed_ver kde-full) - KDE_KOFFICE_INST_VER=$(get_installed_ver kde-koffice) - XORG7_INST_VER=$(get_installed_ver xorg7) - - # Add header with meta-packages pseudo Id -{ - cat << EOF -alsa $BLFS_XML $ALSA_VER $ALSA_INST_VER -gnome-core $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_CORE_INST_VER -gnome-full $BLFS_XML $GNOME_VER$GNOME_MINOR_VER $GNOME_FULL_INST_VER -kde-core $BLFS_XML $KDE_VER $KDE_CORE_INST_VER -kde-full $BLFS_XML $KDE_VER $KDE_FULL_INST_VER -kde-koffice $BLFS_XML $KDE_KOFFICE_VER $KDE_KOFFICE_INST_VER -xorg7 $BLFS_XML $XORG7_VER $XORG7_INST_VER -EOF -} >> packages.tmp - - # Dump packages list - sort packages.tmp -b --key=2 --field-separator=/ --output=packages - - # Clean up - rm packages.tmp -} - -# Pre-made *.dep files for meta-packages - -#--------------------------# -generate_gnome_core() { # GNOME core -#--------------------------# - local line base_xml package - - > gnome-core.dep.tmp - - for line in `grep "xi:include" $BLFS_XML/gnome/core/core.xml` ; do - base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` - package=`grep "gnome/core/$base_xml" packages | cut -f1` - [[ -n "$package" ]] && echo $package >> gnome-core.dep.tmp - done - - # Replace dummy packages with the proper ones - sed -i 's/GNOME-//g' gnome-core.dep.tmp - - tac gnome-core.dep.tmp > libs/gnome-core.dep - rm gnome-core.dep.tmp -} - -#--------------------------# -generate_gnome_full() { # GNOME full -#--------------------------# - local line base_xml package - - echo "gnome-core" > gnome-full.dep.tmp - - for line in `grep "xi:include" $BLFS_XML/gnome/add/add.xml` ; do - base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` - package=`grep "gnome/add/$base_xml" packages | cut -f1` - [[ -n "$package" ]] && echo $package >> gnome-full.dep.tmp - done - - tac gnome-full.dep.tmp > libs/gnome-full.dep - rm gnome-full.dep.tmp -} - -#--------------------------# -generate_kde_core() { # KDE core -#--------------------------# - local line base_xml package - - > kde-core.dep.tmp - - for line in `grep "xi:include" $BLFS_XML/kde/core/core.xml` ; do - base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` - package=`grep "kde/core/$base_xml" packages | cut -f1` - [[ -n "$package" ]] && echo $package >> kde-core.dep.tmp - done - - tac kde-core.dep.tmp > libs/kde-core.dep - rm kde-core.dep.tmp -} - -#--------------------------# -generate_kde_full() { # KDE full -#--------------------------# - local line base_xml package - - echo "kde-core" > kde-full.dep.tmp - - for line in `grep "xi:include" $BLFS_XML/kde/add/add.xml` ; do - base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` - package=`grep "kde/add/$base_xml" packages | cut -f1` - [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp - done - - for line in `grep "xi:include" $BLFS_XML/kde/devel/devel.xml` ; do - base_xml=`echo $line | sed 's/^.*href="//;s/".*//'` - package=`grep "kde/devel/$base_xml" packages | cut -f1` - [[ -n "$package" ]] && echo $package >> kde-full.dep.tmp - done - - tac kde-full.dep.tmp > libs/kde-full.dep - rm kde-full.dep.tmp -} - -#--------------------------# -generate_kde_koffice() { # KDE full + Koffice -#--------------------------# - echo -e "koffice\nkde-full\nkde-core" > libs/kde-koffice.dep -} - -#--------------------------# -generate_alsa() { # ALSA packages -#--------------------------# - echo -e "alsa-oss\nalsa-firmware\nalsa-tools\nalsa-utils\n\ -alsa-plugins\nalsa-lib" > libs/alsa.dep -} - -#--------------------------# -generate_xorg7() { # Xorg7 packages -#--------------------------# - echo -e "x-config\nx-setup\nrman\nxterm2\nxorg7-driver\nxorg7-server\nluit\n\ -xkeyboard-config\nxorg7-font\nxorg7-data\nxorg7-app\nmesalib\nlibdrm\nxbitmaps\n\ -xorg7-lib\nlibxcb\nxcb-proto\nlibXdmcp\nlibXau\nxorg7-util\nxorg7-proto" > libs/xorg7.dep -} diff --git a/BLFS/libs/func_parser b/BLFS/libs/func_parser deleted file mode 100644 index 3cf2356..0000000 --- a/BLFS/libs/func_parser +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash -##### -# -# Parse the XML documents to create a 'package' book -# -# $Id$ -##### - - -#----------------------------# -generate_TARGET_xml() { # -#----------------------------# -: < - - - - - - - - - - Preface - - - - - - - - - - Installing $TARGET in Dependencies Build Order - -EOF -} > $TARGET-index.xml - - #--------------------- - # Dump $TARGET-index.xml.tmp in reverse order. - tac $TARGET-index.xml.tmp >> $TARGET-index.xml - rm $TARGET-index.xml.tmp - - #--------------------- - # Footer of $TARGET-index.xml -{ -cat << EOF - - - - - - - - - - -EOF -} >> $TARGET-index.xml - - echo "done" -} - - -#-------------------------# -generate_target_book() { # -#-------------------------# -: < HTML book from <$BLFS_XML> xml files ..." - xsltproc --xinclude --nonet \ - --stringparam mail_server $MAIL_SERVER \ - --stringparam xwindow $X11 \ - --stringparam base.dir HTML/ \ - ../libs/book.xsl \ - $TARGET-index.xml > xsltproc.log 2>&1 - mkdir HTML/{stylesheets,images} - cp ../$BLFS_XML/stylesheets/lfs-xsl/*.css HTML/stylesheets - cp ../$BLFS_XML/images/*.png HTML/images - cd HTML - sed -i -e "s@../stylesheets@stylesheets@g" *.html - sed -i -e "s@../images@images@g" *.html - for filename in `find . -name "*.html"` ; do - tidy -config ../../$BLFS_XML/tidy.conf $filename || true - sh ../../$BLFS_XML/obfuscate.sh $filename - sed -i -e "s@text/html@application/xhtml+xml@g" $filename - done - cd .. - echo "done" -} - - -#-------------------------# -create_build_scripts() { # -#-------------------------# -: <> xsltproc.log - - echo -en "\n\tGenerating the build scripts ..." - xsltproc --xinclude --nonet \ - --stringparam sudo $SUDO \ - -o ./scripts/ ../libs/scripts.xsl \ - $TARGET-index.xml >> xsltproc.log 2>&1 - # Make the scripts executable. - chmod -R +x scripts - cd .. - echo -e "done\n" - -} diff --git a/BLFS/packdesc.dtd b/BLFS/packdesc.dtd new file mode 100644 index 0000000..43d5e61 --- /dev/null +++ b/BLFS/packdesc.dtd @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff --git a/BLFS/update_book.sh b/BLFS/update_book.sh deleted file mode 100755 index 42b3002..0000000 --- a/BLFS/update_book.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/bash -# -# $Id$ -# -set -e - -declare -r SVN="svn://svn.linuxfromscratch.org" - -DOC_MODE=$1 # Action to take, update, get or none -BLFS_XML=$2 # Book directory -TREE=$3 # SVN tree for the BLFS book version - -[[ -z $BLFS_XML ]] && BLFS_XML=blfs-xml -[[ -z $DOC_MODE ]] && DOC_MODE=update -[[ -z $TREE ]] && TREE=trunk/BOOK - -TRACKING_DIR=tracking-dir - -#--------------------- -# packages module -source libs/func_packages -[[ $? > 0 ]] && echo -e "\n\tERROR: func_packages did not load..\n" && exit - -#----------------------------# -BOOK_Source() { # -#----------------------------# -: < /dev/null - svn up - popd 1> /dev/null - echo -e "\n\tBook sources updated." - else - echo -e "\n\tLooks like $BLFS_XML is not a svn working copy." - echo -e "\tSkipping BLFS sources update.\n" - fi - ;; - - get ) - [[ ! -d $BLFS_XML ]] && mkdir -pv $BLFS_XML - svn co $SVN/BLFS/$TREE $BLFS_XML 2>&1 - ;; - * ) - echo -e "\n\tUnknown option ${DOC_MODE} ignored.\n" - ;; - esac -} - -[ "${DOC_MODE}" != "none" ] && BOOK_Source - -if [ "${DOC_MODE}" = "none" ] ; then - echo -en "\n\tGenerating packages database file ..." - generate_packages - echo "done." - - echo -en "\tGenerating alsa dependencies list ..." - generate_alsa - echo "done." - - echo -en "\tGenerating gnome-core dependencies list ..." - generate_gnome_core - echo "done." - - echo -en "\tGenerating gnome-full dependencies list ..." - generate_gnome_full - echo "done." - - echo -en "\tGenerating kde-core dependencies list ..." - generate_kde_core - echo "done." - - echo -en "\tGenerating kde-full dependencies list ..." - generate_kde_full - echo -e "done." - - echo -en "\tGenerating kde-koffice dependencies list ..." - generate_kde_koffice - echo -e "done." - - echo -en "\tGenerating xorg7 dependencies list ..." - generate_xorg7 - echo "done." -fi - diff --git a/BLFS/xsl/bump.xsl b/BLFS/xsl/bump.xsl new file mode 100644 index 0000000..3bac560 --- /dev/null +++ b/BLFS/xsl/bump.xsl @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + `packages' must be an absolute path + + + + + + + diff --git a/BLFS/xsl/dependencies.xsl b/BLFS/xsl/dependencies.xsl new file mode 100644 index 0000000..166d76d --- /dev/null +++ b/BLFS/xsl/dependencies.xsl @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + xorg7-server + xorg7-server + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/BLFS/xsl/gen_config.xsl b/BLFS/xsl/gen_config.xsl new file mode 100644 index 0000000..c9413ac --- /dev/null +++ b/BLFS/xsl/gen_config.xsl @@ -0,0 +1,188 @@ + + + + + + + + + + + comment "" + +menu "Default package for resolving MTA dependency" + +choice + prompt "Mail server" + config MS_sendmail + bool "sendmail" + config MS_postfix + bool "postfix" + config MS_exim + bool "exim" +endchoice +config MAIL_SERVER + string + default sendmail if MS_sendmail + default postfix if MS_postfix + default exim if MS_exim + +endmenu + +choice + prompt "Dependency level" + default DEPLVL_2 + + config DEPLVL_1 + bool "Required dependencies only" + + config DEPLVL_2 + bool "Required and recommended dependencies" + + config DEPLVL_3 + bool "Required, recommended and optional dependencies" + +endchoice +config optDependency + int + default 1 if DEPLVL_1 + default 2 if DEPLVL_2 + default 3 if DEPLVL_3 + + +config SUDO + bool "Build as User" + default y + help + Select if sudo will be used (you build as a normal user) + otherwise sudo is not needed (you build as root) + + + + + + config MENU_ + + +bool " + + " +default n + +menu " + + " +depends MENU_ + + + + + + endmenu + + + + + + + + config MENU_ + + + bool " + + " + default n + + menu " + + " + depends MENU_ + + + + + + endmenu + + + + + + + + config CONFIG_ + + + bool " + + + + + [Installed + + ] + + " + default y + + + + + config MENU_ + + + bool " + + " + default n + + menu " + + " + depends MENU_ + + + + + + endmenu + + + + + + + + config CONFIG_ + + + bool " + + + + + [Installed + + ] + + " + default y + + + + + + diff --git a/BLFS/xsl/gen_pkg_list.xsl b/BLFS/xsl/gen_pkg_list.xsl new file mode 100644 index 0000000..bd04d52 --- /dev/null +++ b/BLFS/xsl/gen_pkg_list.xsl @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ref + + + + + + + + + + required + + + + ref + + + + + + + + + + + + + optional + required + + + + + + + + + + + + ref + link + + + + + + + + + + + + + + + + + diff --git a/BLFS/xsl/make_book.xsl b/BLFS/xsl/make_book.xsl new file mode 100644 index 0000000..de4e91e --- /dev/null +++ b/BLFS/xsl/make_book.xsl @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + Preface + + + + + Installing packages in dependency build order + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (in full book) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + filename=".html" + + + + + + + + + + + + + + + sect3 + sect4 + + + + + + + + + + + + + + + + + + + + + (in full book) + + + + + + + + + + + + + + + + + + + + + + + + + + filename=".html" + <xsl:value-of select="./@xreflabel"/> + + Introduction to <xsl:value-of select="@id"/> + Package Information + + + Download (HTTP): + + + Download (FTP): + + + + + + + + + + Installation of <xsl:value-of select="@xreflabel"/> + Run the following commands: + + + + Now, as the root user: + + + + + + + + + + + + + + + filename=".html" + <xsl:value-of select="./@xreflabel"/> + + Introduction to <xsl:value-of select="@id"/> + Package Information + + + Download (HTTP): + + + Download (FTP): + + + + + + + + + + + + + + + + + + diff --git a/BLFS/libs/scripts.xsl b/BLFS/xsl/scripts.xsl similarity index 60% rename from BLFS/libs/scripts.xsl rename to BLFS/xsl/scripts.xsl index 63fe140..1727814 100644 --- a/BLFS/libs/scripts.xsl +++ b/BLFS/xsl/scripts.xsl @@ -5,7 +5,7 @@ extension-element-prefixes="exsl" version="1.0"> - + @@ -19,42 +19,11 @@ - + - - - - - - - - - - - - - - - - - - - - - - - @@ -76,11 +45,9 @@ SCRIPT is - - PACKAGE is - + FTPDIR is - + @@ -94,31 +61,35 @@ @id = 'xorg7-font' or @id = 'xorg7-lib' or @id = 'xorg7-proto' or @id = 'xorg7-util')"> + PKG_DIR= - - SRC_DIR=$SRC_DIR + + - - - - + - + cd $SRC_DIR/$PKG_DIR rm -rf $UNPACKDIR unpacked + - SRC_DIR=$SRC_DIR + # Useless SRC_DIR=$SRC_DIR cd $SRC_DIR mkdir -p xc @@ -132,23 +103,17 @@ cd xc exit - - - mkdir -p $SRC_DIR/$PKG_DIR cd $SRC_DIR/$PKG_DIR - - - - + @@ -167,8 +132,7 @@ cd $UNPACKDIR ldconfig - - + @@ -179,8 +143,8 @@ cd $UNPACKDIR - SRC_ARCHIVE=$SRC_ARCHIVE -FTP_SERVER=$FTP_SERVER + mkdir -p ${section} cd ${section} @@ -195,8 +159,8 @@ FTP_SERVER=$FTP_SERVER elif [[ -f $SRC_ARCHIVE/${line} ]] ; then cp $SRC_ARCHIVE/${line} ${line} else - wget ${FTP_SERVER}conglomeration/Xorg/${line} || \ - wget http://xorg.freedesktop.org/releases/individual/${section}/${line} + wget -T 30 -t 5 ${FTP_X_SERVER}pub/individual/${section}/${line} || \ + wget -T 30 -t 5 http://xorg.freedesktop.org/releases/individual/${section}/${line} fi fi done @@ -245,7 +209,8 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 - + @@ -254,145 +219,65 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 - - - + - - - cdparanoia - - - - docbk - - - - gc - - - - iso-codes - - - - jpeg - - - - lynx - - - - ntp - - - - openldap - - - - OOo - - - - pine - - - - portmap - - - - psutils - - - - qpopper - - - - qt-x11-free - - - - sendmail - - - - slib - - - - tcl - - - - tcp_wrappers - - - - tetex - - - - tidy - - - - tk - - - - unzip - - - - wireless_tools - - - - whois - - - - Xorg - - - - zip - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - if [[ ! -f $PACKAGE ]] ; then + + + + + + + PACKAGE= + + if [[ ! -f $PACKAGE ]] ; then if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE ]] ; then cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE $PACKAGE elif [[ -f $SRC_ARCHIVE/$PACKAGE ]] ; then cp $SRC_ARCHIVE/$PACKAGE $PACKAGE else - wget ${FTP_SERVER}conglomeration/$PKG_DIR/$PACKAGE + wget -T 30 -t 5 ${FTP_SERVER}svn/ + + /$PACKAGE + + + + + + + + + + + + - || \ wget + || \ wget -T 30 -t 5 @@ -401,12 +286,15 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 + + fi fi + - || \ wget + || \ wget -T 30 -t 5 fi fi @@ -416,19 +304,57 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 $PACKAGE" | md5sum -c - - + + + + + - wget + wget -T 30 -t 5 + + + + + + + + + PACKAGE1= + + if [[ ! -f $PACKAGE1 ]] ; then + + if [[ -f $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 ]] ; then + cp $SRC_ARCHIVE/$PKG_DIR/$PACKAGE1 $PACKAGE1 + elif [[ -f $SRC_ARCHIVE/$PACKAGE1 ]] ; then + cp $SRC_ARCHIVE/$PACKAGE1 $PACKAGE1 else + + wget -T 30 -t 5 ${FTP_SERVER}blfs/svn/ + + /$PACKAGE1 + || \ wget -T 30 -t 5 + + fi fi + + + + echo " + + $PACKAGE1" | md5sum -c - + - wget + wget -T 30 -t 5 @@ -436,7 +362,7 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 - wget + wget -T 30 -t 5 @@ -457,6 +383,36 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 + + + [[ ! -d $SRC_DIR/blfs-bootscripts ]] && mkdir $SRC_DIR/blfs-bootscripts +pushd $SRC_DIR/blfs-bootscripts +URL= + +BOOTPACKG=$(basename $URL) +[[ ! -f "$BOOTPACKG" ]] && { wget -T 30 -t 5 $URL; rm -f unpacked; } +if [[ -e unpacked ]] ; then + UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` + if ! [[ -d $UNPACKDIR ]]; then + rm unpacked + tar -xvf $BOOTPACKG > unpacked + UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` + fi +else + tar -xvf $BOOTPACKG > unpacked + UNPACKDIR=`head -n1 unpacked | sed 's@^./@@;s@/.*@@'` +fi +cd $UNPACKDIR + + + + + +popd + + + + section= @@ -481,16 +437,17 @@ mv ../${sect_ver}.md5.orig ../${sect_ver}.md5 + **EDITME EDITME** - - + diff --git a/README.BLFS b/README.BLFS index ba8977b..d879670 100644 --- a/README.BLFS +++ b/README.BLFS @@ -2,7 +2,7 @@ $Id$ 1. INTRODUCTION:: - If you want to add blfs-tool support into a xLFS base system build, + If you want to add blfs-tool support into an xLFS base system build, read the "BLFS_TOOL SUPPORT" section found in the README and be sure to follow the after-booting installation intructions. @@ -36,7 +36,7 @@ $Id$ Due the complexity of the BLFS book, the scripts and Makefile generation is done in several steps: - 3.1 INSTALLED PACKAGES TRACKING SYSTEM + 3.1 INSTALLED PACKAGES TRACKING SYSTEM:: This tool includes a very simple tracking system to log which packages have been installed using the tool. It is used to skip installed packages @@ -44,52 +44,49 @@ $Id$ updated in the BLFS book. Do not rely on this feature as a package management tool. - The directory where tracking files will be stored needs to be created - before installing blfs-tool. You can place this directory anywhere, taking - care that the user must have read and write privileges on that directory - and on all files it contains. + The tracking system itself is an XML file: instpkg.xml. It is + initialized when make is first run in blfs_root. It resides in a directory + which is created when needed during the process of building custom tools + or blfs tools, after xLFS. You can specify that directory location in + the blfs tools submenu of jhalfs. You may need to update permissions + and/or ownership of this directory before using the blfs tool. - To use the default path set in the installation menu, run as root: - - install -d -m1777 /var/lib/jhalfs/BLFS + The default location of the tracking directory is /var/lib/jhalfs/BLFS 3.2 BLFS_TOOL INSTALLATION:: - Run "make" to launch the jhalfs menuconfig interface. Select the BLFS - book and version. Then set the installation directory (default - $HOME/blfs_root), the BLFS sources directory (default blfs-xml), and - the installed packages tracking directory (default /var/lib/jhalfs/BLFS). - - All required files will be placed in the installation directory and - BLFS XML sources will be installed in the named sub-directory. - - Installed files: + The tools are installed just after the building of xLFS, if the + appropriate options have been selected in the building menu, as per + jhalfs README. If you forgot to select the options and xLFS has been + built, it is possible to go back to selecting the appropriate + BLFS tools options in the jhalfs menu, then tick `Run makefile' + and not `Rebuild files'. You obtain a /blfs_root directory in the + root directory of the new xLFS system, which contains the followings: blfs-xml/* SVN tree of the selected BLFS book version - lib/* functions libraries, xsl stylesheets, and auto-generated - meta-packages dependencies tree files + lib/* functions libraries menu/* lxdialog and menuconfig source code + xsl/* XSL stylesheets used at several stages of the process README.BLFS this file - TODO developers notes - update_book.sh update the XML book sources and regenerates packages - database and meta-packages dependencies tree - gen_config.sh regenerates Config.in + TODO developers notes (well, not often updated) gen_pkg_book.sh resolves dependencies and generates linear BLFS books and build scripts gen-makefile.sh generates the target Makefile progress_bar.sh the target Makefile progress bar - Makefile run gen_config.sh to update Config.in, - then launch the menuconfig interface, and lastly run + gen-special.sh Helper script for generating the package database + Makefile Used by make to update the package database from the SVN + tree, then launch the menuconfig interface, and run gen_pkg_book.sh based on configuration settings - Config.in menuconfig interface input file - packages auto-generated packages database + packages.xml auto-generated packages database + packdesc.dtd a simple DTD describing the format of the package + database envars.conf envars needed when running the target build scripts From now on, all the work must be done from inside the installation root directory. - When finished the installation, the configuration and target selection - menu is launch. + You may move that directory to the $HOME of a non root user, or build + as root from that directory. 3.3 UPDATING BOOK SOURCES:: @@ -97,7 +94,11 @@ $Id$ installed packages to the latest version found in that book, you need to update the XML sources and packages database. - To do that run "./update_book.sh" + To do that run "make update". It may happen that the subversion + version of your building host is older than the version you just + built. This may generate weird errors like "'.' omitted". The easiest + thing to do in that case, is to completely remove the blfs-xml directory + and run "make update". On the next configuration run, packages already installed but listed with a new version in the book will be available for target selection @@ -106,46 +107,53 @@ $Id$ 3.4 CONFIGURING AND PARSING THE BOOK:: The next step is to create a book and build scripts in dependency - build order for a target package. A target can be a package or a - meta-package. - - WARNING: - Only one target (meta-package or individual package) must be - selected on each configuration run. - There is no way to solve dependencies properly when more - than one target are selected. + build order for one or several packages. Run to launch the configuration interface. The main menu contains - three blocks: meta-package selection, individual package selection, and - build options. - - When a meta-package is selected, it is possible to unselect unwanted - components. The unselected components will be skipped if no other components - depends on them. + two blocks: individual package selection, and build options. In the build options section, the dependencies level and default packages - used to solve alternatives are set. You can also select whether the build will - be made as a normal user or as root. That settings are saved to be reused in - future configuration runs. + used to solve alternatives are set (currently, only for the mTA). You can + also select whether the build will be made as a normal user or as root. + Those settings are saved to be reused in future configuration runs. - If, for example, your target selection is Xsoft-->Graphweb-->galeon, a - directory named "galeon" will be created. Inside that directory you will - find a directory named "HTML" that contains a galeon-based HTML book with - its dependencies in build order, and a "scripts" directory with build - scripts for that packages. + When you are done with the menu, a few checks occur, and the book is + generated. When circular dependencies are found, a 3 line message is + printed: + A is a dependency of B + C is a dependency of A + A is a dependency of C + and a question: + Do you want to build A first? + This means that the system has found the dependency chain: B->A->C->A. + You have therefore to choose whether A is built before C, or + C before A: the system cannot make that choice (well, maybe in a few + year, with an AI system able to understand the book). if you answer no, + C is built first. If you answer yes, C is put in place of A as a dependency + of B, then the tree dependency restarts from there, that is with the + layout B->C->... You may then hit the case B->C->A->C, for which you + should answer no, unless you want to enter an infinite (human driven) loop. - There are also two other directories ("dependencies" and "xincludes") - that contain files generated while resolving dependencies trees. + You end up with a book.xml file which contains the linearized book, + and a rendered HTML, in the directory book-html, which you can browse with + "lynx book-html/index.html" (or with any other browser). + + Furthermore, there is a directory "scripts", which contains the generated + scriptlets. + + There is also another directory, "dependencies" that contains files + generated while resolving dependencies. 3.5 EDITING BUILD SCRIPTS - Now it is time to review the generated book and scripts, making any changes - to the scripts necessary to fix generation bugs or to suit your needs. + Now it is time to review the generated book and scripts, making any + changes to the scripts necessary to fix generation bugs or to suit your + needs. Scripts for additional packages (i.e., for non-BLFS packages) can be easily inserted. For example, if you want to install the external dependency "bar" before "foo" package and the "foo" script is named "064-z-foo", you - need to create a "064-y-bar" build script. + just need to create a "064-y-bar" build script. Remember, the package tracking system isn't a package management tool and knows nothing about packages not in the BLFS book. @@ -156,43 +164,39 @@ $Id$ 3.6 CREATING THE MAKEFILE 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 + created. Create an empty directory (for example "mkdir work") and cd + to that directory. Then run ../gen-makefile.sh - Review the Makefile, and, if all looks sane, start the build. + Review the Makefile, and, if all looks sane, start the build by running + "make". 4. GENERATED BUILD SCRIPTS ISSUES:: In this section, known issues with the generated build scripts are - discussed. They are due to build procedures and/or BLFS layout particularities - that we can't handle. In several cases, editing the build scripts is mandatory. + discussed. They are due to build procedures and/or BLFS layout + particularities that we can't handle. In several cases, editing the + build scripts is mandatory. You may also need to insert some build scripts created by you to resolve unhandled dependencies and/or to remove some script installing the affected package by hand. 4.1 BLFS BOOTSCRIPTS - For now, bootscripts installation will fail. You will need to edit - the scripts for packages that install bootscripts and fix their - installation command. That could be fixed in the future. + Normally, bootscript installation should work. On the other hand, the + book does not give instruction for running them, so you might have to + manually insert /etc/init.d/ at some place during the build. 4.2 PACKAGE CONFIGURATION - For those packages that have a "Configuration" section, you should - edit the build script to fit the needs of your system. - - 4.4 PDL, Perl modules, and Glib-Bindings. - - The generated scripts for these packages are broken and can not - be fixed. You must rename it as the sub-package to be installed and - edit it to use the proper commads for that sub-package. - - You may need to create additional scripts for these sub-package - dependencies, if any. + For those packages that have a "Configuration" section, you should + edit the build script to fit the needs of your system. Sometimes, the + bash startup files are modified (see for example the instructions for + llvm). You might have to insert something like "source /etc/bash_profile" + at some point during the build. 4.4 GCC, JDK, Sane, and KDE-multimedia, freetype2, MesaLib and others - On the pages for these packages, the BLFS book actually has instructions + On the pages for those packages, the BLFS book actually has instructions to download and install two or more packages. You must edit the scripts to fix this. @@ -200,7 +204,7 @@ $Id$ 4.5 XORG7 - The generated scripts for Xorg7 pseudo-packages have $SRC_ARCHIVE + The generated scripts for Xorg7 packages have $SRC_ARCHIVE support for individual packages, but not for patches nor *.wget and *.md5 files. @@ -209,7 +213,7 @@ $Id$ The *.wget and *.md5 files should be downladed always from inside the scripts to be sure that the most current individual packages are - used. Thus don't reuse previouly existing ones. + used. Thus don't reuse previously existing ones. In the script for xorg7-font, be sure to move the fonts directories symlinks creation to after the "for ... done" loop. diff --git a/README.PACKAGE_MANAGEMENT b/README.PACKAGE_MANAGEMENT index 9e159f4..dc3ff95 100644 --- a/README.PACKAGE_MANAGEMENT +++ b/README.PACKAGE_MANAGEMENT @@ -60,4 +60,17 @@ BY : Pierre Labastie upgrade. The user has to provide his own function. A template is provided in the pkgmngt subdirectory. +3. DETAILED INSTRUCTIONS: + Before beginning, you should know which package manager you want, where + to get the sources, and how to use it for: + a) Making a package from a directory tree. Usually, there is some control + file containing the version, pacakager, build system (32 or 64 bits at + least) or other more or less usefull but mandatory bits of information + which you should understand. + b) Unpack the package. + + Second, you ought to have a basic knowledge of bash scripting and + docbook-xml writing, because you have to write a bash function for packing + and unpacking the package, and a set of instructions to install the PM. + diff --git a/jhalfs b/jhalfs index 25d87c3..a89004e 100755 --- a/jhalfs +++ b/jhalfs @@ -437,11 +437,11 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then cp README.BLFS ${BUILDDIR}${BLFS_ROOT} # Clean-up rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn + rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/.svn rm -rf ${BUILDDIR}${BLFS_ROOT}/menu/lxdialog/.svn # Set some harcoded envars to their proper values - sed -i 's,blfs-xml,'$BLFS_XML',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,libs/book.xsl} - sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{update_book.sh,gen-makefile.sh} + sed -i 's,tracking-dir,'$TRACKING_DIR',' ${BUILDDIR}${BLFS_ROOT}/{Makefile,gen-makefile.sh} # Copy the dependencies build scripts cp -r $COMMON_DIR/blfs-tool-deps $JHALFSDIR/ rm -rf $JHALFSDIR/blfs-tool-deps/.svn