Add versions to file names in logs and test-logs: use it for the SBY report

This commit is contained in:
Pierre Labastie 2013-10-05 17:45:52 +00:00
parent ad4ff97cf4
commit 3cb4ef5b5a
2 changed files with 93 additions and 29 deletions

View file

@ -113,20 +113,20 @@ chapter5_Makefiles() {
# >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
#--------------------------------------------------------------------# #--------------------------------------------------------------------#
# #
# Find the name of the tarball and the version of the package
pkg_tarball=$(get_package_tarball_name $name)
pkg_version=$(get_package_version $pkg_tarball)
# Drop in the name of the target on a new line, and the previous target # Drop in the name of the target on a new line, and the previous target
# as a dependency. Also call the echo_message function. # as a dependency. Also call the echo_message function.
LUSER_wrt_target "${this_script}" "$PREV" LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version"
# Find the version of the command files, if it corresponds with the building of
# a specific package
pkg_tarball=$(get_package_tarball_name $name)
# If $pkg_tarball isn't empty, we've got a package... # If $pkg_tarball isn't empty, we've got a package...
if [ "$pkg_tarball" != "" ] ; then if [ "$pkg_tarball" != "" ] ; then
# Insert instructions for unpacking the package and to set the PKGDIR variable. # Insert instructions for unpacking the package and to set the PKGDIR variable.
LUSER_wrt_unpack "$pkg_tarball" LUSER_wrt_unpack "$pkg_tarball"
# If the testsuites must be run, initialize the log file # If the testsuites must be run, initialize the log file
[[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}" [[ "$TEST" = "3" ]] && LUSER_wrt_test_log "${this_script}" "$pkg_version"
# If using optimizations, write the instructions # If using optimizations, write the instructions
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi fi
@ -135,8 +135,8 @@ chapter5_Makefiles() {
# and date and disk usage again at the bottom of the log file. # and date and disk usage again at the bottom of the log file.
# The changingowner script must be run as root. # The changingowner script must be run as root.
case "${this_script}" in case "${this_script}" in
*changingowner) wrt_RunAsRoot "$file" ;; *changingowner) wrt_RunAsRoot "$file" "$pkg_version" ;;
*) LUSER_wrt_RunAsUser "$file" ;; *) LUSER_wrt_RunAsUser "$file" "$pkg_version" ;;
esac esac
# Remove the build directory(ies) except if the package build fails # Remove the build directory(ies) except if the package build fails
@ -213,6 +213,7 @@ chapter6_Makefiles() {
# a specific package. We need this here to can skip scripts not needed for # a specific package. We need this here to can skip scripts not needed for
# iterations rebuilds # iterations rebuilds
pkg_tarball=$(get_package_tarball_name $name) pkg_tarball=$(get_package_tarball_name $name)
pkg_version=$(get_package_version $pkg_tarball)
if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then
case "${this_script}" in case "${this_script}" in
@ -238,8 +239,8 @@ chapter6_Makefiles() {
# In the mount of kernel filesystems we need to set LFS # In the mount of kernel filesystems we need to set LFS
# and not to use chroot. # and not to use chroot.
case "${this_script}" in case "${this_script}" in
*kernfs) LUSER_wrt_target "${this_script}" "$PREV" ;; *kernfs) LUSER_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
*) CHROOT_wrt_target "${this_script}" "$PREV" ;; *) CHROOT_wrt_target "${this_script}" "$PREV" "$pkg_version" ;;
esac esac
# If $pkg_tarball isn't empty, we've got a package... # If $pkg_tarball isn't empty, we've got a package...
@ -254,10 +255,10 @@ chapter6_Makefiles() {
# If the testsuites must be run, initialize the log file # If the testsuites must be run, initialize the log file
case $name in case $name in
binutils | gcc | glibc | gmp | mpfr ) binutils | gcc | glibc | gmp | mpfr )
[[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" "$pkg_version"
;; ;;
* ) * )
[[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}" [[ "$TEST" = "2" ]] || [[ "$TEST" = "3" ]] && CHROOT_wrt_test_log "${this_script}" "$pkg_version"
;; ;;
esac esac
# If using optimizations, write the instructions # If using optimizations, write the instructions
@ -267,8 +268,8 @@ chapter6_Makefiles() {
# In the mount of kernel filesystems we need to set LFS # In the mount of kernel filesystems we need to set LFS
# and not to use chroot. # and not to use chroot.
case "${this_script}" in case "${this_script}" in
*kernfs) wrt_RunAsRoot "$file" ;; *kernfs) wrt_RunAsRoot "$file" "$pkg_version" ;;
*) CHROOT_wrt_RunAsRoot "$file" ;; *) CHROOT_wrt_RunAsRoot "$file" "$pkg_version" ;;
esac esac
# Write installed files log and remove the build directory(ies) # Write installed files log and remove the build directory(ies)

View file

