1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Deliver packages and tgz files to Mandriva
|
---|
4 | #
|
---|
5 | # $Id$
|
---|
6 | #
|
---|
7 |
|
---|
8 | dname=`dirname $0`
|
---|
9 | prem=`echo $dname |cut -c1`
|
---|
10 | if [ ${prem} == "/" ]; then
|
---|
11 | export TOOLHOME=$dname
|
---|
12 | else
|
---|
13 | export TOOLHOME=${PWD}/$dname
|
---|
14 | fi
|
---|
15 |
|
---|
16 | . $TOOLHOME/common-env
|
---|
17 | . $TOOLHOME/distro-env
|
---|
18 | . $TOOLHOME/mdv-env
|
---|
19 |
|
---|
20 | # We need to get $VER and $TAG
|
---|
21 | if [ "$1" = "" ]; then
|
---|
22 | LAST=`cat ${TOPDIR}/LAST`
|
---|
23 | else
|
---|
24 | LAST=$1
|
---|
25 | shift
|
---|
26 | fi
|
---|
27 | VER=`echo $LAST | cut -d- -f1`
|
---|
28 | TAG=`echo $LAST | cut -d- -f2`
|
---|
29 | echo "Working on ${VER}-$TAG"
|
---|
30 |
|
---|
31 | if [ "$1" = "" ]; then
|
---|
32 | c="mondo-doc mindi mondo"
|
---|
33 | else
|
---|
34 | if [ "$1" = "all" ]; then
|
---|
35 | c="mindi-kernel mondo-doc mindi mondo"
|
---|
36 | else
|
---|
37 | c=$1
|
---|
38 | fi
|
---|
39 | fi
|
---|
40 |
|
---|
41 | export pkg=""
|
---|
42 | echo "Working under $TOPBUILDDIR"
|
---|
43 | cd $TOPBUILDDIR
|
---|
44 |
|
---|
45 | ppkg=""
|
---|
46 | spkg=""
|
---|
47 |
|
---|
48 | for 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"
|
---|
54 | done
|
---|
55 |
|
---|
56 | echo "Packages delivery to ${ACCOUNT}"
|
---|
57 | cat > /tmp/mkmondo << EOF
|
---|
58 | rm -f /tmp/mondorescue.log
|
---|
59 | for 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
|
---|
67 | done
|
---|
68 | apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
|
---|
69 | aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
|
---|
70 | for 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\`"
|
---|
73 | done
|
---|
74 | for p in \$apkg; do
|
---|
75 | sudo ftpcontrib \$p
|
---|
76 | done
|
---|
77 | rm -f \$ppkg
|
---|
78 | EOF
|
---|
79 | chmod 755 /tmp/mkmondo
|
---|
80 | scp -p ${spkg} /tmp/mkmondo ${ACCOUNT}:
|
---|
81 | scp -p /tmp/mkmondo ${ACCOUNT}:
|
---|
82 | echo "Packages rebuild on ${DSTNODE}"
|
---|
83 | ssh ${ACCOUNT} ${DSTNODE} "./mkmondo"
|
---|