[388] | 1 | #!/bin/bash
|
---|
| 2 | #
|
---|
[550] | 3 | # Creates build environment and files for packages creation from SVN repository
|
---|
[388] | 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 |
|
---|
[764] | 8 | (
|
---|
[549] | 9 | dname=`dirname $0`
|
---|
| 10 | prem=`echo $dname |cut -c1`
|
---|
[1043] | 11 | if [ _${prem} = _"/" ]; then
|
---|
[549] | 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 |
|
---|
[932] | 21 | VER=`cat ${TOOLHOME}/../mondo/VERSION`
|
---|
| 22 | TAG=`cat ${TOOLHOME}/../mondo/TAG`
|
---|
[553] | 23 | DEST=${TOPDIR}/${VER}-$TAG
|
---|
[977] | 24 | TEST="false"
|
---|
| 25 | OPT=""
|
---|
[553] | 26 | mkdir -p $DEST
|
---|
[549] | 27 |
|
---|
[977] | 28 | if [ "$1" = "--test" ]; then
|
---|
| 29 | TEST="true"
|
---|
| 30 | OPT="-r BASE"
|
---|
| 31 | shift
|
---|
| 32 | fi
|
---|
| 33 |
|
---|
[549] | 34 | if [ "$1" = "" ]; then
|
---|
[977] | 35 | c="mondo-doc mindi mindi-busybox mondo"
|
---|
[549] | 36 | else
|
---|
| 37 | if [ "$1" = "all" ]; then
|
---|
[839] | 38 | c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
|
---|
[549] | 39 | else
|
---|
[932] | 40 | c="$*"
|
---|
[549] | 41 | fi
|
---|
| 42 | fi
|
---|
| 43 |
|
---|
[553] | 44 | # Make it safe for SVN commands
|
---|
[900] | 45 | cd ${TOOLHOME}/..
|
---|
[549] | 46 |
|
---|
[550] | 47 | for p in $c; do
|
---|
[900] | 48 | v=`cat ${TOOLHOME}/../$p/VERSION`
|
---|
[932] | 49 | tag=`cat ${TOOLHOME}/../$p/TAG`
|
---|
| 50 | echo "Management of $p $v-$tag (rev $REVISION)"
|
---|
[900] | 51 | dest="$DEST/$p-$v"
|
---|
[553] | 52 | rm -fr $dest
|
---|
[977] | 53 | svn $OPT export ${TOOLHOME}/../$p $dest
|
---|
[553] | 54 | echo "$REVISION" > $dest/REVISION
|
---|
[550] | 55 | echo "Generating SVN log file ..."
|
---|
[977] | 56 | svn $OPT log -v ${TOOLHOME}/../$p > $dest/svn.log
|
---|
[550] | 57 |
|
---|
| 58 | for d in `cat ${TOOLHOME}/DISTROS`; do
|
---|
[553] | 59 | export ddir=`echo $d | cut -d_ -f1`
|
---|
| 60 | export dver=`echo $d | cut -d_ -f2`
|
---|
[550] | 61 | echo "Generating build files for $ddir ($dver)"
|
---|
[553] | 62 | . $TOOLHOME/distro-env
|
---|
[550] | 63 |
|
---|
[551] | 64 | ddd=`LANG=C ; date '+%Y-%m-%d'`
|
---|
[900] | 65 | cat > $MONDOTMP/mondorescue.mc << EOF
|
---|
[932] | 66 | define(\`TTT', ${tag})dnl
|
---|
| 67 | define(\`RRR', ${tag}${suf})dnl
|
---|
[551] | 68 | define(\`VVV', ${v})dnl
|
---|
| 69 | define(\`DDD', ${ddd})dnl
|
---|
| 70 | EOF
|
---|
| 71 |
|
---|
[600] | 72 | mkdir -p $dest/distributions/$ddir $dest/distributions/${ddir}-$dver
|
---|
[553] | 73 | if [ "$dtype" = "rpm" ]; then
|
---|
| 74 | if [ -f $dest/distributions/$ddir/spec.m4 ]; then
|
---|
| 75 | inc=$dest/distributions/$ddir/spec.m4
|
---|
| 76 | elif [ -f $dest/distributions/$dfam/spec.m4 ]; then
|
---|
| 77 | inc=$dest/distributions/$dfam/spec.m4
|
---|
[550] | 78 | else
|
---|
| 79 | echo "Unable to build the RPM specfile for this distro. Please report to authors"
|
---|
[549] | 80 | exit -1
|
---|
| 81 | fi
|
---|
[550] | 82 |
|
---|
[900] | 83 | $TOOLHOME/mkchangelog.pl $dtype $p $MONDOTMP/$p.spec
|
---|
[649] | 84 | if [ $? -ne 0 ]; then
|
---|
| 85 | echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
|
---|
[549] | 86 | exit -1
|
---|
| 87 | fi
|
---|
[900] | 88 | m4 $MONDOTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
|
---|
[729] | 89 |
|
---|
[900] | 90 | rm -f $MONDOTMP/$p.spec
|
---|
[553] | 91 | elif [ "$dtype" = "ebuild" ]; then
|
---|
[900] | 92 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
|
---|
[1043] | 93 | elif [ "$dtype" = "tgz" ]; then
|
---|
| 94 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/slack-desc > $dest/distributions/${ddir}-$dver/slack-desc
|
---|
| 95 | elif [ "$dtype" = "port" ]; then
|
---|
| 96 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$dfam/Makefile > $dest/distributions/${ddir}-$dver/Makefile
|
---|
[588] | 97 | elif [ "$dtype" = "deb" ]; then
|
---|
[672] | 98 | cp -a $dest/distributions/$ddir/* $dest/distributions/${ddir}-$dver
|
---|
[900] | 99 | m4 $MONDOTMP/mondorescue.mc $dest/distributions/$ddir/rules > $dest/distributions/${ddir}-$dver/rules
|
---|
[672] | 100 | $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
|
---|
| 101 | if [ $? -ne 0 ]; then
|
---|
| 102 | echo "Unable to create changelog for ${ddir}-$dver/changelog"
|
---|
| 103 | exit -1
|
---|
| 104 | fi
|
---|
[550] | 105 | else
|
---|
[551] | 106 | echo "Unknown Build"
|
---|
[549] | 107 | fi
|
---|
| 108 | done
|
---|
[550] | 109 |
|
---|
[900] | 110 | # The rest is done there
|
---|
| 111 | cd $DEST
|
---|
[550] | 112 | if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
|
---|
[553] | 113 | cd $dest
|
---|
[550] | 114 | for f in mondorescue-howto.sgml *8; do
|
---|
[900] | 115 | m4 $MONDOTMP/mondorescue.mc $f > ${f}.new
|
---|
[550] | 116 | mv ${f}.new $f
|
---|
| 117 | done
|
---|
| 118 | make -f Makefile.howto
|
---|
| 119 | if [ $? != 0 ]; then
|
---|
| 120 | exit -1
|
---|
| 121 | fi
|
---|
| 122 | make -f Makefile.man
|
---|
| 123 | if [ $? != 0 ]; then
|
---|
| 124 | exit -1
|
---|
| 125 | fi
|
---|
| 126 | cd ..
|
---|
| 127 | fi
|
---|
[1043] | 128 | if [ _"`echo $p | grep 'busybox'`" != _"" ]; then
|
---|
| 129 | cd $dest
|
---|
| 130 | mv Rules.mak Rules.mak.orig
|
---|
| 131 | cat Rules.mak.orig | sed "s/^EXTRAVERSION\([\t ]*\):=/EXTRAVERSION\1:=-$tag-r$REVISION/" > Rules.mak
|
---|
| 132 | cd ..
|
---|
| 133 | fi
|
---|
[550] | 134 |
|
---|
[839] | 135 | if [ _"`echo $p | grep -vE 'kernel|busybox' | grep mindi`" != _"" ]; then
|
---|
[900] | 136 | v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
|
---|
[729] | 137 | if [ ! -d mondo-doc-$v1 ]; then
|
---|
[550] | 138 | echo "mondo-doc should be created before $p"
|
---|
| 139 | exit -1
|
---|
| 140 | fi
|
---|
[900] | 141 | (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
|
---|
[553] | 142 | rm -f $dest/rootfs/sbin/parted2fdisk-ia64
|
---|
[550] | 143 | fi
|
---|
| 144 | if [ "`echo $p | grep -v doc | grep mondo`" != "" ]; then
|
---|
[900] | 145 | v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
|
---|
[729] | 146 | if [ ! -d mondo-doc-$v1 ]; then
|
---|
[550] | 147 | echo "mondo-doc should be created before $p"
|
---|
| 148 | exit -1
|
---|
| 149 | fi
|
---|
[900] | 150 | (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] | 151 | (cd $dest ; echo "Bootstraping mondo ... " ; ./bootstrap)
|
---|
[550] | 152 | fi
|
---|
| 153 |
|
---|
| 154 | # Finally creates the tar files
|
---|
[782] | 155 | echo -n "Creating $p tar files (gzip... "
|
---|
[900] | 156 | tar cfphz ${DEST}/$p-$v.tar.gz $p-$v
|
---|
[977] | 157 | if [ $TEST = "false" ]; then
|
---|
| 158 | echo -n " bzip2..."
|
---|
| 159 | tar cfphj ${DEST}/$p-$v.tar.bz2 $p-$v
|
---|
| 160 | fi
|
---|
[782] | 161 | echo " )"
|
---|
[977] | 162 | if [ $TEST = "true" ]; then
|
---|
| 163 | echo "Use source under $DEST/$p-$v"
|
---|
| 164 | fi
|
---|
[549] | 165 | done
|
---|
[550] | 166 |
|
---|
[900] | 167 | rm -rf $MONDOTMP
|
---|
[553] | 168 |
|
---|
| 169 | echo "Version delivered :"
|
---|
| 170 | echo "-------------------"
|
---|
| 171 | echo "${VER}-$TAG"
|
---|
| 172 | echo "-------------------"
|
---|
| 173 | echo "${VER}-$TAG" > ${TOPDIR}/LAST
|
---|
| 174 | exit 0
|
---|
[764] | 175 | ) 2>&1 | tee /tmp/svn2build.log
|
---|