source: branches/stable/tools/pkg2fc @ 1357

Last change on this file since 1357 was 1357, checked in by bruno, 12 years ago

Try to improve Fedora delivery (from 2.2.2)

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#!/bin/bash
2#
3# Deliver packages to Fedora
4#
5# $Id$
6#
7
8(
9dname=`dirname $0`
10prem=`echo $dname |cut -c1`
11if [ _${prem} = _"/" ]; then
12        export TOOLHOME=$dname
13else
14    export TOOLHOME=${PWD}/$dname
15fi
16
17. $TOOLHOME/common-env
18. $TOOLHOME/distro-env
19. $TOOLHOME/fc-env
20
21export LANGUAGE="C"
22
23# We need to get $VER and $TAG
24if [ "$1" = "" ]; then
25    LAST=`cat ${TOPDIR}/LAST`
26else
27    LAST=$1
28    shift
29fi
30VER=`echo $LAST | cut -d- -f1`
31TAG=`echo $LAST | cut -d- -f2`
32echo "Working on ${VER}-$TAG"
33   
34if [ "$1" = "" ]; then
35    c="mondo-doc mindi mindi-busybox mondo"
36else
37    if [ "$1" = "all" ]; then
38        c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
39    else
40        c="$*"
41    fi
42fi
43
44cd $TOPBUILDDIR
45
46ppkg=""
47spkg=""
48lastfc=`cat $TOOLHOME/DISTROS | grep fedora | tail -1 | cut -d_ -f2`
49
50for 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`
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"
57done
58
59echo "Packages delivery to ${ACCOUNT}"
60cat > /tmp/mkmondo << EOF
61set -x
62TOPBUILDDIR=\`rpmquery --eval '%{_topdir}' 2> /dev/null\`
63echo "Working under $TOPBUILDDIR"
64rm -f /tmp/mondorescue.log
65for 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
81        perl -pi -e "s/define Release:[ \t]+([0-9]+)..*/define Release: \$1%{?dist}/" \$TOPBUILDDIR/SPECS/\$sp
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
86done
87apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
88aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
89mkdir -p $DSTDIR
90mv \$aspkg $DSTDIR
91rm -f \$ppkg
92cd /tmp
93EOF
94chmod 755 /tmp/mkmondo
95echo "Packages rebuild on ${ACCOUNT}"
96scp -p /tmp/mkmondo ${ACCOUNT}:
97ssh -q ${ACCOUNT} "cp -v ${spkg} . ; ./mkmondo"
98) 2>&1 | tee /tmp/pk2fc.log
Note: See TracBrowser for help on using the repository browser.