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

Last change on this file since 731 was 731, checked in by Bruno Cornec, 18 years ago
  • gentoo version is really 1.6 (not 2006)
  • mondo-doc debian package improvements
  • Property svn:executable set to *
File size: 4.0 KB
RevLine 
[388]1#!/bin/bash
2#
[550]3# Creates build environment and files for packages creation from SVN repository
[388]4#
5# $Id$
6#
7
[549]8dname=`dirname $0`
9prem=`echo $dname |cut -c1`
10if [ ${prem} == "/" ]; then
11 export TOOLHOME=$dname
[388]12else
[549]13 export TOOLHOME=${PWD}/$dname
[388]14fi
15
[549]16cd $TOOLHOME
17. ./common-env
18. ./svn-env
[388]19
[553]20DEST=${TOPDIR}/${VER}-$TAG
21mkdir -p $DEST
[549]22
23if [ "$1" = "" ]; then
24 c="mondo-doc mindi mondo"
25else
26 if [ "$1" = "all" ]; then
27 c="mindi-kernel mondo-doc mindi mondo"
28 else
29 c=$1
30 fi
31fi
32
[553]33# Make it safe for SVN commands
[549]34cd ${BASE}/svn
35
[550]36for p in $c; do
37 v=`cat ${SVNBRANCH}/$p/VERSION`
38 echo "Management of $p $v-$REVISION"
[721]39 dest="$p-$v"
[553]40 rm -fr $dest
41 svn export ${SVNBRANCH}/$p $dest
42 echo "$REVISION" > $dest/REVISION
[550]43 echo "Generating SVN log file ..."
[553]44 svn log -v ${SVNBRANCH}/$p > $dest/svn.log
[550]45
46 for d in `cat ${TOOLHOME}/DISTROS`; do
[553]47 export ddir=`echo $d | cut -d_ -f1`
48 export dver=`echo $d | cut -d_ -f2`
[550]49 echo "Generating build files for $ddir ($dver)"
[553]50 . $TOOLHOME/distro-env
[550]51
52 # Create conf file dir
53 mkdir -p ${BUILDDIR}
54
[551]55 ddd=`LANG=C ; date '+%Y-%m-%d'`
[651]56 cat > $TMP/mondorescue.mc << EOF
[554]57define(\`TTT', ${TAG})dnl
[551]58define(\`RRR', ${TAG}${suf})dnl
59define(\`VVV', ${v})dnl
60define(\`DDD', ${ddd})dnl
61EOF
62
[596]63 mkdir -p $dest/distributions/$ddir $dest/distributions/${ddir}-$dver
[553]64 if [ "$dtype" = "rpm" ]; then
65 if [ -f $dest/distributions/$ddir/spec.m4 ]; then
66 inc=$dest/distributions/$ddir/spec.m4
67 elif [ -f $dest/distributions/$dfam/spec.m4 ]; then
68 inc=$dest/distributions/$dfam/spec.m4
[550]69 else
70 echo "Unable to build the RPM specfile for this distro. Please report to authors"
[549]71 exit -1
72 fi
[550]73 echo "Using $inc customization to build SPEC file"
74
[651]75 $TOOLHOME/mkchangelog.pl $dtype $p $TMP/$p.spec
[636]76 if [ $? -ne 0 ]; then
77 echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
[549]78 exit -1
79 fi
[710]80 m4 $TMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $TMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
81
[651]82 rm -f $TMP/$p.spec
[553]83 elif [ "$dtype" = "ebuild" ]; then
[731]84 m4 $TMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
[578]85 elif [ "$dtype" = "deb" ]; then
86 # To be developped
[659]87 #m4 $TMP/mondorescue.mc $dest/distributions/$dfam/$p > /dev/null
88 cp -a $dest/distributions/$ddir/* $dest/distributions/${ddir}-$dver
[731]89 m4 $TMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
[659]90 $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
91 if [ $? -ne 0 ]; then
92 echo "Unable to create changelog for ${ddir}-$dver/changelog"
93 exit -1
94 fi
[550]95 else
[551]96 echo "Unknown Build"
[549]97 fi
98 done
[550]99
100 if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
[553]101 cd $dest
[550]102 for f in mondorescue-howto.sgml *8; do
[651]103 m4 $TMP/mondorescue.mc $f > ${f}.new
[550]104 mv ${f}.new $f
105 done
106 make -f Makefile.howto
107 if [ $? != 0 ]; then
108 exit -1
109 fi
110 make -f Makefile.man
111 if [ $? != 0 ]; then
112 exit -1
113 fi
114 cd ..
115 fi
116
117 if [ _"`echo $p | grep -v kernel | grep mindi`" != _"" ]; then
118 v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
[721]119 if [ ! -d mondo-doc-$v1 ]; then
[550]120 echo "mondo-doc should be created before $p"
121 exit -1
122 fi
[721]123 (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$dest)
[553]124 rm -f $dest/rootfs/sbin/parted2fdisk-ia64
[550]125 fi
126 if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
127 v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
[721]128 if [ ! -d mondo-doc-$v1 ]; then
[550]129 echo "mondo-doc should be created before $p"
130 exit -1
131 fi
[721]132 (cd mondo-doc-$v1 ; make -f Makefile.howto install INSTALLDIR=../$dest/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$dest/docs/man)
[553]133 (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
[550]134 fi
135
136 # Finally creates the tar files
137 echo "Creating $p tar files"
[553]138 tar cfhz ${DEST}/$p-$v-$TAG.tar.gz $dest
139 #gzip -cd ${DEST}/$p-$v-$TAG.tar.gz | bzip2 -c3 > ${DEST}/$p-$v-$TAG.tar.bz2
140 #tar cfhj ${DEST}/$p-$v-$TAG.tar.bz2 $dest
[549]141done
[550]142
[659]143rm -rf $TMP
[553]144
145echo "Version delivered :"
146echo "-------------------"
147echo "${VER}-$TAG"
148echo "-------------------"
149echo "${VER}-$TAG" > ${TOPDIR}/LAST
150exit 0
Note: See TracBrowser for help on using the repository browser.