Ignore:
Timestamp:
Aug 30, 2017, 5:07:37 PM (23 months ago)
Author:
bruno
Message:

Remove mentions of YAML 1.0 for now as creating incorrect syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2256 r2257  
    9292
    9393  $ cat $HOME/.pbrc.yml
    94   --- %YAML 1.0
     94  ---
    9595    pbver:
    9696      - pb: 3
     
    540540confess "Will not erase existing $dest while transforming $orig" if (-f $dest);
    541541open(DEST,"> $dest") || confess "Unable to write into $dest";
    542 print DEST "--- %YAML 1.0\n";
    543 my $parambkp = "";
     542print DEST "---\n";
    544543my $pbconfverbkp = $PBCONFVER;
    545544# We force migration from v0 to v1
    546545$PBCONFVER = 0;
    547546my $lh0;
     547my $lh1;
    548548$lh0 = pb_conf_cache($orig,$lh0);
     549pb_log(2,"lh0:\n",Dumper($lh0),"\n");
    549550$PBCONFVER = $pbconfverbkp;
    550551
     
    554555        # Keep comments
    555556        print DEST $_;
     557    } elsif ($_ =~ /^\s*$/) {
     558        # Replace empty lines by comments
     559        print DEST "#\n";;
    556560    } else {
    557561        if (/^\s*([A-z0-9-_]+)\s+(.+)$/) {
    558562            # Handle parameters
    559             my ($param,$var) = ($1, $2);
    560             print DEST "  $param:\n" if ($param ne $parambkp);
    561             print DEST "    $lh0->{$param} $lh0->{$param}->{$var}\n";
    562             $parambkp = $param;
     563            my ($param,$void) = ($1, $2);
     564            if (not defined $lh1->{$param}) {
     565                pb_log(2,"Converting parameter $param\n");
     566                print DEST "$param:\n";
     567                foreach my $k (keys %{$lh0->{$param}}) {
     568                    pb_log(2,"Handling key $k\n");
     569                    print DEST "  $k: $lh0->{$param}->{$k}\n";
     570                }
     571                $lh1->{$param} = 1;
     572            }
    563573        } else {
    564             pb_log(0,"Unable to handle line $_\n");
     574            pb_log(0,"Unable to convert line $_\n");
    565575        }
    566576    }
Note: See TracChangeset for help on using the changeset viewer.