Making the new blfs-tool-deps download code generic enought to can be used also on custom-tools and user inserted scripts.

This commit is contained in:
Manuel Canales Esparcia 2007-09-29 18:15:23 +00:00
parent 3470bea0eb
commit 7db3be7029
4 changed files with 54 additions and 48 deletions

View file

@ -10,6 +10,7 @@
<!-- Create a custom tools directory containing scripts
to be run after the base system has been built -->
<!-- See blfs-tool.xsl for exsl:document examples -->
<xsl:template name="custom-tools">
<!-- Fixed directory and ch_order values -->
<xsl:variable name="basedir">custom-tools/20_</xsl:variable>
@ -23,6 +24,11 @@ PKG_PHASE=dummy
PACKAGE=dummy
VERSION=0.0.0
TARBALL=dummy-0.0.0.tar.bz2
DOWNLOAD=http://www.example.com/sources/dummy-0.0.0.tar.bz2
MD5SUM=b0c2f10c23b1d529725c8f9c693858cf
PATCH="http://www.example.com/sources/dummy-0.0.0.fix1.patch 65c913efccffda4b9dc66e9002e8516e"
PATCH="http://www.example.com/sources/dummy-0.0.0.fix2.patch fb411aae8d1eb8a733bb1def9266f2ba"
</xsl:text>
<xsl:call-template name="disk_usage"/>
<xsl:call-template name="unpack"/>
@ -30,7 +36,6 @@ TARBALL=dummy-0.0.0.tar.bz2
cd $PKGDIR
./configure --prefix=/usr
make
make check
make install
</xsl:text>
<xsl:call-template name="disk_usage"/>

View file

@ -52,6 +52,7 @@
<xsl:if test="$reference = 'ID_of_selected_sect1'">
<!-- Add an exsl:document block for each script to be inserted
at this point of the build. This one is only a dummy example. -->
<!-- See blfs-tool.xsl for exsl:document examples -->
<exsl:document href="{$insert_order}01-dummy" method="text">
<xsl:call-template name="header"/>
<xsl:text>
@ -59,6 +60,11 @@ PKG_PHASE=dummy
PACKAGE=dummy
VERSION=0.0.0
TARBALL=dummy-0.0.0.tar.bz2
DOWNLOAD=http://www.example.com/sources/dummy-0.0.0.tar.bz2
MD5SUM=b0c2f10c23b1d529725c8f9c693858cf
PATCH="http://www.example.com/sources/dummy-0.0.0.fix1.patch 65c913efccffda4b9dc66e9002e8516e"
PATCH="http://www.example.com/sources/dummy-0.0.0.fix2.patch fb411aae8d1eb8a733bb1def9266f2ba"
</xsl:text>
<xsl:call-template name="disk_usage"/>
<xsl:call-template name="unpack"/>
@ -90,6 +96,7 @@ make install
<xsl:if test="$reference = 'ID_of_selected_sect1'">
<!-- Add an exsl:document block for each script to be inserted
at this point of the build. This one is only a dummy example. -->
<!-- See blfs-tool.xsl for exsl:document examples -->
<exsl:document href="{$insert_order}01-dummy" method="text">
<xsl:call-template name="header"/>
<xsl:text>
@ -97,6 +104,11 @@ PKG_PHASE=dummy
PACKAGE=dummy
VERSION=0.0.0
TARBALL=dummy-0.0.0.tar.bz2
DOWNLOAD=http://www.example.com/sources/dummy-0.0.0.tar.bz2
MD5SUM=b0c2f10c23b1d529725c8f9c693858cf
PATCH="http://www.example.com/sources/dummy-0.0.0.fix1.patch 65c913efccffda4b9dc66e9002e8516e"
PATCH="http://www.example.com/sources/dummy-0.0.0.fix2.patch fb411aae8d1eb8a733bb1def9266f2ba"
</xsl:text>
<xsl:call-template name="disk_usage"/>
<xsl:call-template name="unpack"/>

View file

