Changeset 8


Ignore:
Timestamp:
Jul 29, 2007, 2:30:56 AM (11 years ago)
Author:
bruno
Message:

Basic function works (conf file read and interpret)

Location:
devel/pb
Files:
5 edited

Legend:

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

    r6 r8  
    1313
    1414use lib qw (lib etc);
    15 use vars qw (%defpkgdir %extpkgdir @version);
     15use vars qw (%defpkgdir %extpkgdir %version);
    1616use common qw (set_env);
    1717use pb qw (defpkgdir extpkgdir version pb_init);
     
    2424# Handles project name if any
    2525if (defined $opts{'p'}) {
    26     set_env($opts{'p'});
     26    $ENV{'PBPROJ'} = set_env($opts{'p'});
    2727} else {
    28     set_env();
     28    $ENV{'PBPROJ'} = set_env();
    2929}
    3030
  • devel/pb/etc/pb.pb

    r7 r8  
    2020extpkgdir "" = ""
    2121
    22 # List of valid version names
     22# Hash of valid version names
    2323version devel
    2424version stable
  • devel/pb/lib/cms.pm

    r6 r8  
    1818my $ret;
    1919
    20 chdir "$ENV{'PBROOT'}";
    21 system("svn info 2>&1 /dev/null") == 0 or die "system svn info failed: $?";
     20system("cd $ENV{'PBROOT'} ; svn info . 2>&1 > /dev/null");
    2221if ($? == -1) {
    2322    print "failed to execute: $!\n";
     
    2726    $ret =  $? >> 8;
    2827    if ($ret == 0) {
    29         $ENV{'REVISION'}=`(cd "$ENV{'PBROOT'}/.." ; svnversion .)`;
    30         $ENV{'CMSLOG'}="svn log";
    31         $ENV{'CMSEXP'}="svn export";
     28        $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; svnversion .)`;
     29        $ENV{'PBCMSLOG'}="svn log";
     30        $ENV{'PBCMSEXP'}="svn export";
    3231    } else {
    3332        # By default if not SVN take CVS
    34         $ENV{'REVISION'}=`(cd "$ENV{'PBROOT'}/.." ; cvs  rannotate  -f . 2>&1 | awk '{print $1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
    35         $ENV{'CMSLOG'}="cvs log";
    36         $ENV{'CMSEXP'}="cvs export"
     33        $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate  -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
     34        $ENV{'PBCMSLOG'}="cvs log";
     35        $ENV{'PBCMSEXP'}="cvs export"
    3736    }
    3837}
  • devel/pb/lib/common.pm

    r7 r8  
    1616use File::Temp qw /tempdir/;
    1717use vars qw (%defpkgdir %extpkgdir %version);
     18use Data::Dumper;
    1819
    1920$ENV{'PBCONF'} = "/etc/pb";
     
    2526my $tag;
    2627
     28#
    2729# Check project name
     30#
    2831if ((defined $ENV{'PBPROJ'}) &&
    2932    (not (defined $proj))) {
     
    3235die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj));
    3336
     37#
    3438# Use project configuration file
     39#
    3540pb_init("$ENV{'PBCONF'}/$proj.pb");
    3641
     42#
    3743# Check content
     44#
    3845die "PBROOT doesn't exist in $ENV{'PBCONF'}/$proj.pb" if (not (defined $ENV{'PBROOT'}));
    3946die "defpkgdir doesn't exist in $ENV{'PBCONF'}/$proj.pb" if (not (defined %defpkgdir));
    4047
     48#
    4149# Set temp directory
     50#
    4251if (not defined $ENV{'TMPDIR'}) {
    4352    $ENV{'TMPDIR'}="/tmp";
     
    4554$ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
    4655
     56#
     57# Check pb conf compliance
     58#
     59die "Project $ENV{'PBPROJ'} not ProjectBuild compliant. Please populate $ENV{'PBROOT'}/pbconf" if ( not -d "$ENV{'PBROOT'}/pbconf");
     60
     61#
    4762# Get global VERSION
    48 open(VER, "$ENV{'PBROOT'}/VERSION") || die "Unable to open $ENV{'PBROOT'}/VERSION: $?";
     63#
     64open(VER, "$ENV{'PBROOT'}/pbconf/VERSION") || die "Unable to open $ENV{'PBROOT'}/pbconf/VERSION: $?";
    4965$ver = <VER>;
    5066chomp($ver);
    51 die "Invalid version name $ver in $ENV{'PBROOT'}/VERSION" if ($ver !~ /[0-9.]+/) || (defined $version{$ver});
     67#print Dumper(%version);
     68die "Invalid version name $ver in $ENV{'PBROOT'}/VERSION" if ($ver !~ /[0-9.]+/) && (not exists $version{$ver});
    5269$ENV{'PBVER'}=$ver;
    5370close(VER);
    5471
     72#
    5573#Get global TAG
    56 open(TAG, "$ENV{'PBROOT'}/TAG") || die "Unable to open $ENV{'PBROOT'}/TAG: $?";
     74#
     75open(TAG, "$ENV{'PBROOT'}/pbconf/TAG") || die "Unable to open $ENV{'PBROOT'}/pbconf/TAG: $?";
    5776$tag = <TAG>;
    5877chomp($tag);
    59 die "Invalid version tag $tag in $ENV{'PBROOT'}/TAG" if ($tag !~ /[0-9]+/);
     78die "Invalid tag name $tag in $ENV{'PBROOT'}/TAG" if ($tag !~ /[0-9]+/);
    6079$ENV{'PBTAG'}=$tag;
    6180close(TAG);
    6281
     82#
    6383# Adapt to your needs
    6484# Set delivery directory
     85#
    6586$ENV{'PBTOPDIR'}="$ENV{'PBROOT'}/../delivery";
    66 $ENV{'PBDESTDIR'}=$ENV{'TOPDIR'}."/".$ENV{'PBVER'}."-".$ENV{'PBTAG'};
     87$ENV{'PBDESTDIR'}=$ENV{'PBTOPDIR'}."/".$ENV{'PBVER'}."-".$ENV{'PBTAG'};
    6788mkpath $ENV{'PBDESTDIR'};
    6889
    69 umask 0022
     90umask 0022;
     91return($proj);
    7092}
    71931;
  • devel/pb/lib/pb.pm

    r7 r8  
    1111@ISA = qw(Exporter);
    1212# global vars are here
    13 @EXPORT_OK = qw(%defpkgdir %extpkgdir @version &pb_init);
     13@EXPORT_OK = qw(%defpkgdir %extpkgdir %version &pb_init);
    1414use vars @EXPORT_OK;
    1515use AppConfig qw(ARGCOUNT_ONE ARGCOUNT_HASH ARGCOUNT_LIST EXPAND_ALL);
     
    2929$config->define("defpkgdir" => { ARGCOUNT => ARGCOUNT_HASH });
    3030$config->define("extpkgdir" => { ARGCOUNT => ARGCOUNT_HASH });
    31 $config->define("version" => { ARGCOUNT => ARGCOUNT_LIST });
     31$config->define("version" => { ARGCOUNT => ARGCOUNT_HASH });
    3232
    3333$config->file($conffile);
     
    5151# Valid version names
    5252$ptr = $config->get("version");
    53 @version = @$ptr;
     53%version = %$ptr;
    5454
    5555}
Note: See TracChangeset for help on using the changeset viewer.