Changeset 83 in ProjectBuilder


Ignore:
Timestamp:
Sep 3, 2007, 1:22:49 PM (17 years ago)
Author:
Bruno Cornec
Message:

Additional version allow now for optimal reuse of parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r81 r83  
    8787print $LOG "Action: $action\n" if ($debug >= 0);
    8888
     89# Keeps those project value to store at end each time
     90my $pbprojtag = $ENV{'PBTAG'};
     91my $pbprojver = $ENV{'PBVER'};
     92
    8993# Act depending on action
    9094if ($action =~ /^cms2build$/) {
     
    241245        pb_system("tar cfpz $pbpkg-$pbver.tar.gz $pbpkg-$pbver","Creating $pbpkg tar files compressed");
    242246        print $LOG "Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz\n" if ($debug >= 0);
     247
    243248        # Keep track of what is generated for default
    244         $pbver{$pbpkg} = $pbver;
    245         $pbtag{$pbpkg} = $pbtag;
     249        open(LAST,"> $pbrc{$ENV{'PBPROJ'}}") || die "Unable to create $pbrc{$ENV{'PBPROJ'}}";
     250        print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT'}\n";
     251        close(LAST);
     252
     253        # Keep track of per package version
     254        if (! -f "$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") {
     255            open(PKG,">$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
     256            print PKG "# Empty\n";
     257            close(PKG);
     258        }
     259        my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     260        $pkg = { } if (not defined $pkg);
     261        my %pkg = %$pkg;
     262        if ((not defined $pkg{$pbpkg}) || ($pkg{$pbpkg} ne "$pbver-$pbtag")) {
     263            $pkg{$pbpkg} = "$pbver-$pbtag";
     264        }
     265
     266        print $LOG "DEBUG pkg: ".Dumper(\%pkg)."\n" if ($debug >= 1);
     267        open(PKG,"> $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
     268        foreach my $p (keys %pkg) {
     269            print PKG "pbpkg $p = $pkg{$p}\n";
     270        }
     271        close(PKG);
    246272    }
    247     open(LAST,"> $pbrc{$ENV{'PBPROJ'}}") || die "Unable to create $pbrc{$ENV{'PBPROJ'}}";
    248     foreach my $v (keys %pbver) {
    249         print LAST "pbroot $v-_-$pbver{$v}-$pbtag{$v} = $ENV{'PBROOT'}\n";
    250     }
    251     close(LAST);
    252273}
    253274
     
    258279    @pkgs = @$ptr;
    259280
    260     # Check whether we have a specific version to build
    261     my $vertag = shift @ARGV;
    262 
    263281    # Get the running distro to build on
    264282    my ($ddir, $dver, $dfam, $dtype, $dsuf) = pb_distro_init();
    265283    print $LOG "DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $dsuf))."\n" if ($debug >= 1);
    266284
     285    # Get content saved in cms2build
     286    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     287    $pkg = { } if (not defined $pkg);
     288    my %pkg = %$pkg;
     289
    267290    chdir "$ENV{'PBBUILDDIR'}";
    268291    foreach my $pbpkg (@pkgs) {
     292        my $vertag = $pkg{$pbpkg};
    269293        # get the version of the current package - maybe different
    270         if (not defined $vertag) {
    271             if (-f $pbrc{$ENV{'PBPROJ'}}) {
    272                 my $pbroot = pb_conf_read($pbrc{$ENV{'PBPROJ'}},"pbroot");
    273                 # All lines should point to the same pbroot so take the first
    274                 $ENV{'PBROOT'} = (values %$pbroot)[0];
    275                 foreach my $k (keys %$pbroot) {
    276                         if ($k =~ /^$pbpkg-_-/) {
    277                             ($ptr,$vertag) = split(/-_-/,$k);
    278                             last;
    279                         }
    280                 }
    281                 die "Unable to find $pbpkg in $pbrc{$ENV{'PBPROJ'}}\nYou may want to precise as parameter version-tag" if (not defined $vertag);
    282             } else {
    283                 die "Unable to open $pbrc{$ENV{'PBPROJ'}}\nYou may want to precise as parameter version-tag";
    284             }
    285         }
    286294        ($pbver,$pbtag) = split(/-/,$vertag);
    287295
Note: See TracChangeset for help on using the changeset viewer.