@ -27,42 +27,6 @@ blfs_tool_clean_scripts() { # Remove unselected dependencies scripts
done
}
#----------------------------#
add_blfs_deps_urls() { #
#----------------------------#
local saveIFS=$IFS
local IFS file line package tarball download md5sum patchurl patchname patchmd5
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
for file in ${PROGNAME}-commands/blfs-tool-deps/* ; do
# Keep the script file name
this_script=`basename $file`
# Grab the package name, tarball, download URL and MD5SUM
package=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
tarball=`grep "^TARBALL=" ${file} | sed -e 's@TARBALL=@@'`
download=`grep "^DOWNLOAD=" ${file} | sed -e 's@DOWNLOAD=@@'`
md5sum=`grep "^MD5SUM=" ${file} | sed -e 's@MD5SUM=@@'`
# Write the package entry
echo "${download} ${BLFS_SERVER}${package}/${tarball} ${md5sum}" >> ../sources/urls.lst
# Handle the patches, if any
IFS=$'\x0A'
for line in `grep "^PATCH=" ${file}` ; do
IFS=$saveIFS
patchurl=`echo ${line} | sed -e 's@PATCH="@@' -e 's@ .*@@'`
patchname=${patchurl##*/}
patchmd5=`echo ${line} | sed -e 's@.* @@' -e 's@"@@'`
# Write the patch entry
echo "${patchurl} ${BLFS_SERVER}${package}/${patchname} ${patchmd5}" >> ../sources/urls.lst
done
done
}
#----------------------------------#
wrt_blfs_tool_targets() { #

View file

@ -139,7 +139,6 @@ create_urls() { #
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst $CODE_DIR/XSL/urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
clfs2)
echo -n "Creating CLFS2 <${ARCH}> specific URLs file"
@ -148,7 +147,6 @@ create_urls() { #
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst $CODE_DIR/XSL/urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
clfs3)
echo -n "Creating CLFS3 <${ARCH}> specific URLs file"
@ -157,7 +155,6 @@ create_urls() { #
--stringparam family clfs \
-o $BUILDDIR/sources/urls.lst $CODE_DIR/XSL/urls.xsl \
$BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
hlfs)
echo -n "Creating HLFS <${MODEL}> + <${KERNEL}> specific URLs file"
@ -168,7 +165,6 @@ create_urls() { #
--stringparam kernel $KERNEL \
-o $BUILDDIR/sources/urls.lst $CODE_DIR/XSL/urls.xsl \
$BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
lfs)
echo -n "Creating LFS specific URLs file"
@ -177,19 +173,48 @@ create_urls() { #
--stringparam family lfs \
-o ../sources/urls.lst $CODE_DIR/XSL/urls.xsl \
$BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
echo " ...OK"
;;
esac
if [[ "${BLFS_TOOL}" = "y" ]]; then
add_blfs_deps_urls
fi
add_extra_urls
if [[ "${CUSTOM_TOOLS}" = "y" ]]; then
add_CustomToolsURLS
fi
echo " ...OK"
cd $BUILDDIR/sources
}
#----------------------------# Add download URLs found in user added scripts,
add_extra_urls() { # blfs-tool-deps scripts, and custom-tools scripts
#----------------------------#
local saveIFS=$IFS
local IFS file line package tarball download md5sum patchurl patchname patchmd5
local BLFS_SERVER="${SERVER}/pub/blfs/conglomeration/"
for file in ${PROGNAME}-commands/*/* ; do
# Grab the package name, tarball, download URL and MD5SUM
package=`grep "^PACKAGE=" ${file} | sed -e 's@PACKAGE=@@'`
tarball=`grep "^TARBALL=" ${file} | sed -e 's@TARBALL=@@'`
download=`grep "^DOWNLOAD=" ${file} | sed -e 's@DOWNLOAD=@@'`
md5sum=`grep "^MD5SUM=" ${file} | sed -e 's@MD5SUM=@@'`
# Be sure that we have a download URL and MD5SUM value
if [ -n "${download}" ] && [ -n "${md5sum}" ] ; then
# Write the package entry
echo "${download} ${BLFS_SERVER}${package}/${tarball} ${md5sum}" >> ../sources/urls.lst
fi
# Handle the patches, if any
IFS=$'\x0A'
for line in `grep "^PATCH=" ${file}` ; do
IFS=$saveIFS
patchurl=`echo ${line} | sed -e 's@PATCH="@@' -e 's@ .*@@'`
patchname=${patchurl##*/}
patchmd5=`echo ${line} | sed -e 's@.* @@' -e 's@"@@'`
# Write the patch entry
echo "${patchurl} ${BLFS_SERVER}${package}/${patchname} ${patchmd5}" >> ../sources/urls.lst
done
done
}