Ignore:
Timestamp:
May 14, 2006, 7:54:15 PM (14 years ago)
Author:
bcornec
Message:

Cleanup in build process continue

  • removal of most small scripts
  • based on one main svn2build script
  • spec files reviewed for fedora remarks
  • changelog and TAG integrated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/tools/svn2build

    r549 r550  
    11#!/bin/bash
    22#
    3 # Creates build file for packages from SVN repository
     3# Creates build environment and files for packages creation from SVN repository
    44#
    55# $Id$
    66#
    7 
    87
    98umask 022
     
    2019. ./svn-env
    2120
    22 mkdir -p ${TOPDIR}/SPECS
     21mkdir -p ${TOPDIR}/SOURCES
    2322
    2423if [ "$1" = "" ]; then
     
    3534cd ${BASE}/svn
    3635
    37 for d in `cat $TOOLHOME/DISTROS`; do
    38     for p in $c; do
    39         v=`cat ${SVNBRANCH}/$p/VERSION`
    40         echo "Management of build of $v-$REVISION"
    41         rm -fr $p-$v
    42         svn export ${SVNBRANCH}/$p $p-$v
    43         echo "$REVISION" > $p-$v/REVISION
    44         echo "Generating SVN log file ..."
    45         svn log -v ${SVNBRANCH}/$p > $p-$v/svn.log
    46    
    47         if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
    48             cd ${p}-${v}
    49             $TOOLHOME/expandver mondorescue-howto.sgml *8
    50             make -f Makefile.howto
    51             if [ $? != 0 ]; then
     36for p in $c; do
     37    v=`cat ${SVNBRANCH}/$p/VERSION`
     38    echo "Management of $p $v-$REVISION"
     39    rm -fr $p-$v
     40    svn export ${SVNBRANCH}/$p $p-$v
     41    echo "$REVISION" > $p-$v/REVISION
     42    echo "Generating SVN log file ..."
     43    svn log -v ${SVNBRANCH}/$p > $p-$v/svn.log
     44
     45    for d in `cat ${TOOLHOME}/DISTROS`; do
     46        ddir=`echo $d | cut -f'_' -d1`
     47        dver=`echo $d | cut -f'_' -d2`
     48        echo "Generating build files for $ddir ($dver)"
     49        if [ $ddir = "debian" ]; then
     50            dfam="debian"
     51            dtype="deb"
     52            suf=".${dfam}${dver}"
     53            BUILDDIR=${TOPDIR}/debian
     54        elif [ $ddir = "gentoo" ]; then
     55            dfam="gentoo"
     56            dtype="ebuild"
     57            suf=".${ddir}${dver}"
     58            BUILDDIR=${TOPDIR}/ebuild
     59        elif [ $ddir = "slackware" ]; then
     60            dfam="slack"
     61            dtype="tgz"
     62            suf=".${dfam}${dver}"
     63            BUILDDIR=${TOPDIR}/slack
     64        elif [ $ddir = "sles" || $ddir = "suse" ]; then
     65            dfam="suse"
     66            dtype="rpm"
     67            suf=".${ddir}${dver}"
     68            BUILDDIR=${TOPDIR}/SPECS
     69        elif [ $ddir = "fedora" || $ddir = "redhat" || $ddir = "rhel" ]; then
     70            dfam="redhat"
     71            dtype="rpm"
     72            dver=`echo ${dver} | sed "s/\.//"`
     73            if [ $ddir = "fedora" ]; then
     74                suf=".fc${dver}"
     75            elif [ $ddir = "redhat" ]; then
     76                suf=".rh${dver}"
     77            else
     78                suf=".rhel${dver}"
     79            fi
     80            BUILDDIR=${TOPDIR}/SPECS
     81        elif [ $ddir = "mandrake" || $ddir = "mandriva" ]; then
     82            dfam="mandriva"
     83            dtype="rpm"
     84            suf=".`echo $dver | sed 's/\.//'`mdk"
     85            BUILDDIR=${TOPDIR}/SPECS
     86        else
     87            dfam="unknown"
     88            dtype="unknown"
     89            BUILDDIR=${TOPDIR}/SPECS
     90            suf="unknown"
     91        fi
     92
     93        # Create conf file dir
     94        mkdir -p ${BUILDDIR}
     95
     96        if [ $dtype = "rpm" ]; then
     97            if [ -f $p-$v/distributions/$ddir/spec.m4 ]; then
     98                inc=$p-$v/distributions/$ddir/spec.m4
     99            elif [ -f $p-$v/distributions/$dfam/spec.m4 ]; then
     100                inc=$p-$v/distributions/$dfam/spec.m4
     101            else
     102                echo "Unable to build the RPM specfile for this distro. Please report to authors"
    52103                exit -1
    53104            fi
    54             make -f Makefile.man
    55             if [ $? != 0 ]; then
     105            cp $inc /tmp/mondorescue.mc
     106            ddd=`LANG=C ; date '+%Y-%m-%d'`
     107            cat >> /tmp/mondorescue.mc << EOF
     108define(\`RRR', ${TAG}${suf})dnl
     109define(\`VVV', ${v})dnl
     110define(\`DDD', ${ddd})dnl
     111EOF
     112            echo "Using $inc customization to build SPEC file"
     113            m4 /tmp/mondorescue.mc $p-$v/distributions/rpm/$p.spec > $p-$v/distributions/$ddir/$p.spec
     114
     115            if [ -f $p-$v/distributions/$ddir/changelog ]; then
     116                log=$p-$v/distributions/$ddir/changelog
     117            elif [ -f $p-$v/distributions/$dfam/changelog ]; then
     118                log=$p-$v/distributions/$dfam/changelog
     119            else
     120                echo "Unable to build RPM changelog for this distro. Please report to authors"
    56121                exit -1
    57122            fi
    58             cd ..
     123
     124            echo "Using $log customization to build changelog file"
     125            ddate=`LANG=C ; date "+%a %b %d %Y"`
     126            cat > $p-$v/distributions/$ddir/$p.changelog.new << EOF
     127* $ddate Bruno Cornec <bruno@mondorescue.org> VVV-RRR
     128- Updated to VVV-r${REVISION}
     129
     130EOF
     131            cat $log >> $p-$v/distributions/$ddir/$p.changelog.new
     132            m4 /tmp/mondorescue.mc $p-$v/distributions/$ddir/$p.changelog.new > $p-$v/distributions/$ddir/$p.changelog
     133            rm -f $p-$v/distributions/$ddir/$p.changelog.new
     134
     135        elif [ $dtype = "ebuild" ]; then
     136            echo "Gentoo Buid"
     137        else
     138            echo "Unknown Buid"
    59139        fi
    60    
    61         if [ _"`echo $p | grep -v kernel | grep mindi`" != _"" ]; then
    62             v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
    63             if [ ! -d mondo-doc-$v1 ]; then
    64                 echo "mondo-doc should be created before $p"
    65                 exit -1
    66             fi
    67             (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
    68             rm -f $p-$v/rootfs/sbin/parted2fdisk-ia64
     140    done
     141
     142    if [ _"`echo $p | grep mondo-doc`" != _"" ]; then
     143        cd ${p}-${v}
     144        for f in mondorescue-howto.sgml *8; do
     145            m4 /tmp/mondorescue.mc $f > ${f}.new
     146            mv ${f}.new $f
     147        done
     148        make -f Makefile.howto
     149        if [ $? != 0 ]; then
     150            exit -1
    69151        fi
    70         if [ "`echo $p | grep -v doc | grep  mondo`" != "" ]; then
    71             v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
    72             if [ ! -d mondo-doc-$v1 ]; then
    73                 echo "mondo-doc should be created before $p"
    74                 exit -1
    75             fi
    76             (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)
    77             (cd $p-$v ; echo "Bootstraping mondo ... " ; ./bootstrap)
     152        make -f Makefile.man
     153        if [ $? != 0 ]; then
     154            exit -1
    78155        fi
    79    
    80         # Finally creates the tar files
    81         echo "Creating $p tar files"
    82         tar cfhz ${TOPDIR}/SOURCES/$p-$v-$TAG.tgz $p-$v
    83         tar cfhj ${TOPDIR}/SOURCES/$p-$v-$TAG.tar.bz2 $p-$v
    84     done
     156        cd ..
     157    fi
     158
     159    if [ _"`echo $p | grep -v kernel | grep mindi`" != _"" ]; then
     160        v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
     161        if [ ! -d mondo-doc-$v1 ]; then
     162            echo "mondo-doc should be created before $p"
     163            exit -1
     164        fi
     165        (cd mondo-doc-$v1 ; make -f Makefile.man install-$p INSTALLDIR=../$p-$v)
     166        rm -f $p-$v/rootfs/sbin/parted2fdisk-ia64
     167    fi
     168    if [ "`echo $p | grep -v doc | grep  mondo`" != "" ]; then
     169        v1=`cat ${SVNBRANCH}/mondo-doc/VERSION`
     170        if [ ! -d mondo-doc-$v1 ]; then
     171            echo "mondo-doc should be created before $p"
     172            exit -1
     173        fi
     174        (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)
     175        (cd $p-$v ; echo "Bootstraping mondo ... " ; ./bootstrap)
     176    fi
     177
     178    # Finally creates the tar files
     179    echo "Creating $p tar files"
     180    tar cfhz ${TOPDIR}/SOURCES/$p-$v-$TAG.tgz $p-$v
     181    tar cfhj ${TOPDIR}/SOURCES/$p-$v-$TAG.tar.bz2 $p-$v
    85182done
     183
     184rm -f /tmp/mondorescue.mc
Note: See TracChangeset for help on using the changeset viewer.