source: trunk/tools/pkg2mdv @ 1041

Last change on this file since 1041 was 932, checked in by bruno, 13 years ago

merge -r913:931 $SVN_M/branches/stable

  • Property svn:executable set to *
File size: 2.1 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
21# We need to get $VER and $TAG
22if [ "$1" = "" ]; then
23    LAST=`cat ${TOPDIR}/LAST`
24else
25    LAST=$1
26    shift
27fi
28VER=`echo $LAST | cut -d- -f1`
29TAG=`echo $LAST | cut -d- -f2`
30echo "Working on ${VER}-$TAG"
31   
32if [ "$1" = "" ]; then
33    c="mondo-doc mindi mindi-busybox mondo"
34else
35    if [ "$1" = "all" ]; then
36        c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
37    else
38        c="$*"
39    fi
40fi
41
42
43for p in $c; do
44    src=${TOPDIR}/${VER}-$TAG/$p-[1-9]*.tar.bz2
45    s=`basename $src`
46    oldver=`echo $s | sed "s/$p-\([1-9][0-9.]*\).tar.bz2/\1/"`
47    newver=`echo $oldver | sed 's/\([0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)/\1.\2\3/'`
48    distro=`ls -d ${TOPDIR}/${VER}-$TAG/$p-[1-9]*/distributions/mandriva-* | tail -1`
49    spec=${distro}/$p.spec
50    echo "Updating Mandriva package in $SVNMDV/$p"
51    cd $SVNMDV/$p
52    mkdir -p SOURCES SPECS
53    echo "Modifying $oldver => $newver"
54    svn del --force SOURCES/$p-*.tar.bz2
55    cp -a $src SOURCES/$p-$newver.tar.bz2
56    tar xfj SOURCES/$p-$newver.tar.bz2
57    mv $p-$oldver $p-$newver
58    perl -pi -e "s/$oldver/$newver/" $p-$newver/VERSION
59    tar cfj SOURCES/$p-$newver.tar.bz2 $p-$newver
60    rm -rf $p-$newver
61    svn add SOURCES/$p-$newver.tar.bz2
62    cp -a $spec SPECS
63    # Use mkrel for mdv
64    perl -pi -e "s/^Release:[ \t]+..*/Release:  %mkrel $tag/" SPECS/$p.spec
65    perl -pi -e 's/^Version:[ \t]+([0-9])\.([0-9]+)\.([0-9]+)/Version:  $1.$2$3/' SPECS/$p.spec
66    perl -pi -e 's/mindi >= ..*,/mindi/' SPECS/$p.spec
67    $TOOLHOME/mdv-changelog.pl SPECS/$p.spec
68    # Changelog management
69    echo "Building packages"
70    bm
71    if [ $? -eq 0 ]; then
72        rm -rf BUILD RPMS SRPMS BUILDROOT
73        echo "Committing from $SVNMDV/$p into Mandriva's SVN"
74        svn ci -F $MONDOTMP/cmt.spec
75        if [ $? -eq 0 ]; then
76            svn up
77            rm -f $MONDOTMP/cmt.spec
78            echo "Building on Mandriva's cluster"
79            ssh $ACCOUNT $DSTNODE "yr $p"
80        fi
81    fi
82done
83
84rm -rf $MONDOTMP
85
86) 2>&1 | tee /tmp/pk2mdv.log
Note: See TracBrowser for help on using the repository browser.