@ -58,7 +58,7 @@ EOF
#======================= #=======================
#==== PACKAGES NAMES === #==== PACKAGES NAMES AND VERSIONS ====
#----------------------------------# #----------------------------------#
get_package_tarball_name() { # get_package_tarball_name() { #
@ -116,6 +116,41 @@ get_package_tarball_name() { #
} }
#----------------------------------#
get_package_version() { #
#----------------------------------#
# Those hacks may change depending on the invention of devs for tarball names.
# Normally, we expect -digit to signal the beginning of the version field
# but it may happen that there is no '-' (tcl, expect), that the version
# field is ddd-d (pkg-config-lite-028-1, since sed is greedy, it finds only
# the second dash) or that the first character of the version is not a digit
# (iputils-s20121221)...
case ${1} in
tcl*|expect*|tzdata*|xmlts*|unzip*|lynx*)
echo ${1} | sed -e 's@^[^[:digit:]]*@@' \
-e 's@\(-src\)*\.tar.*@@'
;;
iputils*) echo ${1} | sed -e 's@^.*-@@' \
-e 's@\.tar.*@@'
;;
LVM*) echo ${1} | sed -e 's@^[^.]*\.@@' \
-e 's@\.tgz.*@@'
;;
iproute*) echo ${1} | sed -e 's@^[^-]*-@@' \
-e 's@\.tar.*@@'
;;
pkg*|udev*|Singular*)
echo ${1} | sed -e 's@^.*[a-z]-\([[:digit:]]\)@\1@' \
-e 's@\.tar.*@@' \
-e 's@\.zip.*@@'
;;
*) echo ${1} | sed -e 's@^.*[-_]\([[:digit:]]\)@\1@' \
-e 's@\.tar.*@@' \
-e 's@\.zip.*@@'
;;
esac
}
#======================= #=======================
@ -126,14 +161,18 @@ LUSER_wrt_target() { # Create target and initialize log file
#----------------------------------# #----------------------------------#
local i=$1 local i=$1
local PREV=$2 local PREV=$2
local version
if [ "$3" != "" ]; then
version=-$3
fi
( (
cat << EOF cat << EOF
$i: $PREV $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & ${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@ @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
@\$(PRT_DU) >>logs/\$@ @\$(PRT_DU) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -143,14 +182,18 @@ CHROOT_wrt_target() { # Create target and initialize log file
#----------------------------------# #----------------------------------#
local i=$1 local i=$1
local PREV=$2 local PREV=$2
local version
if [ "$3" != "" ]; then
version=-$3
fi
( (
cat << EOF cat << EOF
$i: $PREV $i: $PREV
@\$(call echo_message, Building) @\$(call echo_message, Building)
${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID & ${NO_PROGRESS} @export BASHBIN=\$(SHELL) && \$(SHELL) progress_bar.sh \$@ \$\$PPID &
@echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@ @echo "\$(nl_)\`date\`\$(nl_)" >logs/\$@$version
@\$(PRT_DU_CR) >>logs/\$@ @\$(PRT_DU_CR) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -211,11 +254,15 @@ EOF
#----------------------------------# #----------------------------------#
LUSER_wrt_test_log() { # Initialize testsuite log file LUSER_wrt_test_log() { # Initialize testsuite log file
#----------------------------------# #----------------------------------#
local TESTLOGFILE=$1 local version
if [ "$2" != "" ]; then
version=-$2
fi
local TESTLOGFILE=$1$version
( (
cat << EOF cat << EOF
@echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\ @echo "export TEST_LOG=\$(TESTLOGDIR)/$TESTLOGFILE" >> envars && \\
echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/\$@ echo "\$(nl_)\`date\`\$(nl_)" >\$(TESTLOGDIR)/$TESTLOGFILE
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -223,11 +270,15 @@ EOF
#----------------------------------# #----------------------------------#
CHROOT_wrt_test_log() { # CHROOT_wrt_test_log() { #
#----------------------------------# #----------------------------------#
local TESTLOGFILE=$1 local version
if [ "$2" != "" ]; then
version=-$2
fi
local TESTLOGFILE=$1$version
( (
cat << EOF cat << EOF
@echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\ @echo "export TEST_LOG=\$(crTESTLOGDIR)/$TESTLOGFILE" >> envars && \\
echo "\$(nl_)\`date\`\$(nl_)" >test-logs/\$@ echo "\$(nl_)\`date\`\$(nl_)" >\$(crTESTLOGDIR)/$TESTLOGFILE
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -241,6 +292,10 @@ EOF
wrt_RunAsRoot() { # Some scripts must be run as root.. wrt_RunAsRoot() { # Some scripts must be run as root..
#----------------------------------# #----------------------------------#
local MOUNT_ENV local MOUNT_ENV
local version
if [ "$2" != "" ]; then
version=-$2
fi
local file=$1 local file=$1
case ${PROGNAME} in case ${PROGNAME} in
@ -255,8 +310,8 @@ wrt_RunAsRoot() { # Some scripts must be run as root..
( (
cat << EOF cat << EOF
@export ${MOUNT_ENV}=\$(MOUNT_PT) && \\ @export ${MOUNT_ENV}=\$(MOUNT_PT) && \\
${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ ${PROGNAME}-commands/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\
\$(PRT_DU) >>logs/\$@ \$(PRT_DU) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -265,12 +320,16 @@ EOF
LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log file LUSER_wrt_RunAsUser() { # Calculate time with perl, footer to log file
#----------------------------------# #----------------------------------#
local file=$1 local file=$1
local version
if [ "$2" != "" ]; then
version=-$2
fi
( (
cat << EOF cat << EOF
@source ~/.bashrc && \\ @source ~/.bashrc && \\
\$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@ 2>&1 && \\ \$(CMDSDIR)/`dirname $file`/\$@ >> logs/\$@$version 2>&1 && \\
\$(PRT_DU) >>logs/\$@ \$(PRT_DU) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
@ -279,11 +338,15 @@ EOF
CHROOT_wrt_RunAsRoot() { # CHROOT_wrt_RunAsRoot() { #
#----------------------------------# #----------------------------------#
local file=$1 local file=$1
local version
if [ "$2" != "" ]; then
version=-$2
fi
( (
cat << EOF cat << EOF
@source envars && \\ @source envars && \\
\$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@ 2>&1 && \\ \$(crCMDSDIR)/`dirname $file`/\$@ >>logs/\$@$version 2>&1 && \\
\$(PRT_DU_CR) >>logs/\$@ \$(PRT_DU_CR) >>logs/\$@$version
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp