Changeset 18


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

cms2build roughly working

Location:
devel
Files:
2 deleted
7 edited

Legend:

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

    r17 r18  
    1010# Syntax: pb [-p project] <action> [<params>...]
    1111
    12 use strict;
     12use strict 'vars';
    1313use Switch;
    1414use Getopt::Std;
     
    2121use POSIX qw(strftime);
    2222
     23use vars qw (%defpkgdir %extpkgdir %version %confparam %filteredfiles);
    2324use lib qw (lib);
    24 use vars qw (%defpkgdir %extpkgdir %version %param %filteredfiles);
    2525use common qw (env_init);
    26 use pb qw (defpkgdir extpkgdir version param filteredfiles pb_init);
     26use pb qw (pb_init);
    2727use distro qw (distro_init);
    2828use cms;
     
    7070    } elsif ($ARGV[0] =~ /^all$/) {
    7171        @pkgs = keys %defpkgdir;
    72         push(@pkgs, keys %extpkgdir);
     72        if (defined %extpkgdir) {
     73            my $k = keys %extpkgdir;
     74            if (defined $k) {
     75                push(@pkgs, keys %extpkgdir);
     76            }
     77        }
    7378    } else {
    7479        @pkgs = @ARGV;
     
    231236                }
    232237            }
    233             # Prepare the dest directory for archive
    234             if (-x "$ENV{'PBCONF'}/$pkg/pbpkginit") {
    235                 system("cd $dest ; $ENV{'PBCONF'}/$pkg/pbinit");
    236                 if ($? == -1) {
    237                     print "failed to execute: $!\n";
    238                 } elsif ($? & 127) {
    239                     printf "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without';
    240                 } else {
    241                     print " $dest\n";
    242                 }
    243             }
    244             # Archive dest dir
    245             chdir "$dest/..";
    246             print "Creating $pkg tar files (gzip... ";
    247             system("tar cfphz $pkg-$pbver.tar.gz $pkg-$pbver");
     238        }
     239        close(D);
     240        # Prepare the dest directory for archive
     241        if (-x "$ENV{'PBCONF'}/$pkg/pbpkginit") {
     242            system("cd $dest ; $ENV{'PBCONF'}/$pkg/pbinit");
    248243            if ($? == -1) {
    249244                print "failed to execute: $!\n";
     
    251246                printf "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without';
    252247            } else {
    253                 print " OK)\n";
    254                 print "Under $dest/../$pkg-$pbver.tar.gz\n";
    255             }
    256         }
    257         close(D);
     248                print " $dest\n";
     249            }
     250        }
     251        # Archive dest dir
     252        chdir "$dest/..";
     253        print "Creating $pkg tar files (gzip... ";
     254        system("tar cfphz $pkg-$pbver.tar.gz $pkg-$pbver");
     255        if ($? == -1) {
     256            print "failed to execute: $!\n";
     257        } elsif ($? & 127) {
     258            printf "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without';
     259        } else {
     260            print " OK)\n";
     261            print "Under $dest/../$pkg-$pbver.tar.gz\n";
     262        }
    258263    }
    259264} else {
     
    290295        # special case for ChangeLog
    291296        } elsif (($tmp =~ /^yes$/) && ($s =~ /^PBLOG$/)) {
    292             $tmp = changelog($dtype, $pkg, $pbtag, $dsuf, \*DEST);
     297            my $p = $defpkgdir{$pkg};
     298            $p = $extpkgdir{$pkg} if (not defined $p);
     299            $tmp = changelog($dtype, $pkg, $pbtag, $dsuf, $p, \*DEST);
    293300        }
    294301        $line =~ s|$s|$tmp|;
  • devel/pb/lib/changelog.pm

    r17 r18  
    1717my $pbtag = shift;
    1818my $dsuf = shift;
     19my $path = shift;
    1920my $OUTPUT = shift;
    2021
     
    2627return("\n") if ((not (defined $dtype)) || ($dtype eq "") ||
    2728        (not (defined $pkg)) || ($pkg eq "") ||
     29        (not (defined $pbtag)) || ($pbtag eq "") ||
     30        (not (defined $dsuf)) || ($dsuf eq "") ||
     31        (not (defined $path)) || ($path eq "") ||
    2832        (not (defined $OUTPUT)) || ($OUTPUT eq ""));
    2933
    30 my $chglog = "$ENV{'PBROOT'}/$pkg/ChangeLog";
     34my $chglog = "$ENV{'PBROOT'}/$path/ChangeLog";
    3135if (! -f $chglog) {
    32     print "Unable to find a ChangeLog file for $pkg\n";
     36    print "Unable to find the ChangeLog file ($chglog) for $pkg\n";
    3337    return("\n");
    3438}
     
    7276            $ver2 = "$ver$dsuf";
    7377        }
    74         print $OUTPUT "* $ndate Bruno Cornec <bruno\@mondorescue.org> $ver2\n";
     78        print $OUTPUT "* $ndate $confparam{'packager'} $ver2\n";
    7579        print $OUTPUT "- Updated to $ver\n";
    7680        }
     
    9599
    96100    if ($dtype eq "deb") {
    97         print $OUTPUT " -- Bruno Cornec <bruno\@mondorescue.org> $n2date\n\n";
     101        print $OUTPUT " -- $confparam{'packager'} $n2date\n\n";
    98102        print $OUTPUT "\n";
    99103        }
  • devel/pb/lib/cms.pm

    r9 r18  
    55# $Id$
    66#
    7 
    8 require Exporter;
    9 @ISA = qw(Exporter);
    10 @EXPORT = qw(get_toolhome);
    117
    128use strict;
  • devel/pb/lib/common.pm

    r17 r18  
    55# $Id$
    66#
    7 require Exporter;
    8 @ISA = qw(Exporter);
    9 @EXPORT = qw(env_init);
    107
     8use strict;
    119use lib qw (lib);
    1210use pb qw (pb_init);
    13 use strict;
    1411use File::Basename;
    1512use File::Path;
    1613use File::Temp qw /tempdir/;
    17 use vars qw (%defpkgdir %extpkgdir %version %param);
    1814use Data::Dumper;
    1915
     
    4339# Check content
    4440#
    45 if (not defined $param{"pbroot"}) {
    46     die "param pbroot doesn't exist in $ENV{'PBETC'}/$proj.pb";
     41if (not defined $confparam{"pbroot"}) {
     42    die "confparam pbroot doesn't exist in $ENV{'PBETC'}/$proj.pb";
    4743} else {
    48     $ENV{'PBROOT'} = $param{"pbroot"};
     44    $ENV{'PBROOT'} = $confparam{"pbroot"};
    4945}
    50 if (defined $param{"cvsroot"}) {
    51     $ENV{'CVSROOT'} = $param{"cvsroot"};
     46if (defined $confparam{"cvsroot"}) {
     47    $ENV{'CVSROOT'} = $confparam{"cvsroot"};
    5248}
    5349
  • devel/pb/lib/distro.pm

    r13 r18  
    55# $Id$
    66#
    7 
    8 require Exporter;
    9 @ISA = qw(Exporter);
    10 @EXPORT = qw(distro_init distro_get);
    117
    128use strict;
  • devel/pb/lib/pb.pm

    r17 r18  
    11#!/usr/bin/perl -w
    22#
    3 # Project Builder configuration file
     3# Project Builder configuration file handler
    44# For project pb ;-)
    55#
     
    77#
    88use strict;
    9 use Exporter();
    10 use vars qw(@ISA @EXPORT_OK);
    11 @ISA = qw(Exporter);
    12 # global vars are here
    13 @EXPORT_OK = qw(%defpkgdir %extpkgdir %version %param %filteredfiles &pb_init);
    14 use vars @EXPORT_OK;
    159use AppConfig qw(ARGCOUNT_HASH);
    1610
     
    3327# Root of the project to build
    3428# needs at least 2 levels of dir as in the upper
    35 # other dirs will be created and used
    36 $ptr = $config->get("param");
    37 %param = %$ptr;
     29# other dirs will be created and used
    3830
    39 # List of pkg to build by default
     31# main parameter hash (mandatory)
     32$ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
     33%confparam = %$ptr;
     34
     35# List of pkg to build by default (mandatory)
    4036$ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
    4137%defpkgdir = %$ptr;
    4238
    43 # List of additional pkg to build when all is called
     39# List of additional pkg to build when all is called (optional)
    4440$ptr = $config->get("extpkgdir");
    45 %extpkgdir = %$ptr;
     41if (not defined $ptr) {
     42    %extpkgdir = ();
     43} else {
     44    %extpkgdir = %$ptr;
     45}
    4646
    47 # Valid version names
     47# Valid version names (optional)
    4848$ptr = $config->get("version");
    49 %version = %$ptr;
     49if (not defined $ptr) {
     50    %version = ();
     51} else {
     52    %version = %$ptr;
     53}
    5054
    51 # List of files to filter
     55# List of files to filter (optional)
    5256$ptr = $config->get("filteredfiles");
    53 %filteredfiles = %$ptr;
     57if (not defined $ptr) {
     58    %filteredfiles = ();
     59} else {
     60    %filteredfiles = %$ptr;
     61}
    5462
    5563}
  • devel/pbconf/pb.pb

    r17 r18  
    66#
    77
    8 # param is a hash to ease interface
     8# confparam is a hash to ease interface
    99# Root directory of the pb project
    10 param pbroot = "/users/bruno/pb/svn/devel"
     10confparam pbroot = "/users/bruno/pb/svn/devel"
    1111
    1212# Packager for ChangeLogs
    13 param packager = "Bruno Cornec <bruno\@mondorescue.org>"
     13confparam packager = "Bruno Cornec <bruno\@mondorescue.org>"
    1414
    1515# If CVS give login method with CVSROOT
    1616#cvsroot = ":pserver:anonymous@linuxcoe.cvs.sourceforge.net:/cvsroot/linuxcoe"
    17 param cvsroot = " "
     17confparam cvsroot = " "
    1818
    1919# Hash of default package/package directory
Note: See TracChangeset for help on using the changeset viewer.