diff options
author | Pascal Terjan <pterjan@mageia.org> | 2011-05-10 20:41:12 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2011-05-10 20:41:12 +0000 |
commit | 352fd710a9a5154fc6d405992bc895cd15f48b3f (patch) | |
tree | 1080f2e808e3ffebc74ce9c413397cf3fa8961b6 | |
parent | 181cdd2c3af4cf05e4548160746eb0bf4082c088 (diff) | |
download | mga-youri-submit-352fd710a9a5154fc6d405992bc895cd15f48b3f.tar mga-youri-submit-352fd710a9a5154fc6d405992bc895cd15f48b3f.tar.gz mga-youri-submit-352fd710a9a5154fc6d405992bc895cd15f48b3f.tar.bz2 mga-youri-submit-352fd710a9a5154fc6d405992bc895cd15f48b3f.tar.xz mga-youri-submit-352fd710a9a5154fc6d405992bc895cd15f48b3f.zip |
- Get rid of Youri::Submit::Pre, only one is defined and we don't use it
-rwxr-xr-x | bin/youri-submit.in | 56 | ||||
-rw-r--r-- | lib/Youri/Submit/Pre/Rsync.pm | 87 |
2 files changed, 1 insertions, 142 deletions
diff --git a/bin/youri-submit.in b/bin/youri-submit.in index 9892d0e..a788e15 100755 --- a/bin/youri-submit.in +++ b/bin/youri-submit.in @@ -20,7 +20,6 @@ youri-submit --help [category] [item] Options: --config <file> use file <file> as config file - --skip-pre <pre> skip pre <pre> --skip-check <check> skip check <check> --skip-action <action> skip action <action> --skip-post <post> skip post <post> @@ -48,10 +47,6 @@ passed to a list of action plugins, depending also on given upload target. Use given file as configuration, instead of normal one. -=item B<--skip-pre> I<id> - -Skip pre transaction plugin with given identity - =item B<--skip-check> I<id> Skip check plugin with given identity. @@ -178,7 +173,6 @@ my $config = Youri::Config->new( 'test' => '|t!', 'list' => '|l!', 'config' => '=s', - 'skip-prei' => '=s@', 'skip-post' => '=s@', 'skip-reject' => '=s@', }, @@ -283,58 +277,10 @@ eval { }; die "Failed to create repository: $@\n" if $@; -# perfrom pre action -my @errors; -my $pre_packages = []; -my $skip_pres = $config->get_arg('skip-pre'); -my %skip_pres = $skip_pres ? map { $_ => 1 } @{$skip_pres} : (); -foreach my $id (@{$target_conf->{pres}}) { - next if $skip_pres{$id}; - print "Creating pre $id\n" if $verbose; - my $pre; - my $pre_conf = $config->get_param('pres')->{$id}; - - if (!$pre_conf) { - print STDERR "No such pre $id, skipping\n"; - next; - } - eval { - $pre = create_instance( - 'Youri::Submit::Pre', - $pre_conf, - { - id => $id, - test => $test, - verbose => $verbose > 0 ? $verbose - 1 : 0, - } - ); - }; - if ($@) { - print STDERR "Failed to create pre $id: $@\n"; - } else { - print "running pre $id\n" if $verbose; - my @err = $pre->run( - $pre_packages, - $repository, - $target, - $config->get_arg('define') - ); - push(@errors, @err) if $err[0]; - } -} - -if (@errors) { - print "Pre-submission errors, aborting:\n"; - foreach my $error (@errors) { - print " - $error\n"; - } - exit(1) -} - # create packages group my $group_error; my @packages_group; -foreach my $group ([ map { { section => "", file => $_ } } @ARGV ], @$pre_packages) { +foreach my $group ([ map { { section => "", file => $_ } } @ARGV ]) { my @packages; foreach my $opt (@$group) { print "Preparing upload for $opt->{file} in $opt->{section}\n" if $verbose; diff --git a/lib/Youri/Submit/Pre/Rsync.pm b/lib/Youri/Submit/Pre/Rsync.pm deleted file mode 100644 index accaace..0000000 --- a/lib/Youri/Submit/Pre/Rsync.pm +++ /dev/null @@ -1,87 +0,0 @@ -# $Id: Rsync.pm 267280 2010-04-01 19:57:53Z bogdano $ -package Youri::Submit::Pre::Rsync; - -=head1 NAME - -Youri::Submit::Pre::Rsync - Old revisions archiving - -=head1 DESCRIPTION - -This action plugin ensures archiving of old package revisions. - -=cut - -use warnings; -use strict; -use Carp; -use base qw/Youri::Submit::Pre/; - -sub _init { - my $self = shift; - my %options = ( - user => '', - host => '', - source => '', - destination => '', - @_ - ); - - foreach my $var ('user', 'host', 'source', 'destination') { - $self->{"_$var"} = $options{$var}; - } -} - -sub run { - my ($self, $pre_packages, $repository, $target, $define) = @_; - croak "Not a class method" unless ref $self; - - if (system("rsync --exclude '*.new' --exclude '.*' --remove-sent-files -avlPHe 'ssh -xc arcfour' $self->{_user}\@$self->{_host}:$self->{_source}/$target/ $self->{_destination}/$target/")) { - $self->{_error} = "Rsync command failed ($!)"; - return - } - my $queue = "$self->{_destination}/$target"; - $self->{_error} = "Reading queue directory failed"; - # now get the packages downloaded - my %packages; - opendir my $queuedh, "$self->{_destination}/$target/" or return "Could not open $self->{_destination}/$target"; - opendir my $targetdh, $queue or return "Could not open $queue"; - my $idx; - foreach my $media (readdir $targetdh) { - $media =~ /^\.{1,2}$/ and next; - print "$target - $media\n"; - if (-d "$queue/$media") { - opendir my $submediadh, "$queue/$media" or return "Could not open $queue/$media"; - foreach my $submedia (readdir $submediadh) { - $submedia =~ /^\.{1,2}$/ and next; - print "$target - $media - $submedia\n"; - opendir my $rpmdh, "$queue/$media/$submedia" or return "Could not open $queue/$media/$submedia"; - foreach my $rpm (readdir $rpmdh) { - $rpm =~ /^\.{1,2}$/ and next; - print "$target - $media - $submedia : $rpm\n"; - my $file = "$queue/$media/$submedia/$rpm"; - $file =~ s/\/+/\//g; - if ($rpm =~ /^(\d{14}\.\w+\.\w+\.\d+)_.*\.rpm$/) { - push @{$packages{$1}{rpms}}, { section => "$media/$submedia", file => $file }; - } elsif ($rpm =~ /\.rpm$/) { - $idx++; - push @{$packages{"independant_$idx"}{rpms}}, { section => "$media/$submedia", file => $file } - } - } - } - } - } - foreach my $key (keys %packages) { - push @$pre_packages, $packages{$key}{rpms} - } - return -} - -=head1 COPYRIGHT AND LICENSE - -Copyright (C) 2002-2006, Mandriva <warly@mandriva.com> - -This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - -=cut - -1; |