source: MondoRescue/branches/2.2.0/tools/svn2build@ 885

Last change on this file since 885 was 885, checked in by Bruno Cornec, 18 years ago

merge -r881:884 $SVN_M/branches/stable

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