diff options
author | Florent Villard <warly@mandriva.com> | 2006-10-12 09:27:45 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-10-12 09:27:45 +0000 |
commit | 7b3e49b8fd247bd0823d8aa8e514877e01e886a7 (patch) | |
tree | dfabc27faa7099161f739e038dd3ce1ccf7b3a74 /lib | |
parent | c6c75849a40d6b3dd3cdaa14bd443e748822f9c5 (diff) | |
download | mga-youri-core-7b3e49b8fd247bd0823d8aa8e514877e01e886a7.tar mga-youri-core-7b3e49b8fd247bd0823d8aa8e514877e01e886a7.tar.gz mga-youri-core-7b3e49b8fd247bd0823d8aa8e514877e01e886a7.tar.bz2 mga-youri-core-7b3e49b8fd247bd0823d8aa8e514877e01e886a7.tar.xz mga-youri-core-7b3e49b8fd247bd0823d8aa8e514877e01e886a7.zip |
allow to upload i386 arch for non-free; improve the search pattern in upload queue; do not search in testing section by default; add conditional architecture list depending of the target
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Youri/Repository/Mandriva_upload.pm | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index 41d1b8d..fb08e5c 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -19,6 +19,7 @@ use File::Find 'find'; use base qw/Youri::Repository/; use MDV::Distribconf::Build; use SVN::Client; + use constant { PACKAGE_CLASS => 'Youri::Package::URPM', PACKAGE_CHARSET => 'utf8' @@ -26,6 +27,10 @@ use constant { memoize('_get_section', '_get_media_config'); +my %translate_arch = ( + i386 => 'i586', +); + sub _init { my $self = shift; my %options = ( @@ -37,17 +42,23 @@ sub _init { rejected => '', @_ ); - - foreach my $var ('arch', 'upload_state') { + foreach my $var ('upload_state') { $self->{"_$var"} = []; foreach my $value (split ' ', $options{$var}) { push @{$self->{"_$var"}}, $value } } - print "Initializing repository for @{$self->{_arch}}\n"; + print "Initializing repository\n"; foreach my $v ('rejected', 'svn', 'queue', 'noarch', 'install_root', 'upload_root', 'verbose') { $self->{"_$v"} = $options{$v} } + foreach my $target (@{$options{targets}}) { + $self->{$target} = []; + print "Adding $target ($options{$target}{arch})\n" if $self->{_verbose}; + foreach my $value (split ' ', $options{$target}{arch}) { + push @{$self->{_arch}{$target}}, $value + } + } $self } sub get_group_id { @@ -65,10 +76,10 @@ sub _get_media_config { my %media; my $real_target = $target; $real_target =~ s/_force//; - foreach my $arch (@{$self->{_arch}}) { + foreach my $arch (@{$self->{_arch}{$target}}) { my $root = "$self->{_install_root}/$real_target/$arch"; my $distrib = MDV::Distribconf::Build->new($root); - print "Getting media config from $root\n"; + print "Getting media config from $root\n" if $self->{_verbose}; $self->{distrib}{$arch} = $distrib; $distrib->loadtree or die "$root does not seem to be a distribution tree\n"; $distrib->parse_mediacfg; @@ -150,6 +161,14 @@ sub _get_path { "$target/$arch/media/$section" } +sub get_arch { + my ($self, $package, $target, $define) = @_; + my $arch = $package->get_arch(); + if ($arch eq 'noarch') { + $arch = $self->{_noarch} + } + $arch +} sub get_version_path { my ($self, $package, $target, $define) = @_; @@ -214,6 +233,7 @@ sub _get_section { my $media = $self->_get_media_config($target); my $arch = $package->get_arch(); $arch = $self->{_noarch} if $arch eq 'noarch'; + $arch = $translate_arch{$arch} || $arch; if (!$section) { $section = $package->_get_section() @@ -251,6 +271,8 @@ sub _get_section { # a suitable source patten in source directory # a suitable binary patten in binary directory foreach my $m (keys %{$media->{$arch}}) { + # do not use testing by default + next if $m =~ /testing/; next unless $self->get_files( '', @@ -289,10 +311,10 @@ sub get_upload_newer_revisions { print "Looking for package $package revisions for $target in $path (pattern $pattern)\n"; find( sub { - s/([^_]+)_//; - return if ! /$pattern/; - print "Find $_\n"; + s/\d{14}\.[^.]*\.[^.]*\.\d+_//; s/^\@\d+://; + return if ! /^$pattern/; + print "Find $_\n"; push @packages, $File::Find::name if $package->compare_ranges("== $name", "< $_") }, $path); } @@ -328,7 +350,7 @@ sub get_revisions { croak "Not a class method" unless ref $self; print "Looking for package $package revisions for $target\n" if $self->{_verbose} > 0; - my $arch = $package->get_arch(); + my $arch = $define->{arch} || $package->get_arch(); $arch = $self->{_noarch} if $arch eq 'noarch'; my $path = $arch eq 'src' ? "$target/SRPMS/" : "$target/$arch/media"; my $media = $self->_get_media_config($target); |