Changeset 2253 in ProjectBuilder
- Timestamp:
- Aug 30, 2017, 5:07:33 PM (7 years ago)
- Location:
- devel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Conf.pm
r2252 r2253 192 192 if (/^\s*([A-z0-9-_.]+)\s+([[A-z0-9-_.\?\[\]\*\+\\]+)\s*=\s*(.*)$/) { 193 193 pb_log(3,"DEBUG: 1:$1 2:$2 3:$3\n"); 194 $lh->{$1}->{$2}=$3; 194 my ($what, $var, $value) = ($1, $2, $3); 195 # Add support for multi-lines 196 while ($value =~ s/\\\s*$//o) { 197 $_ = <CONF>; 198 die "Still processing continuations for $what $var at EOF" if (not defined $_); 199 s/[\r\n]//go; 200 $value .= "\n$_"; 201 } 202 $lh->{$what}->{$var}=$value; 203 } elsif ((/^\s*#/o) || (/^\s*$/o)) { 204 # ignore 205 } else { 206 chomp(); 207 warn "unexpected line '$_' in $f"; 195 208 } 196 209 } … … 513 526 } 514 527 528 =item B<pb_conf_update_v0> 529 530 This function transform the old configuration v0 file as first param into a new v1 one as second param 531 532 =cut 533 534 sub pb_conf_update_v0 { 535 536 my $orig = shift; 537 my $dest = shift; 538 539 open(ORIG,$orig) || confess "Unable to open $orig"; 540 confess "Will not erase existing $dest while transforming $orig" if (-f $dest); 541 open(DEST,"> $dest") || confess "Unable to write into $dest"; 542 print DEST "--- %YAML 1.0\n"; 543 my $parambkp = ""; 544 my $pbconfverbkp = $PBCONFVER; 545 # We force migration from v0 to v1 546 $PBCONFVER = 0; 547 my $lh0; 548 $lh0 = pb_conf_cache($orig,$lh0); 549 $PBCONFVER = $pbconfverbkp; 550 551 # We can't just write the YAML if we want to ckeep comments ! 552 while (<ORIG>) { 553 if ($_ =~ /^#/) { 554 # Keep comments 555 print DEST $_; 556 } else { 557 if (/^\s*([A-z0-9-_]+)\s+(.+)$/) { 558 # Handle parameters 559 my ($param,$void) = ($1, $2); 560 print DEST " $param:\n" if ($param ne $parambkp); 561 print DEST " $lh0->{$param} $lh0->{$param}->{$var}\n"; 562 $parambkp = $param; 563 } else { 564 pb_log(0,"Unable to handle line $_\n"); 565 } 566 } 567 } 568 close(ORIG); 569 close(DEST); 570 return(); 571 } 572 515 573 =back 516 574 -
devel/pb-modules/lib/ProjectBuilder/Env.pm
r2252 r2253 76 76 77 77 if (! -f $ENV{'PBETC'}) { 78 pb_log(0, "No existing $ENV{'PBETC'} found, creating one as template\n"); 79 open(PBRC, "> $ENV{'PBETC'}") || die "Unable to create $ENV{'PBETC'}"; 80 print PBRC << "EOF"; 81 --- 78 if (! -f "$dir/.pbrc") { 79 pb_log(0, "No existing $ENV{'PBETC'} found, creating one as template\n"); 80 open(PBRC, "> $ENV{'PBETC'}") || die "Unable to create $ENV{'PBETC'}"; 81 print PBRC << "EOF"; 82 --- %YAML 1.0 82 83 # 83 84 # Define for each project the URL of its pbconf repository 84 85 # No default option allowed here as they need to be all different 85 86 # 86 #pbconfurl example = svn+ssh://svn.example.org/svn/pb/projects/example/pbconf 87 #pbconfurl pb = svn+ssh://svn.project-builder.org/mondo/svn/pb/pbconf 88 87 # pbconfurl: 88 # example: svn+ssh://svn.example.org/svn/pb/projects/example/pbconf 89 # pbconfurl: 90 # pb: svn+ssh://svn.project-builder.org/mondo/svn/pb/pbconf 91 # 89 92 # Under that dir will take place everything related to pb 90 93 # If you want to use VMs/chroot/..., then use \$ENV{'HOME'} to make it portable 91 94 # to your VMs/chroot/... 92 95 # if not defined then /var/cache 93 #pbdefdir default = \$ENV{'HOME'}/pb/projects 94 #pbdefdir pb = \$ENV{'HOME'} 95 96 # pbdefdir: 97 # default: \$ENV{'HOME'}/pb/projects 98 # pbdefdir: 99 # pb: \$ENV{'HOME'} 100 # 96 101 # If not defined, pbconfdir is under pbdefdir/pbproj/pbconf 97 #pbconfdir pb = \$ENV{'HOME'}/pb/pbconf 98 102 # pbconfdir: 103 # pb: \$ENV{'HOME'}/pb/pbconf 104 # 99 105 # If not defined, pbprojdir is under pbdefdir/pbproj 100 106 # Only defined if we have access to the dev of the project 101 #pbprojdir example = \$ENV{'HOME'}/example/svn 102 107 # pbprojdir: 108 # example: \$ENV{'HOME'}/example/svn 109 # 103 110 # We have commit acces to these 104 #pburl example = cvs+ssh://user\@example.cvs.sourceforge.net:/cvsroot/example 105 #pburl pb = svn+ssh://svn.project-builder.org/mondo/svn/pb 106 111 # pburl: 112 # example: cvs+ssh://user\@example.cvs.sourceforge.net:/cvsroot/example 113 # pburl: 114 # pb: svn+ssh://svn.project-builder.org/mondo/svn/pb 115 # 107 116 # I mask my real login on the ssh machines here 108 #sshlogin example = user 109 117 # sshlogin: 118 # example: user 119 # 110 120 # where to find Build System infos: 111 #vmpath default = /home/qemu 112 #vepath default = /home/rpmbootstrap 113 #rmpath default = /home/remote 114 121 # vmpath: 122 # default: /home/qemu 123 # vepath: 124 # default: /home/rpmbootstrap 125 # rmpath: 126 # default: /home/remote 127 # 115 128 # Overwrite generic setup 116 #vmport pb = 2223 117 #vmport example = 2224 118 129 # vmport: 130 # pb: 2223 131 # vmport: 132 # example: 2224 133 # 119 134 # Info on who is packaging 120 #pbpackager default = William Porte <bill\@porte.org> 121 #pbpassphrase default = TheScretePassPhrase 122 #pbpassfile default = /home/williamporte/secret/passfile 123 EOF 135 # pbpackager: 136 # default: William Porte <bill\@porte.org> 137 # pbpassphrase: 138 # default: TheScretePassPhrase 139 # pbpassfile: 140 # default: /home/williamporte/secret/passfile 141 EOF 142 } else { 143 pb_log(0, "Found an existing $dir/.pbrc converting it into $ENV{'PBETC'}\n"); 144 pb_conf_update_v0("$dir/.pbrc",$ENV{'PBETC'}); 124 145 } 146 } 125 147 126 148 # We only have one configuration file for now. … … 421 443 open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"; 422 444 print CONF << "EOF"; 423 --- 445 --- YAML 1.0 424 446 # 425 447 # Project Builder configuration file … … 620 642 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.yml"; 621 643 print CONF << "EOF"; 622 --- 644 --- YAML 1.0 623 645 # 624 646 # \$Id\$ … … 692 714 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.yml"; 693 715 print CONF << "EOF"; 694 --- 716 --- YAML 1.0 695 717 # 696 718 # \$Id\$ … … 725 747 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.yml"; 726 748 print CONF << "EOF"; 727 --- 749 --- YAML 1.0 728 750 # 729 751 # \$Id\$ … … 756 778 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.yml"; 757 779 print CONF << "EOF"; 758 --- 780 --- YAML 1.0 759 781 # 760 782 # \$Id\$ … … 770 792 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.yml"; 771 793 print CONF << "EOF"; 772 --- 794 --- YAML 1.0 773 795 # 774 796 # \$Id\$ … … 799 821 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.yml"; 800 822 print CONF << "EOF"; 801 --- 823 --- YAML 1.0 802 824 # 803 825 # \$Id\$ … … 815 837 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.yml"; 816 838 print CONF << "EOF"; 817 --- 839 --- YAML 1.0 818 840 # 819 841 # \$Id\$ … … 831 853 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.yml"; 832 854 print CONF << "EOF"; 833 --- 855 --- YAML 1.0 834 856 # 835 857 # \$Id\$ … … 847 869 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.yml"; 848 870 print CONF << "EOF"; 849 --- 871 --- YAML 1.0 850 872 # 851 873 # \$Id\$ … … 863 885 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian.yml"; 864 886 print CONF << "EOF"; 865 --- 887 --- YAML 1.0 866 888 # 867 889 # \$Id\$ … … 880 902 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv"; 881 903 print CONF << "EOF"; 882 --- 904 --- YAML 1.0 883 905 # 884 906 # \$Id\$ … … 898 920 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv"; 899 921 print CONF << "EOF"; 900 --- 922 --- YAML 1.0 901 923 # 902 924 # \$Id\$ … … 916 938 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv"; 917 939 print CONF << "EOF"; 918 --- 940 --- YAML 1.0 919 941 # 920 942 # \$Id\$ … … 935 957 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv"; 936 958 print CONF << "EOF"; 937 --- 959 --- YAML 1.0 938 960 # 939 961 # \$Id\$ … … 952 974 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.yml"; 953 975 print CONF << "EOF"; 954 --- 976 --- YAML 1.0 955 977 # 956 978 # \$Id\$ … … 969 991 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.yml") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.yml"; 970 992 print CONF << "EOF"; 971 --- 993 --- YAML 1.0 972 994 # 973 995 # \$Id\$ -
devel/pb/lib/ProjectBuilder/Filter.pm
r2251 r2253 68 68 my $pbos = shift; 69 69 my $ptr = undef; # returned value pointer on the hash of filters 70 my %h;70 my $h; 71 71 72 72 pb_log(2,"Entering pb_get_filters - pbpkg: $pbpkg - pbos: ".Dumper($pbos)."\n"); … … 88 88 foreach my $f (@ffiles) { 89 89 pb_log(3,"DEBUG processing filter file $f\n"); 90 open(CONF,$f) || next; 91 while(<CONF>) { 92 if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) { 93 my ($what, $var, $value) = ($1, $2, $3); 94 pb_log(3,"DEBUG creating entry $what, key $var, value $value\n"); 95 # Add support for multi-lines 96 while ($value =~ s/\\\s*$//o) { 97 $_ = <CONF>; 98 die "Still processing continuations for $what $var at EOF" if (not defined $_); 99 s/[\r\n]//go; 100 $value .= "\n$_"; 101 } 102 $h{$what}{$var}=$value; 103 } elsif ((/^\s*#/o) || (/^\s*$/o)) { 104 # ignore 105 } else { 106 chomp(); 107 warn "unexpected line '$_' in $f"; 108 } 109 } 110 close(CONF); 111 } 112 $ptr = $h{"filter"}; 90 $h = pb_conf_cache($f,$h); 91 } 92 $ptr = $h->{"filter"}; 113 93 114 94 # TODO: find a place to document it. Why not in this file as pod and also documenting filters ? 115 95 # Handle transform 116 if (defined $h {transform}) {117 while (my ($out_key,$spec) = each %{$h {transform}}) {96 if (defined $h->{transform}) { 97 while (my ($out_key,$spec) = each %{$h->{transform}}) { 118 98 die "Unknown transform for $out_key '$spec' expected <out-key> <transform>" unless $spec =~ /^([\w\-]+)\s+(.+)$/; 119 99 my ($in_key, $expr) = ($1, $2);
Note:
See TracChangeset
for help on using the changeset viewer.