[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 | umask 022
|
---|
| 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`
|
---|
| 39 | echo "Management of $p $v-$REVISION"
|
---|
[553] | 40 | dest="$p-$v-$TAG"
|
---|
| 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'`
|
---|
| 57 | cat > /tmp/mondorescue.mc << EOF
|
---|
| 58 | define(\`RRR', ${TAG}${suf})dnl
|
---|
| 59 | define(\`VVV', ${v})dnl
|
---|
| 60 | define(\`DDD', ${ddd})dnl
|
---|
| 61 | EOF
|
---|
| 62 |
|
---|
[553] | 63 | mkdir -p $dest/distributions/$ddir
|
---|
| 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"
|
---|
[553] | 74 | m4 /tmp/mondorescue.mc $inc $dest/distributions/rpm/$p.spec > $dest/distributions/$ddir/$p.spec
|
---|
[550] | 75 |
|
---|
[553] | 76 | if [ -f $dest/distributions/$ddir/changelog ]; then
|
---|
| 77 | log=$dest/distributions/$ddir/changelog
|
---|
| 78 | elif [ -f $dest/distributions/$dfam/changelog ]; then
|
---|
| 79 | log=$dest/distributions/$dfam/changelog
|
---|
[550] | 80 | else
|
---|
| 81 | echo "Unable to build RPM changelog for this distro. Please report to authors"
|
---|
[549] | 82 | exit -1
|
---|
| 83 | fi
|
---|
[550] | 84 |
|
---|
| 85 | echo "Using $log customization to build changelog file"
|
---|
| 86 | ddate=`LANG=C ; date "+%a %b %d %Y"`
|
---|
[553] | 87 | cat > $dest/distributions/$ddir/$p.changelog.new << EOF
|
---|
[550] | 88 | * $ddate Bruno Cornec <bruno@mondorescue.org> VVV-RRR
|
---|
| 89 | - Updated to VVV-r${REVISION}
|
---|
| 90 |
|
---|
| 91 | EOF
|
---|
[553] | 92 | cat $log >> $dest/distributions/$ddir/$p.changelog.new
|
---|
| 93 | m4 /tmp/mondorescue.mc $dest/distributions/$ddir/$p.changelog.new > $dest/distributions/$ddir/$p.changelog
|
---|
| 94 | rm -f $dest/distributions/$ddir/$p.changelog.new
|
---|
[550] | 95 |
|
---|
[553] | 96 | elif [ "$dtype" = "ebuild" ]; then
|
---|
[551] | 97 | echo "Gentoo Build"
|
---|
[550] | 98 | else
|
---|
[551] | 99 | echo "Unknown Build"
|
---|
[549] | 100 | fi
|
---|
| 101 | done
|
---|
[550] | 102 |
|
---|
| 103 | if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
|
---|
[553] | 104 | cd $dest
|
---|
[550] | 105 | for f in mondorescue-howto.sgml *8; do
|
---|
| 106 | m4 /tmp/mondorescue.mc $f > ${f}.new
|
---|
| 107 | mv ${f}.new $f
|
---|
| 108 | done
|
---|
| 109 | make -f Makefile.howto
|
---|
| 110 | if [ $? != 0 ]; then
|
---|
| 111 | exit -1
|
---|
| 112 | fi
|
---|
| 113 | make -f Makefile.man
|
---|
| 114 | if [ $? != 0 ]; then
|
---|
| 115 | exit -1
|
---|
| 116 | fi
|
---|
| 117 | cd ..
|
---|
| 118 | fi
|
---|
| 119 |
|
---|
| 120 | if [ _"`echo $p | grep -v kernel | grep mindi`" != _"" ]; then
|
---|
| 121 | v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
|
---|
| 122 | if [ ! -d mondo-doc-$v1 ]; then
|
---|
| 123 | echo "mondo-doc should be created before $p"
|
---|
| 124 | exit -1
|
---|
| 125 | fi
|
---|
[553] | 126 | (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$dest)
|
---|
| 127 | rm -f $dest/rootfs/sbin/parted2fdisk-ia64
|
---|
[550] | 128 | fi
|
---|
| 129 | if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
|
---|
| 130 | v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
|
---|
| 131 | if [ ! -d mondo-doc-$v1 ]; then
|
---|
| 132 | echo "mondo-doc should be created before $p"
|
---|
| 133 | exit -1
|
---|
| 134 | fi
|
---|
[553] | 135 | (cd mondo-doc-$v1 ; make -f Makefile.howto install INSTALLDIR=../$dest/docs/en ; make -f Makefile.man install-$p INSTALLDIR=../$dest/docs/man)
|
---|
| 136 | (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
|
---|
[550] | 137 | fi
|
---|
| 138 |
|
---|
| 139 | # Finally creates the tar files
|
---|
| 140 | echo "Creating $p tar files"
|
---|
[553] | 141 | tar cfhz ${DEST}/$p-$v-$TAG.tar.gz $dest
|
---|
| 142 | #gzip -cd ${DEST}/$p-$v-$TAG.tar.gz | bzip2 -c3 > ${DEST}/$p-$v-$TAG.tar.bz2
|
---|
| 143 | #tar cfhj ${DEST}/$p-$v-$TAG.tar.bz2 $dest
|
---|
[549] | 144 | done
|
---|
[550] | 145 |
|
---|
| 146 | rm -f /tmp/mondorescue.mc
|
---|
[553] | 147 |
|
---|
| 148 | echo "Version delivered :"
|
---|
| 149 | echo "-------------------"
|
---|
| 150 | echo "${VER}-$TAG"
|
---|
| 151 | echo "-------------------"
|
---|
| 152 | echo "${VER}-$TAG" > ${TOPDIR}/LAST
|
---|
| 153 | exit 0
|
---|