Changeset 1174 in ProjectBuilder for devel/pb/lib/ProjectBuilder/CMS.pm


Ignore:
Timestamp:
Feb 4, 2011, 2:25:47 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Fix ebuild test name generation (Report Francesco)
  • Fix project package generation from file URL
  • Introduce hpux entry (not working)
  • pb_cms_mod_http renamed pb_cms_mod_htftp and also now handles ftp protocol
  • Fix pb_cms_compliant for file URL build
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r1173 r1174  
    8484
    8585my $tmp = $ENV{'PBROOTDIR'};
    86 $tmp =~ s|^$ENV{'PBCONFDIR'}||;
     86$tmp =~ s|^$ENV{'PBCONFDIR'}/||;
    8787
    8888#
    8989# Check project cms compliance
    9090#
    91 pb_cms_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$pburl->{$ENV{'PBPROJ'}},$pbinit);
     91my $turl = "$pburl->{$ENV{'PBPROJ'}}/$tmp";
     92$turl = $pburl->{$ENV{'PBPROJ'}} if (($scheme =~ /^file/) || ($scheme =~ /^(ht|f)tp/));
     93pb_cms_compliant(undef,'PBDIR',"$ENV{'PBPROJDIR'}/$tmp",$turl,$pbinit);
    9294
    9395
     
    104106    $ENV{'PBREVISION'}=$tmp;
    105107    $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")) {
    107109    $ENV{'PBREVISION'}="flat";
    108110    $ENV{'PBCMSLOGFILE'}="flat.log";
     
    157159my $tmp1;
    158160
     161pb_log(1,"pb_cms_export uri: $uri - destdir: $destdir\n");
     162pb_log(1,"pb_cms_export source: $source\n") if (defined $source);
    159163my @date = pb_get_date();
    160164# If it's not flat, then we have a real uri as source
     
    170174            $tmp = "$destdir/".basename($source);
    171175        }
    172         $source = pb_cms_mod_http($source,"svn");
     176        $source = pb_cms_mod_htftp($source,"svn");
    173177        pb_system("$vcscmd export $source $tmp","Exporting $source from $scheme to $tmp ");
    174178    } else {
    175         $uri = pb_cms_mod_http($uri,"svn");
     179        $uri = pb_cms_mod_htftp($uri,"svn");
    176180        pb_system("$vcscmd export $uri $destdir","Exporting $uri from $scheme to $destdir ");
    177181    }
     
    185189            $src = dirname($source);
    186190        }
    187         $source = pb_cms_mod_http($source,"svk");
     191        $source = pb_cms_mod_htftp($source,"svk");
    188192        # This doesn't exist !
    189193        # pb_system("$vcscmd export $path $tmp","Exporting $path from $scheme to $tmp ");
     
    208212    pb_cms_export("file://$ENV{'PBTMP'}/$f",$source,$destdir);
    209213    return("$ENV{'PBTMP'}/$f");
    210 } elsif ($scheme eq "file") {
     214} elsif ($scheme =~ /^file/) {
    211215    eval
    212216    {
     
    222226    pb_log(2,"mimetype: $mm\n");
    223227
    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");
    235238    }
    236239    pb_mkdir_p($destdir);
     
    262265            $tmp = "$destdir/".basename($source);
    263266        }
    264         $source = pb_cms_mod_http($source,"hg");
     267        $source = pb_cms_mod_htftp($source,"hg");
    265268        pb_system("cd $source ; $vcscmd archive $tmp","Exporting $source from Mercurial to $tmp ");
    266269    } else {
    267         $uri = pb_cms_mod_http($uri,"hg");
     270        $uri = pb_cms_mod_htftp($uri,"hg");
    268271        pb_system("$vcscmd clone $uri $destdir","Exporting $uri from Mercurial to $destdir ");
    269272    }
     
    275278            $tmp = "$destdir/".basename($source);
    276279        }
    277         $source = pb_cms_mod_http($source,"git");
     280        $source = pb_cms_mod_htftp($source,"git");
    278281        pb_system("cd $source ; $vcscmd archive --format=tar HEAD | (mkdir $tmp && cd $tmp && tar xf -)","Exporting $source/HEAD from GIT to $tmp ");
    279282    } else {
    280         $uri = pb_cms_mod_http($uri,"git");
     283        $uri = pb_cms_mod_htftp($uri,"git");
    281284        pb_system("$vcscmd clone $uri $destdir","Exporting $uri from GIT to $destdir ");
    282285    }
     
    409412
    410413if ($scheme =~ /^svn/) {
    411     $oldurl = pb_cms_mod_http($oldurl,"svn");
    412     $newurl = pb_cms_mod_http($newurl,"svn");
     414    $oldurl = pb_cms_mod_htftp($oldurl,"svn");
     415    $newurl = pb_cms_mod_htftp($newurl,"svn");
    413416    pb_system("$vcscmd copy -m \"Creation of $newurl from $oldurl\" $oldurl $newurl","Copying $oldurl to $newurl ");
    414417} elsif (($scheme eq "flat") || ($scheme eq "ftp") || ($scheme eq "http"))   {
     
    435438
    436439if ($scheme =~ /^svn/) {
    437     $url = pb_cms_mod_http($url,"svn");
     440    $url = pb_cms_mod_htftp($url,"svn");
    438441    pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");
    439442} elsif ($scheme =~ /^svk/) {
    440     $url = pb_cms_mod_http($url,"svk");
     443    $url = pb_cms_mod_htftp($url,"svk");
    441444    pb_system("$vcscmd co $url $destination","Checking out $url to $destination ");
    442445} elsif ($scheme =~ /^hg/) {
    443     $url = pb_cms_mod_http($url,"hg");
     446    $url = pb_cms_mod_htftp($url,"hg");
    444447    pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");
    445448} elsif ($scheme =~ /^git/) {
    446     $url = pb_cms_mod_http($url,"git");
     449    $url = pb_cms_mod_htftp($url,"git");
    447450    pb_system("$vcscmd clone $url $destination","Checking out $url to $destination ");
    448451} elsif (($scheme eq "ftp") || ($scheme eq "http")) {
     
    626629        } elsif ($dtype eq "ebuild") {
    627630            $pbpkgreal = $pbpkg;
     631        } elsif ($dtype eq "hpux") {
     632            $pbpkgreal = $pbpkg;
    628633        } elsif ($dtype eq "pkg") {
    629634            $pbpkgreal = "PB$pbpkg";
     
    660665my %pdir;
    661666
     667pb_log(1,"pb_cms_compliant: envar: $envar - defdir: $defdir - uri: $uri\n");
    662668my ($pdir) = pb_conf_get_if($param) if (defined $param);
    663669if (defined $pdir) {
     
    684690my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
    685691
    686 if (($scheme !~ /^cvs/) && ($scheme !~ /^svn/) && ($scheme =~ /^svk/) && ($scheme !~ /^hg/) && ($scheme !~ /^git/) ) {
     692if (($scheme !~ /^cvs/) && ($scheme !~ /^svn/) && ($scheme !~ /^svk/) && ($scheme !~ /^hg/) && ($scheme !~ /^git/)) {
    687693    # Do not compare if it's not a real cms
     694    pb_log(1,"pb_cms_compliant useless\n");
    688695    return;
    689696} elsif (defined $pbinit) {
     
    707714        # The local content doesn't correpond to the repository
    708715        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");
    710717        pb_log(0,"       * $ENV{'PBETC'} refers to $uri\n");
    711718        die "Project $ENV{'PBPROJ'} is not Project-Builder compliant.";
     
    715722    }
    716723}
     724pb_log(1,"pb_cms_compliant end\n");
    717725}
    718726
     
    830838        close(CL);
    831839        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")) {
    833841        pb_system("echo ChangeLog for $pkgdir > $dest/ChangeLog","Empty ChangeLog file created");
    834842    } elsif ($scheme =~ /^cvs/) {
     
    854862}
    855863
    856 sub pb_cms_mod_http {
     864sub pb_cms_mod_htftp {
    857865
    858866my $url = shift;
    859867my $proto = shift;
    860868
    861 $url =~ s/^$proto\+(http[s]*):/$1:/;
    862 pb_log(1,"pb_cms_mod_http returns $url\n");
     869$url =~ s/^$proto\+((ht|f)tp[s]*):/$1:/;
     870pb_log(1,"pb_cms_mod_htftp returns $url\n");
    863871return($url);
    864872}
Note: See TracChangeset for help on using the changeset viewer.