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

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