[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] | 8 | dname=`dirname $0`
|
---|
| 9 | prem=`echo $dname |cut -c1`
|
---|
| 10 | if [ ${prem} == "/" ]; then
|
---|
| 11 | export TOOLHOME=$dname
|
---|
[388] | 12 | else
|
---|
[549] | 13 | export TOOLHOME=${PWD}/$dname
|
---|
[388] | 14 | fi
|
---|
| 15 |
|
---|
[549] | 16 | cd $TOOLHOME
|
---|
| 17 | . ./common-env
|
---|
| 18 | . ./svn-env
|
---|
[388] | 19 |
|
---|
[553] | 20 | DEST=${TOPDIR}/${VER}-$TAG
|
---|
| 21 | mkdir -p $DEST
|
---|
[549] | 22 |
|
---|
| 23 | if [ "$1" = "" ]; then
|
---|
| 24 | c="mondo-doc mindi mondo"
|
---|
| 25 | else
|
---|
| 26 | if [ "$1" = "all" ]; then
|
---|
| 27 | c="mindi-kernel mondo-doc mindi mondo"
|
---|
| 28 | else
|
---|
| 29 | c=$1
|
---|
| 30 | fi
|
---|
| 31 | fi
|
---|
| 32 |
|
---|
[553] | 33 | # Make it safe for SVN commands
|
---|
[549] | 34 | cd ${BASE}/svn
|
---|
| 35 |
|
---|
[550] | 36 | for p in $c; do
|
---|
| 37 | v=`cat ${SVNBRANCH}/$p/VERSION`
|
---|
| 38 | echo "Management of $p $v-$REVISION"
|
---|
[553] | 39 | dest="$p-$v-$TAG"
|
---|
| 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'`
|
---|
| 56 | cat > /tmp/mondorescue.mc << EOF
|
---|
[554] | 57 | define(\`TTT', ${TAG})dnl
|
---|
[551] | 58 | define(\`RRR', ${TAG}${suf})dnl
|
---|
| 59 | define(\`VVV', ${v})dnl
|
---|
| 60 | define(\`DDD', ${ddd})dnl
|
---|
| 61 | EOF
|
---|
| 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"
|
---|
[596] | 74 | m4 /tmp/mondorescue.mc $inc $dest/distributions/rpm/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
|
---|
[550] | 75 |
|
---|
[636] | 76 | $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/$p.spec
|
---|
| 77 | if [ $? -ne 0 ]; then
|
---|
| 78 | echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
|
---|
[549] | 79 | exit -1
|
---|
| 80 | fi
|
---|
[550] | 81 |
|
---|
| 82 | ddate=`LANG=C ; date "+%a %b %d %Y"`
|
---|
[596] | 83 | cat > $dest/distributions/${ddir}-$dver/$p.changelog.new << EOF
|
---|
[550] | 84 | * $ddate Bruno Cornec <bruno@mondorescue.org> VVV-RRR
|
---|
| 85 | - Updated to VVV-r${REVISION}
|
---|
| 86 |
|
---|
| 87 | EOF
|
---|
[553] | 88 | elif [ "$dtype" = "ebuild" ]; then
|
---|
[596] | 89 | m4 /tmp/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v-r$TAG.ebuild
|
---|
[578] | 90 | elif [ "$dtype" = "deb" ]; then
|
---|
| 91 | # To be developped
|
---|
| 92 | m4 /tmp/mondorescue.mc $dest/distributions/$dfam/$p > /dev/null
|
---|
[550] | 93 | else
|
---|
[551] | 94 | echo "Unknown Build"
|
---|
[549] | 95 | fi
|
---|
| 96 | done
|
---|
[550] | 97 |
|
---|
| 98 | if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
|
---|
[553] | 99 | cd $dest
|
---|
[550] | 100 | for f in mondorescue-howto.sgml *8; do
|
---|
| 101 | m4 /tmp/mondorescue.mc $f > ${f}.new
|
---|
| 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 |
|
---|
| 115 | if [ _"`echo $p | grep -v kernel | grep mindi`" != _"" ]; then
|
---|
| 116 | v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
|
---|
[578] | 117 | if [ ! -d mondo-doc-$v1-$TAG ]; then
|
---|
[550] | 118 | echo "mondo-doc should be created before $p"
|
---|
| 119 | exit -1
|
---|
| 120 | fi
|
---|
[578] | 121 | (cd mondo-doc-$v1-$TAG ; make -f Makefile.man install-$p INSTALLDIR=../$dest)
|
---|
[553] | 122 | rm -f $dest/rootfs/sbin/parted2fdisk-ia64
|
---|
[550] | 123 | fi
|
---|
| 124 | if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
|
---|
| 125 | v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
|
---|
[578] | 126 | if [ ! -d mondo-doc-$v1-$TAG ]; then
|
---|
[550] | 127 | echo "mondo-doc should be created before $p"
|
---|
| 128 | exit -1
|
---|
| 129 | fi
|
---|
[578] | 130 | (cd mondo-doc-$v1-$TAG ; make -f Makefile.howto install INSTALLDIR=../$dest/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$dest/docs/man)
|
---|
[553] | 131 | (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
|
---|
[550] | 132 | fi
|
---|
| 133 |
|
---|
| 134 | # Finally creates the tar files
|
---|
| 135 | echo "Creating $p tar files"
|
---|
[553] | 136 | tar cfhz ${DEST}/$p-$v-$TAG.tar.gz $dest
|
---|
| 137 | #gzip -cd ${DEST}/$p-$v-$TAG.tar.gz | bzip2 -c3 > ${DEST}/$p-$v-$TAG.tar.bz2
|
---|
| 138 | #tar cfhj ${DEST}/$p-$v-$TAG.tar.bz2 $dest
|
---|
[549] | 139 | done
|
---|
[550] | 140 |
|
---|
| 141 | rm -f /tmp/mondorescue.mc
|
---|
[553] | 142 |
|
---|
| 143 | echo "Version delivered :"
|
---|
| 144 | echo "-------------------"
|
---|
| 145 | echo "${VER}-$TAG"
|
---|
| 146 | echo "-------------------"
|
---|
| 147 | echo "${VER}-$TAG" > ${TOPDIR}/LAST
|
---|
| 148 | exit 0
|
---|