Changeset 8 in ProjectBuilder for devel/pb/lib/common.pm


Ignore:
Timestamp:
Jul 29, 2007, 2:30:56 AM (17 years ago)
Author:
Bruno Cornec
Message:

Basic function works (conf file read and interpret)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.