Changeset 2254 in ProjectBuilder for devel/pb/lib/ProjectBuilder/Filter.pm


Ignore:
Timestamp:
Aug 30, 2017, 5:07:34 PM (7 years ago)
Author:
Bruno Cornec
Message:

Automatically modify v0 filter files into v1 format

File:
1 edited

Legend:

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

    r2253 r2254  
    2424use ProjectBuilder::Distribution;
    2525use ProjectBuilder::Changelog;
     26use ProjectBuilder::VCS;
    2627
    2728# Inherit from the "Exporter" module which handles exporting functions.
     
    6566
    6667my @ffiles;
     68my @ffilestoconvert;
    6769my $pbpkg = shift || die "No package specified";
    6870my $pbos = shift;
     
    7981    foreach my $file_basename (@file_basenames) {
    8082        my $path = "$dir/${file_basename}.yml";
    81         push(@ffiles, $path) if -f $path;
    82     }
    83 }
     83        if (-f $path) {
     84            push(@ffiles, $path);
     85        } else {
     86            my $path2 = "$dir/${file_basename}.pbf";
     87            push(@ffilestoconvert, $path2) if (-f $path2);
     88        }
     89    }
     90}
     91
     92# Convert all old filter files into new ones
     93if (@ffilestoconvert) {
     94    foreach my $f (@ffilestoconvert) {
     95        my $fyml = $f;
     96        $fyml =~ s/\.pbf/.yml/;
     97        pb_update_conf_v0($f,$fyml);
     98        my ($pburl) = pb_conf_get("pburl");
     99        my ($scheme, $account, $host, $port, $path) = pb_get_uri($pburl->{$ENV{'PBPROJ'}});
     100        pb_vcs_add_if_not_in($scheme,$fyml);
     101        push(@ffiles, $fyml);
     102    }
    84103
    85104if (@ffiles) {
Note: See TracChangeset for help on using the changeset viewer.