source: branches/2.06/tools/mkrpm @ 315

Last change on this file since 315 was 315, checked in by bcornec, 14 years ago
  • svn.log now part of the rpms
  • .spec factorisation continues (mkrel, requires, ...)
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3# Creates RPMs packages from SVN repository for local tests
4#
5# $Id: mkrpm 315 2006-01-13 19:07:06Z bcornec $
6#
7
8umask 022
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/rpm-env
18
19# To be safe for SVN commands
20cd $TOOLHOME/..
21rev=`$TOOLHOME/mksvnversion`
22
23echo "Generating SVN log file ..."
24svn log -v > /tmp/mondorescue-svn.log
25
26if [ "$1" = "" ]; then
27    c="mindi mondo"
28else
29    c=$1
30fi
31if [ "`echo $c | grep mindi-kernel`" != "" ]; then
32    cd ${BASE}/svn
33    echo "Management of mindi-kernel ${MINDI_VER}"
34    rm -fr mindi-kernel-${MINDI_VER}
35    cp -a ${VER}/mindi-kernel mindi-kernel-${MINDI_VER}
36    find mindi-kernel-${MINDI_VER} -type d -name .svn | xargs rm -rf
37    find mindi-kernel-${MINDI_VER} -type f -name '.*.swp' | xargs rm -rf
38    find mindi-kernel-${MINDI_VER} -type f -name '*~' | xargs rm -rf
39    mkdir -p ${TOPDIR}/SOURCES
40    tar cvfhz ${TOPDIR}/SOURCES/mindi-kernel-${MINDI_VER}.tgz mindi-kernel-${MINDI_VER}
41    tar cvfhj ${TOPDIR}/SOURCES/mindi-kernel-${MINDI_VER}.tar.bz2 mindi-kernel-${MINDI_VER}
42    sed "s/^%define mrel..*RRR/%define mrel ${rev}${suf}/" mindi-kernel-${MINDI_VER}/mindi-kernel.spec > ${TOPDIR}/SPECS/mindi-kernel.spec
43    rm -f ${TMP}/mindi-kernel*-root
44    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-kernel-${MINDI_VER}-${rev}${suf}.${ARCH}.rpm"
45fi
46if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
47    cd ${BASE}/svn
48    echo "Management of mindi ${MINDI_VER}"
49    rm -fr mindi-${MINDI_VER}
50    cp -a ${VER}/mindi mindi-${MINDI_VER}
51    cp -a /tmp/mondorescue-svn.log mindi-${MINDI_VER}/svn.log
52    find mindi-${MINDI_VER} -type d -name .svn | xargs rm -rf
53    find mindi-${MINDI_VER} -type f -name '.*.swp' | xargs rm -rf
54    find mindi-${MINDI_VER} -type f -name '*~' | xargs rm -rf
55    rm -f mindi-${MINDI_VER}/parted2fdisk mindi-${MINDI_VER}/parted2fdisk.c mindi-${MINDI_VER}/rootfs/sbin/parted2fdisk-ia64
56    mkdir -p ${TOPDIR}/SOURCES
57    tar cvfhz ${TOPDIR}/SOURCES/mindi-${MINDI_VER}.tgz mindi-${MINDI_VER}
58    tar cvfhj ${TOPDIR}/SOURCES/mindi-${MINDI_VER}.tar.bz2 mindi-${MINDI_VER}
59    sed -e "s/^%define mrel..*RRR/%define mrel  ${rev}${suf}/" -e "s/VVV/${MINDI_VER}/" mindi-${MINDI_VER}/mindi.spec > ${TOPDIR}/SPECS/mindi.spec
60    rm -f ${TMP}/mindi-*-root
61    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mindi-${MINDI_VER}-${rev}${suf}.${ARCH}.rpm"
62    # ATTENTION: This could be dangerous for your setup
63    opt="rm -rf /usr/lib/mindi ;"
64fi
65if [ "`echo $c | grep  mondo`" != "" ]; then
66    cd ${BASE}/svn
67    echo "Management of mondo ${MONDO_VER}"
68    rm -rf mondo-${MONDO_VER}
69    cp -a ${VER}/mondo mondo-${MONDO_VER}
70    cp -a /tmp/mondorescue-svn.log mondo-${MONDO_VER}/svn.log
71    cd mondo-${MONDO_VER}
72    echo "Bootstraping mondo ... "
73    ./bootstrap
74    find . -type d -name .svn | xargs rm -rf
75    find . -type f -name '.*.swp' | xargs rm -rf
76    find . -type f -name '*~' | xargs rm -rf
77    cd ..
78    tar cvfhz ${TOPDIR}/SOURCES/mondo-${MONDO_VER}.tgz mondo-${MONDO_VER}
79    tar cvfhj ${TOPDIR}/SOURCES/mondo-${MONDO_VER}.tar.bz2 mondo-${MONDO_VER}
80    sed -e "s/^%define mrel..*RRR/%define mrel  ${rev}${suf}/" -e "s/VVV/${MONDO_VER}/" mondo-${MONDO_VER}/mondo.spec > ${TOPDIR}/SPECS/mondo.spec
81    rm -f ${TMP}/mondo-*-root
82    pkg="$pkg ${TOPDIR}/RPMS/${ARCH}/mondo-${MONDO_VER}-${rev}${suf}.${ARCH}.rpm"
83fi
84cd ${TOPDIR}/SPECS
85if [ "`echo $c | grep kernel`" != "" ]; then
86    rpmbuild -ba mindi-kernel.spec
87fi
88if [ "`echo $c | grep -v kernel | grep mindi`" != "" ]; then
89    rpmbuild -ba mindi.spec
90fi
91if [ "`echo $c | grep mondo`" != "" ]; then
92    rpmbuild -ba mondo.spec
93fi
94su - -c "$opt rpm -Uvh --force $pkg"
Note: See TracBrowser for help on using the repository browser.