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