Changeset 5


Ignore:
Timestamp:
Jul 29, 2007, 12:50:34 AM (11 years ago)
Author:
bruno
Message:

Lots of modifs to find the right way. Probably still not good

Location:
devel/pb
Files:
2 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/cms2build.pl

    r4 r5  
    88use strict;
    99use common.pm;
    10 use proj.pm;
     10use pb.pm;
    1111use cms.pm;
    1212
    13 set_env();
    14 
    15 VER=`cat ${TOOLHOME}/VERSION`
    16 TAG=`cat ${TOOLHOME}/TAG`
    17 my $DEST=$ENV{'TOPDIR'}."/".$VER."-".$TAG
    1813TEST="false"
    1914OPT=""
     
    3732
    3833# Make it safe for CMS commands
    39 cd ${TOOLHOME}/..
     34cd ${PBROOT}/..
    4035
    4136for pkg in $c; do
    4237    p=$PKGDIR[
    43     v=`cat ${TOOLHOME}/../$p/VERSION`
    44     tag=`cat ${TOOLHOME}/../$p/TAG`
     38    v=`cat ${PBROOT}/../$p/VERSION`
     39    tag=`cat ${PBROOT}/../$p/TAG`
    4540    echo "Management of $p $v-$tag (rev $REVISION)"
    4641    dest="$DEST/$p-$v"
    4742    rm -fr $dest
    48     $CMSEXP $OPT ${TOOLHOME}/../$p $dest
     43    $CMSEXP $OPT ${PBROOT}/../$p $dest
    4944    echo "$REVISION" > $dest/REVISION
    5045    echo "Generating SVN log file ..."
    51     $SVNLOG $OPT -v ${TOOLHOME}/../$p > $dest/history.log
     46    $SVNLOG $OPT -v ${PBROOT}/../$p > $dest/history.log
    5247
    53     for d in `cat ${TOOLHOME}/DISTROS`; do
     48    for d in `cat ${PBROOT}/DISTROS`; do
    5449        export ddir=`echo $d | cut -d_ -f1`
    5550        export dver=`echo $d | cut -d_ -f2`
    5651        echo "Generating build files for $ddir ($dver)"
    57         . $TOOLHOME/distro-env
     52        . $PBROOT/distro-env
    5853
    5954        ddd=`LANG=C ; date '+%Y-%m-%d'`
    60         cat > $PROJTMP/mondorescue.mc << EOF
     55        cat > $PBTMP/mondorescue.mc << EOF
    6156define(\`TTT', ${tag})dnl
    6257define(\`RRR', ${tag}${suf})dnl
     
    7772
    7873            if [ $ddir = "fedora" ]; then
    79                 $TOOLHOME/mkchangelog.pl fc $p $PROJTMP/$p-fc.spec
    80                 m4 $PROJTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p-fc.spec > $dest/distributions/${ddir}-$dver/$p-fc.spec
     74                $PBROOT/mkchangelog.pl fc $p $PBTMP/$p-fc.spec
     75                m4 $PBTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p-fc.spec > $dest/distributions/${ddir}-$dver/$p-fc.spec
    8176            fi
    82             $TOOLHOME/mkchangelog.pl $dtype $p $PROJTMP/$p.spec
     77            $PBROOT/mkchangelog.pl $dtype $p $PBTMP/$p.spec
    8378            if [ $? -ne 0 ]; then
    8479                echo "Unable to create changelog for ${ddir}-$dver/$p.spec"
    8580                exit -1
    8681            fi
    87             m4 $PROJTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
     82            m4 $PBTMP/mondorescue.mc $inc $dest/distributions/rpm/$p.spec $MONDOTMP/$p.spec > $dest/distributions/${ddir}-$dver/$p.spec
    8883            if [ _"`/bin/arch`" = _"x86_64" ] && [ $ddir = "rhel" ]; then
    8984                # Bug on x86_64 on _sysconfdir on rhel4 at least
     
    9186            fi
    9287
    93             rm -f $PROJTMP/$p.spec
     88            rm -f $PBTMP/$p.spec
    9489        elif [ "$dtype" = "ebuild" ]; then
    95             m4 $PROJTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
     90            m4 $PBTMP/mondorescue.mc $dest/distributions/$dfam/$p.ebuild > $dest/distributions/${ddir}-$dver/$p-$v.ebuild
    9691        elif [ "$dtype" = "tgz" ]; then
    97             m4 $PROJTMP/mondorescue.mc $dest/distributions/$dfam/slack-desc > $dest/distributions/${ddir}-$dver/slack-desc
     92            m4 $PBTMP/mondorescue.mc $dest/distributions/$dfam/slack-desc > $dest/distributions/${ddir}-$dver/slack-desc
    9893        elif [ "$dtype" = "port" ]; then
    99             m4 $PROJTMP/mondorescue.mc $dest/distributions/$dfam/Makefile > $dest/distributions/${ddir}-$dver/Makefile
     94            m4 $PBTMP/mondorescue.mc $dest/distributions/$dfam/Makefile > $dest/distributions/${ddir}-$dver/Makefile
    10095        elif [ "$dtype" = "deb" ]; then
    10196            if [ -f $dest/distributions/$ddir/rules ]; then
     
    109104                exit -1
    110105            fi
    111             m4 $PROJTMP/mondorescue.mc $inc > $dest/distributions/${ddir}-$dver/rules
    112             $TOOLHOME/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
     106            m4 $PBTMP/mondorescue.mc $inc > $dest/distributions/${ddir}-$dver/rules
     107            $PBROOT/mkchangelog.pl $dtype $p $dest/distributions/${ddir}-$dver/changelog
    113108            if [ $? -ne 0 ]; then
    114109                echo "Unable to create changelog for ${ddir}-$dver/changelog"
     
    125120        cd $dest
    126121        for f in mondorescue-howto.sgml *8; do
    127             m4 $PROJTMP/mondorescue.mc $f > ${f}.new
     122            m4 $PBTMP/mondorescue.mc $f > ${f}.new
    128123            mv ${f}.new $f
    129124        done
     
    146141
    147142    if [ _"`echo $p | grep -vE 'kernel|busybox' | grep mindi`" != _"" ]; then
    148         v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
     143        v1=`cat ${PBROOT}/../mondo-doc/VERSION`
    149144        if [ ! -d mondo-doc-$v1 ]; then
    150145            echo "mondo-doc should be created before $p"
     
    155150    fi
    156151    if [ "`echo $p | grep -v doc | grep  mondo`" != "" ]; then
    157         v1=`cat ${TOOLHOME}/../mondo-doc/VERSION`
     152        v1=`cat ${PBROOT}/../mondo-doc/VERSION`
    158153        if [ ! -d mondo-doc-$v1 ]; then
    159154            echo "mondo-doc should be created before $p"
     
    177172done
    178173
    179 rm -rf $PROJTMP
     174rm -rf $PBTMP
    180175
    181176echo "Version delivered :"
  • devel/pb/bin/mdv-changelog.pl

    r2 r5  
    88
    99open(FILE, $ARGV[0]) || die "Unable to open $ARGV[0]";
    10 open(OUT, "> $ENV{'PROJTMP'}/out.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec";
    11 open(CMT, "> $ENV{'PROJTMP'}/cmt.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec";
     10open(OUT, "> $ENV{'PBTMP'}/out.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec";
     11open(CMT, "> $ENV{'PBTMP'}/cmt.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec";
    1212while (<FILE>) {
    1313    if ($_ !~ /^\%changelog/) {
     
    2929                close (FILE);
    3030
    31                 move("$ENV{'PROJTMP'}/out.spec", $ARGV[0]);
     31                move("$ENV{'PBTMP'}/out.spec", $ARGV[0]);
    3232                exit(0);
    3333            }
  • devel/pb/bin/mkannounce.pl

    r2 r5  
    1818$ENV{LANG}="C";
    1919
    20 my $TOOLHOME;
     20my $PBROOT;
    2121my $tmp = dirname($PROGRAM_NAME);
    2222print "$tmp\n";
    2323if ($tmp =~ /^\//) {
    24     $TOOLHOME = $tmp;
     24    $PBROOT = $tmp;
    2525    }
    2626else {
    27     $TOOLHOME = "$ENV{PWD}/$tmp";
     27    $PBROOT = "$ENV{PWD}/$tmp";
    2828    }
    2929
    30 my $db="$TOOLHOME/../website/announces3.sql";
     30my $db="$PBROOT/../website/announces3.sql";
    3131
    3232my $dbh = DBI->connect("dbi:SQLite:dbname=$db","","",
  • devel/pb/bin/mkchangelog.pl

    r2 r5  
    3535        (not (defined $outfile)) || ($outfile eq ""));
    3636
    37 my $TOOLHOME;
     37my $PBROOT;
    3838$tmp = dirname($PROGRAM_NAME);
    3939if ($tmp =~ /^\//) {
    40     $TOOLHOME = $tmp;
     40    $PBROOT = $tmp;
    4141    }
    4242else {
    43     $TOOLHOME = "$ENV{PWD}/$tmp";
     43    $PBROOT = "$ENV{PWD}/$tmp";
    4444    }
    4545
    46 die "TOOLHOME doesn't exist" if (not (defined $TOOLHOME));
     46die "PBROOT doesn't exist" if (not (defined $PBROOT));
    4747
    48 if (-f "$TOOLHOME/../$pkg/ChangeLog") {
    49     $chglog = "$TOOLHOME/../$pkg/ChangeLog";
     48if (-f "$PBROOT/../$pkg/ChangeLog") {
     49    $chglog = "$PBROOT/../$pkg/ChangeLog";
    5050    }
    5151else {
    5252    $pkg2 = $pkg;
    5353    $pkg2 =~ s/-..*//;
    54     if (-f "$TOOLHOME/../$pkg2/ChangeLog") {
    55         $chglog = "$TOOLHOME/../$pkg2/ChangeLog";
     54    if (-f "$PBROOT/../$pkg2/ChangeLog") {
     55        $chglog = "$PBROOT/../$pkg2/ChangeLog";
    5656        }
    5757    else {
     
    5959    }
    6060}
    61 $tmp="$TOOLHOME/../$pkg/TAG";
     61$tmp="$PBROOT/../$pkg/TAG";
    6262if (-f "$tmp") {
    6363    open(TAG,"$tmp") || die "Unable to open $tmp";
  • devel/pb/bin/mknewshtml.pl

    r2 r5  
    1818$ENV{LANG}="C";
    1919
    20 my $TOOLHOME;
     20my $PBROOT;
    2121my $tmp = dirname($PROGRAM_NAME);
    2222if ($tmp =~ /^\//) {
    23     $TOOLHOME = $tmp;
     23    $PBROOT = $tmp;
    2424    }
    2525else {
    26     $TOOLHOME = "$ENV{PWD}/$tmp";
     26    $PBROOT = "$ENV{PWD}/$tmp";
    2727    }
    2828
    2929my $lastnews="$ARGV[0]/latest-news.html";
    3030my $news="$ARGV[0]/news.shtml";
    31 my $db="$TOOLHOME/../website/announces3.sql";
     31my $db="$PBROOT/../website/announces3.sql";
    3232
    3333print "Using Database $db\n";
  • devel/pb/lib/cms.pm

    r2 r5  
    2424    $ret =  $? >> 8;
    2525    if ($ret == 0) {
    26         $ENV{'REVISION'}=`(cd $TOOLHOME/.. ; svnversion .)`;
     26        $ENV{'REVISION'}=`(cd $PBROOT/.. ; svnversion .)`;
    2727        $ENV{'CMSLOG'}="svn log";
    2828        $ENV{'CMSEXP'}="svn export";
    2929    } else {
    3030        # By default if not SVN take CVS
    31         $ENV{'REVISION'}=`(cd $TOOLHOME/.. ; cvs  rannotate  -f . 2>&1 | awk '{print $1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
     31        $ENV{'REVISION'}=`(cd $PBROOT/.. ; cvs  rannotate  -f . 2>&1 | awk '{print $1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
    3232        $ENV{'CMSLOG'}="cvs log";
    3333        $ENV{'CMSEXP'}="cvs export"
  • devel/pb/lib/common.pm

    r2 r5  
    99@EXPORT = qw(set_env);
    1010
     11use lib qw (lib);
    1112use strict;
    1213use File::Basename;
    1314use ExtUtils::Command;
    1415use File::Temp qw /tempdir/;
     16use vars qw (%defpkgdir %extpkgdir %version &pb_init);
     17
     18$ENV{'PBCONF'} = "/etc/pb";
    1519
    1620sub set_env {
    1721
    18 my $tmp = dirname($PROGRAM_NAME);
    19 #print "$tmp\n";
    20 if ($tmp =~ /^\//) {
    21         $ENV{'TOOLHOME'} = $tmp;
    22         }
    23 else {
    24         $ENV{'TOOLHOME'} = "$ENV{PWD}/$tmp";
    25         }
     22my $proj=shift;
     23my $ver;
     24my $tag;
    2625
    27 die "TOOLHOME doesn't exist" if (not (defined $ENV{'TOOLHOME'}));
     26# Check project name
     27if ((defined $ENV{'PBPROJ'}) &&
     28    (not (defined $proj))) {
     29    $proj = $ENV{'PBPROJ'};
     30}
     31die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj));
    2832
    29 # Adapt to your needs
    30 $ENV{'TOPDIR'}=$ENV{'TOOLHOME'}."/../delivery";
    31 mkpath $ENV{'TOPDIR'};
     33# Use project configuration file
     34require "$ENV{'PBCONF'}/$proj.pb";
     35pb_init();
    3236
     37# Check content
     38die "PBROOT doesn't exist in $ENV{'PBCONF'}/$proj.pb" if (not (defined $ENV{'PBROOT'}));
     39die "defpkgdir doesn't exist in $ENV{'PBCONF'}/$proj.pb" if (not (defined %defpkgdir));
     40
     41# Set temp directory
    3342if (undef $ENV{'TMPDIR'}) {
    3443    $ENV{'TMPDIR'}="/tmp";
    3544}
    36 $ENV{'PROJTMP'} = tempdir( "projbuild.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
     45$ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
     46
     47# Get global VERSION
     48open(VER, "$ENV{'PBROOT'}/VERSION") || die "Unable to open $ENV{'PBROOT'}/VERSION: $?";
     49$ver = <VER>;
     50chomp($ver);
     51die "Invalid version name $ver in $ENV{'PBROOT'}/VERSION" if ($ver !~ /[0-9.]+/) || (defined $version{$ver});
     52$ENV{'PBVER'}=$ver;
     53close(VER);
     54
     55#Get global TAG
     56open(TAG, "$ENV{'PBROOT'}/TAG") || die "Unable to open $ENV{'PBROOT'}/TAG: $?";
     57$tag = <TAG>;
     58chomp($tag);
     59die "Invalid version tag $tag in $ENV{'PBROOT'}/TAG" if ($tag !~ /[0-9]+/);
     60$ENV{'PBTAG'}=$tag;
     61close(TAG);
     62
     63# Adapt to your needs
     64# Set delivery directory
     65$ENV{'PBTOPDIR'}="$ENV{'PBROOT'}/../delivery";
     66$ENV{'PBDESTDIR'}=$ENV{'TOPDIR'}."/".$ENV{'PBVER'}."-".$ENV{'PBTAG'};
     67mkpath $ENV{'PBDESTDIR'};
    3768
    3869umask 0022
  • devel/pb/lib/toolhome.pm

    r2 r5  
    11#!/usr/bin/perl -w
    22#
    3 # Module to compute TOOLHOME and put in the environment
     3# Module to compute PBROOT and put in the environment
    44#
    55# $Id$
     
    1717#print "$tmp\n";
    1818if ($tmp =~ /^\//) {
    19         $ENV{'TOOLHOME'} = $tmp;
     19        $ENV{'PBROOT'} = $tmp;
    2020        }
    2121else {
    22         $ENV{'TOOLHOME'} = "$ENV{PWD}/$tmp";
     22        $ENV{'PBROOT'} = "$ENV{PWD}/$tmp";
    2323        }
    2424
    25 die "TOOLHOME doesn't exist" if (not (defined $ENV{'TOOLHOME'}));
     25die "PBROOT doesn't exist" if (not (defined $ENV{'PBROOT'}));
    2626}
    27271;
Note: See TracChangeset for help on using the changeset viewer.