[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] | 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 |
|
---|
[924] | 21 | VER=`cat ${TOOLHOME}/../mondo/VERSION`
|
---|
| 22 | TAG=`cat ${TOOLHOME}/../mondo/TAG`
|
---|
[553] | 23 | DEST=${TOPDIR}/${VER}-$TAG
|
---|
| 24 | mkdir -p $DEST
|
---|
[549] | 25 |
|
---|
| 26 | if [ "$1" = "" ]; then
|
---|
[825] | 27 | c="mondo-doc mindi mindi-busybox mondo"
|
---|
[549] | 28 | else
|
---|
| 29 | if [ "$1" = "all" ]; then
|
---|
[825] | 30 | c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
|
---|
[549] | 31 | else
|
---|
[924] | 32 | c="$*"
|
---|
[549] | 33 | fi
|
---|
| 34 | fi
|
---|
| 35 |
|
---|
[553] | 36 | # Make it safe for SVN commands
|
---|
[872] | 37 | cd ${TOOLHOME}/..
|
---|
[549] | 38 |
|
---|
[550] | 39 | for p in $c; do
|
---|
[872] | 40 | v=`cat ${TOOLHOME}/../$p/VERSION`
|
---|
[924] | 41 | tag=`cat ${TOOLHOME}/../$p/TAG`
|
---|
| 42 | echo "Management of $p $v-$tag (rev $REVISION)"
|
---|
[882] | 43 | dest="$DEST/$p-$v"
|
---|
[553] | 44 | rm -fr $dest
|
---|
[872] | 45 | svn export ${TOOLHOME}/../$p $dest
|
---|
[553] | 46 | echo "$REVISION" > $dest/REVISION
|
---|
[550] | 47 | echo "Generating SVN log file ..."
|
---|
[872] | 48 | svn log -v ${TOOLHOME}/../$p > $dest/svn.log
|
---|
[550] | 49 |
|
---|
| 50 | for d in `cat ${TOOLHOME}/DISTROS`; do
|
---|
[553] | 51 | export ddir=`echo $d | cut -d_ -f1`
|
---|
| 52 | export dver=`echo $d | cut -d_ -f2`
|
---|
[550] | 53 | echo "Generating build files for $ddir ($dver)"
|
---|
[553] | 54 | . $TOOLHOME/distro-env
|
---|
[550] | 55 |
|
---|
[551] | 56 | ddd=`LANG=C ; date '+%Y-%m-%d'`
|
---|
[882] | 57 | cat > $MONDOTMP/mondorescue.mc << EOF
|
---|
[924] | 58 | define(\`TTT', ${tag})dnl
|
---|
| 59 | define(\`RRR', ${tag}${suf})dnl
|
---|
[551] | 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 |
|
---|
[882] | 76 | $TOOLHOME/mkchangelog.pl $dtype $p $MONDOTMP/$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
|
---|
[882] | 81 | m4 $MONDOTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
|
---|
[710] | 82 |
|
---|
[882] | 83 | rm -f $MONDOTMP/$p.spec
|
---|
[553] | 84 | elif [ "$dtype" = "ebuild" ]; then
|
---|
[882] | 85 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
|
---|
[1023] | 86 | elif [ "$dtype" = "tgz" ]; then
|
---|
[1024] | 87 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/slack-desc > $dest/distributions/${ddir}-$dver/slack-desc
|
---|
[1038] | 88 | elif [ "$dtype" = "port" ]; then
|
---|
| 89 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/Makefile > $dest/distributions/${ddir}-$dver/Makefile
|
---|
[578] | 90 | elif [ "$dtype" = "deb" ]; then
|
---|
[659] | 91 | cp -a $dest/distributions/$ddir/* $dest/distributions/${ddir}-$dver
|
---|
[882] | 92 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
|
---|
[659] | 93 | $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
|
---|
| 94 | if [ $? -ne 0 ]; then
|
---|
| 95 | echo "Unable to create changelog for ${ddir}-$dver/changelog"
|
---|
| 96 | exit -1
|
---|
| 97 | fi
|
---|
[550] | 98 | else
|
---|
[551] | 99 | echo "Unknown Build"
|
---|
[549] | 100 | fi
|
---|
| 101 | done
|
---|
[550] | 102 |
|
---|
[882] | 103 | # The rest is done there
|
---|
| 104 | cd $DEST
|
---|
[550] | 105 | if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
|
---|
[553] | 106 | cd $dest
|
---|
[550] | 107 | for f in mondorescue-howto.sgml *8; do
|
---|
[882] | 108 | m4 $MONDOTMP/mondorescue.mc $f > ${f}.new
|
---|
[550] | 109 | mv ${f}.new $f
|
---|
| 110 | done
|
---|
| 111 | make -f Makefile.howto
|
---|
| 112 | if [ $? != 0 ]; then
|
---|
| 113 | exit -1
|
---|
| 114 | fi
|
---|
| 115 | make -f Makefile.man
|
---|
| 116 | if [ $? != 0 ]; then
|
---|
| 117 | exit -1
|
---|
| 118 | fi
|
---|
| 119 | cd ..
|
---|
| 120 | fi
|
---|
[1006] | 121 | if [ _"`echo $p | grep 'busybox'`" != _"" ]; then
|
---|
| 122 | cd $dest
|
---|
| 123 | mv Rules.mak Rules.mak.orig
|
---|
| 124 | cat Rules.mak.orig | sed "s/^EXTRAVERSION\([\t ]*\):=/EXTRAVERSION\1:=-$tag-r$REVISION/" > Rules.mak
|
---|
| 125 | cd ..
|
---|
| 126 | fi
|
---|
[550] | 127 |
|
---|
[829] | 128 | if [ _"`echo $p | grep -vE 'kernel|busybox' | grep mindi`" != _"" ]; then
|
---|
[872] | 129 | v1=`cat ${TOOLHOME}/../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
|
---|
[882] | 134 | (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
|
---|
[553] | 135 | rm -f $dest/rootfs/sbin/parted2fdisk-ia64
|
---|
[550] | 136 | fi
|
---|
| 137 | if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
|
---|
[872] | 138 | v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
|
---|
[721] | 139 | if [ ! -d mondo-doc-$v1 ]; then
|
---|
[550] | 140 | echo "mondo-doc should be created before $p"
|
---|
| 141 | exit -1
|
---|
| 142 | fi
|
---|
[882] | 143 | (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] | 144 | (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
|
---|
[550] | 145 | fi
|
---|
| 146 |
|
---|
| 147 | # Finally creates the tar files
|
---|
[781] | 148 | echo -n "Creating $p tar files (gzip... "
|
---|
[882] | 149 | tar cfphz ${DEST}/$p-$v.tar.gz $p-$v
|
---|
[781] | 150 | echo -n " bzip2..."
|
---|
[882] | 151 | tar cfphj ${DEST}/$p-$v.tar.bz2 $p-$v
|
---|
[781] | 152 | echo " )"
|
---|
[549] | 153 | done
|
---|
[550] | 154 |
|
---|
[882] | 155 | rm -rf $MONDOTMP
|
---|
[553] | 156 |
|
---|
| 157 | echo "Version delivered :"
|
---|
| 158 | echo "-------------------"
|
---|
| 159 | echo "${VER}-$TAG"
|
---|
| 160 | echo "-------------------"
|
---|
| 161 | echo "${VER}-$TAG" > ${TOPDIR}/LAST
|
---|
| 162 | exit 0
|
---|
[757] | 163 | ) 2>&1 | tee /tmp/svn2build.log
|
---|