source: MondoRescue/branches/2.2.2/tools/pkg2fc

Last change on this file was 1356, checked in by Bruno Cornec, 17 years ago

Try to improve Fedora delivery

  • 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
21# We need to get $VER and $TAG
22if [ "$1" = "" ]; then
23 LAST=`cat ${TOPDIR}/LAST`
24else
25 LAST=$1
26 shift
27fi
28VER=`echo $LAST | cut -d- -f1`
29TAG=`echo $LAST | cut -d- -f2`
30echo "Working on ${VER}-$TAG"
31
32if [ "$1" = "" ]; then
33 c="mondo-doc mindi mindi-busybox mondo"
34else
35 if [ "$1" = "all" ]; then
36 c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
37 else
38 c="$*"
39 fi
40fi
41
42cd $TOPBUILDDIR
43
44ppkg=""
45spkg=""
46lastfc=`cat $TOOLHOME/DISTROS | grep fedora | tail -1 | cut -d_ -f2`
47
48for 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"
55done
56
57echo "Packages delivery to ${ACCOUNT}"
58cat > /tmp/mkmondo << EOF
59set -x
60TOPBUILDDIR=\`rpmquery --eval '%{_topdir}' 2> /dev/null\`
61echo "Working under $TOPBUILDDIR"
62rm -f /tmp/mondorescue.log
63for 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
84done
85apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
86aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
87mkdir -p $DSTDIR
88mv \$aspkg $DSTDIR
89rm -f \$ppkg
90cd /tmp
91EOF
92chmod 755 /tmp/mkmondo
93echo "Packages rebuild on ${ACCOUNT}"
94scp -p /tmp/mkmondo ${ACCOUNT}:
95ssh -q ${ACCOUNT} "cp -v ${spkg} . ; ./mkmondo"
96) 2>&1 | tee /tmp/pk2fc.log
Note: See TracBrowser for help on using the repository browser.