r3896 - in jhalfs/trunk: . BLFS

pierre at higgs.linuxfromscratch.org pierre at higgs.linuxfromscratch.org
Thu Mar 2 08:38:25 PST 2017


Author: pierre
Date: Thu Mar  2 08:38:25 2017
New Revision: 3896

Log:
Unless explicitely set on the command line, the REV parameter
in BLFS tools make is the same as the preceding used one. Formerly, it
was set to sysv unless defined on the command line

Modified:
   jhalfs/trunk/BLFS/Makefile
   jhalfs/trunk/install-blfs-tools.sh

Modified: jhalfs/trunk/BLFS/Makefile
==============================================================================
--- jhalfs/trunk/BLFS/Makefile	Wed Mar  1 08:07:26 2017	(r3895)
+++ jhalfs/trunk/BLFS/Makefile	Thu Mar  2 08:38:25 2017	(r3896)
@@ -5,16 +5,6 @@
 
 # $Id$
 
-ifeq ($(REV),)
-  REV = sysv
-endif
-
-ifneq ($(REV),sysv)
-  ifneq ($(REV),systemd)
-    $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
-  endif
-endif
-
 ifdef V
   Q =
 else
@@ -25,21 +15,39 @@
 LANG=C
 LC_ALL=C
 
-# The right-hand side is updated by jhalfs
-TRACKING_DIR = tracking-dir
-TOPDIR=$(shell pwd)
-BLFS_XML = $(TOPDIR)/blfs-xml
-XSLDIR = $(TOPDIR)/xsl
-
-RENDERTMP = $(BLFS_XML)/tmp
-BLFS_FULL = $(RENDERTMP)/blfs-full.xml
-PACK_LIST = $(TOPDIR)/packages.xml
-MENU = $(TOPDIR)/menu
+# Makefile should reside in a directory where there are two subdirectories
+# initially:
+TOPDIR           = $(shell pwd)
+# the stylesheets
+XSLDIR           = $(TOPDIR)/xsl
+# the menu program sources
+MENU             = $(TOPDIR)/menu
+
+# Those directories and files will be created and populated by make:
+# directory of the book sources:
+BLFS_XML         = $(TOPDIR)/blfs-xml
+# contains the REV used in the preceding call:
+REVFILE          = $(TOPDIR)/revision
+# the list of packages:
+PACK_LIST        = $(TOPDIR)/packages.xml
+# the generated menu input:
 CONFIG_CONFIG_IN = $(TOPDIR)/Config.in
-CONFIG_OUT = $(TOPDIR)/configuration
-BOOK_XML = $(TOPDIR)/book.xml
-TRACKFILE = $(TRACKING_DIR)/instpkg.xml
+# menu output:
+CONFIG_OUT       = $(TOPDIR)/configuration
+# the linear book:
+BOOK_XML         = $(TOPDIR)/book.xml
+
+RENDERTMP        = $(BLFS_XML)/tmp
+BLFS_FULL        = $(RENDERTMP)/blfs-full.xml
+
+# The right-hand side is updated by jhalfs:
+# Where the tracking file resides:
+TRACKING_DIR = tracking-dir
+
+# Will be created  by make, if not existent
+TRACKFILE        = $(TRACKING_DIR)/instpkg.xml
 
+# Initial content of the tracking file
 define INITIAL_TRACK
 <?xml version="1.0" encoding="ISO-8859-1"?>\n\
 \n\
@@ -52,9 +60,30 @@
 SVN = svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK
 
 ALLXML := $(filter-out $(RENDERTMP)/%, \
-	$(wildcard $(BLFS_XML)/*.xml $(BLFS_XML)/*/*.xml $(BLFS_XML)/*/*/*.xml $(BLFS_XML)/*/*/*/*.xml $(BLFS_XML)/*/*/*/*/*.xml))
+              $(shell if [ -d $(BLFS_XML) ]; then \
+                        find $(BLFS_XML) -name \*.xml; \
+                      fi))
 ALLXSL := $(filter-out $(RENDERTMP)/%, \
-        $(wildcard $(BLFS_XML)/*.xsl $(BLFS_XML)/*/*.xsl $(BLFS_XML)/*/*/*.xsl $(BLFS_XML)/*/*/*/*.xsl $(BLFS_XML)/*/*/*/*/*.xsl))
+              $(shell if [ -d $(BLFS_XML) ]; then \
+                        find $(BLFS_XML) -name \*.xsl; \
+                      fi))
+
+# Try to set the REV variable according to previous runs, except when
+# set on the command line:
+REV1 := $(shell if [ -f $(REVFILE) ] ; then cat $(REVFILE); fi)
+ifneq ($(origin REV),command line)
+  ifdef REV1
+    REV = $(REV1)
+  else
+    REV = not defined
+  endif
+endif
+
+ifneq ($(REV),sysv)
+  ifneq ($(REV),systemd)
+    $(error The REV variable is $(REV), but can only be 'sysv' or 'systemd')
+  endif
+endif
 
 $(BOOK_XML): $(CONFIG_OUT)
 	$(Q)$(TOPDIR)/gen_pkg_book.sh $(TOPDIR) $(BLFS_FULL)
@@ -106,6 +135,9 @@
 $(XSLDIR)/specialCases.xsl: $(TOPDIR)/gen-special.sh $(BLFS_FULL)
 	$(Q)$(TOPDIR)/gen-special.sh $(BLFS_FULL) $@
 
+ifneq ($(REV),$(REV1))
+$(BLFS_FULL): FORCE
+endif
 $(BLFS_FULL): $(BLFS_XML) $(BLFS_XML)/general.ent $(ALLXML) $(ALLXSL)
 	$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
 	@echo "Adjusting for revision $(REV)..."
@@ -117,6 +149,7 @@
 	@echo "Validating the book..."
 	$(Q)xmllint --nonet --noent --postvalid \
 	  -o $@ $(RENDERTMP)/blfs-prof.xml
+	$(Q)echo $(REV) > $(REVFILE)
 
 all: update $(BOOK_XML)
 
@@ -135,4 +168,5 @@
 	rm -rf $(TOPDIR)/dependencies $(TOPDIR)/book-html $(TOPDIR)/scripts
 	- $(MAKE) -C $(MENU) clean
 
-.PHONY: clean all update $(CONFIG_OUT)
+FORCE:
+.PHONY: clean all update $(CONFIG_OUT) FORCE

Modified: jhalfs/trunk/install-blfs-tools.sh
==============================================================================
--- jhalfs/trunk/install-blfs-tools.sh	Wed Mar  1 08:07:26 2017	(r3895)
+++ jhalfs/trunk/install-blfs-tools.sh	Thu Mar  2 08:38:25 2017	(r3896)
@@ -11,12 +11,13 @@
                 Must start with a '/' (default /blfs_root)
 BLFS_BRANCH_ID: development, branch-xxx, xxx (where xxx is a valid tag)
                 (default development)
+INIT_SYSTEM   : which book do you want? 'sysv' or 'systemd' (default sysv)
 Examples:
 1 - If you plan to use the tools to build BLFS on top of LFS, but you did not
 use jhalfs, or forgot to include the jhalfs-blfs tools:
 (as root) mkdir -p /var/lib/jhalfs/BLFS && chown -R <user> /var/lib/jhalfs
-(as user) ./install-blfs-tools.sh
-2 - To install with only user privileges:
+(as user) INIT_SYSTEM=<your system> ./install-blfs-tools.sh
+2 - To install with only user privileges (default to sysv):
 TRACKING_DIR=$HOME/blfs_root/trackdir ./install-blfs-tools.sh
 inline_doc
 
@@ -56,6 +57,7 @@
 BUILDDIR=$(cd ~;pwd)
 BLFS_ROOT="${BLFS_ROOT:=/blfs_root}"
 TRACKING_DIR="${TRACKING_DIR:=/var/lib/jhalfs/BLFS}"
+INIT_SYSTEM="${INIT_SYSTEM:=sysv}"
 
 [[ $VERBOSITY > 0 ]] && echo "${SD_BORDER}${nl_}"
 
@@ -90,9 +92,9 @@
 cp $COMMON_DIR/progress_bar.sh ${BUILDDIR}${BLFS_ROOT}
 cp README.BLFS ${BUILDDIR}${BLFS_ROOT}
 [[ $VERBOSITY > 0 ]] && echo "... OK"
-[[ $VERBOSITY > 0 ]] && echo -n Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
 
 # Clean-up
+[[ $VERBOSITY > 0 ]] && echo Cleaning the ${BUILDDIR}${BLFS_ROOT} directory
 make -C ${BUILDDIR}${BLFS_ROOT}/menu clean
 rm -rf ${BUILDDIR}${BLFS_ROOT}/libs/.svn
 rm -rf ${BUILDDIR}${BLFS_ROOT}/xsl/.svn
@@ -112,9 +114,10 @@
 mkdir -p $TRACKING_DIR
 [[ $VERBOSITY > 0 ]] && echo "... OK"
 
-[[ $VERBOSITY > 0 ]] && echo -n "Downloading and validating the book (may take some time)"
+[[ $VERBOSITY > 0 ]] && echo "Downloading and validating the book (may take some time)"
 make -j1 -C $BUILDDIR$BLFS_ROOT \
      TRACKING_DIR=$TRACKING_DIR \
+     REV=$INIT_SYSTEM            \
      SVN=svn://svn.linuxfromscratch.org/BLFS/$BLFS_TREE \
      $BUILDDIR$BLFS_ROOT/packages.xml
 [[ $VERBOSITY > 0 ]] && echo "... OK"


More information about the alfs-log mailing list