Changeset 2257 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder


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

Remove mentions of YAML 1.0 for now as creating incorrect syntax

Location:
devel/pb-modules/lib/ProjectBuilder
Files:
2 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    }
  • devel/pb-modules/lib/ProjectBuilder/Env.pm

    r2256 r2257  
    8080        open(PBRC, "> $ENV{'PBETC'}") || die "Unable to create $ENV{'PBETC'}";
    8181        print PBRC << "EOF";
    82 --- %YAML 1.0
     82---
    8383#
    8484# Define for each project the URL of its pbconf repository
     
    451451            open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    452452            print CONF << "EOF";
    453 --- YAML 1.0
     453---
    454454#
    455455# Project Builder configuration file
     
    650650            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.yml";
    651651            print CONF << "EOF";
    652 --- YAML 1.0
     652---
    653653#
    654654# \$Id\$
     
    722722            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.yml";
    723723            print CONF << "EOF";
    724 --- YAML 1.0
     724---
    725725#
    726726# \$Id\$
     
    755755            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.yml";
    756756            print CONF << "EOF";
    757 --- YAML 1.0
     757---
    758758#
    759759# \$Id\$
     
    786786                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.yml";
    787787                print CONF << "EOF";
    788 --- YAML 1.0
     788---
    789789#
    790790# \$Id\$
     
    800800            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.yml";
    801801            print CONF << "EOF";
    802 --- YAML 1.0
     802---
    803803#
    804804# \$Id\$
     
    829829            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.yml";
    830830            print CONF << "EOF";
    831 --- YAML 1.0
     831---
    832832#
    833833# \$Id\$
     
    845845            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.yml";
    846846            print CONF << "EOF";
    847 --- YAML 1.0
     847---
    848848#
    849849# \$Id\$
     
    861861            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.yml";
    862862            print CONF << "EOF";
    863 --- YAML 1.0
     863---
    864864#
    865865# \$Id\$
     
    877877            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.yml";
    878878            print CONF << "EOF";
    879 --- YAML 1.0
     879---
    880880#
    881881# \$Id\$
     
    893893            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian.yml";
    894894            print CONF << "EOF";
    895 --- YAML 1.0
     895---
    896896#
    897897# \$Id\$
     
    910910                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
    911911                print CONF << "EOF";
    912 --- YAML 1.0
     912---
    913913#
    914914# \$Id\$
     
    928928                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
    929929                print CONF << "EOF";
    930 --- YAML 1.0
     930---
    931931#
    932932# \$Id\$
     
    946946                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
    947947                print CONF << "EOF";
    948 --- YAML 1.0
     948---
    949949#
    950950# \$Id\$
     
    965965                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
    966966                print CONF << "EOF";
    967 --- YAML 1.0
     967---
    968968#
    969969# \$Id\$
     
    982982            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.yml";
    983983            print CONF << "EOF";
    984 --- YAML 1.0
     984---
    985985#
    986986# \$Id\$
     
    999999            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.yml";
    10001000            print CONF << "EOF";
    1001 --- YAML 1.0
     1001---
    10021002#
    10031003# \$Id\$
Note: See TracChangeset for help on using the changeset viewer.