[878] | 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`
|
---|
[1042] | 11 | if [ _${prem} = _"/" ]; then
|
---|
[878] | 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 |
|
---|
[1121] | 21 | export LANGUAGE="C"
|
---|
| 22 |
|
---|
[878] | 23 | # We need to get $VER and $TAG
|
---|
| 24 | if [ "$1" = "" ]; then
|
---|
| 25 | LAST=`cat ${TOPDIR}/LAST`
|
---|
| 26 | else
|
---|
| 27 | LAST=$1
|
---|
| 28 | shift
|
---|
| 29 | fi
|
---|
| 30 | VER=`echo $LAST | cut -d- -f1`
|
---|
| 31 | TAG=`echo $LAST | cut -d- -f2`
|
---|
| 32 | echo "Working on ${VER}-$TAG"
|
---|
| 33 |
|
---|
| 34 | if [ "$1" = "" ]; then
|
---|
| 35 | c="mondo-doc mindi mindi-busybox mondo"
|
---|
| 36 | else
|
---|
| 37 | if [ "$1" = "all" ]; then
|
---|
| 38 | c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
|
---|
| 39 | else
|
---|
[924] | 40 | c="$*"
|
---|
[878] | 41 | fi
|
---|
| 42 | fi
|
---|
| 43 |
|
---|
| 44 | cd $TOPBUILDDIR
|
---|
| 45 |
|
---|
| 46 | ppkg=""
|
---|
| 47 | spkg=""
|
---|
[1357] | 48 | lastfc=`cat $TOOLHOME/DISTROS | grep fedora | tail -1 | cut -d_ -f2`
|
---|
[878] | 49 |
|
---|
| 50 | for p in $c; do
|
---|
| 51 | # s= stable; t = trunk; 1-9 = official version
|
---|
| 52 | src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
|
---|
| 53 | pv=`basename $src .tar.gz`
|
---|
[1357] | 54 | tar -xz -C $MONDOTMP -f $src $pv/TAG
|
---|
| 55 | tag=`cat $MONDOTMP/$pv/TAG`
|
---|
| 56 | spkg="$spkg ${DSTDIR}/../fedora/${lastfc}/$pv-${tag}.fc${lastfc}.src.rpm"
|
---|
[878] | 57 | done
|
---|
| 58 |
|
---|
| 59 | echo "Packages delivery to ${ACCOUNT}"
|
---|
| 60 | cat > /tmp/mkmondo << EOF
|
---|
[1357] | 61 | set -x
|
---|
| 62 | TOPBUILDDIR=\`rpmquery --eval '%{_topdir}' 2> /dev/null\`
|
---|
| 63 | echo "Working under $TOPBUILDDIR"
|
---|
[878] | 64 | rm -f /tmp/mondorescue.log
|
---|
[1357] | 65 | for p in $spkg ; do
|
---|
| 66 | pkg=\`basename \$p\`
|
---|
| 67 | rpm -ivh \$pkg
|
---|
| 68 | sp=\`rpm -qlp \$pkg | grep -E '\.spec'\`
|
---|
| 69 | src=\`rpm -qlp \$pkg | grep -E '\.tar\.'\`
|
---|
| 70 | fcsp=\`echo \$sp | sed 's/\.spec/-fc.spec/'\`
|
---|
| 71 | spec=\`tar tfz \$TOPBUILDDIR/SOURCES/\$src | grep -E "\$fcsp"\`
|
---|
| 72 | tar xzf \$TOPBUILDDIR/SOURCES/\$src \$spec
|
---|
| 73 | for s in \$spec ; do
|
---|
| 74 | file \$s | grep -q ISO-8859
|
---|
| 75 | if [ \$? -eq 0 ]; then
|
---|
| 76 | cat \$s | recode latin1..utf-8 > \$TOPBUILDDIR/SPECS/\$sp
|
---|
| 77 | else
|
---|
| 78 | mv \$s \$TOPBUILDDIR/SPECS/\$sp
|
---|
| 79 | fi
|
---|
| 80 | # Use dist for fc
|
---|
[1397] | 81 | perl -pi -e 's/Release:[ \t]+([0-9]+)..*/Release: \$1%{?dist}/' \$TOPBUILDDIR/SPECS/\$sp
|
---|
[1357] | 82 | perl -pi -e 's/ Bruno Cornec <bruno@mondorescue.org>..*/ Bruno Cornec <bruno@mondorescue.org> %{version}-%{release}/' \$TOPBUILDDIR/SPECS/\$sp
|
---|
| 83 | rm -rf \$TOPBUILDDIR/BUILD/*
|
---|
| 84 | rpmbuild -ba \$TOPBUILDDIR/SPECS/\$sp 2>&1 | tee -a /tmp/mondorescue.log
|
---|
| 85 | done
|
---|
[878] | 86 | done
|
---|
| 87 | apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
|
---|
| 88 | aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
|
---|
[1357] | 89 | mkdir -p $DSTDIR
|
---|
| 90 | mv \$aspkg $DSTDIR
|
---|
[878] | 91 | rm -f \$ppkg
|
---|
[1357] | 92 | cd /tmp
|
---|
[878] | 93 | EOF
|
---|
| 94 | chmod 755 /tmp/mkmondo
|
---|
[1357] | 95 | echo "Packages rebuild on ${ACCOUNT}"
|
---|
[878] | 96 | scp -p /tmp/mkmondo ${ACCOUNT}:
|
---|
[1357] | 97 | ssh -q ${ACCOUNT} "cp -v ${spkg} . ; ./mkmondo"
|
---|
[1271] | 98 | ) 2>&1 | tee /tmp/pk2fc.log
|
---|