Changeset 736 in ProjectBuilder for devel/pb/lib/ProjectBuilder/Env.pm


Ignore:
Timestamp:
Mar 12, 2009, 2:51:00 AM (15 years ago)
Author:
Bruno Cornec
Message:

Fix #35 by forcing the usage of a -r release option, and by exporting only that version tree from the VCS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Env.pm

    r709 r736  
    109109}
    110110
    111 # Adds a potential conf file now as it's more
     111# Adds a potential conf file now as it's less
    112112# important than the project conf file
    113113my ($vmpath,$vepath) = pb_conf_get("vmpath","vepath");
     
    177177
    178178# Put under CMS the PBPROJ dir
    179 if (defined $pbinit) {
     179if ($action =~ /^newproj$/) {
    180180    if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
    181181        pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") || die "Unable to recursively create $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
     
    236236    if (not defined $ENV{'PBROOTDIR'}) {
    237237        if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
    238             opendir(DIR,$ENV{'PBCONFDIR'}) || die "Unable to open directory $ENV{'PBCONFDIR'}: $!";
    239             my $maxmtime = 0;
    240             foreach my $d (readdir(DIR)) {
    241                 pb_log(3,"Looking at \'$d\'...");
    242                 next if ($d =~ /^\./);
    243                 next if (! -d "$ENV{'PBCONFDIR'}/$d");
    244                 my $s = stat("$ENV{'PBCONFDIR'}/$d");
    245                 next if (not defined $s);
    246                 pb_log(3,"KEEP\n");
    247                 # Keep the most recent
    248                 pb_log(2," $s->mtime\n");
    249                 if ($s->mtime > $maxmtime) {
    250                     $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$d";
    251                     $maxmtime = $s->mtime;
    252                 }
    253             }
    254             closedir(DIR);
     238            $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}";
    255239            pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
    256240            pb_log(1,"         Please use -r release if you want to use another release\n");
     
    585569#filter PBDEP =
    586570
    587 # PBSUF is replaced by the package suffix (\$pbsuf'} in code)
     571# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
    588572filter PBSUF = %{dist}
    589573
     
    935919            pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
    936920        } else {
     921            pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
     922            pb_log(0,"       Please use -r release in order to be able to initialize your environment correctly\n");
    937923            die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    938924        }
Note: See TracChangeset for help on using the changeset viewer.