diff options
author | Florent Villard <warly@mandriva.com> | 2006-08-05 12:49:19 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2006-08-05 12:49:19 +0000 |
commit | 49b1c37357b72374aaa6053d503a242e8b85dd0e (patch) | |
tree | 85a71280539ea0a0ae2e8f4e9e8837bf7e9d7660 /lib | |
parent | 648860b1d702c26deef80cbb262f575f4818ae0d (diff) | |
download | mga-youri-core-49b1c37357b72374aaa6053d503a242e8b85dd0e.tar mga-youri-core-49b1c37357b72374aaa6053d503a242e8b85dd0e.tar.gz mga-youri-core-49b1c37357b72374aaa6053d503a242e8b85dd0e.tar.bz2 mga-youri-core-49b1c37357b72374aaa6053d503a242e8b85dd0e.tar.xz mga-youri-core-49b1c37357b72374aaa6053d503a242e8b85dd0e.zip |
use define to get the user
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Youri/Repository/Mandriva_upload.pm | 17 | ||||
-rw-r--r-- | lib/Youri/Upload/Check/ACL.pm | 4 |
2 files changed, 10 insertions, 11 deletions
diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index 0b5ee58..b4e393b 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -33,7 +33,6 @@ sub _init { install_root => '', test => 0, # test mode verbose => 0, # verbose mode - user => '', @_ ); @@ -44,17 +43,19 @@ sub _init { } } print "Initializing repository for @{$self->{_arch}}\n"; - foreach my $v ('user', 'noarch', 'install_root', 'upload_root', 'verbose') { + foreach my $v ('noarch', 'install_root', 'upload_root', 'verbose') { $self->{"_$v"} = $options{$v} } - + $self +} +sub get_group_id { + my ($user) = @_; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time); $year+=1900; $mon++; my $hostname = `hostname`; my ($host) = $hostname =~ /([^.]*)/; - $self->{group_id} = sprintf "$year%02d%02d%02d%02d%02d.$self->{_user}.$host.${$}_", $mon, $mday, $hour, $min, $sec; - $self + sprintf "$year%02d%02d%02d%02d%02d.$self->{_user}.$host.${$}_", $mon, $mday, $hour, $min, $sec; } sub _get_media_config { @@ -103,15 +104,15 @@ sub get_package_charset { } sub get_upload_dir { - my ($self, $package, $target, $define, $user) = @_; + my ($self, $package, $target, $define) = @_; croak "Not a class method" unless ref $self; my $arch = $package->get_arch(); - print "USER $user\n"; return $self->{_upload_root} . "/todo/$target/" . $self->_get_section($package, $target, $define) . - "/$self->{group_id}" + '/' . + get_group_id($define->{user}) } sub get_install_path { diff --git a/lib/Youri/Upload/Check/ACL.pm b/lib/Youri/Upload/Check/ACL.pm index e231500..9e19e35 100644 --- a/lib/Youri/Upload/Check/ACL.pm +++ b/lib/Youri/Upload/Check/ACL.pm @@ -21,10 +21,8 @@ sub _init { my $self = shift; my %options = ( acl_file => '', - user => '', @_ ); - $self->{_user} = $options{user}; $acl = get_acl($options{acl_file}); } @@ -35,7 +33,7 @@ sub run { my $arch = $package->get_arch(); my $srpm = $package->get_canonical_name; my $section = $repository->_get_section($package, $target, $define); - my $user = $self->{_user}; + my $user = $define->{user}; foreach my $t (keys %$acl) { next if $target !~ /$t/; foreach my $acl (@{$acl->{$t}}) { |