- Timestamp:
- Apr 16, 2012, 3:43:53 AM (13 years ago)
- Location:
- devel
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Env.pm
r1464 r1469 23 23 use ProjectBuilder::Conf; 24 24 use ProjectBuilder::CMS; 25 use ProjectBuilder::VCS; 25 26 26 27 # Inherit from the "Exporter" module which handles exporting functions. … … 251 252 pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n"); 252 253 253 # Need to do that earlier as it's used potentialy in pb_ cms_add254 # Need to do that earlier as it's used potentialy in pb_vcs_add 254 255 pb_temp_init($pbkeep); 255 256 pb_log(2,"PBTMP: $ENV{'PBTMP'}\n"); … … 263 264 pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}"); 264 265 } 265 pb_ cms_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");266 pb_vcs_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}"); 266 267 } 267 268 … … 574 575 575 576 # PBVER is replaced by the version (\$pb->{'ver'} in code) 576 filter PBVER = \$pb->{'ver'} $pb->{'extdir'}577 filter PBVER = \$pb->{'ver'}\$pb->{'extdir'} 577 578 578 579 # PBDATE is replaced by the date (\$pb->{'date'} in code) … … 1184 1185 1185 1186 } 1186 pb_ cms_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});1187 pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'}); 1187 1188 pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit); 1188 1189 } else { -
devel/pb/bin/pb
r1465 r1469 32 32 use ProjectBuilder::Conf; 33 33 use ProjectBuilder::Distribution; 34 use ProjectBuilder::VCS; 34 35 use ProjectBuilder::CMS; 35 36 use ProjectBuilder::Env; … … 850 851 } 851 852 } 852 my $preserve = pb_ cms_export($sourceuri,$sourcedir,$dest);853 my $preserve = pb_vcs_export($sourceuri,$sourcedir,$dest); 853 854 854 855 # Generated fake content for test versions to speed up stuff … … 998 999 foreach my $pf (split(/,/,$pb->{'patches'}->{$v})) { 999 1000 my $pp = basename($pf); 1000 pb_ cms_export($pf,undef,"$dest/pbconf/$v/pbpatch");1001 pb_vcs_export($pf,undef,"$dest/pbconf/$v/pbpatch"); 1001 1002 pb_filter_file_inplace($ptr,"$dest/pbconf/$v/pbpatch/$pp",$pb); 1002 1003 pb_system("gzip -9f $dest/pbconf/$v/pbpatch/$pp","","quiet"); … … 1017 1018 foreach my $pf (split(/,/,$pb->{'sources'}->{$v})) { 1018 1019 my $pp = basename($pf); 1019 pb_ cms_export($pf,undef,"$dest/pbconf/$v/pbsrc");1020 pb_vcs_export($pf,undef,"$dest/pbconf/$v/pbsrc"); 1020 1021 pb_filter_file_inplace($ptr,"$dest/pbconf/$v/pbsrc/$pp",$pb); 1021 1022 } … … 2604 2605 } 2605 2606 2606 my $res = pb_ cms_isdiff($scheme,$ENV{'PBROOTDIR'});2607 my $res = pb_vcs_isdiff($scheme,$ENV{'PBROOTDIR'}); 2607 2608 die "ERROR: No differences accepted in CMS for $ENV{'PBROOTDIR'} before creating a new version" if ($res != 0); 2608 2609 2609 $res = pb_ cms_isdiff($scheme2,$ENV{'PBDIR'});2610 $res = pb_vcs_isdiff($scheme2,$ENV{'PBDIR'}); 2610 2611 die "ERROR: No differences accepted in CMS for $ENV{'PBDIR'} before creating a new version" if ($res != 0); 2611 2612 … … 2625 2626 # Duplicate and extract project-builder part 2626 2627 pb_log(2,"Copying $uri/$oldver to $newurl\n"); 2627 pb_ cms_copy($scheme,"$uri/$oldver",$newurl);2628 pb_vcs_copy($scheme,"$uri/$oldver",$newurl); 2628 2629 pb_log(2,"Checkout $newurl to $ENV{'PBCONFDIR'}/$newver\n"); 2629 pb_ cms_up($scheme,"$ENV{'PBCONFDIR'}");2630 pb_vcs_up($scheme,"$ENV{'PBCONFDIR'}"); 2630 2631 2631 2632 # Duplicate and extract project … … 2633 2634 2634 2635 pb_log(2,"Copying $pburl->{$ENV{'PBPROJ'}}/$oldver to $newurl2\n"); 2635 pb_ cms_copy($scheme2,"$pburl->{$ENV{'PBPROJ'}}/$oldver",$newurl2);2636 pb_vcs_copy($scheme2,"$pburl->{$ENV{'PBPROJ'}}/$oldver",$newurl2); 2636 2637 2637 2638 my $tmp = $ENV{'PBDIR'}; 2638 2639 $tmp =~ s|$oldver$||; 2639 2640 pb_log(2,"Checkout $newurl2 to $tmp/$newver\n"); 2640 pb_ cms_up($scheme2,"$tmp");2641 pb_vcs_up($scheme2,"$tmp"); 2641 2642 2642 2643 # Update the .pb file -
devel/pb/lib/ProjectBuilder/CMS.pm
r1421 r1469 22 22 use ProjectBuilder::Base; 23 23 use ProjectBuilder::Conf; 24 use ProjectBuilder::VCS; 24 25 25 26 # Inherit from the "Exporter" module which handles exporting functions. … … 32 33 33 34 our @ISA = qw(Exporter); 34 our @EXPORT = qw(pb_cms_init pb_cms_ export pb_cms_get_uri pb_cms_copy pb_cms_checkout pb_cms_up pb_cms_checkin pb_cms_isdiff pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_compliant pb_cms_log pb_cms_add);35 our @EXPORT = qw(pb_cms_init pb_cms_checkin pb_cms_get_pkg pb_cms_get_real_pkg pb_cms_compliant pb_cms_log); 35 36 ($VERSION,$REVISION) = pb_version_init(); 36 37 … … 65 66 pb_log(2,"DEBUG: Project URL of $ENV{'PBPROJ'}: $pburl->{$ENV{'PBPROJ'}}\n"); 66 67 my ($scheme, $account, $host, $port, $path) = pb_get_uri($pburl->{$ENV{'PBPROJ'}}); 67 my $vcscmd = pb_ cms_cmd($scheme);68 my $vcscmd = pb_vcs_cmd($scheme); 68 69 69 70 my ($pbprojdir) = pb_conf_get_if("pbprojdir"); … … 141 142 } 142 143 143 =item B<pb_cms_export>144 145 This function exports a CMS content to a directory.146 The first parameter is the URL of the CMS content.147 The second parameter is the directory in which it is locally exposed (result of a checkout). If undef, then use the original CMS content.148 The third parameter is the directory where we want to deliver it (result of export).149 It returns the original tar file if we need to preserve it and undef if we use the produced one.150 151 =cut152 153 sub pb_cms_export {154 155 my $uri = shift;156 my $source = shift;157 my $destdir = shift;158 my $tmp;159 my $tmp1;160 161 pb_log(1,"pb_cms_export uri: $uri - destdir: $destdir\n");162 pb_log(1,"pb_cms_export source: $source\n") if (defined $source);163 my @date = pb_get_date();164 # If it's not flat, then we have a real uri as source165 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);166 my $vcscmd = pb_cms_cmd($scheme);167 $uri = pb_cms_mod_socks($uri);168 169 if ($scheme =~ /^svn/) {170 if (defined $source) {171 if (-d $source) {172 $tmp = $destdir;173 } else {174 $tmp = "$destdir/".basename($source);175 }176 $source = pb_cms_mod_htftp($source,"svn");177 pb_system("$vcscmd export $source $tmp","Exporting $source from $scheme to $tmp ");178 } else {179 $uri = pb_cms_mod_htftp($uri,"svn");180 pb_system("$vcscmd export $uri $destdir","Exporting $uri from $scheme to $destdir ");181 }182 } elsif ($scheme eq "svk") {183 my $src = $source;184 if (defined $source) {185 if (-d $source) {186 $tmp = $destdir;187 } else {188 $tmp = "$destdir/".basename($source);189 $src = dirname($source);190 }191 $source = pb_cms_mod_htftp($source,"svk");192 # This doesn't exist !193 # pb_system("$vcscmd export $path $tmp","Exporting $path from $scheme to $tmp ");194 pb_log(4,"$uri,$source,$destdir,$scheme, $account, $host, $port, $path,$tmp");195 if (-d $source) {196 pb_system("mkdir -p $tmp ; cd $tmp; tar -cf - -C $source . | tar xf -","Exporting $source from $scheme to $tmp ");197 } else {198 # If source is file do not use -C with source199 pb_system("mkdir -p ".dirname($tmp)." ; cd ".dirname($tmp)."; tar -cf - -C $src ".basename($source)." | tar xf -","Exporting $src/".basename($source)." from $scheme to $tmp ");200 }201 } else {202 # Look at svk admin hotcopy203 die "Unable to export from svk without a source defined";204 }205 } elsif ($scheme eq "dir") {206 pb_system("cp -r $path $destdir","Copying $uri from DIR to $destdir ");207 } elsif (($scheme eq "http") || ($scheme eq "ftp")) {208 my $f = basename($path);209 unlink "$ENV{'PBTMP'}/$f";210 pb_system("$vcscmd $ENV{'PBTMP'}/$f $uri","Downloading $uri with $vcscmd to $ENV{'PBTMP'}/$f\n");211 # We want to preserve the original tar file212 pb_cms_export("file://$ENV{'PBTMP'}/$f",$source,$destdir);213 return("$ENV{'PBTMP'}/$f");214 } elsif ($scheme =~ /^file/) {215 eval216 {217 require File::MimeInfo;218 File::MimeInfo->import();219 };220 if ($@) {221 # File::MimeInfo not found222 die("ERROR: Install File::MimeInfo to handle scheme $scheme\n");223 }224 225 my $mm = mimetype($path);226 pb_log(2,"mimetype: $mm\n");227 228 # Check whether the file is well formed229 # (containing already a directory with the project-version name)230 #231 # If it's not the case, we try to adapt, but distro needing232 # to verify the checksum will have issues (Fedora)233 # Then upstream should be notified that they need to change their rules234 # This doesn't apply to patches or additional sources of course.235 my ($pbwf) = pb_conf_get_if("pbwf");236 if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}}) && ($path !~ /\/pbpatch\//) && ($path !~ /\/pbsrc\//)) {237 $destdir = dirname($destdir);238 pb_log(2,"This is a well-formed file so destdir is now $destdir\n");239 }240 pb_mkdir_p($destdir);241 242 if ($mm =~ /\/x-bzip-compressed-tar$/) {243 # tar+bzip2244 pb_system("cd $destdir ; tar xfj $path","Extracting $path in $destdir ");245 } elsif ($mm =~ /\/x-lzma-compressed-tar$/) {246 # tar+lzma247 pb_system("cd $destdir ; tar xfY $path","Extracting $path in $destdir ");248 } elsif ($mm =~ /\/x-compressed-tar$/) {249 # tar+gzip250 pb_system("cd $destdir ; tar xfz $path","Extracting $path in $destdir ");251 } elsif ($mm =~ /\/x-tar$/) {252 # tar253 pb_system("cd $destdir ; tar xf $path","Extracting $path in $destdir ");254 } elsif ($mm =~ /\/zip$/) {255 # zip256 pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir ");257 } else {258 # simple file: copy it (patch e.g.)259 copy($path,$destdir);260 }261 } elsif ($scheme =~ /^hg/) {262 if (defined $source) {263 if (-d $source) {264 $tmp = $destdir;265 } else {266 $tmp = "$destdir/".basename($source);267 }268 $source = pb_cms_mod_htftp($source,"hg");269 pb_system("cd $source ; $vcscmd archive $tmp","Exporting $source from Mercurial to $tmp ");270 } else {271 $uri = pb_cms_mod_htftp($uri,"hg");272 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from Mercurial to $destdir ");273 }274 } elsif ($scheme =~ /^git/) {275 if (defined $source) {276 if (-d $source) {277 $tmp = $destdir;278 } else {279 $tmp = "$destdir/".basename($source);280 }281 $source = pb_cms_mod_htftp($source,"git");282 pb_system("cd $source ; $vcscmd archive --format=tar HEAD | (mkdir $tmp && cd $tmp && tar xf -)","Exporting $source/HEAD from GIT to $tmp ");283 } else {284 $uri = pb_cms_mod_htftp($uri,"git");285 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir ");286 }287 } elsif ($scheme =~ /^cvs/) {288 # CVS needs a relative path !289 my $dir=dirname($destdir);290 my $base=basename($destdir);291 if (defined $source) {292 # CVS also needs a modules name not a dir293 $tmp1 = basename($source);294 } else {295 # Probably not right, should be checked, but that way I'll notice it :-)296 pb_log(0,"You're in an untested part of project-builder.org, please report any result upstream\n");297 $tmp1 = $uri;298 }299 # If we're working on the CVS itself300 my $cvstag = basename($ENV{'PBROOTDIR'});301 my $cvsopt = "";302 if ($cvstag eq "cvs") {303 my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date);304 $cvsopt = "-D \"$pbdate\"";305 } else {306 # we're working on a tag which should be the last part of PBROOTDIR307 $cvsopt = "-r $cvstag";308 }309 pb_system("cd $dir ; $vcscmd -d $account\@$host:$path export $cvsopt -d $base $tmp1","Exporting $tmp1 from $source under CVS to $destdir ");310 } else {311 die "cms $scheme unknown";312 }313 return(undef);314 }315 316 =item B<pb_cms_get_uri>317 318 This function is only called with a real CMS system and gives the URL stored in the checked out directory.319 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)320 The second parameter is the directory in which it is locally exposed (result of a checkout).321 322 =cut323 324 sub pb_cms_get_uri {325 326 my $scheme = shift;327 my $dir = shift;328 329 my $res = "";330 my $void = "";331 my $vcscmd = pb_cms_cmd($scheme);332 333 if ($scheme =~ /^svn/) {334 open(PIPE,"LANGUAGE=C $vcscmd info $dir |") || return("");335 while (<PIPE>) {336 ($void,$res) = split(/^URL:/) if (/^URL:/);337 }338 $res =~ s/^\s*//;339 close(PIPE);340 chomp($res);341 } elsif ($scheme =~ /^svk/) {342 open(PIPE,"LANGUAGE=C $vcscmd info $dir |") || return("");343 my $void2 = "";344 while (<PIPE>) {345 ($void,$void2,$res) = split(/ /) if (/^Depot/);346 }347 $res =~ s/^\s*//;348 close(PIPE);349 chomp($res);350 } elsif ($scheme =~ /^hg/) {351 open(HGRC,".hg/hgrc/") || return("");352 while (<HGRC>) {353 ($void,$res) = split(/^default.*=/) if (/^default.*=/);354 }355 close(HGRC);356 chomp($res);357 } elsif ($scheme =~ /^git/) {358 open(GITRC,".git/gitrc/") || return("");359 while (<GITRC>) {360 ($void,$res) = split(/^default.*=/) if (/^default.*=/);361 }362 close(GITRC);363 chomp($res);364 } elsif ($scheme =~ /^cvs/) {365 # This path is always the root path of CVS, but we may be below366 open(FILE,"$dir/CVS/Root") || die "$dir isn't CVS controlled";367 $res = <FILE>;368 chomp($res);369 close(FILE);370 # Find where we are in the tree371 my $rdir = $dir;372 while ((! -d "$rdir/CVSROOT") && ($rdir ne "/")) {373 $rdir = dirname($rdir);374 }375 die "Unable to find a CVSROOT dir in the parents of $dir" if (! -d "$rdir/CVSROOT");376 #compute our place under that root dir - should be a relative path377 $dir =~ s|^$rdir||;378 my $suffix = "";379 $suffix = "$dir" if ($dir ne "");380 381 my $prefix = "";382 if ($scheme =~ /ssh/) {383 $prefix = "cvs+ssh://";384 } else {385 $prefix = "cvs://";386 }387 $res = $prefix.$res.$suffix;388 } else {389 die "cms $scheme unknown";390 }391 pb_log(1,"pb_cms_get_uri returns $res\n");392 return($res);393 }394 395 =item B<pb_cms_copy>396 397 This function copies a CMS content to another.398 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)399 The second parameter is the URL of the original CMS content.400 The third parameter is the URL of the destination CMS content.401 402 Only coded for SVN now as used for pbconf itself not the project403 404 =cut405 406 sub pb_cms_copy {407 my $scheme = shift;408 my $oldurl = shift;409 my $newurl = shift;410 my $vcscmd = pb_cms_cmd($scheme);411 $oldurl = pb_cms_mod_socks($oldurl);412 $newurl = pb_cms_mod_socks($newurl);413 414 if ($scheme =~ /^svn/) {415 $oldurl = pb_cms_mod_htftp($oldurl,"svn");416 $newurl = pb_cms_mod_htftp($newurl,"svn");417 pb_system("$vcscmd copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl ");418 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) {419 } else {420 die "cms $scheme unknown for project management";421 }422 }423 424 =item B<pb_cms_checkout>425 426 This function checks a CMS content out to a directory.427 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)428 The second parameter is the URL of the CMS content.429 The third parameter is the directory where we want to deliver it (result of export).430 431 =cut432 433 sub pb_cms_checkout {434 my $scheme = shift;435 my $url = shift;436 my $destination = shift;437 my $vcscmd = pb_cms_cmd($scheme);438 $url = pb_cms_mod_socks($url);439 440 if ($scheme =~ /^svn/) {441 $url = pb_cms_mod_htftp($url,"svn");442 pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");443 } elsif ($scheme =~ /^svk/) {444 $url = pb_cms_mod_htftp($url,"svk");445 pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");446 } elsif ($scheme =~ /^hg/) {447 $url = pb_cms_mod_htftp($url,"hg");448 pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");449 } elsif ($scheme =~ /^git/) {450 $url = pb_cms_mod_htftp($url,"git");451 pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");452 } elsif (($scheme eq "ftp") || ($scheme eq "http")) {453 return;454 } elsif ($scheme =~ /^cvs/) {455 my ($scheme, $account, $host, $port, $path) = pb_get_uri($url);456 457 # If we're working on the CVS itself458 my $cvstag = basename($ENV{'PBROOTDIR'});459 my $cvsopt = "";460 if ($cvstag eq "cvs") {461 my @date = pb_get_date();462 my $pbdate = strftime("%Y-%m-%d %H:%M:%S", @date);463 $cvsopt = "-D \"$pbdate\"";464 } else {465 # we're working on a tag which should be the last part of PBROOTDIR466 $cvsopt = "-r $cvstag";467 }468 pb_mkdir_p("$destination");469 pb_system("cd $destination ; $vcscmd -d $account\@$host:$path co $cvsopt .","Checking out $url to $destination ");470 } elsif ($scheme =~ /^file/) {471 pb_cms_export($url,undef,$destination);472 } else {473 die "cms $scheme unknown";474 }475 }476 477 =item B<pb_cms_up>478 479 This function updates a local directory with the CMS content.480 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...)481 The second parameter is the directory to update.482 483 =cut484 485 sub pb_cms_up {486 my $scheme = shift;487 my $dir = shift;488 my $vcscmd = pb_cms_cmd($scheme);489 490 if (($scheme =~ /^svn/) || ($scheme =~ /^cvs/) || ($scheme =~ /^svk/)) {491 pb_system("$vcscmd up $dir","Updating $dir ");492 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) {493 } else {494 die "cms $scheme unknown";495 }496 }497 498 144 =item B<pb_cms_checkin> 499 145 … … 509 155 my $dir = shift; 510 156 my $pbinit = shift || undef; 511 my $vcscmd = pb_cms_cmd($scheme);512 157 513 158 my $ver = basename($dir); … … 515 160 $msg = "Project $ENV{PBPROJ} creation" if (defined $pbinit); 516 161 517 if (($scheme =~ /^svn/) || ($scheme =~ /^cvs/) || ($scheme =~ /^svk/)) { 518 pb_system("cd $dir ; $vcscmd ci -m \"$msg\" .","Checking in $dir "); 519 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) { 520 } else { 521 die "cms $scheme unknown"; 522 } 523 pb_cms_up($scheme,$dir); 524 } 525 526 =item B<pb_cms_add> 527 528 This function adds to a CMS content from a local directory. 529 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...) 530 The second parameter is the directory/file to add. 531 532 =cut 533 534 sub pb_cms_add { 535 my $scheme = shift; 536 my $f = shift; 537 my $vcscmd = pb_cms_cmd($scheme); 538 539 if (($scheme =~ /^svn/) || ($scheme =~ /^cvs/) || ($scheme =~ /^svk/)) { 540 pb_system("$vcscmd add $f","Adding $f to VCS "); 541 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) { 542 } else { 543 die "cms $scheme unknown"; 544 } 545 pb_cms_up($scheme,$f); 546 } 547 548 =item B<pb_cms_isdiff> 549 550 This function returns a integer indicating the number f differences between the CMS content and the local directory where it's checked out. 551 The first parameter is the schema of the CMS systems (svn, cvs, svn+ssh, ...) 552 The second parameter is the directory to consider. 553 554 =cut 555 556 sub pb_cms_isdiff { 557 my $scheme = shift; 558 my $dir =shift; 559 my $vcscmd = pb_cms_cmd($scheme); 560 my $l = undef; 561 562 if (($scheme =~ /^svn/) || ($scheme =~ /^cvs/) || ($scheme =~ /^svk/)) { 563 open(PIPE,"$vcscmd diff $dir |") || die "Unable to get $vcscmd diff from $dir"; 564 $l = 0; 565 while (<PIPE>) { 566 # Skipping normal messages in case of CVS 567 next if (/^cvs diff:/); 568 $l++; 569 } 570 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) { 571 $l = 0; 572 } else { 573 die "cms $scheme unknown"; 574 } 575 pb_log(1,"pb_cms_isdiff returns $l\n"); 576 return($l); 162 pb_vcs_checkin($scheme,$dir,$msg); 577 163 } 578 164 … … 707 293 pb_mkdir_p("$ENV{$envar}"); 708 294 pb_rm_rf($ENV{$envar}); 709 pb_ cms_checkout($scheme,$uri,$ENV{$envar});295 pb_vcs_checkout($scheme,$uri,$ENV{$envar}); 710 296 } else { 711 297 pb_log(1,"$uri found locally, checking content\n"); 712 my $cmsurl = pb_ cms_get_uri($scheme,$ENV{$envar});298 my $cmsurl = pb_vcs_get_uri($scheme,$ENV{$envar}); 713 299 my ($scheme2, $account2, $host2, $port2, $path2) = pb_get_uri($cmsurl); 714 300 # For svk, scheme doesn't appear in svk info so remove it here in uri coming from conf file … … 800 386 801 387 pb_cms_create_authors($authors,$dest,$scheme); 802 my $vcscmd = pb_ cms_cmd($scheme);388 my $vcscmd = pb_vcs_cmd($scheme); 803 389 804 390 if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) { … … 869 455 } 870 456 871 sub pb_cms_mod_htftp {872 873 my $url = shift;874 my $proto = shift;875 876 $url =~ s/^$proto\+((ht|f)tp[s]*):/$1:/;877 pb_log(1,"pb_cms_mod_htftp returns $url\n");878 return($url);879 }880 881 sub pb_cms_mod_socks {882 883 my $url = shift;884 885 $url =~ s/^([A-z0-9]+)\+(socks):/$1:/;886 pb_log(1,"pb_cms_mod_socks returns $url\n");887 return($url);888 }889 890 891 sub pb_cms_cmd {892 893 my $scheme = shift;894 my $cmd = "";895 896 # If there is a socks proxy to use897 if ($scheme =~ /socks/) {898 # Get the socks proxy command from the conf file899 my ($pbsockscmd) = pb_conf_get("pbsockscmd");900 $cmd = "$pbsockscmd->{$ENV{'PBPROJ'}} ";901 }902 903 if ($scheme =~ /hg/) {904 return($cmd."hg")905 } elsif ($scheme =~ /git/) {906 return($cmd."git")907 } elsif ($scheme =~ /svn/) {908 return($cmd."svn")909 } elsif ($scheme =~ /svk/) {910 return($cmd."svk")911 } elsif ($scheme =~ /cvs/) {912 return($cmd."cvs")913 } elsif (($scheme =~ /http/) || ($scheme =~ /ftp/)) {914 my $command = pb_check_req("wget",1);915 if (-x $command) {916 return($cmd."$command -nv -O ");917 } else {918 $command = pb_check_req("curl",1);919 if (-x $command) {920 return($cmd."$command -o ");921 } else {922 die "Unable to handle $scheme.\nNo wget/curl available, please install one of those";923 }924 }925 } else {926 return($cmd);927 }928 }929 930 931 932 457 =back 933 458
Note:
See TracChangeset
for help on using the changeset viewer.