Merged r2734:2745 from trunk.

This commit is contained in:
Manuel Canales Esparcia 2006-06-02 17:53:17 +00:00
parent db6b93417d
commit 460ea6306b
9 changed files with 110 additions and 32 deletions

View file

@ -991,6 +991,7 @@ $HEADER
SRC= /sources
MOUNT_PT= $BUILDDIR
PKG_LST= $PKG_LST
include makefile-functions

View file

@ -141,7 +141,12 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
*) FILE="$name-$vrs.tar.*" ;;
esac
# Insert instructions for unpacking the package and to set the PKGDIR variable.
wrt_unpack "$FILE"
case $this_script in
*binutils* )
wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
*)
wrt_unpack "$FILE" ;;
esac
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi
@ -149,7 +154,7 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
*binutils* ) # Dump the path to sources directory for later removal
(
cat << EOF
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "\$(MOUNT_PT)\$(SRC)/\$\$ROOT" >> sources-dir
EOF
) >> $MKFILE.tmp
@ -429,7 +434,7 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
*bootscripts*)
(
cat << EOF
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT
@rm -r \`cat sources-dir\` && \\
rm sources-dir
@ -478,6 +483,7 @@ $HEADER
SRC= /sources
MOUNT_PT= $BUILDDIR
PKG_LST= $PKG_LST
include makefile-functions
@ -571,7 +577,7 @@ do-housekeeping:
userdel lfs; \\
rm -rf /home/lfs; \\
fi;
EOF
) >> $MKFILE

View file

@ -355,6 +355,7 @@ $HEADER
SRC= /sources
MOUNT_PT= $BUILDDIR
PKG_LST= $PKG_LST
include makefile-functions
@ -431,7 +432,7 @@ restore-lfs-env:
fi;
@chown lfs:lfs /home/lfs/.bash* && \\
touch \$@
do_housekeeping:
-umount \$(MOUNT_PT)/sys
-umount \$(MOUNT_PT)/proc
@ -442,7 +443,7 @@ do_housekeeping:
userdel lfs; \\
rm -rf /home/lfs; \\
fi;
EOF
) >> $MKFILE

View file

@ -57,7 +57,7 @@ ${BOLD} -B, --book VER${OFF}
${BOLD} -D --directory DIR${OFF}
use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs-X produces
will be in the directory DIR/jhalfs.
will be in the directory DIR/${SCRIPT_ROOT}.
The current setting for BUILDDIR is "$BUILDDIR"
${BOLD} -G, --get-packages${OFF}
@ -201,20 +201,62 @@ cat << EOF
$i: $PREV
@\$(call echo_message, Building)
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >logs/$LOGFILE
@./progress_bar.sh \$@ &
@echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >logs/$LOGFILE
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_existing_dirs() { #
#----------------------------------#
local PKG_NAME=$1
(
cat << EOF
@PKG_PATH=\`ls -t \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1\` && \\
ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
[[ -n \$\$ROOT ]] && \\
rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build ]; then \\
rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_remove_existing_dirs2() { #
#----------------------------------#
local PKG_NAME=$1
(
cat << EOF
@PKG_PATH=\`ls -t \$(SRC)/${PKG_NAME} | head -n1\` && \\
ROOT=\`tar -tf \$\$PKG_PATH | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
[[ -n \$\$ROOT ]] && \\
rm -rf \$(SRC)/\$\$ROOT && \\
if [ -e \$(SRC)/${PKG_NAME%%-*}-build ]; then \\
rm -rf \$(SRC)/${PKG_NAME%%-*}-build; \\
fi;
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
(
cat << EOF
@\$(call unpack,$FILE)
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
EOF
@ -226,10 +268,15 @@ EOF
wrt_unpack2() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
(
cat << EOF
@\$(call unpack2,$FILE)
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
EOF
) >> $MKFILE.tmp
@ -240,16 +287,20 @@ EOF
wrt_unpack3() { #
#----------------------------------#
local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs2 "$FILE"
fi
(
cat << EOF
@\$(call unpack3,$FILE)
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
EOF
) >> $MKFILE.tmp
}
#----------------------------------#
wrt_target_vars() { # Target vars for hlfs (cross-build method)
#----------------------------------#
@ -271,7 +322,7 @@ wrt_run_as_su() { # Execute script inside time { }, footer to l
(
cat << EOF
@( time { su - lfs -c "source /home/lfs/.bashrc && $JHALFSDIR/${PROGNAME}-commands/$file" >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/$this_script
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
EOF
) >> $MKFILE.tmp
}
@ -285,7 +336,7 @@ wrt_run_as_root() { # Some scripts must be run as root..
(
cat << EOF
@( time { export LFS=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/$this_script
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
EOF
) >> $MKFILE.tmp
}
@ -299,7 +350,7 @@ wrt_run_as_root2() { #
(
cat << EOF
@( time { source envars && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=jhalfs \`\n" >>logs/$this_script
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \`\n" >>logs/$this_script
EOF
) >> $MKFILE.tmp
}
@ -313,8 +364,8 @@ wrt_run_as_chroot1() { #
local file=$2
(
cat << EOF
@( time { \$(CHROOT1) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/${this_script}
@( time { \$(CHROOT1) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
EOF
) >> $MKFILE.tmp
}
@ -327,8 +378,8 @@ wrt_run_as_chroot2() { #
local file=$2
(
cat << EOF
@( time { \$(CHROOT2) 'cd /jhalfs && source envars && /jhalfs/${PROGNAME}-commands/$file >>/jhalfs/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=jhalfs \$(MOUNT_PT)\`\n" >>logs/${this_script}
@( time { \$(CHROOT2) 'cd /${SCRIPT_ROOT} && source envars && /${SCRIPT_ROOT}/${PROGNAME}-commands/$file >>/${SCRIPT_ROOT}/logs/${this_script} 2>&1' ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/${this_script}
EOF
) >> $MKFILE.tmp
}
@ -363,7 +414,7 @@ wrt_remove_build_dirs() { #
local name=$1
(
cat << EOF
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -r \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
if [ -e \$(MOUNT_PT)\$(SRC)/$name-build ]; then \\
rm -r \$(MOUNT_PT)\$(SRC)/$name-build; \\
@ -379,7 +430,7 @@ wrt_remove_build_dirs2() { #
local name=$1
(
cat << EOF
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
@ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\
rm -r \$(SRC)/\$\$ROOT && \\
if [ -e \$(SRC)/$name-build ]; then \\
rm -r \$(SRC)/$name-build; \\

View file

@ -88,9 +88,13 @@ RUN_FARCE=0
# Don't edit it unless you know what you are doing
#--- Working directories
JHALFSDIR=$BUILDDIR/jhalfs
SCRIPT_ROOT=jhalfs
JHALFSDIR=$BUILDDIR/$SCRIPT_ROOT
LOGDIR=$JHALFSDIR/logs
#--- File listing package contents (from where package sources dir is extracted)
PKG_LST=unpacked
#--- ICA report log directory
ICALOGDIR=$LOGDIR/ICA

View file

@ -43,17 +43,17 @@ wrt_compare_work() { #
#----------------------------------#
local ITERATION=$1
local PREV_IT=$2
local PRUNEPATH="/dev /home /jhalfs /lost+found /media /mnt /opt /proc \
local PRUNEPATH="/dev /home /${SCRIPT_ROOT} /lost+found /media /mnt /opt /proc \
/sources /root /srv /sys /tmp /tools /usr/local /usr/src /var/log/paco"
if [[ "$PROGNAME" = "clfs" ]] && [[ "$METHOD" = "boot" ]] ; then
local ROOT_DIR=/
local DEST_TOPDIR=/jhalfs
local ICALOGDIR=/jhalfs/logs/ICA
local FARCELOGDIR=/jhalfs/logs/farce
local DEST_TOPDIR=/${SCRIPT_ROOT}
local ICALOGDIR=/${SCRIPT_ROOT}/logs/ICA
local FARCELOGDIR=/${SCRIPT_ROOT}/logs/farce
else
local ROOT_DIR=$BUILDDIR
local DEST_TOPDIR=$BUILDDIR/jhalfs
local DEST_TOPDIR=$BUILDDIR/${SCRIPT_ROOT}
fi
if [[ "$RUN_ICA" = "1" ]] ; then

View file

@ -17,17 +17,17 @@ endef
define unpack
@cd $(MOUNT_PT)$(SRC) && \
tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef
define unpack2
@cd $(MOUNT_PT)$(SRC) && \
/tools/bin/tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
/tools/bin/tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef
define unpack3
@cd $(SRC) && \
tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
tar -xvf `ls -t $(1) | head -n1` > $(PKG_LST)
endef
define echo_report

15
common/progress_bar.sh Executable file
View file

@ -0,0 +1,15 @@
#!/bin/bash
# $Id$
set -e
[[ -z $1 ]] && exit
if [ ! -f $1 ] ; then
while fuser -v . 2>&1 | grep make >/dev/null ; do
echo -n "."
sleep 1
[[ -f $1 ]] && exit
done
fi

View file

@ -136,7 +136,7 @@ while test $# -gt 0 ; do
;;
* )
BUILDDIR=$1
JHALFSDIR=$BUILDDIR/jhalfs
JHALFSDIR=$BUILDDIR/${SCRIPT_ROOT}
LOGDIR=$JHALFSDIR/logs
MKFILE=$JHALFSDIR/Makefile
;;
@ -481,7 +481,7 @@ fi
#
#
if [[ "$PWD" != "$JHALFSDIR" ]]; then
cp $COMMON_DIR/makefile-functions $JHALFSDIR/
cp $COMMON_DIR/{makefile-functions,progress_bar.sh} $JHALFSDIR/
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
if [[ "$COMPARE" != "0" ]] ; then
mkdir -p $JHALFSDIR/extras