From 67c3df4aef96002e14b43e99d3354fc27fe35757 Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Mon, 5 Feb 2018 18:12:17 +0000 Subject: [PATCH] Add stats to jhalfs-blfs. NB: due to book layout, far from perfect... --- BLFS/gen_pkg_book.sh | 10 +- BLFS/xsl/gen_config.xsl | 8 ++ BLFS/xsl/scripts.xsl | 236 ++++++++++++++++++++++++++++++++++++---- 3 files changed, 230 insertions(+), 24 deletions(-) diff --git a/BLFS/gen_pkg_book.sh b/BLFS/gen_pkg_book.sh index 4bdffb1..318f4b4 100755 --- a/BLFS/gen_pkg_book.sh +++ b/BLFS/gen_pkg_book.sh @@ -51,6 +51,7 @@ parse_configuration() { # MAIL_SERVER=* | \ WRAP_INSTALL=* | \ DEL_LA_FILES=* | \ + STATS=* | \ SUDO=* ) eval ${REPLY} # Define/set a global variable.. continue ;; esac @@ -71,6 +72,7 @@ parse_configuration() { # SUDO=${SUDO:-n} WRAP_INSTALL=${WRAP_INSTALL:-n} DEL_LA_FILES=${DEL_LA_FILES:-n} + STATS=${STATS:-n} } #--------------------------# @@ -94,7 +96,7 @@ validate_configuration() { # # Generates the root of the dependency tree # #--------------------------# -generate_deps() { # +generate_deps() { # #--------------------------# local -i index @@ -199,10 +201,16 @@ for ht in ${BookHtml}/*.html done echo -en "\n\tGenerating the build scripts ...\n" rm -rf scripts +if test $STATS = y; then + LIST_STAT="${TARGET[*]}" +else + LIST_STAT="" +fi xsltproc --xinclude --nonet \ --stringparam sudo "$SUDO" \ --stringparam wrap-install "$WRAP_INSTALL" \ --stringparam del-la-files "$DEL_LA_FILES" \ + --stringparam list-stat "$LIST_STAT" \ -o ./scripts/ ${MakeScripts} \ ${BookXml} # Make the scripts executable. diff --git a/BLFS/xsl/gen_config.xsl b/BLFS/xsl/gen_config.xsl index 060db80..bc326a6 100644 --- a/BLFS/xsl/gen_config.xsl +++ b/BLFS/xsl/gen_config.xsl @@ -79,6 +79,14 @@ config DEL_LA_FILES help This option should be active on any system mixing libtool and meson build systems. ImageMagick .la files are preserved. + +config STATS + bool "Generate statistics for the requested package(s)" + default n + help + If you want timing and memory footprint statistics to be + generated for the packages you build (not their dependencies), + set this option to y. diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl index fe92698..30fd22d 100644 --- a/BLFS/xsl/scripts.xsl +++ b/BLFS/xsl/scripts.xsl @@ -25,6 +25,9 @@ "porg style" package management --> + + + @@ -39,6 +42,10 @@ for libdir in /lib /usr/lib $(find /opt -name lib); do done + + + @@ -96,6 +103,20 @@ mkdir -p $SRC_DIR mkdir -p $BUILD_DIR + + + + INFOLOG=$(pwd)/info-${PKG_DIR} +TESTLOG=$(pwd)/test-${PKG_DIR} +unset MAKEFLAGS +#MAKEFLAGS=-j4 +echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG +> $TESTLOG +PKG_DEST=${BUILD_DIR}/dest +rm -rf $PKG_DEST + + + @@ -140,7 +161,16 @@ find . -maxdepth 1 -mindepth 1 -type d | xargs sudo rm -rf -case $PACKAGE in + + + + + echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG + + + + + case $PACKAGE in *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma) tar -xvf $SRC_DIR/$PACKAGE > unpacked JH_UNPACKDIR=`grep '[^./]\+' unpacked | head -n1 | sed 's@^\./@@;s@/.*@@'` @@ -169,6 +199,13 @@ esac export JH_UNPACKDIR cd $JH_UNPACKDIR + + + echo Start Time: ${SECONDS} >> $INFOLOG + + + + sudo /sbin/ @@ -421,15 +458,22 @@ fi - - - - sudo -E sh << ROOT_EOF - - + + + + + + sudo -E sh << ROOT_EOF + + if [ -r "$JH_PACK_INSTALL" ]; then source $JH_PACK_INSTALL export -f wrapInstall @@ -441,18 +485,12 @@ wrapInstall ' - + - + ' packInstall @@ -460,6 +498,21 @@ wrapInstall ' + + + + + sudo -E sh << ROOT_EOF + + + + + + ROOT_EOF + + + + @@ -534,15 +587,38 @@ popd - - # - - make - - -k + + + + +echo Time after make: ${SECONDS} >> $INFOLOG +echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG +echo Time before test: ${SECONDS} >> $INFOLOG + + + + # + + + + + + make + + -k + + + + + + + + + >> $TESTLOG 2>&1 - || true @@ -637,4 +713,118 @@ popd EDITME** + + + +echo Time after tests: ${SECONDS} >> $INFOLOG +echo Size after tests: $(sudo du -skx --exclude home /) >> $INFOLOG +echo Time before install: ${SECONDS} >> $INFOLOG + + + +echo Time after install: ${SECONDS} >> $INFOLOG +echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + make DESTDIR=$PKG_DEST + + + + + + + + + + + + + + + + + + DESTDIR=$PKG_DEST ninja + + + + + + + + + + + >$PKG_DEST/ + + + + + + + $PKG_DEST/ + + + + + + + + + + + +