Changeset 1174 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Feb 4, 2011, 2:25:47 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/CMS.pm
r1173 r1174 84 84 85 85 my $tmp = $ENV{'PBROOTDIR'}; 86 $tmp =~ s|^$ENV{'PBCONFDIR'} ||;86 $tmp =~ s|^$ENV{'PBCONFDIR'}/||; 87 87 88 88 # 89 89 # Check project cms compliance 90 90 # 91 pb_cms_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$pburl->{$ENV{'PBPROJ'}},$pbinit); 91 my $turl = "$pburl->{$ENV{'PBPROJ'}}/$tmp"; 92 $turl = $pburl->{$ENV{'PBPROJ'}} if (($scheme =~ /^file/) || ($scheme =~ /^(ht|f)tp/)); 93 pb_cms_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$turl,$pbinit); 92 94 93 95 … … 104 106 $ENV{'PBREVISION'}=$tmp; 105 107 $ENV{'PBCMSLOGFILE'}="git.log"; 106 } elsif (($scheme eq "file") || ($scheme eq "ftp") || ($scheme eq "http")) {108 } elsif (($scheme =~ /^file/) || ($scheme eq "ftp") || ($scheme eq "http")) { 107 109 $ENV{'PBREVISION'}="flat"; 108 110 $ENV{'PBCMSLOGFILE'}="flat.log"; … … 157 159 my $tmp1; 158 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); 159 163 my @date = pb_get_date(); 160 164 # If it's not flat, then we have a real uri as source … … 170 174 $tmp = "$destdir/".basename($source); 171 175 } 172 $source = pb_cms_mod_ht tp($source,"svn");176 $source = pb_cms_mod_htftp($source,"svn"); 173 177 pb_system("$vcscmd export $source $tmp","Exporting $source from $scheme to $tmp "); 174 178 } else { 175 $uri = pb_cms_mod_ht tp($uri,"svn");179 $uri = pb_cms_mod_htftp($uri,"svn"); 176 180 pb_system("$vcscmd export $uri $destdir","Exporting $uri from $scheme to $destdir "); 177 181 } … … 185 189 $src = dirname($source); 186 190 } 187 $source = pb_cms_mod_ht tp($source,"svk");191 $source = pb_cms_mod_htftp($source,"svk"); 188 192 # This doesn't exist ! 189 193 # pb_system("$vcscmd export $path $tmp","Exporting $path from $scheme to $tmp "); … … 208 212 pb_cms_export("file://$ENV{'PBTMP'}/$f",$source,$destdir); 209 213 return("$ENV{'PBTMP'}/$f"); 210 } elsif ($scheme eq "file") {214 } elsif ($scheme =~ /^file/) { 211 215 eval 212 216 { … … 222 226 pb_log(2,"mimetype: $mm\n"); 223 227 224 if (defined $source) { 225 # Check whether the file is well formed 226 # (containing already a directory with the project-version name) 227 # 228 # If it's not the case, we try to adapt, but distro needing 229 # to verify the checksum will have issues (Fedora) 230 # Then upstream should be notified that they need to change their rules 231 my ($pbwf) = pb_conf_get_if("pbwf"); 232 if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 233 $destdir = dirname($destdir); 234 } 228 # Check whether the file is well formed 229 (containing already a directory with the project-version name) 230 # 231 # If it's not the case, we try to adapt, but distro needing 232 # to verify the checksum will have issues (Fedora) 233 # Then upstream should be notified that they need to change their rules 234 my ($pbwf) = pb_conf_get_if("pbwf"); 235 if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 236 $destdir = dirname($destdir); 237 pb_log(2,"This is a well-formed file so destdir is now $destdir\n"); 235 238 } 236 239 pb_mkdir_p($destdir); … … 262 265 $tmp = "$destdir/".basename($source); 263 266 } 264 $source = pb_cms_mod_ht tp($source,"hg");267 $source = pb_cms_mod_htftp($source,"hg"); 265 268 pb_system("cd $source ; $vcscmd archive $tmp","Exporting $source from Mercurial to $tmp "); 266 269 } else { 267 $uri = pb_cms_mod_ht tp($uri,"hg");270 $uri = pb_cms_mod_htftp($uri,"hg"); 268 271 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from Mercurial to $destdir "); 269 272 } … … 275 278 $tmp = "$destdir/".basename($source); 276 279 } 277 $source = pb_cms_mod_ht tp($source,"git");280 $source = pb_cms_mod_htftp($source,"git"); 278 281 pb_system("cd $source ; $vcscmd archive --format=tar HEAD | (mkdir $tmp && cd $tmp && tar xf -)","Exporting $source/HEAD from GIT to $tmp "); 279 282 } else { 280 $uri = pb_cms_mod_ht tp($uri,"git");283 $uri = pb_cms_mod_htftp($uri,"git"); 281 284 pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir "); 282 285 } … … 409 412 410 413 if ($scheme =~ /^svn/) { 411 $oldurl = pb_cms_mod_ht tp($oldurl,"svn");412 $newurl = pb_cms_mod_ht tp($newurl,"svn");414 $oldurl = pb_cms_mod_htftp($oldurl,"svn"); 415 $newurl = pb_cms_mod_htftp($newurl,"svn"); 413 416 pb_system("$vcscmd copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl "); 414 417 } elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http")) { … … 435 438 436 439 if ($scheme =~ /^svn/) { 437 $url = pb_cms_mod_ht tp($url,"svn");440 $url = pb_cms_mod_htftp($url,"svn"); 438 441 pb_system("$vcscmd co $url $destination","Checking out $url to $destination "); 439 442 } elsif ($scheme =~ /^svk/) { 440 $url = pb_cms_mod_ht tp($url,"svk");443 $url = pb_cms_mod_htftp($url,"svk"); 441 444 pb_system("$vcscmd co $url $destination","Checking out $url to $destination "); 442 445 } elsif ($scheme =~ /^hg/) { 443 $url = pb_cms_mod_ht tp($url,"hg");446 $url = pb_cms_mod_htftp($url,"hg"); 444 447 pb_system("$vcscmd clone $url $destination","Checking out $url to $destination "); 445 448 } elsif ($scheme =~ /^git/) { 446 $url = pb_cms_mod_ht tp($url,"git");449 $url = pb_cms_mod_htftp($url,"git"); 447 450 pb_system("$vcscmd clone $url $destination","Checking out $url to $destination "); 448 451 } elsif (($scheme eq "ftp") || ($scheme eq "http")) { … … 626 629 } elsif ($dtype eq "ebuild") { 627 630 $pbpkgreal = $pbpkg; 631 } elsif ($dtype eq "hpux") { 632 $pbpkgreal = $pbpkg; 628 633 } elsif ($dtype eq "pkg") { 629 634 $pbpkgreal = "PB$pbpkg"; … … 660 665 my %pdir; 661 666 667 pb_log(1,"pb_cms_compliant: envar: $envar - defdir: $defdir - uri: $uri\n"); 662 668 my ($pdir) = pb_conf_get_if($param) if (defined $param); 663 669 if (defined $pdir) { … … 684 690 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri); 685 691 686 if (($scheme !~ /^cvs/) && ($scheme !~ /^svn/) && ($scheme =~ /^svk/) && ($scheme !~ /^hg/) && ($scheme !~ /^git/)) {692 if (($scheme !~ /^cvs/) && ($scheme !~ /^svn/) && ($scheme !~ /^svk/) && ($scheme !~ /^hg/) && ($scheme !~ /^git/)) { 687 693 # Do not compare if it's not a real cms 694 pb_log(1,"pb_cms_compliant useless\n"); 688 695 return; 689 696 } elsif (defined $pbinit) { … … 707 714 # The local content doesn't correpond to the repository 708 715 pb_log(0,"ERROR: Inconsistency detected:\n"); 709 pb_log(0," * $ENV{$envar} refers to $cmsurl but\n");716 pb_log(0," * $ENV{$envar} ($envar) refers to $cmsurl but\n"); 710 717 pb_log(0," * $ENV{'PBETC'} refers to $uri\n"); 711 718 die "Project $ENV{'PBPROJ'} is not Project-Builder compliant."; … … 715 722 } 716 723 } 724 pb_log(1,"pb_cms_compliant end\n"); 717 725 } 718 726 … … 830 838 close(CL); 831 839 pb_system("$vcscmd log -v $pkgdir > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from GIT"); 832 } elsif (($scheme eq "file") || ($scheme eq "dir") || ($scheme eq "http") || ($scheme eq "ftp")) {840 } elsif (($scheme =~ /^file/) || ($scheme eq "dir") || ($scheme eq "http") || ($scheme eq "ftp")) { 833 841 pb_system("echo ChangeLog for $pkgdir > $dest/ChangeLog","Empty ChangeLog file created"); 834 842 } elsif ($scheme =~ /^cvs/) { … … 854 862 } 855 863 856 sub pb_cms_mod_ht tp {864 sub pb_cms_mod_htftp { 857 865 858 866 my $url = shift; 859 867 my $proto = shift; 860 868 861 $url =~ s/^$proto\+( http[s]*):/$1:/;862 pb_log(1,"pb_cms_mod_ht tp returns $url\n");869 $url =~ s/^$proto\+((ht|f)tp[s]*):/$1:/; 870 pb_log(1,"pb_cms_mod_htftp returns $url\n"); 863 871 return($url); 864 872 }
Note:
See TracChangeset
for help on using the changeset viewer.