Changeset 1392


Ignore:
Timestamp:
Jan 24, 2012, 4:00:44 PM (7 years ago)
Author:
bruno
Message:
  • Adds a cleanssh target to purge test versiosn on the remote repository
Location:
devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Env.pm

    r1386 r1392  
    308308#
    309309
    310 if (($action =~ /^cms2/) || ($action =~ /^sbx2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^checkssh/)) {
     310if (($action =~ /^cms2/) || ($action =~ /^sbx2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^checkssh/) || ($action =~ /^cleanssh/)) {
    311311
    312312    #
  • devel/pb/bin/pb

    r1388 r1392  
    381381
    382382Purge the build and delivery directories related to the current project
     383
     384=back
     385
     386=item B<cleanssh>
     387
     388Purge the ssh server of its packages (only for testver and test packages)
    383389
    384390=back
     
    707713
    708714    pb_announce("Announce");
     715} elsif ($action =~ /^cleanssh$/) {
     716    pb_announce("Clean");
    709717} elsif ($action =~ /^checkssh$/) {
    710718    pb_announce("Check");
     
    32293237    # Get all required parameters
    32303238    my ($pbpackager,$pbrepo,$pbml,$pbsmtp) = pb_conf_get("pbpackager","pbrepo","pbml","pbsmtp");
    3231     my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag");
     3239    my ($pkgv, $pkgt, $testver) = pb_conf_get_if("pkgver","pkgtag","testver");
     3240    if (((not defined $testver) || (not defined $testver->{$ENV{'PBPROJ'}}) || ($testver->{$ENV{'PBPROJ'}} !~ /true/i)) && ($antype eq "Clean")) {
     3241        # We just clean for test versions
     3242        pb_log(0,"Unable to clean SSH repository for non testver version\n");
     3243        return;
     3244    }
    32323245    my $pkg = pb_cms_get_pkg($defpkgdir,$extpkgdir);
    32333246    my @pkgs = @$pkg;
     
    32483261    # Command to find packages on repo
    32493262    my $findstr = "find ".join(" ",keys %dl)." ";
     3263    my $srcstr = "";
    32503264    # Generated announce files
    32513265    my @files;
     
    32713285        my $pbrealpkgrpm = pb_cms_get_real_pkg($pbpkg,"rpm");
    32723286        my $pbrealpkgdeb = pb_cms_get_real_pkg($pbpkg,"deb");
    3273         $findstr .= "-name \'$pbrealpkgrpm-$pbver-$pbtag\.*.rpm\' -o -name \'$pbrealpkgdeb"."_$pbver*\.deb\' -o -name \'$pbrealpkg-$pbver*\.ebuild\' -o -name \'$pbrealpkg-$pbver*\.pkg\' -o -name \'$pbrealpkg-$pbver*\.sd\' ";
     3287        if ($antype eq "Clean") {
     3288            $pbtag = "0.[0-9][0-9]*";
     3289            $findstr .= "-name \'$pbrealpkgrpm-$pbver-$pbtag\.*.rpm\' -o -name \'$pbrealpkgrpm-debug-$pbver-$pbtag\.*.rpm\' -o -name \'$pbrealpkgdeb"."_$pbver-$pbtag"."_*\.deb\' -o -name \'$pbrealpkgdeb"."_$pbver-$pbtag.dsc\' -o -name \'$pbrealpkgdeb"."_$pbver-$pbtag.tar.gz\' -o -name \'$pbrealpkg-$pbver"."_p[0-9]*\.ebuild\' -o -name \'$pbrealpkg-$pbver-$pbtag*\.pkg\' -o -name \'$pbrealpkg-$pbver-$pbtag*\.sd\' ";
     3290        } else {
     3291            $findstr .= "-name \'$pbrealpkgrpm-$pbver-$pbtag\.*.rpm\' -o -name \'$pbrealpkgdeb"."_$pbver*\.deb\' -o -name \'$pbrealpkg-$pbver*\.ebuild\' -o -name \'$pbrealpkg-$pbver*\.pkg\' -o -name \'$pbrealpkg-$pbver*\.sd\' ";
     3292            $srcstr .= "src/$pbrealpkg-$pbver.tar.gz src/$pbrealpkg-$pbver.pbconf.tar.gz";
     3293        }
    32743294
    32753295        if ($antype eq "Announce") {
     
    32973317            close(OUT);
    32983318            push(@files,"$ENV{'PBTMP'}/$pbpkg.ann");
    3299         } else {
     3319        } elsif ($antype eq "Check") {
    33003320            # For the check we also build the theoritical complete list we should get
    33013321            foreach my $d (split(/,/,$distrolist)) {
     
    33183338        pb_log(2,"theorlist : ".Dumper(%theorlist)."\n");
    33193339    }
    3320     $findstr .= " | grep -Ev \'src.rpm\'" if ($antype eq "Announce");
     3340    if ($antype eq "Announce") {
     3341        $findstr .= " | grep -Ev \'src.rpm\'";
     3342    } elsif ($antype eq "Clean") {
     3343        $findstr .= " | xargs rm -f -v $srcstr ";
     3344    }
    33213345
    33223346    # Prepare the command to run and execute it
    33233347    open(PBS,"> $ENV{'PBTMP'}/pbscript") || die "Unable to create $ENV{'PBTMP'}/pbscript";
     3348    print PBS "#!/bin/bash\n";
    33243349    print PBS "set -x\n" if ($pbdebug gt 1);
    33253350    print PBS "$findstr | sort 2> /dev/null\n";
     
    33273352    chmod 0755,"$ENV{'PBTMP'}/pbscript";
    33283353    pb_send2target("Announce");
     3354
     3355    # Nothing more for th cleanssh case
     3356    return if ($antype eq "Clean");
    33293357
    33303358    my $sl = "Project $ENV{'PBPROJ'} version $ENV{'PBPROJVER'} is now available";
Note: See TracChangeset for help on using the changeset viewer.