1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Deliver packages to Fedora
|
---|
4 | #
|
---|
5 | # $Id$
|
---|
6 | #
|
---|
7 |
|
---|
8 | (
|
---|
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/fc-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 mindi-busybox mondo"
|
---|
34 | else
|
---|
35 | if [ "$1" = "all" ]; then
|
---|
36 | c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
|
---|
37 | else
|
---|
38 | c="$*"
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 |
|
---|
42 | cd $TOPBUILDDIR
|
---|
43 |
|
---|
44 | ppkg=""
|
---|
45 | spkg=""
|
---|
46 | lastfc=`cat $TOOLHOME/DISTROS | grep fedora | tail -1 | cut -d_ -f2`
|
---|
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 | tar -xz -C $MONDOTMP -f $src $pv/TAG
|
---|
53 | tag=`cat $MONDOTMP/$pv/TAG`
|
---|
54 | spkg="$spkg ${DSTDIR}/../fedora/${lastfc}/$pv-${tag}.fc${lastfc}.src.rpm"
|
---|
55 | done
|
---|
56 |
|
---|
57 | echo "Packages delivery to ${ACCOUNT}"
|
---|
58 | cat > /tmp/mkmondo << EOF
|
---|
59 | set -x
|
---|
60 | TOPBUILDDIR=\`rpmquery --eval '%{_topdir}' 2> /dev/null\`
|
---|
61 | echo "Working under $TOPBUILDDIR"
|
---|
62 | rm -f /tmp/mondorescue.log
|
---|
63 | for p in $spkg ; do
|
---|
64 | pkg=\`basename \$p\`
|
---|
65 | rpm -ivh \$pkg
|
---|
66 | sp=\`rpm -qlp \$pkg | grep -E '\.spec'\`
|
---|
67 | src=\`rpm -qlp \$pkg | grep -E '\.tar\.'\`
|
---|
68 | fcsp=\`echo \$sp | sed 's/\.spec/-fc.spec/'\`
|
---|
69 | spec=\`tar tfz \$TOPBUILDDIR/SOURCES/\$src | grep -E "\$fcsp"\`
|
---|
70 | tar xzf \$TOPBUILDDIR/SOURCES/\$src \$spec
|
---|
71 | for s in \$spec ; do
|
---|
72 | file \$s | grep -q ISO-8859
|
---|
73 | if [ \$? -eq 0 ]; then
|
---|
74 | cat \$s | recode latin1..utf-8 > \$TOPBUILDDIR/SPECS/\$sp
|
---|
75 | else
|
---|
76 | mv \$s \$TOPBUILDDIR/SPECS/\$sp
|
---|
77 | fi
|
---|
78 | # Use dist for fc
|
---|
79 | perl -pi -e "s/define Release:[ \t]+([0-9]+)..*/define Release: \$1%{?dist}/" \$TOPBUILDDIR/SPECS/\$sp
|
---|
80 | perl -pi -e 's/ Bruno Cornec <bruno@mondorescue.org>..*/ Bruno Cornec <bruno@mondorescue.org> %{version}-%{release}/' \$TOPBUILDDIR/SPECS/\$sp
|
---|
81 | rm -rf \$TOPBUILDDIR/BUILD/*
|
---|
82 | rpmbuild -ba \$TOPBUILDDIR/SPECS/\$sp 2>&1 | tee -a /tmp/mondorescue.log
|
---|
83 | done
|
---|
84 | done
|
---|
85 | apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
|
---|
86 | aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
|
---|
87 | mkdir -p $DSTDIR
|
---|
88 | mv \$aspkg $DSTDIR
|
---|
89 | rm -f \$ppkg
|
---|
90 | cd /tmp
|
---|
91 | EOF
|
---|
92 | chmod 755 /tmp/mkmondo
|
---|
93 | echo "Packages rebuild on ${ACCOUNT}"
|
---|
94 | scp -p /tmp/mkmondo ${ACCOUNT}:
|
---|
95 | ssh -q ${ACCOUNT} "cp -v ${spkg} . ; ./mkmondo"
|
---|
96 | ) 2>&1 | tee /tmp/pk2fc.log
|
---|