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