Changeset 314 in ProjectBuilder


Ignore:
Timestamp:
Feb 9, 2008, 9:29:56 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Big rewrite still WIP
  • lot of interface changes, pbconf relocated and split from project dir.
  • URL usage
Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r313 r314  
    9999die pb_syntax() if (not defined $action);
    100100
    101 my ($pbrc, $filteredfiles, $supfiles, $defpkgdir, $extpkgdir);
     101my ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir);
    102102my $pbinit = undef;
    103103$pbinit = 1 if ($action =~ /^newproj$/);
     
    106106# And get global params
    107107if (defined $opts{'p'}) {
    108     ($debug,$LOG, $pbrc, $filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
     108    ($debug,$LOG, $filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
    109109    = pb_env_init($opts{'p'},$pbinit);
    110110} else {
    111     ($debug,$LOG, $pbrc, $filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
     111    ($debug,$LOG, $filteredfiles, $supfiles, $defpkgdir, $extpkgdir)
    112112    = pb_env_init(undef,$pbinit);
    113113}
     
    309309            }
    310310            print $LOG "Build files generated for ".join(',',@found)."\n";
    311             print $LOG "No Build files found for ".join(',',@notfound)."\n";
     311            print $LOG "No Build files found for ".join(',',@notfound)."\n" if (@notfound);
    312312        }
    313313        # Get the generic filter (all.pbf) and
     
    340340        print $LOG "Under $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz\n" if ($debug >= 0);
    341341
    342         # Keep track of what is generated for default
    343         open(LAST,"> $pbrc->{$ENV{'PBPROJ'}}") || die "Unable to create $pbrc->{$ENV{'PBPROJ'}}";
    344         print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT'}\n";
     342        # Keep track of what is generated by default
     343        open(LAST,"> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
     344        #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOT'}\n";
     345        # Why not use pbproj ?
     346        print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOT'}\n";
    345347        close(LAST);
    346348
    347349        # Keep track of per package version
    348         if (! -f "$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") {
    349             open(PKG,">$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
    350             print PKG "# Empty\n";
    351             close(PKG);
    352         }
    353         my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
     350        my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
    354351        $pkg = { } if (not defined $pkg);
    355352        if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) {
     
    660657        # Gather all required files to send them to the VM
    661658        # and launch the build thourgh pbscript
    662         pb_send2ssh("Script","$v",$vmexist,$vmpid,"vmhost","vmlogin","pbrc","vmport","vmtmout");
     659        pb_send2ssh("Script","$v",$vmexist,$vmpid,"vmhost","vmlogin","$ENV{'PBDESTDIR'}/pbrc","vmport","vmtmout");
    663660
    664661    }
     
    859856        # Gather all required files to send them to the VM
    860857        # and launch the build thourgh pbscript
    861         pb_send2ssh("VMs","$v",$vmexist,$vmpid,"vmhost","vmlogin","pbrc","vmport","vmtmout");
     858        pb_send2ssh("VMs","$v",$vmexist,$vmpid,"vmhost","vmlogin","$ENV{'PBDESTDIR'}/pbrc","vmport","vmtmout");
    862859    }
    863860}
     
    873870    my $res = pb_cms_isdiff($cms);
    874871    die "You need to have no differences before creating a new version" if ($res != 0);
    875     my $cmsurl = pb_cms_getinfo($cms);
     872    my $cmsurl = pb_cms_getinfo($cms,$ENV{'PBROOT'});
    876873    my $newurl = dirname($cmsurl)."/$newver";
    877874    pb_cms_copy($cms,$cmsurl,$newurl);
  • devel/pb/lib/ProjectBuilder/Base.pm

    r313 r314  
    6767# Detect the root dir for hosting all the content generated with pb
    6868#
    69 my ($pbroot) = pb_conf_get_if("pbroot");
    70 my %pbroot = %$pbroot;
    71 
    72 if (not defined $ENV{'PBROOT'}) {
    73     if (not defined ($pbroot{$ENV{'PBPROJ'}})) {
    74         print $LOG "WARNING: no pbroot defined, using /var/cache\n";
    75         print $LOG "Please create a pbroot reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\nif you want to use another directory\n";
     69# Tree will look like this:
     70#
     71#             maint pbdir                                              dev dir (optional)
     72#                  |                                                      |
     73#            ------------------------                              --------------------
     74#            |                      |                              |                  |
     75#         pbproj1                pbproj2                        pbproj1           pbproj2
     76#            |                                                     |
     77#  ---------------------------------------------              ----------
     78#  *      *        |       |        |          |              *        *
     79# 1.0    dev    pbconf    ...     build     delivery         1.0      dev
     80#                  |                |          |
     81#               ------                        pbrc
     82#               |    |       
     83#              1.0  dev     
     84#                    |
     85#               ----------------------------------
     86#               |          |           |         |
     87#             pkg1      pbproj1.pb   pbfilter   pbcl
     88#               |
     89#        -----------------
     90#        |      |        |
     91#       rpm    deb    pbfilter
     92#
     93#
     94# (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdir (when appropriate)
     95# Names under a pbproj and the corresponding pbconf should be similar
     96#
     97
     98my ($pbdir) = pb_conf_get_if("pbdir");
     99my %pbdir = %$pbdir;
     100
     101if (not defined $ENV{'PBDIR'}) {
     102    if (not defined ($pbdir{$ENV{'PBPROJ'}})) {
     103        print $LOG "WARNING: no pbdir defined, using /var/cache\n";
     104        print $LOG "Please create a pbdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\nif you want to use another directory\n";
    76105    }
    77106    # That's always the environment variable that will be used
    78     $ENV{'PBROOT'} = $pbroot{$ENV{'PBPROJ'}};
     107    $ENV{'PBDIR'} = $pbdir{$ENV{'PBPROJ'}};
    79108}
    80109# Expand potential env variable in it
    81 eval { $ENV{'PBROOT'} =~ s/(\$ENV.+\})/$1/eeg };
     110eval { $ENV{'PBDIR'} =~ s/(\$ENV.+\})/$1/eeg };
    82111
    83112#
    84113# Set delivery directory
    85114#
    86 $ENV{'PBDESTDIR'}="$ENV{'PBROOT'}/$ENV{'PBPROJ'}/delivery";
     115$ENV{'PBDESTDIR'}="$ENV{'PBDIR'}/$ENV{'PBPROJ'}/delivery";
    87116
    88117#
     
    109138# Set build directory
    110139#
    111 $ENV{'PBBUILDDIR'}="$ENV{'PBROOT'}/$ENV{'PBPROJ'}/build";
     140$ENV{'PBBUILDDIR'}="$ENV{'PBDIR'}/$ENV{'PBPROJ'}/build";
    112141if (! -d "$ENV{'PBBUILDDIR'}") {
    113142    pb_mkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";
     
    122151$ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
    123152
    124 # Not sure it'll still be needed
    125 #$pbrc{$ENV{'PBPROJ'}} = $topdir."/pbrc";
    126 
    127153#
    128154# Check pbconf compliance
    129155#
    130 $ENV{'PBCONF'} = "$ENV{'PBROOT'}/$ENV{'PBPROJ'}/pbconf";
    131 if (not -d "$ENV{'PBCONF'}") {
    132     pb_mkdir_p("$ENV{'PBCONF'}");
    133     }
    134 
    135 
    136 if (defined $pbinit) {
    137     print $LOG "Creating $ENV{'PBCONF'} directory\n";
    138     pb_mkdir_p("$ENV{'PBCONF'}");
    139     }
    140 die "Project $ENV{'PBPROJ'} not Project-Builder compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}");
     156$ENV{'PBCONF'} = "$ENV{'PBDIR'}/$ENV{'PBPROJ'}/pbconf";
     157
     158my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbconf{$ENV{'PBPROJ'}});
     159my $cms = { $ENV{'PBPROJ'} => $scheme };
     160
     161if ((not -d "$ENV{'PBCONF'}") || (defined $pbinit)) {
     162    pb_cms_checkout($cms,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'});
     163} else {
     164    my $cmsurl = pb_cms_getinfo($cms,$ENV{'PBCONF'});
     165    if ($cmsurl !~ /^$scheme/) {
     166        pb_rm_rf("$ENV{'PBCONF'}");
     167        pb_cms_checkout($cms,$pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONF'});
     168    } elsif ($cmsurl ne $pbconf{$ENV{'PBPROJ'}}) {
     169        # The local content doesn't correpond to the repository
     170        print $LOG "ERROR: Inconsistency detected:\n";
     171        print $LOG "* $ENV{'PBCONF'} refers to $cmsurl but\n";
     172        print $LOG "* $ENV{'PBETC'} refers to $pbconf{$ENV{'PBPROJ'}}\n";
     173        die "Project $ENV{'PBPROJ'} is not Project-Builder compliant.";
     174    } else {
     175        # they match - do nothing - there may be local changes
     176    }
     177}
     178
     179# Check where is our PBROOT (release tag name can't be guessed the first time)
     180if (not defined $ENV{'PBROOT'}) {
     181    if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
     182        opendir(DIR,$ENV{'PBCONF'}) || die "Unable to open directory $ENV{'PBCONF'}: $!";
     183        my maxmtime = 0;
     184        foreach my $d (readdir(DIR)) {
     185            next if ($d =~ /^\./);
     186            next if (! -d $d);
     187            my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
     188                          = stat($d);
     189            # Keep the most recent
     190            if ($mtime > $maxmtime) {
     191                $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$d";
     192                $maxmtime = $mtime;
     193            }
     194        }
     195        closedir(DIR);
     196        print $LOG "WARNING: no pbroot defined, using $ENV{'PBROOT'}\n";
     197        print $LOG "Please -r release if you want to use another release\n";
     198    } else {
     199        my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
     200        # That's always the environment variable that will be used
     201        $ENV{'PBROOT'} = $pbroot{$ENV{'PBPROJ'}};
     202    }
     203} else {
     204    # transform in full path if relative
     205    $ENV{'PBROOT'} = "$ENV{'PBCONF'}/$ENV{'PBROOT'}" if ($ENV{'PBROOT'} !~ |/|);
     206}
    141207
    142208my %version = ();
     
    146212my %supfiles = ();
    147213
    148 if ((-f "$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
     214if ((-f "$ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
    149215    # List of pkg to build by default (mandatory)
    150216    my ($defpkgdir) = pb_conf_get("defpkgdir");
     
    159225    print "DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n" if ($debug >= 1);
    160226    print "DEBUG: supfiles: ".Dumper($supfiles)."\n" if ($debug >= 1);
    161     die "Unable to find defpkgdir in $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb" if (not defined $defpkgdir);
    162227    # Global
    163228    %defpkgdir = %$defpkgdir;
     
    169234    # Get global Version/Tag
    170235    #
    171 
    172236    if (not defined $ENV{'PBVER'}) {
    173237        if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
    174238            $ENV{'PBVER'}=$pkgv->{$ENV{'PBPROJ'}};
    175239        } else {
    176             die "No projver found in $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb";
     240            die "No projver found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
    177241        }
    178242    }
    179     die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$ENV{'PBPROJ'}}/));
     243    die "Invalid version name $ENV{'PBVER'} in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$ENV{'PBPROJ'}}/));
    180244   
    181245    if (not defined $ENV{'PBTAG'}) {
     
    183247            $ENV{'PBTAG'}=$pkgt->{$ENV{'PBPROJ'}};
    184248        } else {
    185             die "No projtag found in $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb";
     249            die "No projtag found in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
    186250        }
    187251    }
    188     die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
     252    die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
    189253} else {
    190254    if (defined $pbinit) {
    191         open(CONF,"> $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb";
     255        open(CONF,"> $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
    192256        print CONF << "EOF";
    193257#
     
    280344EOF
    281345        close(CONF);
    282         pb_mkdir_p("$ENV{'PBCONF'}/pbfilter") || die "Unable to create $ENV{'PBCONF'}/pbfilter";
    283         open(CONF,"> $ENV{'PBCONF'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/all.pbf";
     346        pb_mkdir_p("$ENV{'PBROOT'}/pbfilter") || die "Unable to create $ENV{'PBROOT'}/pbfilter";
     347        open(CONF,"> $ENV{'PBROOT'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/all.pbf";
    284348        print CONF << "EOF";
    285349#
     
    319383EOF
    320384        close(CONF);
    321         open(CONF,"> $ENV{'PBCONF'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/rpm.pbf";
     385        open(CONF,"> $ENV{'PBROOT'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/rpm.pbf";
    322386        print CONF << "EOF";
    323387#
     
    342406EOF
    343407        close(CONF);
    344         open(CONF,"> $ENV{'PBCONF'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/deb.pbf";
     408        open(CONF,"> $ENV{'PBROOT'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/deb.pbf";
    345409        print CONF << "EOF";
    346410#
     
    375439EOF
    376440        close(CONF);
    377         open(CONF,"> $ENV{'PBCONF'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/md.pbf";
     441        open(CONF,"> $ENV{'PBROOT'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/md.pbf";
    378442        print CONF << "EOF";
    379443# Specific group for Mandriva for $ENV{'PBPROJ'}
     
    381445EOF
    382446        close(CONF);
    383         open(CONF,"> $ENV{'PBCONF'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/novell.pbf";
     447        open(CONF,"> $ENV{'PBROOT'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOT'}/pbfilter/novell.pbf";
    384448        print CONF << "EOF";
    385449# Specific group for SuSE for $ENV{'PBPROJ'}
     
    387451EOF
    388452        close(CONF);
    389         pb_mkdir_p("$ENV{'PBCONF'}/pkg1/deb") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb";
    390         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/control") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/control";
     453        pb_mkdir_p("$ENV{'PBROOT'}/pkg1/deb") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb";
     454        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/control") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/control";
    391455        print CONF << "EOF";
    392456Source: PBPKG
     
    411475EOF
    412476        close(CONF);
    413         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/copyright") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/copyright";
     477        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/copyright") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/copyright";
    414478        print CONF << "EOF";
    415479This package is debianized by PBPACKAGER
     
    442506EOF
    443507        close(CONF);
    444         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/changelog") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/changelog";
     508        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/changelog") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/changelog";
    445509        print CONF << "EOF";
    446510PBLOG
    447511EOF
    448512        close(CONF);
    449         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/compat") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/compat";
     513        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/compat") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/compat";
    450514        print CONF << "EOF";
    4515154
    452516EOF
    453517        close(CONF);
    454         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/pkg1.dirs") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/pkg1.dirs";
     518        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/pkg1.dirs") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/pkg1.dirs";
    455519        print CONF << "EOF";
    456520EOF
    457521        close(CONF);
    458         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/pkg1.docs") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/pkg1.docs";
     522        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/pkg1.docs") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/pkg1.docs";
    459523        print CONF << "EOF";
    460524INSTALL
     
    465529EOF
    466530        close(CONF);
    467         open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/rules") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/rules";
     531        open(CONF,"> $ENV{'PBROOT'}/pkg1/deb/rules") || die "Unable to create $ENV{'PBROOT'}/pkg1/deb/rules";
    468532        print CONF << 'EOF';
    469533#!/usr/bin/make -f
     
    602666EOF
    603667        close(CONF);
    604         pb_mkdir_p("$ENV{'PBCONF'}/pkg1/rpm") || die "Unable to create $ENV{'PBCONF'}/pkg1/rpm";
    605         open(CONF,"> $ENV{'PBCONF'}/pkg1/rpm/pkg1.spec") || die "Unable to create $ENV{'PBCONF'}/pkg1/rpm/pkg1.spec";
     668        pb_mkdir_p("$ENV{'PBROOT'}/pkg1/rpm") || die "Unable to create $ENV{'PBROOT'}/pkg1/rpm";
     669        open(CONF,"> $ENV{'PBROOT'}/pkg1/rpm/pkg1.spec") || die "Unable to create $ENV{'PBROOT'}/pkg1/rpm/pkg1.spec";
    606670        print CONF << 'EOF';
    607671#
     
    652716EOF
    653717        close(CONF);
    654         pb_mkdir_p("$ENV{'PBCONF'}/pkg1/pbfilter") || die "Unable to create $ENV{'PBCONF'}/pkg1/pbfilter";
     718        pb_mkdir_p("$ENV{'PBROOT'}/pkg1/pbfilter") || die "Unable to create $ENV{'PBROOT'}/pkg1/pbfilter";
    655719
    656720        print "\nDo not to forget to commit the pbconf directory in your CMS if needed\n";
    657721        print "After having renamed the pkg1 directory to your package's name      \n\n";
    658722    } else {
    659         die "Unable to open $ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb";
     723        die "Unable to open $ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb";
    660724    }
    661725}
    662726umask 0022;
    663 return($debug,$LOG,\%pbconf, \%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
     727return($debug,$LOG, \%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
    664728}
    665729
     
    738802# Everything is returned via ptr1
    739803my @ptr1 = pb_conf_read_if("$ENV{'PBETC'}", @param);
    740 my @ptr2 = pb_conf_read_if("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb", @param);
     804my @ptr2 = pb_conf_read_if("$ENV{'PBROOT'}/$ENV{'PBPROJ'}.pb", @param);
    741805
    742806my $p1;
     
    825889
    826890# Analyze a url passed and return protocol, account, password, server, port, path
    827 sub pb_get_url {
    828 
    829 my $url = shift || undef;
    830 
    831 # A URL has the format protocol://ac@host[:port][path[?query][#fragment]].
    832 my $url_regex = "([a-z]+?)://([-\w]+.[-\w.]*)(\d+)?(/.*)?";
    833 
    834 my ($proto,$account,$passwd,$server,$port,$path) = ;
     891sub pb_get_uri {
     892
     893my $uri = shift || undef;
     894
     895# A URL has the format protocol://[ac@]host[:port][path[?query][#fragment]].
     896# Cf man URI
     897my ($scheme, $authority, $path, $query, $fragment) =
     898         $uri =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
     899my ($account,$host,$port) = $authority =~ m|(?:([^\@]+)\@)?([^:]+)(:(?:[0-9]+))?|;
     900print "DEBUG: scheme:$scheme ac:$account host:$host port:$port path:$path\n" if ($debug >= 1);
     901return($scheme, $account, $host, $port, $path);
    835902}
    836903
     
    9751042sub pb_cms_getinfo {
    9761043my $cms = shift;
     1044my $dir = shift;
    9771045my $url = "";
    9781046my $void = "";
    9791047
    980 if ($cms->{$ENV{'PBPROJ'}} eq "svn") {
    981     open(PIPE,"LANGUAGE=C svn info $ENV{'PBROOT'} |") || die "Unable to get svn info from $ENV{'PBROOT'}";
     1048if ($cms->{$ENV{'PBPROJ'}} =~ /^svn/) {
     1049    open(PIPE,"LANGUAGE=C svn info $dir |") || return("");
    9821050    while (<PIPE>) {
    9831051        ($void,$url) = split(/^URL:/) if (/^URL:/);
     
    10761144
    10771145# Global filter files first, then package specificities
    1078 if (-d "$ENV{'PBCONF'}/pbfilter") {
    1079     $mfile00 = "$ENV{'PBCONF'}/pbfilter/all.pbf" if (-f "$ENV{'PBCONF'}/pbfilter/all.pbf");
    1080     $mfile0 = "$ENV{'PBCONF'}/pbfilter/$dtype.pbf" if (-f "$ENV{'PBCONF'}/pbfilter/$dtype.pbf");
    1081     $mfile1 = "$ENV{'PBCONF'}/pbfilter/$dfam.pbf" if (-f "$ENV{'PBCONF'}/pbfilter/$dfam.pbf");
    1082     $mfile2 = "$ENV{'PBCONF'}/pbfilter/$ddir.pbf" if (-f "$ENV{'PBCONF'}/pbfilter/$ddir.pbf");
    1083     $mfile3 = "$ENV{'PBCONF'}/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBCONF'}/pbfilter/$ddir-$dver.pbf");
     1146if (-d "$ENV{'PBROOT'}/pbfilter") {
     1147    $mfile00 = "$ENV{'PBROOT'}/pbfilter/all.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/all.pbf");
     1148    $mfile0 = "$ENV{'PBROOT'}/pbfilter/$dtype.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$dtype.pbf");
     1149    $mfile1 = "$ENV{'PBROOT'}/pbfilter/$dfam.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$dfam.pbf");
     1150    $mfile2 = "$ENV{'PBROOT'}/pbfilter/$ddir.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$ddir.pbf");
     1151    $mfile3 = "$ENV{'PBROOT'}/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBROOT'}/pbfilter/$ddir-$dver.pbf");
    10841152
    10851153    push @ffiles,$mfile00 if (defined $mfile00);
     
    10901158}
    10911159
    1092 if (-d "$ENV{'PBCONF'}/$pbpkg/pbfilter") {
    1093     $ffile00 = "$ENV{'PBCONF'}/$pbpkg/pbfilter/all.pbf" if (-f "$ENV{'PBCONF'}/$pbpkg/pbfilter/all.pbf");
    1094     $ffile0 = "$ENV{'PBCONF'}/$pbpkg/pbfilter/$dtype.pbf" if (-f "$ENV{'PBCONF'}/$pbpkg/pbfilter/$dtype.pbf");
    1095     $ffile1 = "$ENV{'PBCONF'}/$pbpkg/pbfilter/$dfam.pbf" if (-f "$ENV{'PBCONF'}/$pbpkg/pbfilter/$dfam.pbf");
    1096     $ffile2 = "$ENV{'PBCONF'}/$pbpkg/pbfilter/$ddir.pbf" if (-f "$ENV{'PBCONF'}/$pbpkg/pbfilter/$ddir.pbf");
    1097     $ffile3 = "$ENV{'PBCONF'}/$pbpkg/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBCONF'}/$pbpkg/pbfilter/$ddir-$dver.pbf");
     1160if (-d "$ENV{'PBROOT'}/$pbpkg/pbfilter") {
     1161    $ffile00 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/all.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/all.pbf");
     1162    $ffile0 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dtype.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dtype.pbf");
     1163    $ffile1 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dfam.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$dfam.pbf");
     1164    $ffile2 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir.pbf");
     1165    $ffile3 = "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir-$dver.pbf" if (-f "$ENV{'PBROOT'}/$pbpkg/pbfilter/$ddir-$dver.pbf");
    10981166
    10991167    push @ffiles,$ffile00 if (defined $ffile00);
Note: See TracChangeset for help on using the changeset viewer.