source: BLFS/update-lfs.sh@ 5af9ab4

ablfs-more legacy trunk
Last change on this file since 5af9ab4 was c8d5f11, checked in by Pierre Labastie <pierre@…>, 6 years ago

update-lfs.sh: remove tools package from instpkg.xml

  • Property mode set to 100755
File size: 4.9 KB
RevLine 
[ce244f6]1#!/bin/bash
2
3# $Id$
4
5# Fills the tracking file with versions of LFS packages taken from an
6# SVN repository, at either a given date or a given tag (argument $1).
7#------
8# Argument $1:
9# $1 contains a tag or a date, to indicate which version of the LFS book
10# to use. It may be empty, meaning to use whatever version is presently in
11# lfs-xml.
12#
13# It is recognized as a tag if it begins with x.y, where 'x' is one or more
14# digit(s), the '.' (dot) is mandatory, an 'y' is one or more digits. Anything
15# after y is allowed (for example 7.6-systemd or 8.1-rc1).
16#
17# It is recognized as a date if it is exactly 8 digits. Then it is assumed that
18# the format is YYYYMMDD.
19#
20# Note that there is no check that the tag or the date are valid. Svn errors
21# out if the tag is not valid, and if the date is impossible (that is MM>12
22# or DD>31), but it happily accepts YYYY=3018 (and updates to HEAD).
23#------
24# The tracking file is taken from Makefile in the same directory.
25
26MYDIR=$( cd $(dirname $0); pwd )
27LFS_XML=${MYDIR}/lfs-xml
28
29if [ -z "$1" ]; then # use lfs-xml as is
30 DO_COMMANDS=n
31elif [ "$(echo $1 | sed 's/^[[:digit:]]\+\.[[:digit:]]\+//')" != "$1" ]
32 then # tag
33 DO_COMMANDS=y
34 CURR_SVN=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Relative URL: //p')
35 CURR_REV=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Revision: //p')
36 BEG_COMMAND="(cd $LFS_XML; svn switch ^/tags/$1)"
37 END_COMMAND="(cd $LFS_XML; svn switch $CURR_SVN@$CURR_REV)"
38elif [ "$(echo $1 | sed 's/^[[:digit:]]\{8\}$//')" != "$1" ]; then # date
39 DO_COMMANDS=y
40 CURR_REV=$(cd $LFS_XML; LANG=C svn info | sed -n 's/Revision: //p')
41 BEG_COMMAND="(cd $LFS_XML; svn update -r\\{$1\\})"
42 END_COMMAND="(cd $LFS_XML; svn update -r$CURR_REV)"
43else
44 echo Bad format in $1: must be a x.y[-aaa] tag or a YYYYMMDD date
45 exit 1
46fi
47
48if [ -f $MYDIR/Makefile ]; then
49 TRACKING_DIR=$(sed -n 's/TRACKING_DIR[ ]*=[ ]*//p' $MYDIR/Makefile)
50 TRACKFILE=${TRACKING_DIR}/instpkg.xml
51else
52 echo The directory where $0 resides does not contain a Makefile
53 exit 1
54fi
55
56# We need to know the revision to generate the correct lfs-full...
57if [ ! -r $MYDIR/revision ]; then
58 echo $MYDIR/revision is not available
59 exit 1
60fi
61REVISION=$(cat $MYDIR/revision)
62#Debug
63#echo BEG_COMMAND = $BEG_COMMAND
64#echo Before BEG_COMMAND
65#( cd $LFS_XML; LANG=C svn info )
66#End debug
67
68if [ "$DO_COMMANDS"=y ]; then
69 echo Running: $BEG_COMMAND
70 eval $BEG_COMMAND
71fi
72
73# Update code
74LFS_FULL=/tmp/lfs-full.xml
75echo Creating $LFS_FULL with information from $LFS_XML
76echo "Processing LFS bootscripts..."
77( cd $LFS_XML && bash process-scripts.sh )
78echo "Adjusting LFS for revision $REVISION..."
79xsltproc --nonet --xinclude \
80 --stringparam profile.revision $REVISION \
81 --output /tmp/lfs-prof.xml \
82 $LFS_XML/stylesheets/lfs-xsl/profile.xsl \
83 $LFS_XML/index.xml
84echo "Validating the LFS book..."
85xmllint --nonet --noent --postvalid \
86 -o $LFS_FULL /tmp/lfs-prof.xml
87rm -f $LFS_XML/appendices/*.script
88( cd $LFS_XML && ./aux-file-data.sh $LFS_FULL )
89
90echo Updating ${TRACKFILE} with information taken from $LFS_FULL
91echo -n "Is it OK? yes/no (no): "
92read ANSWER
93#Debug
94echo You answered $ANSWER
95#End debug
96
97if [ x$ANSWER = "xyes" ] ; then
[e3f4b9a4]98 for pack in $(grep '<productname' $LFS_FULL |
99 sed 's/.*>\([^<]*\)<.*/\1/' |
100 sort | uniq); do
[c8d5f11]101 if [ "$pack" = "libstdc++" -o \
102 "$pack" = "tcl" -o \
103 "$pack" = "tcl-core" -o \
104 "$pack" = "expect" -o \
105 "$pack" = "dejagnu" ]; then continue; fi
[e3f4b9a4]106 VERSION=$(grep -A1 ">$pack</product" $LFS_FULL |
107 head -n2 |
108 sed -n '2s/.*>\([^<]*\)<.*/\1/p')
[ce244f6]109#Debug
110echo $pack: $VERSION
[e3f4b9a4]111#End debug
112 xsltproc --stringparam packages $MYDIR/packages.xml \
113 --stringparam package $pack \
114 --stringparam version $VERSION \
115 -o track.tmp \
116 $MYDIR/xsl/bump.xsl ${TRACKFILE}
117 sed -i "s@PACKDESC@$MYDIR/packdesc.dtd@" track.tmp
118 xmllint --format --postvalid track.tmp > ${TRACKFILE}
119 rm track.tmp
120 done
121 VERSION=$(grep 'echo.*lfs-release' $LFS_FULL |
122 sed 's/.*echo[ ]*\([^ ]*\).*/\1/')
123#Debug
124echo LFS-Release: $VERSION
[ce244f6]125#End debug
126 xsltproc --stringparam packages $MYDIR/packages.xml \
[e3f4b9a4]127 --stringparam package LFS-Release \
[ce244f6]128 --stringparam version $VERSION \
129 -o track.tmp \
130 $MYDIR/xsl/bump.xsl ${TRACKFILE}
131 sed -i "s@PACKDESC@$MYDIR/packdesc.dtd@" track.tmp
132 xmllint --format --postvalid track.tmp > ${TRACKFILE}
133 rm track.tmp
134fi
135#Debug
136#echo After BEG_COMMAND\; before END_COMMAND
137#( cd $LFS_XML; LANG=C svn info )
138#End debug
139
140
141if [ "$DO_COMMANDS"=y ]; then
142 echo Running: $END_COMMAND
143 eval $END_COMMAND
144fi
145
146#Debug
147#echo After END_COMMAND
148#( cd $LFS_XML; LANG=C svn info )
149#End debug
Note: See TracBrowser for help on using the repository browser.