source: MondoRescue/branches/stable/tools/svn2build@ 1028

Last change on this file since 1028 was 1028, checked in by Bruno Cornec, 17 years ago
  • Slackware 10.2 support added (from svn merge -r 1022:1027 $SVN_M/branches/2.2.1)
  • mkanounce now adds the ANNOUNCE keyword to mails
  • 2.2.1 announce in DB
  • Property svn:executable set to *
File size: 4.5 KB
Line 
1#!/bin/bash
2#
3# Creates build environment and files for packages creation from SVN repository
4#
5# $Id$
6#
7
8(
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ ${prem} == "/" ]; then
12 export TOOLHOME=$dname
13else
14 export TOOLHOME=${PWD}/$dname
15fi
16
17cd $TOOLHOME
18. ./common-env
19. ./svn-env
20
21VER=`cat ${TOOLHOME}/../mondo/VERSION`
22TAG=`cat ${TOOLHOME}/../mondo/TAG`
23DEST=${TOPDIR}/${VER}-$TAG
24mkdir -p $DEST
25
26if [ "$1" = "" ]; then
27 c="mondo-doc mindi mindi-busybox mondo"
28else
29 if [ "$1" = "all" ]; then
30 c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
31 else
32 c="$*"
33 fi
34fi
35
36# Make it safe for SVN commands
37cd ${TOOLHOME}/..
38
39for p in $c; do
40 v=`cat ${TOOLHOME}/../$p/VERSION`
41 tag=`cat ${TOOLHOME}/../$p/TAG`
42 echo "Management of $p $v-$tag (rev $REVISION)"
43 dest="$DEST/$p-$v"
44 rm -fr $dest
45 svn export ${TOOLHOME}/../$p $dest
46 echo "$REVISION" > $dest/REVISION
47 echo "Generating SVN log file ..."
48 svn log -v ${TOOLHOME}/../$p > $dest/svn.log
49
50 for d in `cat ${TOOLHOME}/DISTROS`; do
51 export ddir=`echo $d | cut -d_ -f1`
52 export dver=`echo $d | cut -d_ -f2`
53 echo "Generating build files for $ddir ($dver)"
54 . $TOOLHOME/distro-env
55
56 ddd=`LANG=C ; date '+%Y-%m-%d'`
57 cat > $MONDOTMP/mondorescue.mc << EOF
58define(\`TTT', ${tag})dnl
59define(\`RRR', ${tag}${suf})dnl
60define(\`VVV', ${v})dnl
61define(\`DDD', ${ddd})dnl
62EOF
63
64 mkdir -p $dest/distributions/$ddir $dest/distributions/${ddir}-$dver
65 if [ "$dtype" = "rpm" ]; then
66 if [ -f $dest/distributions/$ddir/spec.m4 ]; then
67 inc=$dest/distributions/$ddir/spec.m4
68 elif [ -f $dest/distributions/$dfam/spec.m4 ]; then
69 inc=$dest/distributions/$dfam/spec.m4
70 else
71 echo "Unable to build the RPM specfile for this distro. Please report to authors"
72 exit -1
73 fi
74 echo "Using $inc customization to build SPEC file"
75
76 $TOOLHOME/mkchangelog.pl $dtype $p $MONDOTMP/$p.spec
77 if [ $? -ne 0 ]; then
78 echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
79 exit -1
80 fi
81 m4 $MONDOTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
82
83 rm -f $MONDOTMP/$p.spec
84 elif [ "$dtype" = "ebuild" ]; then
85 m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
86 elif [ "$dtype" = "tgz" ]; then
87 m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/slack-desc > $dest/distributions/${ddir}-$dver/slack-desc
88 elif [ "$dtype" = "deb" ]; then
89 cp -a $dest/distributions/$ddir/* $dest/distributions/${ddir}-$dver
90 m4 $MONDOTMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
91 $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
92 if [ $? -ne 0 ]; then
93 echo "Unable to create changelog for ${ddir}-$dver/changelog"
94 exit -1
95 fi
96 else
97 echo "Unknown Build"
98 fi
99 done
100
101 # The rest is done there
102 cd $DEST
103 if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
104 cd $dest
105 for f in mondorescue-howto.sgml *8; do
106 m4 $MONDOTMP/mondorescue.mc $f > ${f}.new
107 mv ${f}.new $f
108 done
109 make -f Makefile.howto
110 if [ $? != 0 ]; then
111 exit -1
112 fi
113 make -f Makefile.man
114 if [ $? != 0 ]; then
115 exit -1
116 fi
117 cd ..
118 fi
119 if [ _"`echo $p | grep 'busybox'`" != _"" ]; then
120 cd $dest
121 mv Rules.mak Rules.mak.orig
122 cat Rules.mak.orig | sed "s/^EXTRAVERSION\([\t ]*\):=/EXTRAVERSION\1:=-$tag-r$REVISION/" > Rules.mak
123 cd ..
124 fi
125
126 if [ _"`echo $p | grep -vE 'kernel|busybox' | grep mindi`" != _"" ]; then
127 v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
128 if [ ! -d mondo-doc-$v1 ]; then
129 echo "mondo-doc should be created before $p"
130 exit -1
131 fi
132 (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
133 rm -f $dest/rootfs/sbin/parted2fdisk-ia64
134 fi
135 if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
136 v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
137 if [ ! -d mondo-doc-$v1 ]; then
138 echo "mondo-doc should be created before $p"
139 exit -1
140 fi
141 (cd mondo-doc-$v1 ; make -f Makefile.howto install INSTALLDIR=../$p-$v/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v/docs/man)
142 (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
143 fi
144
145 # Finally creates the tar files
146 echo -n "Creating $p tar files (gzip... "
147 tar cfphz ${DEST}/$p-$v.tar.gz $p-$v
148 echo -n " bzip2..."
149 tar cfphj ${DEST}/$p-$v.tar.bz2 $p-$v
150 echo " )"
151done
152
153rm -rf $MONDOTMP
154
155echo "Version delivered :"
156echo "-------------------"
157echo "${VER}-$TAG"
158echo "-------------------"
159echo "${VER}-$TAG" > ${TOPDIR}/LAST
160exit 0
161) 2>&1 | tee /tmp/svn2build.log
Note: See TracBrowser for help on using the repository browser.