Changeset 1374


Ignore:
Timestamp:
12/22/11 04:14:40 (17 months ago)
Author:
bruno
Message:
  • Start to add CPAN upload support to solve #101 - Needs to be tested now with an official version
Location:
devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1367 r1374  
    551551ossha fedora-9 = sha1 
    552552ossha fedora-10 = sha1 
     553 
     554# 
     555# CPAN upload info (info from cpanupload) 
     556# 
     557cpanpause default = pause.perl.org 
     558cpandir default = incoming 
     559cpansubdir default = 
     560cpanurl default = http://pause.perl.org/pause/authenquery 
     561#cpanuser default = XXX 
     562#cpanpasswd default = YYY 
  • devel/pb-modules/etc/pb.conf.pod

    r1367 r1374  
    2222 
    2323=over 4 
     24 
     25=item B<cpandir> 
     26 
     27 Nature: Optional 
     28 Key: project (as defined in the -p option or PBPROJ environment variable) 
     29 Value: CPAN Pause directory to upload new modules 
     30 Conffile: pb 
     31 Example: cpandir default = incoming 
     32 
     33=item B<cpanpasswd> 
     34 
     35 Nature: Optional 
     36 Key: project (as defined in the -p option or PBPROJ environment variable) 
     37 Value: CPAN Pause user's password 
     38 Conffile: home 
     39 Example: cpanpasswd default = mycomplicatedpwd 
     40 
     41=item B<cpanpause> 
     42 
     43 Nature: Optional 
     44 Key: project (as defined in the -p option or PBPROJ environment variable) 
     45 Value: CPAN Pause site to upload new modules 
     46 Conffile: pb 
     47 Example: cpanpause default = pause.perl.org 
     48 
     49=item B<cpansubdir> 
     50 
     51 Nature: Optional 
     52 Key: project (as defined in the -p option or PBPROJ environment variable) 
     53 Value: CPAN Pause subdirectory in the user's area to upload into 
     54 Conffile: pb 
     55 Example: cpansubdir default = mydir 
     56 
     57=item B<cpanurl> 
     58 
     59 Nature: Optional 
     60 Key: project (as defined in the -p option or PBPROJ environment variable) 
     61 Value: CPAN Pause URL to activate the upload mecanism 
     62 Conffile: pb 
     63 Example: cpanurl default = http://pause.perl.org/pause/authenquery 
     64 
     65=item B<cpanuser> 
     66 
     67 Nature: Optional 
     68 Key: project (as defined in the -p option or PBPROJ environment variable) 
     69 Value: CPAN Pause user 
     70 Conffile: home 
     71 Example: cpanuser default = XXX 
    2472 
    2573=item B<defpkgdir> 
  • devel/pb/bin/pb

    r1367 r1374  
    15561556sub pb_build2ssh { 
    15571557    pb_send2target("Sources"); 
     1558    pb_send2target("CPAN"); 
    15581559} 
    15591560 
     
    16071608        $dir = "websshdir"; 
    16081609        $port = "websshport"; 
     1610    } elsif ($cmt eq "CPAN") { 
     1611        $host = "cpanpause"; 
     1612        $login = ""; 
     1613        $dir = "cpandir"; 
     1614        $port = ""; 
    16091615    } 
    16101616    my $cmd = ""; 
    16111617    my $src = ""; 
     1618    my $cpanpkg = 0; 
    16121619    my $pbos; 
    16131620 
     
    16421649                $src = "$src $ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz" 
    16431650            } 
     1651 
     1652            # Do we have one perl package 
     1653            my @nametype = pb_conf_get_if("namingtype"); 
     1654            my $type = $nametype[0]->{$pbpkg}; 
     1655            if ((defined $type) && ($type eq "perl")) { 
     1656                $cpanpkg = 1; 
     1657            } 
    16441658        } 
    16451659        # Adds conf file for availability of conf elements 
    16461660        pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"); 
     1661    } 
     1662    my ($rbsconf,$testver,$delivery) = pb_conf_get_if($conf,"testver","delivery"); 
     1663    if ($cmt =~ /CPAN/) { 
     1664        # Do not deliver on Pause if this is a test version 
     1665        return if ($testver =~ /true/); 
     1666        # Do not deliver on Pause if this is not a perl package 
     1667        return if ($cpanpkg == 0); 
    16471668    } 
    16481669 
     
    16531674    } elsif ($cmt =~ /(V[EM]|RM)test/) { 
    16541675        $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $ENV{'PBDESTDIR'}/pbscript.$$ $ENV{'PBDESTDIR'}/pbtest"; 
    1655     } elsif (($cmt eq "Announce") || ($cmt eq "Web")) { 
     1676    } elsif (($cmt eq "Announce") || ($cmt eq "Web") || ($cmt eq "CPAN")) { 
    16561677        $src="$src $ENV{'PBTMP'}/pbscript"; 
    16571678    } elsif ($cmt eq "Packages") { 
     
    16631684        $src = "$src $ENV{'PBBUILDDIR'}/pbscript.$$"; 
    16641685    } 
    1665     if (($cmt eq "Sources") || ($cmt eq "Packages")) { 
     1686    if (($cmt eq "Sources") || ($cmt eq "Packages") || ($cmt eq "CPAN")) { 
    16661687        my ($pbpackager) = pb_conf_get("pbpackager"); 
    16671688        $ENV{'PBPACKAGER'} = $pbpackager->{$ENV{'PBPROJ'}}; 
     
    16831704    my ($sshhost,$sshlogin,$sshdir,$sshport) = pb_conf_get($host,$login,$dir,$port); 
    16841705    # Not mandatory... 
    1685     my ($rbsconf,$testver,$delivery) = pb_conf_get_if($conf,"testver","delivery"); 
    16861706    $delivery->{$ENV{'PBPROJ'}} = "" if (not defined $delivery->{$ENV{'PBPROJ'}}); 
    16871707    my ($vtmout,$vepath); 
     
    17191739    if (($cmt eq "Sources") || ($cmt =~ /(V[EM]|RM)Script/)) { 
    17201740        $tdir = "$remdir/$delivery->{$ENV{'PBPROJ'}}/src"; 
     1741    } elsif ($cmt eq "CPAN") { 
     1742        $tdir = "$remdir"; 
    17211743    } elsif ($cmt =~ /(V[EM]|RM)(build|test)/) { 
    17221744        $tdir = $remdir."/$ENV{'PBPROJ'}/delivery"; 
     
    19381960    } 
    19391961 
    1940     # ssh communication if not VE 
     1962    # ssh communication if not VE or CPAN 
    19411963    # should use a hash instead... 
    19421964    my ($shcmd,$cpcmd,$cptarget,$cp2target); 
    1943     if ($cmt !~ /^VE/) { 
    1944         my $keyfile = pb_ssh_get(0); 
    1945         $shcmd = "ssh -i $keyfile -q -o UserKnownHostsFile=/dev/null -p $nport $mac"; 
    1946         $cpcmd = "scp -i $keyfile -p -o UserKnownHostsFile=/dev/null -P $nport"; 
    1947         $cptarget = "$mac:$tdir"; 
    1948         if ($cmt =~ /^(V|R)Mbuild/) { 
    1949             $cp2target = "$mac:$bdir"; 
    1950         } 
    1951     } else { 
     1965    if ($cmt =~ /^VE/) { 
    19521966        my $tp = $vepath->{$ENV{'PBPROJ'}}; 
    19531967        my $tpdir = "$tp/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}"; 
     
    19741988        } 
    19751989        pb_log(2,"On VE using $cptarget as target dir to copy to\n"); 
    1976     } 
    1977  
     1990    } elsif ($cmt =~ /^CPAN/) { 
     1991        my $ftpput = ps_check_req("ncftpput",1); 
     1992        my $ftpget = ps_check_req("wget",1); 
     1993        my ($cpanuser,$cpanpasswd) = pb_conf_get("cpanuser","cpanpasswd"); 
     1994        my ($cpansubdir) = pb_conf_get_if("cpansubdir"); 
     1995        $shcmd = "$ftpget --post-data \'HIDDENNAME=".$cpanuser; 
     1996        $shcmd .= "&user=".$cpanuser; 
     1997        $shcmd .= "&password=".$cpanpasswd; 
     1998        $shcmd .= "&SUBMIT_pause99_add_uri_upload=\"Upload the checked files\""; 
     1999        $shcmd .= "&pause99_add_uri_subdirtext=".$cpansubdir if (defined $cpansubdir); 
     2000        foreach my $s (split(/ /,$src)) { 
     2001            $shcmd .= "&pause99_add_uri_upload=".basename($s); 
     2002        } 
     2003        $shcmd .= "'"; 
     2004        $cpcmd = "$ftpput $host $dir"; 
     2005        $cptarget = "CPAN"; 
     2006    } else { 
     2007        my $keyfile = pb_ssh_get(0); 
     2008        my $sshcmd = ps_check_req("ssh",1); 
     2009        my $scpcmd = ps_check_req("scp",1); 
     2010        $shcmd = "$sshcmd -i $keyfile -q -o UserKnownHostsFile=/dev/null -p $nport $mac"; 
     2011        $cpcmd = "$scpcmd -i $keyfile -p -o UserKnownHostsFile=/dev/null -P $nport"; 
     2012        $cptarget = "$mac:$tdir"; 
     2013        if ($cmt =~ /^(V|R)Mbuild/) { 
     2014            $cp2target = "$mac:$bdir"; 
     2015        } 
     2016    } 
     2017     
    19782018    my $logres = ""; 
    19792019    # Do not touch when just announcing 
    1980     if ($cmt ne "Announce") { 
     2020    if (($cmt ne "Announce") && ($cmt ne "CPAN")) { 
    19812021        pb_system("$shcmd \"mkdir -p $tdir ; cd $tdir ; echo \'for i in $basesrc; do if [ -f \$i ]; then rm -f \$i; fi; done\ ; $cmd' | bash\"","Preparing $tdir on $cptarget"); 
    19822022    } else { 
     
    19982038    } 
    19992039 
    2000     pb_system("$shcmd \"echo \'cd $tdir ; if [ -x $pbscript ]; then ./$pbscript; fi ; rm -f ./$pbscript\' | bash\"","Executing pbscript on $cptarget if needed","verbose"); 
     2040    # It's already ready for CPAN 
     2041    if ($cmt !~ /^CPAN/) { 
     2042        $shcmd .= "\"echo \'cd $tdir ; if [ -x $pbscript ]; then ./$pbscript; fi ; rm -f ./$pbscript\' | bash\""; 
     2043    } 
     2044    pb_system("$shcmd","Executing pbscript on $cptarget if needed","verbose"); 
    20012045    if ($cmt =~ /^(V[EM]|RM)build/) { 
    20022046        # Get back info on pkg produced, compute their name and get them from the VM/RM 
Note: See TracChangeset for help on using the changeset viewer.