source: branches/3.0/tools/pkg2mdv

Last change on this file was 1523, checked in by bruno, 12 years ago

Mandriva packages go first to contrib/testing not backport

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/bash
2#
3# Deliver packages and tgz files to Mandriva
4#
5# $Id$
6#
7
8(
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ ${prem} = "/" ]; then
12        export TOOLHOME=$dname
13else
14    export TOOLHOME=${PWD}/$dname
15fi
16
17. $TOOLHOME/common-env
18. $TOOLHOME/distro-env
19. $TOOLHOME/mdv-env
20
21export LANGUAGE="C"
22
23# We need to get $VER and $TAG
24if [ "$1" = "" ]; then
25    LAST=`cat ${TOPDIR}/LAST`
26else
27    LAST=$1
28    shift
29fi
30VER=`echo $LAST | cut -d- -f1`
31TAG=`echo $LAST | cut -d- -f2`
32echo "Working on ${VER}-$TAG"
33   
34if [ "$1" = "" ]; then
35    c="mondo-doc mindi mindi-busybox mondo"
36else
37    if [ "$1" = "all" ]; then
38        c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
39    else
40        c="$*"
41    fi
42fi
43
44
45for p in $c; do
46    src=${TOPDIR}/${VER}-$TAG/$p-[1-9]*.tar.bz2
47    s=`basename $src`
48    if [ _"$p" = _"mindi-busybox" ]; then
49        oldver=`echo $s | sed "s/$p-\([1-9][0-9.]*\).tar.bz2/\1/"`
50        newver=$oldver
51    else
52        oldver=`echo $s | sed "s/$p-\([1-9][0-9.]*\).tar.bz2/\1/"`
53        newver=`echo $oldver | sed 's/\([0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2\3/'`
54    fi
55    distro=`ls -d ${TOPDIR}/${VER}-$TAG/$p-[1-9]*/distributions/mandriva-* | tail -1`
56    spec=${distro}/$p.spec
57    echo "Updating Mandriva package in $SVNMDV/$p"
58    cd $SVNMDV/$p
59    mkdir -p SOURCES SPECS
60    svn del --force SOURCES/$p-*.tar.bz2
61    cp -a $src SOURCES/$p-$newver.tar.bz2
62    cp -a $spec SPECS
63
64    # Case when there is a version change
65    if [ _"$oldver" != _"$newver" ]; then
66        echo "Modifying $oldver => $newver"
67        tar xfj SOURCES/$p-$newver.tar.bz2
68        mv $p-$oldver $p-$newver
69        perl -pi -e "s/$oldver/$newver/" $p-$newver/VERSION
70        tar cfj SOURCES/$p-$newver.tar.bz2 $p-$newver
71        rm -rf $p-$newver
72        perl -pi -e 's/^Version:[ \t]+([0-9])\.([0-9]+)\.([0-9]+)/Version:  $1.$2$3/' SPECS/$p.spec
73    fi
74    svn add SOURCES/$p-$newver.tar.bz2
75    # Use mkrel for mdv
76    perl -pi -e "s/^Release:[ \t]+..*/Release:  %mkrel $TAG/" SPECS/$p.spec
77    perl -pi -e "s/^Release:/Packager:  Bruno Cornec <bcornec\@mandriva.org>\nRelease:/" SPECS/$p.spec
78    perl -pi -e 's/mindi >= [0-9.]*,/mindi/' SPECS/$p.spec
79    $TOOLHOME/mdv-changelog.pl SPECS/$p.spec
80    # Changelog management
81    echo "Building packages"
82    bm
83    if [ $? -eq 0 ]; then
84        rm -rf BUILD RPMS SRPMS BUILDROOT
85        echo "Committing from $SVNMDV/$p into Mandriva's SVN"
86        svn ci -F $MONDOTMP/cmt.spec
87        if [ $? -eq 0 ]; then
88            svn up
89            rm -f $MONDOTMP/cmt.spec
90            echo "Building on Mandriva's cluster"
91            rev=`svn info | egrep "^Revision:" | cut -d: -f2`
92            repsys submit svn+ssh://svn.mandriva.com/svn/packages/cooker/$p $rev
93            for t in 2007.0 2007.1; do
94                repsys submit -t $t --define section=contrib/testing svn+ssh://svn.mandriva.com/svn/packages/cooker/$p $rev
95            done
96        fi
97    fi
98done
99
100rm -rf $MONDOTMP
101
102) 2>&1 | tee /tmp/pk2mdv.log
Note: See TracBrowser for help on using the repository browser.