Simplified unpack code due tar >= 1.5 prerequisite.
If both bz2 and gz formats of the same package are found in the sources dir, only the more recent one is unpacked.
This commit is contained in:
parent
c0cbd50735
commit
c3c4e1dc59
5 changed files with 31 additions and 48 deletions
|
@ -287,7 +287,7 @@ cross_tools_Makefiles() { #
|
|||
#
|
||||
# If $vrs isn't empty, we've got a package...
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar" && echo -e '\ttrue' >> $MKFILE.tmp
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
||||
#
|
||||
wrt_run_as_lfs "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -339,7 +339,7 @@ temptools_Makefiles() { #
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar" && echo -e '\ttrue' >> $MKFILE.tmp
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
||||
#
|
||||
wrt_run_as_lfs "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -411,7 +411,7 @@ boot_Makefiles() { #
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and changing directories
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
||||
#
|
||||
# Select a script execution method
|
||||
case $this_script in
|
||||
|
@ -488,7 +488,7 @@ chroot_Makefiles() { #
|
|||
#
|
||||
if [ "$vrs" != "" ] ; then
|
||||
case $this_script in
|
||||
*util-linux) wrt_unpack "$name-$vrs.tar"
|
||||
*util-linux) wrt_unpack "$name-$vrs.tar.*"
|
||||
echo -e '\ttrue' >> $MKFILE.tmp
|
||||
;;
|
||||
*) wrt_unpack2 "$name-$vrs.tar.*"
|
||||
|
@ -551,8 +551,8 @@ testsuite_tools_Makefiles() { #
|
|||
echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
||||
#
|
||||
case $name in
|
||||
tcl) wrt_unpack2 "$name$vrs-src.tar" ;;
|
||||
*) wrt_unpack2 "$name-$vrs.tar" ;;
|
||||
tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
||||
*) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
#
|
||||
wrt_run_as_chroot1 "${this_script}" "${file}"
|
||||
|
@ -604,8 +604,8 @@ bm_testsuite_tools_Makefiles() { #
|
|||
echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
||||
#
|
||||
case $name in
|
||||
tcl) wrt_unpack4 "$name$vrs-src.tar.*" ;;
|
||||
*) wrt_unpack4 "$name-$vrs.tar.*" ;;
|
||||
tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
||||
*) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
#
|
||||
wrt_run_as_root2 "${this_script}" "${file}"
|
||||
|
@ -818,8 +818,8 @@ bm_final_system_Makefiles() { #
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
if [ "$vrs" != "" ] ; then
|
||||
case $name in
|
||||
temp-perl) wrt_unpack4 "perl-$vrs.tar.*" ;;
|
||||
*) wrt_unpack4 "$name-$vrs.tar.*" ;;
|
||||
temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
||||
*) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
#
|
||||
# Export a few 'config' vars..
|
||||
|
@ -985,7 +985,7 @@ EOF
|
|||
#
|
||||
# If $vrs isn't empty, we've got a package...
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
||||
#
|
||||
wrt_run_as_root2 "${this_script}" "${file}"
|
||||
#
|
||||
|
@ -1056,7 +1056,7 @@ bootable_Makefiles() { #
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and changing directories
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*"
|
||||
#
|
||||
# Select a script execution method
|
||||
case $this_script in
|
||||
|
@ -1100,7 +1100,7 @@ bm_bootable_Makefiles() { #
|
|||
# A little housekeeping on the scripts
|
||||
case $this_script in
|
||||
*grub*) continue ;;
|
||||
*kernel)
|
||||
*kernel)
|
||||
# if there is no kernel config file do not build the kernel
|
||||
[[ -z $CONFIG ]] && continue
|
||||
cfg_file="/sources/`basename $CONFIG`"
|
||||
|
@ -1141,7 +1141,7 @@ bm_bootable_Makefiles() { #
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
# Insert instructions for unpacking the package and changing directories
|
||||
#
|
||||
[[ "$vrs" != "" ]] && wrt_unpack4 "$name-$vrs.tar.*"
|
||||
[[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
||||
#
|
||||
# Select a script execution method
|
||||
case $this_script in
|
||||
|
|
|
@ -215,10 +215,10 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
|||
if [ "$vrs" != "" ] ; then
|
||||
# Deal with non-standard names
|
||||
case $name in
|
||||
tcl) FILE="$name$vrs-src.tar" ;;
|
||||
uclibc) FILE="uClibc-$vrs.tar" ;;
|
||||
gcc) FILE="gcc-core-$vrs.tar" ;;
|
||||
*) FILE="$name-$vrs.tar" ;;
|
||||
tcl) FILE="$name$vrs-src.tar.*" ;;
|
||||
uclibc) FILE="uClibc-$vrs.tar.*" ;;
|
||||
gcc) FILE="gcc-core-$vrs.tar.*" ;;
|
||||
*) FILE="$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
wrt_unpack "$FILE"
|
||||
|
|
|
@ -106,9 +106,9 @@ chapter5_Makefiles() {
|
|||
# If $vrs isn't empty, we've got a package...
|
||||
if [ "$vrs" != "" ] ; then
|
||||
if [ "$name" = "tcl" ] ; then
|
||||
FILE="$name$vrs-src.tar"
|
||||
FILE="$name$vrs-src.tar.*"
|
||||
else
|
||||
FILE="$name-$vrs.tar"
|
||||
FILE="$name-$vrs.tar.*"
|
||||
fi
|
||||
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
|
|
|
@ -228,21 +228,6 @@ EOF
|
|||
}
|
||||
|
||||
|
||||
#=============================#
|
||||
wrt_unpack3() { # Unpack and set 'ROOT' var
|
||||
#=============================#
|
||||
local FILE=$1
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack3,$FILE)
|
||||
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
||||
echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\
|
||||
chown -R lfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------#
|
||||
wrt_unpack2() { #
|
||||
#----------------------------------#
|
||||
|
@ -258,12 +243,12 @@ EOF
|
|||
|
||||
|
||||
#=============================#
|
||||
wrt_unpack4() { # Unpack and set 'ROOT' var
|
||||
wrt_unpack3() { # Unpack and set 'ROOT' var
|
||||
#=============================#
|
||||
local FILE=$1
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack4,$FILE)
|
||||
@\$(call unpack3,$FILE)
|
||||
@ROOT=\`head -n1 /tmp/unpacked | sed 's@^./@@;s@/.*@@'\` && \\
|
||||
echo "export PKGDIR=\$(SRC)/\$\$ROOT" > envars
|
||||
EOF
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
# $Id$
|
||||
|
||||
BOLD= "[0;1m"
|
||||
RED= "[1;31m"
|
||||
GREEN= "[0;32m"
|
||||
|
@ -13,23 +16,18 @@ define echo_message
|
|||
endef
|
||||
|
||||
define unpack
|
||||
@if [ -f $(MOUNT_PT)$(SRC)/$(1).bz2 ] ; then \
|
||||
cd $(MOUNT_PT)$(SRC) ; tar -xvjf $(1).bz2 > /tmp/unpacked ; \
|
||||
else \
|
||||
cd $(MOUNT_PT)$(SRC) ; tar -xvzf $(1).gz > /tmp/unpacked ; \
|
||||
fi ;
|
||||
@cd $(MOUNT_PT)$(SRC) && \
|
||||
tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
|
||||
endef
|
||||
|
||||
define unpack2
|
||||
@cd $(MOUNT_PT)$(SRC) ; /tools/bin/tar -xvf $(1) > /tmp/unpacked
|
||||
@cd $(MOUNT_PT)$(SRC) && \
|
||||
/tools/bin/tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
|
||||
endef
|
||||
|
||||
define unpack3
|
||||
@cd $(MOUNT_PT)$(SRC) ; tar -xvf $(1) > /tmp/unpacked
|
||||
endef
|
||||
|
||||
define unpack4
|
||||
@cd $(SRC) ; tar -xvf $(1) > /tmp/unpacked
|
||||
@cd $(SRC) && \
|
||||
tar -xvf `ls -t $(1) | head -n1` > /tmp/unpacked
|
||||
endef
|
||||
|
||||
define echo_finished
|
||||
|
|
Reference in a new issue