diff options
-rw-r--r-- | lib/Youri/Repository/Mandriva_upload.pm | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index e334f39..5f48a10 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -34,6 +34,7 @@ sub _init { test => 0, # test mode verbose => 0, # verbose mode queue => '', + rejected => '', @_ ); @@ -44,7 +45,7 @@ sub _init { } } print "Initializing repository for @{$self->{_arch}}\n"; - foreach my $v ('svn', 'queue', 'noarch', 'install_root', 'upload_root', 'verbose') { + foreach my $v ('rejected', 'svn', 'queue', 'noarch', 'install_root', 'upload_root', 'verbose') { $self->{"_$v"} = $options{$v} } $self @@ -78,7 +79,7 @@ sub _get_media_config { my $path = $distrib->getfullpath($media, 'path'); if (!$debug_for && !$rpms) { if (-d $path) { - print "MEDIA defining $media in $path\n"; + print "MEDIA defining $media in $path\n" if $self->{_verbose}; $media{$arch}{$media} = $path } else { print "ERROR $path does not exist for media $media on $arch\n" @@ -87,7 +88,7 @@ sub _get_media_config { if ($rpms) { my ($media) = split ' ', $rpms; if (-d $path) { - print "MEDIA defining SOURCE media for $media in $path\n"; + print "MEDIA defining SOURCE media for $media in $path\n" if $self->{_verbose}; $media{src}{$media} = $path } else { print "ERROR $path does not exist for source media $media on $arch\n" @@ -115,7 +116,7 @@ sub get_upload_dir { "/$self->{_queue}/$target/" . $self->_get_section($package, $target, $define) . '/' . - get_group_id($define->{user}) + ($define->{prefix} ? '' : get_group_id($define->{user})) } sub get_install_path { @@ -130,12 +131,24 @@ sub get_archive_path { return $self->_get_path($package, $target, $define); } +sub get_reject_path { + my ($self, $package, $target, $define) = @_; + + return $self->{_rejected}; +} + + sub _get_path { my ($self, $package, $target, $define) = @_; my $section = $self->_get_section($package, $target, $define); - - $section + my $arch = $package->get_arch(); + if ($arch eq 'noarch') { + $arch = $self->{_noarch} + } elsif ($arch eq 'src') { + return "$target/SRPMS/$section" + } + "$target/$arch/media/$section" } @@ -191,13 +204,22 @@ sub _get_section { my $section = $define->{section}; my $media = $self->_get_media_config($target); my $arch = $package->get_arch(); + $arch = $self->{_noarch} if $arch eq 'noarch'; + + if (!$section) { + $section = $package->_get_section() + } + if ($package->is_debug()) { + $section = "${debug}_$section" + } # if section is provided, check this one is defined if ($section) { + print "Using requested section $section\n"; if ($media->{$arch}{$section}) { return $section } else { - die "FATAL youri: unknown section $section for target $target" + die "FATAL youri: unknown section $section for target $target for arch $arch" } } # try to find section automatically @@ -290,6 +312,38 @@ sub get_svn_url { $self->{_svn} } +sub get_revisions { + my ($self, $package, $target, $define, $filter) = @_; + 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(); + $arch = $self->{_noarch} if $arch eq 'noarch'; + my $path = $arch eq 'src' ? "$target/SRPMS/" : "$target/$arch/media"; + my $media = $self->_get_media_config($target); + my @packages; + foreach my $media (keys %{$media->{$arch}}) { + push @packages, + map { $self->get_package_class()->new(file => $_) } + $self->get_files( + $self->{_install_root}, + "$path/$media", + $self->get_package_class()->get_pattern( + $package->get_name(), + undef, + undef, + $package->get_arch(), + ) + ); + } + + @packages = grep { $filter->($_) } @packages if $filter; + + return + sort { $b->compare($a) } # sort by revision order + @packages; +} + # 20060801 warly # # Upload steps |