source: trunk/tools/pkg2mdv @ 649

Last change on this file since 649 was 649, checked in by bcornec, 13 years ago

merge -r617:641 $SVN_M/branches/stable

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1#!/bin/bash
2#
3# Deliver packages and tgz files to Mandriva
4#
5# $Id$
6#
7
8dname=`dirname $0`
9prem=`echo $dname |cut -c1`
10if [ ${prem} == "/" ]; then
11        export TOOLHOME=$dname
12else
13    export TOOLHOME=${PWD}/$dname
14fi
15
16. $TOOLHOME/common-env
17. $TOOLHOME/distro-env
18. $TOOLHOME/mdv-env
19
20# We need to get $VER and $TAG
21if [ "$1" = "" ]; then
22    LAST=`cat ${TOPDIR}/LAST`
23else
24    LAST=$1
25    shift
26fi
27VER=`echo $LAST | cut -d- -f1`
28TAG=`echo $LAST | cut -d- -f2`
29echo "Working on ${VER}-$TAG"
30   
31if [ "$1" = "" ]; then
32    c="mondo-doc mindi mondo"
33else
34    if [ "$1" = "all" ]; then
35        c="mindi-kernel mondo-doc mindi mondo"
36    else
37        c=$1
38    fi
39fi
40
41export pkg=""
42echo "Working under $TOPBUILDDIR"
43cd $TOPBUILDDIR
44
45ppkg=""
46spkg=""
47
48for p in $c; do
49    # s= stable; t = trunk; 1-9 = official version
50    src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
51    pv=`basename $src .tar.gz`
52    spkg="$spkg ${TOPBUILDDIR}/SRPMS/$pv${suf}.src.rpm"
53    ppkg="$ppkg $pv${suf}.src.rpm"
54done
55
56echo "Packages delivery to ${ACCOUNT}"
57cat > /tmp/mkmondo << EOF
58rm -f /tmp/mondorescue.log
59for p in $ppkg ; do
60    rpm -ivh \$p
61    s=\`rpm -qlp \$p | egrep '\.spec'\`
62    # Use mkrel for mdv
63    perl -pi -e 's/define mrel[ \t]+([0-9]+)\..*/define mrel    %mkrel \$1/' rpm/SPECS/\$s
64    perl -pi -e 's/ Bruno Cornec <bruno@mondorescue.org> ([0-9]+.*)/ Bruno Cornec <bcornec@mandriva.org> %{version}-%{release}/' rpm/SPECS/\$s
65    rm -rf rpm/BUILD/*
66    rpmbuild -ba rpm/SPECS/\$s 2>&1 | tee -a /tmp/mondorescue.log
67done
68apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
69aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
70for d in 2006 200664; do
71    scp -p \$aspkg chroot\${d}:
72    ssh chroot\${d} "for p in $aspkg; do rpm -ivh \`basename \$p\` ; rpmbuild -ba rpm/SPECS/\$s | tee -a /tmp/mondorescue.log ; done ; sudo ftp\${d}contrib \`egrep '^Wrote:' /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`"
73done
74for p in \$apkg; do
75    sudo ftpcontrib \$p
76done
77rm -f \$ppkg
78EOF
79chmod 755 /tmp/mkmondo
80scp -p ${spkg} /tmp/mkmondo ${ACCOUNT}:
81scp -p /tmp/mkmondo ${ACCOUNT}:
82echo "Packages rebuild on ${DSTNODE}"
83ssh ${ACCOUNT} ${DSTNODE} "./mkmondo"
Note: See TracBrowser for help on using the repository browser.