source: branches/stable/tools/pkg2fc @ 1326

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

mkchangelog now supports an fc option for Fedora pkg genration

  • Property svn:executable set to *
File size: 2.0 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
44export pkg=""
45echo "Working under $TOPBUILDDIR"
46cd $TOPBUILDDIR
47
48ppkg=""
49spkg=""
50
51for p in $c; do
52    # s= stable; t = trunk; 1-9 = official version
53    src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
54    pv=`basename $src .tar.gz`
55    tag=`echo $pv | sed "s/-\([0-9]*.*\)/\2/"` 
56    spkg="$spkg ${TOPBUILDDIR}/SRPMS/$pv-${tag}${suf}.src.rpm"
57    ppkg="$ppkg $pv-${tag}${suf}.src.rpm"
58done
59
60echo "Packages delivery to ${ACCOUNT}"
61cat > /tmp/mkmondo << EOF
62rm -f /tmp/mondorescue.log
63for p in $ppkg ; do
64    rpm -ivh \$p
65    src=\`rpm -qlp \$p | grep -E '\.spec'\`
66    spec=\`tar tvf rpm/SOURCES/\$src | grep -E "\$p-fc.spec"\`
67    tar xf rpm/SOURCES/\$src \$spec
68    s=\`rpm -qlp \$p | egrep '\.spec'\`
69    mv \$p-fc.spec rpm/SPECS/\$s
70    # Use dist for fc
71    perl -pi -e "s/define Release:[ \t]+([0-9]+)..*/define Release: \$1%{?dist}/" rpm/SPECS/\$s
72    perl -pi -e 's/ Bruno Cornec <bruno@mondorescue.org>..*/ Bruno Cornec <bruno@mondorescue.org> %{version}-%{release}/' rpm/SPECS/\$s
73    rm -rf rpm/BUILD/*
74    rpmbuild -ba rpm/SPECS/\$s 2>&1 | tee -a /tmp/mondorescue.log
75done
76apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
77aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
78mkdir -p \$DSTDIR
79mv \$aspkg \$DSTDIR
80rm -f \$ppkg
81EOF
82chmod 755 /tmp/mkmondo
83scp -p ${spkg} /tmp/mkmondo ${ACCOUNT}:
84scp -p /tmp/mkmondo ${ACCOUNT}:
85echo "Packages rebuild on ${DSTNODE}"
86ssh -q ${ACCOUNT} ${DSTNODE} "./mkmondo"
87) 2>&1 | tee /tmp/pk2fc.log
Note: See TracBrowser for help on using the repository browser.