diff options
author | Florent Villard <warly@mandriva.com> | 2006-08-06 16:49:55 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-08-06 16:49:55 +0000 |
commit | 9478d85440450c4db3cbffa649b6782586644c22 (patch) | |
tree | c8044390317fb14b0e0a6b683e88a6a6a84ee3af | |
parent | ed936a26aab795fd4595a7dce2e1d51d53a21803 (diff) | |
download | mga-youri-core-9478d85440450c4db3cbffa649b6782586644c22.tar mga-youri-core-9478d85440450c4db3cbffa649b6782586644c22.tar.gz mga-youri-core-9478d85440450c4db3cbffa649b6782586644c22.tar.bz2 mga-youri-core-9478d85440450c4db3cbffa649b6782586644c22.tar.xz mga-youri-core-9478d85440450c4db3cbffa649b6782586644c22.zip |
now can define section at upload
-rw-r--r-- | lib/Youri/Repository/Mandriva_upload.pm | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index b4e393b..53ced5b 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -33,6 +33,7 @@ sub _init { install_root => '', test => 0, # test mode verbose => 0, # verbose mode + queue => '' @_ ); @@ -43,7 +44,7 @@ sub _init { } } print "Initializing repository for @{$self->{_arch}}\n"; - foreach my $v ('noarch', 'install_root', 'upload_root', 'verbose') { + foreach my $v ('queue', 'noarch', 'install_root', 'upload_root', 'verbose') { $self->{"_$v"} = $options{$v} } $self @@ -55,14 +56,16 @@ sub get_group_id { $mon++; my $hostname = `hostname`; my ($host) = $hostname =~ /([^.]*)/; - sprintf "$year%02d%02d%02d%02d%02d.$self->{_user}.$host.${$}_", $mon, $mday, $hour, $min, $sec; + sprintf "$year%02d%02d%02d%02d%02d.$user.$host.${$}_", $mon, $mday, $hour, $min, $sec; } sub _get_media_config { my ($self, $target) = @_; my %media; + my $real_target = $target; + $real_target =~ s/_force//; foreach my $arch (@{$self->{_arch}}) { - my $root = "$self->{_install_root}/$target/$arch"; + my $root = "$self->{_install_root}/$real_target/$arch"; my $distrib = MDV::Distribconf::Build->new($root); print "Getting media config from $root\n"; $self->{distrib}{$arch} = $distrib; @@ -109,7 +112,7 @@ sub get_upload_dir { my $arch = $package->get_arch(); return $self->{_upload_root} . - "/todo/$target/" . + "/$self->{_queue}/$target/" . $self->_get_section($package, $target, $define) . '/' . get_group_id($define->{user}) @@ -185,10 +188,19 @@ sub get_replaced_packages { sub _get_section { my ($self, $package, $target, $define) = @_; - my $section; + my $section = $define->{section}; + my $media = $self->_get_media_config($target); + my $arch = $package->get_arch(); + # if section is provided, check this one is defined + if ($section) { + if ($media->{$arch}{$section}) { + return $section + } else { + die "FATAL youri: unknown section $section for target $target" + } + } # try to find section automatically - my $arch = $package->get_arch(); my $source_pattern = PACKAGE_CLASS->get_pattern( $package->get_canonical_name(), @@ -207,7 +219,6 @@ sub _get_section { # for each potential section, try to match # a suitable source patten in source directory # a suitable binary patten in binary directory - my $media = $self->_get_media_config($target); foreach my $m (keys %{$media->{$arch}}) { next unless $self->get_files( |