Changeset 79 in ProjectBuilder


Ignore:
Timestamp:
Sep 3, 2007, 4:09:00 AM (17 years ago)
Author:
Bruno Cornec
Message:

Use more nv variables to deal with filters easily even outside ou pb

Location:
devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r78 r79  
    4343my @date=(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst());
    4444my $pbdate = strftime("%Y-%m-%d", @date);
     45$ENV{'PBDATE'}=$pbdate;
    4546
    4647getopts('hl:p:qr:tv',\%opts);
     
    128129        print $LOG "Management of $pbpkg $pbver-$pbtag (rev $pbrev)\n" if ($debug >= 0);
    129130        die "Unable to get env var PBDESTDIR" if (not defined $ENV{'PBDESTDIR'});
     131        # Put some var in env to allow filtering
     132        $ENV{'PBVER'}=$pbver;
     133        $ENV{'PBTAG'}=$pbtag;
     134        $ENV{'PBPKG'}=$pbpkg;
     135        $ENV{'PBREV'}=$pbrev;
    130136        # Clean up dest if necessary. The export will recreate it
    131137        my $dest = "$ENV{'PBDESTDIR'}/$pbpkg-$pbver";
     
    211217            if (defined $ptr) {
    212218                foreach my $f (values %bfiles) {
    213                     pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$pbpkg,$pbtag,$dtype,$dsuf);
     219                    pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$dsuf);
    214220                }
    215221                if (defined $filteredfiles{$dir}) {
     
    247253    open(LAST,"> $pbrc{$ENV{'PBPROJ'}}") || die "Unable to create $pbrc{$ENV{'PBPROJ'}}";
    248254    foreach my $v (keys %pbver) {
    249         print LAST "pbroot $v-_-$pbver{v}-$pbtag{v} = $ENV{'PBROOT'}\n";
     255        print LAST "pbroot $v-_-$pbver{$v}-$pbtag{$v} = $ENV{'PBROOT'}\n";
    250256    }
    251257    close(LAST);
  • devel/pb/lib/ProjectBuilder/Base.pm

    r78 r79  
    314314my $dver = shift || die "No dver specified";
    315315my $ptr; # returned value pointer on the hash of filters
     316my %ptr;
    316317
    317318if (-d "$ENV{'PBCONF'}/$pbpkg/pbfilter") {
     
    326327    push @ffiles,$ffile3 if (defined $ffile3);
    327328}
    328 my $config = AppConfig->new({
    329     # Auto Create variables mentioned in Conf file
    330     CREATE => 1,
    331     DEBUG => 0,
    332     GLOBAL => {
    333         # Each conf item is a hash
    334         ARGCOUNT => AppConfig::ARGCOUNT_HASH
    335     }
    336 });
    337 
    338329if (@ffiles) {
    339330    print $LOG "DEBUG ffiles: ".Dumper(\@ffiles)."\n" if ($debug >= 1);
     331
     332    my $config = AppConfig->new({
     333        # Auto Create variables mentioned in Conf file
     334        CREATE => 1,
     335        DEBUG => 0,
     336        GLOBAL => {
     337            # Each conf item is a hash
     338            ARGCOUNT => AppConfig::ARGCOUNT_HASH
     339        }
     340    });
     341
    340342    $config->file(@ffiles);
    341343    $ptr = $config->get("filter");
     
    344346    $ptr = { };
    345347}
    346 return($ptr);
     348%ptr = %$ptr;
     349return(\%ptr);
    347350}
    348351
     
    354357my %filter=%$ptr;
    355358my $destfile=shift;
    356 my $pbpkg=shift;
    357 my $pbtag=shift;
    358359my $dtype=shift;
    359360my $dsuf=shift;
     
    367368    foreach my $s (keys %filter) {
    368369        # Process single variables
    369         print $LOG "DEBUG filter{$s}: $filter{$s}\n" if ($debug > 1);
     370        print $LOG "DEBUG filter{$s}: $filter{$s}\n" if ($debug >= 1);
    370371        my $tmp = $filter{$s};
    371372        next if (not defined $tmp);
    372373        # Expand variables if any single one found
     374        print $LOG "DEBUG tmp: $tmp\n" if ($debug >= 1);
    373375        if ($tmp =~ /\$/) {
    374376            eval { $tmp =~ s/(\$\w+)/$1/eeg };
     
    376378        } elsif (($tmp =~ /^yes$/) && ($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) {
    377379            $tmp = "";
    378             my $p = $defpkgdir{$pbpkg};
    379             $p = $extpkgdir{$pbpkg} if (not defined $p);
    380             pb_changelog($dtype, $pbpkg, $pbtag, $dsuf, $p, \*DEST);
     380            my $p = $defpkgdir{$ENV{'PBPKG'}};
     381            $p = $extpkgdir{$ENV{'PBPKG'}} if (not defined $p);
     382            pb_changelog($dtype, $ENV{'PBPKG'}, $ENV{'PBTAG'}, $dsuf, $p, \*DEST);
    381383        }
    382384        $line =~ s|$s|$tmp|;
  • devel/pbconf/project-builder/pbfilter/rpm.pbf

    r32 r79  
    1414
    1515# PBVER is replaced by the version ($pbver in code)
    16 filter PBVER = $pbver
     16filter PBVER = $ENV{'PBVER'}
    1717
    1818# PBDATE is replaced by the date ($pbdate in code)
    19 filter PBDATE = $pbdate
     19filter PBDATE = $ENV{'PBDATE'}
    2020
    2121# PBLOG is replaced by the changelog if value is yes
     
    2323
    2424# PBTAG is replaced by the tag ($pbtag in code)
    25 filter PBTAG = $pbtag
     25filter PBTAG = $ENV{'PBTAG'}
    2626
    2727# PBREV is replaced by the revision ($pbrev in code)
    28 filter PBREV = $pbrev
     28filter PBREV = $ENV{'PBREV'}
    2929
    3030# PBPKG is replaced by the package name ($pbpkg in code)
    31 filter PBPKG = $pbpkg
     31filter PBPKG = $ENV{'PBPKG'}
Note: See TracChangeset for help on using the changeset viewer.