Changeset 2176 in ProjectBuilder for devel/pb-modules


Ignore:
Timestamp:
Feb 14, 2017, 7:17:12 PM (7 years ago)
Author:
Bruno Cornec
Message:

Fix package based installation of pb

Location:
devel/pb-modules
Files:
1 added
3 edited

Legend:

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

    r2154 r2176  
    1919use ProjectBuilder::Base;
    2020use ProjectBuilder::Version;
     21#use YAML;
    2122
    2223# Inherit from the "Exporter" module which handles exporting functions.
     
    123124my $cf = shift;
    124125my $lh = shift;
     126my $confver = "0.14";
    125127
    126128# 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;
     129if ($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        }
    133138    }
    134 }
    135 close(CONF);
     139    close(CONF);
     140} else {
     141    $lh = LoadFile($cf);
     142}
    136143return($lh);
    137144}
     
    244251my $conffile = shift;
    245252my $h = shift;
     253my $confver = "0.14";
    246254
    247255confess "No configuration file defined to write into !" if (not defined $conffile);
     
    249257open(CONF,"> $conffile") || confess "Unable to write into $conffile";
    250258
    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";
     259if ($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        }
    255266    }
     267} else {
     268    # This is the new YAML format
     269    print CONF Dump($h);
    256270}
    257271close(CONF);
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2171 r2176  
    549549    pb_system("cat $src","INFO: New...\n");
    550550    pb_log("INFO: Returning...\n");
    551     return(0);
    552 }
    553 # TRUE
    554 return(1);
     551    return(1);
     552}
     553return(0);
    555554}
    556555
     
    616615            }
    617616            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);
    619618            confess "Missing directory $dirdest ($reponame)" unless (-d $dirdest);
    620619            pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest");
     
    629628        if ($bn =~ /\.sources.list$/) {
    630629            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);
    632631            pb_system("sudo mv $ENV{'PBTMP'}/$bn /etc/apt/sources.list.d","Adding apt repository");
    633632            pb_system("sudo apt-get update","Updating apt repository");
  • devel/pb-modules/lib/ProjectBuilder/Env.pm

    r2114 r2176  
    183183    if ((defined $p) && (defined $p->{$ENV{'PBPROJ'}})) {
    184184        $p->{$ENV{'PBPROJ'}} = pb_path_expand($p->{$ENV{'PBPROJ'}});
     185        # TODO: should we add the conf files pointed by project default as well ?
    185186        pb_conf_add("$p->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$p->{$ENV{'PBPROJ'}}/.pbrc");
    186187    }
Note: See TracChangeset for help on using the changeset viewer.