diff options
author | Pascal Terjan <pterjan@gmail.com> | 2013-09-29 15:19:45 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@gmail.com> | 2013-09-29 15:19:45 +0000 |
commit | 27417c000d46ff83f40ce75f904672734de6e31d (patch) | |
tree | 8124d630f39d0c2ba5ad8c2fad87e2aa7411f758 /lib/Youri | |
parent | b2e0771472af0a8ef65229aae8e8aae3e8186088 (diff) | |
download | mga-youri-submit-27417c000d46ff83f40ce75f904672734de6e31d.tar mga-youri-submit-27417c000d46ff83f40ce75f904672734de6e31d.tar.gz mga-youri-submit-27417c000d46ff83f40ce75f904672734de6e31d.tar.bz2 mga-youri-submit-27417c000d46ff83f40ce75f904672734de6e31d.tar.xz mga-youri-submit-27417c000d46ff83f40ce75f904672734de6e31d.zip |
Initial implementation for automatically rebuilding some dependent packages
Diffstat (limited to 'lib/Youri')
-rw-r--r-- | lib/Youri/Submit/Action/RebuildPackage.pm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/Youri/Submit/Action/RebuildPackage.pm b/lib/Youri/Submit/Action/RebuildPackage.pm new file mode 100644 index 0000000..d121090 --- /dev/null +++ b/lib/Youri/Submit/Action/RebuildPackage.pm @@ -0,0 +1,60 @@ +# $Id$ +package Youri::Submit::Action::RebuildPackage; + +=head1 NAME + +Youri::Submit::Action::RebuildPackage - rebuild packages dependant on this one + +=head1 DESCRIPTION + +This action plugin rebuilds some packages dependant on this one + +=cut + +use warnings; +use strict; +use Carp; +use File::Temp; +use Youri::Package::RPM::Updater; +use base qw/Youri::Submit::Action/; + +sub _init { + my $self = shift; + my %options = (@_); + + $self->{'rules'} = $options{'rules'}; + + return $self; +} + +sub run { + my ($self, $package, $repository, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + $package->is_source or return 1; + my $srpm_name = $package->get_canonical_name; + my @packages = $self->{rules}{$srpm_name} or return 1; + my $svn = $repository->get_svn_url(); + my $updater = Youri::Package::RPM::Updater->new; + my $oldcwd = getcwd(); + foreach my $pkg (@packages) { + my $tmpdir = File::Temp->newdir; + chdir $tmpdir->dirname; + system('svn', 'co', "${svn}/${pkg}/current"); + chdir 'current'; + $updater->update_from_spec(glob('SPECS/*.spec')); + system('svn', 'ci', '-m', "Rebuild for new $srpm_name"); + system("mgarepo submit &"); + chdir $oldcwd; + } +} + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2013, Mageia project + +This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. + +=cut + +1; |