Changeset 2176 in ProjectBuilder for devel/pb-modules
- Timestamp:
- Feb 14, 2017, 7:17:12 PM (7 years ago)
- Location:
- devel/pb-modules
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Conf.pm
r2154 r2176 19 19 use ProjectBuilder::Base; 20 20 use ProjectBuilder::Version; 21 #use YAML; 21 22 22 23 # Inherit from the "Exporter" module which handles exporting functions. … … 123 124 my $cf = shift; 124 125 my $lh = shift; 126 my $confver = "0.14"; 125 127 126 128 # Read the content of the config file and cache it in the %h hash then available for queries 127 open(CONF,$cf) || confess "Unable to open $cf"; 128 while(<CONF>) { 129 next if (/^#/); 130 if (/^\s*([A-z0-9-_.]+)\s+([[A-z0-9-_.\?\[\]\*\+\\]+)\s*=\s*(.*)$/) { 131 pb_log(3,"DEBUG: 1:$1 2:$2 3:$3\n"); 132 $lh->{$1}->{$2}=$3; 129 if ($confver < 0.15) { 130 open(CONF,$cf) || confess "Unable to open $cf"; 131 # This is the original conf file format for versions up to 0.14 132 while(<CONF>) { 133 next if (/^#/); 134 if (/^\s*([A-z0-9-_.]+)\s+([[A-z0-9-_.\?\[\]\*\+\\]+)\s*=\s*(.*)$/) { 135 pb_log(3,"DEBUG: 1:$1 2:$2 3:$3\n"); 136 $lh->{$1}->{$2}=$3; 137 } 133 138 } 134 } 135 close(CONF); 139 close(CONF); 140 } else { 141 $lh = LoadFile($cf); 142 } 136 143 return($lh); 137 144 } … … 244 251 my $conffile = shift; 245 252 my $h = shift; 253 my $confver = "0.14"; 246 254 247 255 confess "No configuration file defined to write into !" if (not defined $conffile); … … 249 257 open(CONF,"> $conffile") || confess "Unable to write into $conffile"; 250 258 251 foreach my $p (sort keys %$h) { 252 my $j = $h->{$p}; 253 foreach my $k (sort keys %$j) { 254 print CONF "$p $k = $j->{$k}\n"; 259 if ($confver < 0.15) { 260 # This is the original conf file format for versions up to 0.14 261 foreach my $p (sort keys %$h) { 262 my $j = $h->{$p}; 263 foreach my $k (sort keys %$j) { 264 print CONF "$p $k = $j->{$k}\n"; 265 } 255 266 } 267 } else { 268 # This is the new YAML format 269 print CONF Dump($h); 256 270 } 257 271 close(CONF); -
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r2171 r2176 549 549 pb_system("cat $src","INFO: New...\n"); 550 550 pb_log("INFO: Returning...\n"); 551 return(0); 552 } 553 # TRUE 554 return(1); 551 return(1); 552 } 553 return(0); 555 554 } 556 555 … … 616 615 } 617 616 my $dest = "$dirdest/$bn"; 618 next if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest));617 return if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1); 619 618 confess "Missing directory $dirdest ($reponame)" unless (-d $dirdest); 620 619 pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest"); … … 629 628 if ($bn =~ /\.sources.list$/) { 630 629 my $dest = "/etc/apt/sources.list.d/$bn"; 631 next if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest));630 return if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1); 632 631 pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/apt/sources.list.d","Adding apt repository"); 633 632 pb_system("sudo apt-get update","Updating apt repository"); -
devel/pb-modules/lib/ProjectBuilder/Env.pm
r2114 r2176 183 183 if ((defined $p) && (defined $p->{$ENV{'PBPROJ'}})) { 184 184 $p->{$ENV{'PBPROJ'}} = pb_path_expand($p->{$ENV{'PBPROJ'}}); 185 # TODO: should we add the conf files pointed by project default as well ? 185 186 pb_conf_add("$p->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$p->{$ENV{'PBPROJ'}}/.pbrc"); 186 187 }
Note:
See TracChangeset
for help on using the changeset viewer.