Changeset 88 for devel/pb/bin/pb


Ignore:
Timestamp:
Sep 3, 2007, 4:36:22 PM (12 years ago)
Author:
bruno
Message:

Prepare for new actions on delivery on SSH

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r87 r88  
    2929use ProjectBuilder::Changelog qw (pb_changelog);
    3030use ProjectBuilder::Version qw (pb_version_init);
    31 use ProjectBuilder::Base qw (pb_conf_read pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb);
     31use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb);
    3232
    3333my %opts;                   # CLI Options
     
    9999    pb_cms2build();
    100100    pb_build2pkg();
    101 } elsif ($action =~ /^build2ftp$/) {
    102     pb_build2ftp();
    103 } elsif ($action =~ /^pkg2ftp$/) {
    104     pb_pkg2ftp();
     101} elsif ($action =~ /^build2ssh$/) {
     102    pb_build2ssh();
     103} elsif ($action =~ /^pkg2ssh$/) {
     104    pb_pkg2ssh();
    105105} else {
    106106    print $LOG "'$action' is not available\n";
     
    263263        my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
    264264        $pkg = { } if (not defined $pkg);
    265         my %pkg = %$pkg;
    266         if ((not defined $pkg{$pbpkg}) || ($pkg{$pbpkg} ne "$pbver-$pbtag")) {
    267             $pkg{$pbpkg} = "$pbver-$pbtag";
    268         }
    269 
    270         print $LOG "DEBUG pkg: ".Dumper(\%pkg)."\n" if ($debug >= 1);
     265        if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) {
     266            $pkg->{$pbpkg} = "$pbver-$pbtag";
     267        }
     268
     269        print $LOG "DEBUG pkg: ".Dumper($pkg)."\n" if ($debug >= 1);
    271270        open(PKG,"> $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";
    272         foreach my $p (keys %pkg) {
    273             print PKG "pbpkg $p = $pkg{$p}\n";
     271        foreach my $p (keys %$pkg) {
     272            print PKG "pbpkg $p = $pkg->{$p}\n";
    274273        }
    275274        close(PKG);
     
    290289    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
    291290    $pkg = { } if (not defined $pkg);
    292     my %pkg = %$pkg;
    293291
    294292    chdir "$ENV{'PBBUILDDIR'}";
    295293    foreach my $pbpkg (@pkgs) {
    296         my $vertag = $pkg{$pbpkg};
     294        my $vertag = $pkg->{$pbpkg};
    297295        # get the version of the current package - maybe different
    298296        ($pbver,$pbtag) = split(/-/,$vertag);
     
    337335}
    338336
    339 sub pb_build2ftp {
     337sub pb_build2ssh {
     338
     339    my @src;
    340340
    341341    # Get list of packages to build
     
    350350    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
    351351    $pkg = { } if (not defined $pkg);
    352     my %pkg = %$pkg;
    353352
    354353    chdir "$ENV{'PBBUILDDIR'}";
    355354    foreach my $pbpkg (@pkgs) {
    356         my $vertag = $pkg{$pbpkg};
     355        my $vertag = $pkg->{$pbpkg};
    357356        # get the version of the current package - maybe different
    358357        ($pbver,$pbtag) = split(/-/,$vertag);
     
    360359        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
    361360        print $LOG "Source file: $src\n" if ($debug >= 0);
    362 
     361        push @src, $src;
    363362    }
    364 }
    365 sub pb_pkg2ftp {
     363    my $pt = pb_conf_get("sshhost", "sshlogin", "sshdir");
     364    my ($sshhost,$sshlogin,$sshdir) = @$pt;
     365    my $mac = "$sshlogin->{$ENV{'PBPROJ'}}\@$sshhost->{$ENV{'PBPROJ'}}";
     366    my $dir = "$sshdir->{$ENV{'PBPROJ'}}/src";
     367    pb_system("ssh -q $mac \"mkdir -p $dir","Preparing $dir on $mac");
     368    pb_system("scp -p ".join(' ',@src)." $mac:$dir","Source delivery in $dir on $mac");
     369}
     370
     371sub pb_pkg2ssh {
    366372
    367373    # Get list of packages to build
     
    376382    my $pkg = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg");
    377383    $pkg = { } if (not defined $pkg);
    378     my %pkg = %$pkg;
    379384
    380385    chdir "$ENV{'PBBUILDDIR'}";
    381386    foreach my $pbpkg (@pkgs) {
    382         my $vertag = $pkg{$pbpkg};
     387        my $vertag = $pkg->{$pbpkg};
    383388        # get the version of the current package - maybe different
    384389        ($pbver,$pbtag) = split(/-/,$vertag);
Note: See TracChangeset for help on using the changeset viewer.