source: branches/stable/tools/build2pkg @ 553

Last change on this file since 553 was 553, checked in by bcornec, 14 years ago

Build process in 3 steps:

svn2build creates tar files from SVN (works mostly)
build2pkg creates packages from tar files (works mostly)
build2qemu (has to be created from mkqemu) will create packages for all supported virtuel machines

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/bash
2#
3# Creates packages from build repository
4#
5# $Id$
6#
7# Syntax: build2pkg [version-tag [pkg list]]
8#
9
10umask 022
11dname=`dirname $0`
12prem=`echo $dname |cut -c1`
13if [ ${prem} == "/" ]; then
14    export TOOLHOME=$dname
15else
16    export TOOLHOME=${PWD}/$dname
17fi
18
19. $TOOLHOME/common-env
20. $TOOLHOME/distro-env
21
22# We need to get $VER and $TAG
23if [ "$1" = "" ]; then
24    LAST=`cat ${TOPDIR}/LAST`
25else
26    LAST=$1
27    shift
28fi
29VER=`echo $LAST | cut -d- -f1`
30TAG=`echo $LAST | cut -d- -f2`
31echo "Working on ${VER}-$TAG"
32   
33if [ "$1" = "" ]; then
34    c="mondo-doc mindi mondo"
35else
36    if [ "$1" = "all" ]; then
37        c="mindi-kernel mondo-doc mindi mondo"
38    else
39        c=$1
40    fi
41fi
42
43status=0
44
45#
46# Define on which distro we are to generate the right packages
47#
48
49export pkg=""
50cd $TOPBUILDDIR
51
52for p in $c; do
53    # s= stable; t = trunk; 1-9 = official version
54    src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
55    pv=`basename $src .tar.gz`
56
57    if [  _"$dtype" = _"rpm" ]; then
58        pkg1="${TOPBUILDDIR}/RPMS/${ARCH}/$pv${suf}.${ARCH}.rpm"
59        #rm -f $pkg1
60
61        pkg="$pkg $pkg1"
62
63        echo "Generating $p RPMS"
64        log=/tmp/$p-rpm.log
65
66        if [ "$dfam" = "mandriva" ]; then
67            echo "Generating bzip2 files (mandriva)"
68            gzip -cd $src | bzip2 -c3 > SOURCES/$pv.tar.bz2
69        else
70            ln -sf $src SOURCES/
71        fi
72        cd SPECS
73        tar xfz $src $pv/distributions/$ddir/$p.spec
74        mv $pv/distributions/$ddir/$p.spec .
75        rm -rf $pv
76
77        rpmbuild -ba $p.spec 2> $log 1> $log
78        if [ $? != 0 ]; then 
79            cat $log
80            status=-1
81        fi
82        cd ..
83    fi
84done
85
86if [ $status = 0 ]; then
87    if [  _"$dtype" = _"rpm" ]; then
88        echo "Installing RPMS as root ($pkg)"
89        su - -c "$opt rpm -Uvh --force $pkg"
90    fi
91fi
Note: See TracBrowser for help on using the repository browser.