diff options
Diffstat (limited to 'lib/Youri/Submit/Action')
-rw-r--r-- | lib/Youri/Submit/Action/Archive.pm | 11 | ||||
-rw-r--r-- | lib/Youri/Submit/Action/Install.pm | 3 | ||||
-rw-r--r-- | lib/Youri/Submit/Action/Mail.pm | 17 | ||||
-rw-r--r-- | lib/Youri/Submit/Action/Sign.pm | 12 | ||||
-rw-r--r-- | lib/Youri/Submit/Action/UpdateMaintDb.pm | 80 |
5 files changed, 103 insertions, 20 deletions
diff --git a/lib/Youri/Submit/Action/Archive.pm b/lib/Youri/Submit/Action/Archive.pm index 98ff37c..41a8b8f 100644 --- a/lib/Youri/Submit/Action/Archive.pm +++ b/lib/Youri/Submit/Action/Archive.pm @@ -46,17 +46,6 @@ sub run { ) { my $file = $replaced_package->get_file(); - # trap for debugging bug 34999 - if ($file =~ /\/[\d.]+\/(main\/updates|.*\/release)/) { - my $bugmsg = "BUG#34999 WARNING: trying to remove from a release: $file\n"; - open(BUG34999LOG, '>>', "/home/mandrake/bug34999.log"); - print $bugmsg; - print BUG34999LOG localtime().": ".$bugmsg; - close BUG34999LOG; - - next; - } - my ($rep_section, $rep_main_section) = $file =~ m,$path/(([^/]+)/.*)/[^/]+.rpm,; # We do accept duplicate version for other submedia of the same main media section print "(path '$path') file '$file' section '$rep_section' main_section '$rep_main_section'\n" if $self->{_verbose}; diff --git a/lib/Youri/Submit/Action/Install.pm b/lib/Youri/Submit/Action/Install.pm index 83d0149..80e8de2 100644 --- a/lib/Youri/Submit/Action/Install.pm +++ b/lib/Youri/Submit/Action/Install.pm @@ -14,6 +14,7 @@ This action plugin ensures installation of new package revisions. use warnings; use strict; use Carp; +use File::Basename; use base qw/Youri::Submit::Action/; sub _init { @@ -33,7 +34,7 @@ sub run { croak "Not a class method" unless ref $self; my $file = $package->as_file(); - my $rpm = $package->get_file_name(); + my $rpm = basename($package->get_file_name()); my $dest = $repository->get_install_dir($package, $target, $define); # FIXME remove prefix this should be done by a function diff --git a/lib/Youri/Submit/Action/Mail.pm b/lib/Youri/Submit/Action/Mail.pm index c9bbcbe..02e36cd 100644 --- a/lib/Youri/Submit/Action/Mail.pm +++ b/lib/Youri/Submit/Action/Mail.pm @@ -110,13 +110,24 @@ sub get_content { my ($self, $package, $repository, $target, $define) = @_; croak "Not a class method" unless ref $self; - my $information = $package->get_information(); + my $information = $package->as_formated_string(<<EOF); +Name : %-27{NAME} Relocations: %|PREFIXES?{[%{PREFIXES} ]}:{(not relocatable)}| +Version : %-27{VERSION} Vendor: %{VENDOR} +Release : %-27{RELEASE} Build Date: %{BUILDTIME:date} +Install Date: %|INSTALLTIME?{%-27{INSTALLTIME:date}}:{(not installed) }| Build Host: %{BUILDHOST} +Group : %-27{GROUP} Source RPM: %{SOURCERPM} +Size : %-27{SIZE}%|LICENSE?{ License: %{LICENSE}}| +Signature : %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}| +%|PACKAGER?{Packager : %{PACKAGER}\n}|%|URL?{URL : %{URL}\n}|Summary : %{SUMMARY} +Description :\n%{DESCRIPTION} +EOF + my $last_change = $package->get_last_change(); return $information . "\n" . - $last_change->[Youri::Package::CHANGE_AUTHOR] . ":\n" . - $last_change->[Youri::Package::CHANGE_TEXT]; + $last_change->get_author() . ":\n" . + $last_change->get_raw_text(); } diff --git a/lib/Youri/Submit/Action/Sign.pm b/lib/Youri/Submit/Action/Sign.pm index f016351..d9580b8 100644 --- a/lib/Youri/Submit/Action/Sign.pm +++ b/lib/Youri/Submit/Action/Sign.pm @@ -19,6 +19,8 @@ use base qw/Youri::Submit::Action/; sub _init { my $self = shift; my %options = ( + signuser => 'signbot', + signscript => '/usr/bin/mga-signpackage', name => '', path => $ENV{HOME} . '/.gnupg', passphrase => '', @@ -32,17 +34,17 @@ sub _init { $self->{_name} = $options{name}; $self->{_path} = $options{path}; $self->{_passphrase} = $options{passphrase}; + $self->{_signuser} = $options{signuser}; + $self->{_signscript} = $options{signscript}; } sub run { my ($self, $package, $repository, $target, $define) = @_; croak "Not a class method" unless ref $self; - $package->sign( - $self->{_name}, - $self->{_path}, - $self->{_passphrase} - ) unless $self->{_test}; + if (! $self->{_test}) { + system('/usr/bin/sudo', '-u', $self->{_signuser}, $self->{_signscript}, $package->{_file}, $self->{_name}, $self->{_path}) == 0; + } } =head1 COPYRIGHT AND LICENSE diff --git a/lib/Youri/Submit/Action/UpdateMaintDb.pm b/lib/Youri/Submit/Action/UpdateMaintDb.pm new file mode 100644 index 0000000..10eed21 --- /dev/null +++ b/lib/Youri/Submit/Action/UpdateMaintDb.pm @@ -0,0 +1,80 @@ +# $Id$ +package Youri::Submit::Action::UpdateMaintDb; + +=head1 NAME + +Youri::Submit::Action::UpdateMaintDb - Mageia maintainers database updater + +=head1 DESCRIPTION + +This action plugin HTTP POSTs to package maintainers database to notify +of the action. See <http://maintdb.mageia.org/>. + +=cut + +use warnings; +use strict; +use Carp; +use base qw/Youri::Submit::Action/; + +use HTTP::Request::Common qw(POST); +use LWP::UserAgent; + +sub _init { + my $self = shift; + my %options = ( + maintdb_url => '', + maintdb_key => '', + @_ + ); + + $self->{_maintdb_url} = $options{maintdb_url}; + $self->{_maintdb_key} = $options{maintdb_key}; + + return $self; +} + +sub run { + my ($self, $package, $repository, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + # only SRPMs matter + return unless $package->is_source(); + + unless ($self->{_test}) { + my $pkg_name = $package->get_name(); + my $pkg_media = $repository->_get_main_section($package, $target, $define); + my $pkg_commiter = $define->{user}; + + my $ua = LWP::UserAgent->new; + $ua->agent('Youri/0.1 ' . $ua->agent); + + my $req = POST $self->{_maintdb_url}, + [ + key => $self->{_maintdb_key}, + from => "youri", + package => $pkg_name, + media => $pkg_media, + uid => $pkg_commiter + ]; + + my $res = $ua->request($req); + + if ($res->is_success) { + print "Updated package maintainers DB for '$pkg_name', '$pkg_media', '$pkg_commiter'.\n" if $self->{_verbose}; + } else { + print "ERROR: POST failed to ".$self->{_maintdb_url}." for '$pkg_name', '$pkg_media', '$pkg_commiter'.\n"; + } + } +} + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2007, Mandriva +Copyright (C) 2011, Mageia.Org + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; |