LFS: Added support for installed files logs.
Should be ported to other books when verified that works as expected.
This commit is contained in:
parent
3834b6e986
commit
93346ee11d
6 changed files with 107 additions and 14 deletions
31
Config.in
31
Config.in
|
@ -733,6 +733,17 @@ menu "--- Build Settings"
|
|||
|
||||
#--- End Test Suites
|
||||
|
||||
#--- Installed files logs
|
||||
config INSTALL_LOG
|
||||
bool "Create installed files logs"
|
||||
default n
|
||||
depends on BOOK_LFS
|
||||
help
|
||||
#-- Select this if you want to create logs of the files
|
||||
# installed by each package on the final system.
|
||||
|
||||
#--- End Installed files logs
|
||||
|
||||
#--- FSTAB
|
||||
config HAVE_FSTAB
|
||||
bool "Use a custom fstab file"
|
||||
|
@ -920,13 +931,29 @@ endif
|
|||
string "jhalfs directory"
|
||||
default "$BUILDDIR/$SCRIPT_ROOT"
|
||||
|
||||
config LOGDIRBASE
|
||||
string "Build logs directory basename"
|
||||
default "logs"
|
||||
|
||||
config LOGDIR
|
||||
string "Build logs directory"
|
||||
default "$JHALFSDIR/logs"
|
||||
default "$JHALFSDIR/$LOGDIRBASE"
|
||||
|
||||
config TESTLOGDIRBASE
|
||||
string "Test suites logs directory basename"
|
||||
default "test-logs"
|
||||
|
||||
config TESTLOGDIR
|
||||
string "Test suites logs directory"
|
||||
default "$JHALFSDIR/test-logs"
|
||||
default "$JHALFSDIR/$TESTLOGDIRBASE"
|
||||
|
||||
config FILELOGDIRBASE
|
||||
string "Installed files logs directory basename"
|
||||
default "installed-files"
|
||||
|
||||
config FILELOGDIR
|
||||
string "Installed files logs directory"
|
||||
default "$JHALFSDIR/$FILELOGDIRBASE"
|
||||
|
||||
config ICALOGDIR
|
||||
string "ICA logs directory"
|
||||
|
|
|
@ -232,6 +232,10 @@ chapter6_Makefiles() {
|
|||
# If $pkg_tarball isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and changing directories
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
# Touch timestamp file if inelalled files logs will be created.
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_TouchTimestamp
|
||||
fi
|
||||
CHROOT_Unpack "$pkg_tarball"
|
||||
# If the testsuites must be run, initialize the log file
|
||||
case $name in
|
||||
|
@ -253,9 +257,13 @@ chapter6_Makefiles() {
|
|||
*) CHROOT_wrt_RunAsRoot "$file" ;;
|
||||
esac
|
||||
|
||||
# Remove the build directory(ies) except if the package build fails.
|
||||
# Write installed files log and remove the build directory(ies)
|
||||
# except if the package build fails.
|
||||
if [ "$pkg_tarball" != "" ] ; then
|
||||
CHROOT_wrt_RemoveBuildDirs "$name"
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_LogNewFiles "$name"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Include a touch of the target name so make can check
|
||||
|
@ -310,11 +318,17 @@ chapter78_Makefiles() {
|
|||
name="lfs-bootscripts"
|
||||
pkg_tarball=$(get_package_tarball_name $name)
|
||||
CHROOT_Unpack "$pkg_tarball"
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_TouchTimestamp
|
||||
fi
|
||||
;;
|
||||
*kernel)
|
||||
name="linux"
|
||||
pkg_tarball=$(get_package_tarball_name $name)
|
||||
CHROOT_Unpack "$pkg_tarball"
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_TouchTimestamp
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -331,8 +345,14 @@ chapter78_Makefiles() {
|
|||
esac
|
||||
|
||||
case "${this_script}" in
|
||||
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
||||
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy" ;;
|
||||
*bootscripts) CHROOT_wrt_RemoveBuildDirs "dummy"
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_LogNewFiles "$name"
|
||||
fi ;;
|
||||
*kernel) CHROOT_wrt_RemoveBuildDirs "dummy"
|
||||
if [ "${INSTALL_LOG}" = "y" ] ; then
|
||||
CHROOT_wrt_LogNewFiles "$name"
|
||||
fi ;;
|
||||
esac
|
||||
|
||||
# Include a touch of the target name so make can check
|
||||
|
|
|
@ -20,11 +20,11 @@ validate_config() { # Are the config values sane (within reason)
|
|||
inline_doc
|
||||
|
||||
# First internal variables, then the ones that change the book's flavour, and lastly system configuration variables
|
||||
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH PLATFORM TARGET MIPS_LEVEL REPORT FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL PAGE TIMEZONE LANG LC_ALL LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TARGET32 TEST BOMB_TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET REPORT STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r clfs3_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH PLATFORM TARGET MIPS_LEVEL REPORT FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST BOMB_TEST INSTALL_LOG OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG LUSER LGROUP LHOME BLFS_TOOL CUSTOM_TOOLS REBUILD_MAKEFILE"
|
||||
local -r blfs_PARAM_LIST="BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR"
|
||||
|
||||
local -r blfs_tool_PARAM_LIST="BLFS_BRANCH_ID BLFS_ROOT BLFS_XML TRACKING_DIR DEP_LIBXML DEP_LIBXSLT DEP_TIDY DEP_UNZIP DEP_DBXML DEP_DBXSL DEP_LINKS DEP_SUDO DEP_WGET DEP_SVN DEP_GPM"
|
||||
|
@ -116,6 +116,7 @@ inline_doc
|
|||
CUSTOM_TOOLS | \
|
||||
TIMEZONE | \
|
||||
PAGE | \
|
||||
INSTALL_LOG | \
|
||||
REBUILD_MAKEFILE ) echo -e "`eval echo $PARAM_VALS`" ;;
|
||||
|
||||
# Envvars that depend on other settings to be displayed
|
||||
|
|
|
@ -28,12 +28,13 @@ SCRIPT_ROOT = $SCRIPT_ROOT
|
|||
BASEDIR = \$(MOUNT_PT)
|
||||
SRCSDIR = \$(BASEDIR)/sources
|
||||
CMDSDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$PROGNAME-commands
|
||||
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/logs
|
||||
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/test-logs
|
||||
LOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$LOGDIRBASE
|
||||
TESTLOGDIR = \$(BASEDIR)/\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
|
||||
|
||||
crCMDSDIR = /\$(SCRIPT_ROOT)/$PROGNAME-commands
|
||||
crLOGDIR = /\$(SCRIPT_ROOT)/logs
|
||||
crTESTLOGDIR = /\$(SCRIPT_ROOT)/test-logs
|
||||
crLOGDIR = /\$(SCRIPT_ROOT)/$LOGDIRBASE
|
||||
crTESTLOGDIR = /\$(SCRIPT_ROOT)/$TESTLOGDIRBASE
|
||||
crFILELOGDIR = /\$(SCRIPT_ROOT)/$FILELOGDIRBASE
|
||||
|
||||
SU_LUSER = su - \$(LUSER) -c
|
||||
LUSER_HOME = \$(LHOME)/\$(LUSER)
|
||||
|
@ -289,6 +290,33 @@ EOF
|
|||
#=======================
|
||||
|
||||
|
||||
#==== INSTALLED FILES LOGS ====
|
||||
|
||||
#----------------------------------#
|
||||
CHROOT_wrt_TouchTimestamp() { #
|
||||
#----------------------------------#
|
||||
local name=$1
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call touch_timestamp)
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#----------------------------------#
|
||||
CHROOT_wrt_LogNewFiles() { #
|
||||
#----------------------------------#
|
||||
local name=$1
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call log_new_files,$name)
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#=======================
|
||||
|
||||
|
||||
#==== RM BUILD DIRS ====
|
||||
|
||||
#----------------------------------#
|
||||
|
|
|
@ -111,6 +111,19 @@ endef
|
|||
|
||||
#==#
|
||||
|
||||
define touch_timestamp
|
||||
@touch $(SRC)/timestamp-marker && sleep 1
|
||||
endef
|
||||
|
||||
define log_new_files
|
||||
@find / -xdev ! -path "/$(SCRIPT_ROOT)/*" ! -path "/proc/*" \
|
||||
! -path "/tmp/*" ! -path "/dev/*" ! -path "$(SRC)/*" \
|
||||
-newer $(SRC)/timestamp-marker -not -type d \
|
||||
-fprintf $(crFILELOGDIR)/$(1) "%p\t%s\t%u:%g\t%m\t%l\n" || true
|
||||
endef
|
||||
|
||||
#==@
|
||||
|
||||
define remove_build_dirs
|
||||
@ROOT=`head -n1 $(SRCSDIR)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
|
||||
rm -rf $(SRCSDIR)/$$ROOT && \
|
||||
|
|
4
jhalfs
4
jhalfs
|
@ -109,6 +109,7 @@ VIMLANG=${VIMLANG:-n}
|
|||
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
|
||||
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}
|
||||
REBUILD_MAKEFILE=${REBUILD_MAKEFILE:-n}
|
||||
INSTALL_LOG=${INSTALL_LOG:-n}
|
||||
|
||||
# Book surces envars
|
||||
BRANCH_ID=${BRANCH_ID:=development}
|
||||
|
@ -354,6 +355,9 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
|||
# Create the test-log directory, if needed
|
||||
[[ "$TEST" != "0" ]] && [[ ! -d $TESTLOGDIR ]] && install -d -m 1777 $TESTLOGDIR
|
||||
#
|
||||
# Create the installed-files directory, if needed
|
||||
[[ "$INSTALL_LOG" = "y" ]] && [[ ! -d $FILELOGDIR ]] && install -d -m 1777 $FILELOGDIR
|
||||
#
|
||||
# Prepare report creation, if needed
|
||||
if [[ "$REPORT" = "y" ]]; then
|
||||
cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/
|
||||
|
|
Reference in a new issue