source: branches/stable/tools/build2pkg @ 568

Last change on this file since 568 was 568, checked in by bcornec, 13 years ago

mondo-doc spec should work better and install target
mondo.spec avoids duplicates
documentation corrected (thanks Conor)

  • Property svn:executable set to *
File size: 2.0 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        if [ _"$p" = _"mondo-doc" ]; then
59            ar="noarch"
60        else
61            ar=$ARCH
62        fi
63        pkg1="${TOPBUILDDIR}/RPMS/${ar}/$pv${suf}.${ar}.rpm"
64        #rm -f $pkg1
65
66        pkg="$pkg $pkg1"
67
68        log=/tmp/$p-rpm.log
69
70        if [ "$dfam" = "mandriva" ]; then
71            echo "Generating bzip2 files (mandriva)"
72            gzip -cd $src | bzip2 -c3 > SOURCES/$pv.tar.bz2
73        else
74            ln -sf $src SOURCES/
75        fi
76        echo "Generating $p RPMS"
77        cd SPECS
78        tar xfz $src $pv/distributions/$ddir/$p.spec
79        mv $pv/distributions/$ddir/$p.spec .
80        rm -rf $pv
81
82        rpmbuild -ba $p.spec 2> $log 1> $log
83        if [ $? != 0 ]; then 
84            cat $log
85            status=-1
86        fi
87        cd ..
88    elif [  _"$dtype" = _"gentoo" ]; then
89        echo "Gentoo"
90        log=/tmp/$p-gentoo.log
91        ln -sf $src .
92        tar xfz $src $pv/distributions/$ddir/$pv-r$TAG.ebuild
93
94        ebuild $pv/distributions/$ddir/$pv-r$TAG.ebuild
95        if [ $? != 0 ]; then 
96            cat $log
97            status=-1
98        fi
99        rm -rf $pv
100    else
101        echo "Unknown"
102    fi
103done
104echo "Packages handled : $pkg"
105
106if [ $status = 0 ]; then
107    if [  _"$dtype" = _"rpm" ]; then
108        echo "Installing RPMS as root"
109        su - -c "$opt rpm -Uvh --force $pkg"
110    fi
111fi
Note: See TracBrowser for help on using the repository browser.