From 16bf07533c7575c7294f20f8ac39324c4b200993 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Wed, 18 Oct 2006 12:48:03 +0000 Subject: now defined is splitted in $user_context and $app_context --- lib/Youri/Repository/Mandriva_upload.pm | 59 ++++++++++++++++----------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index fb08e5c..076c573 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -118,40 +118,40 @@ sub get_package_charset { } sub get_upload_dir { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; croak "Not a class method" unless ref $self; my $arch = $package->get_arch(); return $self->{_upload_root} . "/$self->{_queue}/$target/" . - _get_section($self, $package, $target, $define) . + _get_section($self, $package, $target, $user_context, $app_context) . '/' . - ($define->{prefix} ? '' : get_group_id($define->{user})) + ($user_context->{prefix} ? '' : get_group_id($user_context->{user})) } sub get_install_path { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; - return $self->_get_path($package, $target, $define); + return $self->_get_path($package, $target, $user_context, $app_context); } sub get_archive_path { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; - return $self->_get_path($package, $target, $define); + return $self->_get_path($package, $target, $user_context, $app_context); } sub get_reject_path { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; return $self->{_rejected}; } sub _get_path { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; - my $section = $self->_get_section($package, $target, $define); + my $section = $self->_get_section($package, $target, $user_context, $app_context); my $arch = $package->get_arch(); if ($arch eq 'noarch') { $arch = $self->{_noarch} @@ -162,7 +162,7 @@ sub _get_path { } sub get_arch { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; my $arch = $package->get_arch(); if ($arch eq 'noarch') { $arch = $self->{_noarch} @@ -171,25 +171,25 @@ sub get_arch { } sub get_version_path { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; - my $section = $self->_get_section($package, $target, $define); + my $section = $self->_get_section($package, $target, $user_context, $app_context); return "$self->{_module}/$section"; } -=head2 get_replaced_packages($package, $target, $define) +=head2 get_replaced_packages($package, $target, $user_context, $app_context) Overrides parent method to add libified packages. =cut sub get_replaced_packages { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; croak "Not a class method" unless ref $self; my @replaced_packages = - $self->SUPER::get_replaced_packages($package, $target, $define); + $self->SUPER::get_replaced_packages($package, $target, $user_context, $app_context); # mandriva lib policy: # library package names change with revision, making mandatory to @@ -201,7 +201,7 @@ sub get_replaced_packages { map { PACKAGE_CLASS->new(file => $_) } $self->get_files( $self->{_install_root}, - $self->get_install_path($package, $target, $define), + $self->get_install_path($package, $target, $user_context, $app_context), PACKAGE_CLASS->get_pattern( $1 . '[\d_\.]+' . $2, # custom name pattern undef, @@ -217,26 +217,25 @@ sub get_replaced_packages { } sub _get_main_section { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; - my $section = $self->_get_section($package, $target, $define); + my $section = $self->_get_section($package, $target, $user_context, $app_context); my ($main_section) = $section =~ m,^([^/]+),; $main_section } sub _get_section { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; my $name = $package->get_name(); - print "_get_section target $target packages $name\n"; - my $section = $define->{section}; + my $section = $user_context->{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() + $section = $self->{packages}{$package->as_file()}{section} } if ($section && $section !~ /debug_/ && $package->is_debug()) { $section = "debug_$section" @@ -289,7 +288,7 @@ sub _get_section { } # use defined section if not found - $section = $define->{section} unless $section; + $section = $user_context->{section} unless $section; print STDERR "Can't guess destination: section missing, defaulting to contrib/release" unless $section; $section ||= 'contrib/release'; @@ -297,7 +296,7 @@ sub _get_section { } sub get_upload_newer_revisions { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; croak "Not a class method" unless ref $self; my $arch = $package->get_arch(); my $name = $package->get_full_name; @@ -308,7 +307,7 @@ sub get_upload_newer_revisions { foreach my $state (@{$self->{_upload_state}}) { foreach my $m (keys %{$media->{$arch}}) { my $path = "$self->{_upload_root}/$state/$target/$m"; - print "Looking for package $package revisions for $target in $path (pattern $pattern)\n"; + print "Looking for package $package revisions for $target in $path (pattern $pattern)\n" if $self->{_verbose}; find( sub { s/\d{14}\.[^.]*\.[^.]*\.\d+_//; @@ -346,11 +345,11 @@ sub get_svn_url { } sub get_revisions { - my ($self, $package, $target, $define, $filter) = @_; + my ($self, $package, $target, $user_context, $app_context, $filter) = @_; croak "Not a class method" unless ref $self; print "Looking for package $package revisions for $target\n" if $self->{_verbose} > 0; - my $arch = $define->{arch} || $package->get_arch(); + my $arch = $user_context->{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); @@ -380,14 +379,14 @@ sub get_revisions { } sub reject { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; croak "Not a class method" unless ref $self; } sub get_archive_dir { - my ($self, $package, $target, $define) = @_; + my ($self, $package, $target, $user_context, $app_context) = @_; croak "Not a class method" unless ref $self; return -- cgit v1.2.1