diff options
author | Mandrake <mandrake@mandriva.com> | 2006-08-13 13:02:50 +0000 |
---|---|---|
committer | Mandrake <mandrake@mandriva.com> | 2006-08-13 13:02:50 +0000 |
commit | 1e5c08f05ee87f14894fdf4d5fed4ba41826c665 (patch) | |
tree | 6b80a691c24b30c6654eac01cb9dded7f28ff219 | |
parent | 34b9a191444dee5cad79b9258d1d14d2387e2279 (diff) | |
download | mga-youri-core-1e5c08f05ee87f14894fdf4d5fed4ba41826c665.tar mga-youri-core-1e5c08f05ee87f14894fdf4d5fed4ba41826c665.tar.gz mga-youri-core-1e5c08f05ee87f14894fdf4d5fed4ba41826c665.tar.bz2 mga-youri-core-1e5c08f05ee87f14894fdf4d5fed4ba41826c665.tar.xz mga-youri-core-1e5c08f05ee87f14894fdf4d5fed4ba41826c665.zip |
Delete file when installed; include section in the mail subject; move debug package to debug; add function to find main section, only compare package which main section is different (packages can be duplicate in main/release and main/testing
-rw-r--r-- | lib/Youri/Repository/Mandriva_upload.pm | 31 | ||||
-rw-r--r-- | lib/Youri/Upload/Action/Archive.pm | 15 | ||||
-rw-r--r-- | lib/Youri/Upload/Action/Install.pm | 12 | ||||
-rw-r--r-- | lib/Youri/Upload/Action/Mail.pm | 3 | ||||
-rw-r--r-- | lib/Youri/Upload/Check/SVN.pm | 7 | ||||
-rw-r--r-- | lib/Youri/Upload/Reject/Clean.pm | 10 | ||||
-rw-r--r-- | lib/Youri/Upload/Reject/Install.pm | 6 |
7 files changed, 67 insertions, 17 deletions
diff --git a/lib/Youri/Repository/Mandriva_upload.pm b/lib/Youri/Repository/Mandriva_upload.pm index 5f48a10..f2dd1d9 100644 --- a/lib/Youri/Repository/Mandriva_upload.pm +++ b/lib/Youri/Repository/Mandriva_upload.pm @@ -77,15 +77,14 @@ sub _get_media_config { my $debug_for = $distrib->getvalue($media, 'debug_for'); my $srpms = $distrib->getvalue($media, 'srpms'); my $path = $distrib->getfullpath($media, 'path'); - if (!$debug_for && !$rpms) { + if (!$rpms) { if (-d $path) { 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" } - } - if ($rpms) { + } else { my ($media) = split ' ', $rpms; if (-d $path) { print "MEDIA defining SOURCE media for $media in $path\n" if $self->{_verbose}; @@ -198,6 +197,14 @@ sub get_replaced_packages { } +sub _get_main_section { + my ($self, $package, $target, $define) = @_; + + my $section = $self->_get_section($package, $target, $define); + my ($main_section) = $section =~ m,^([^/]+),; + $main_section +} + sub _get_section { my ($self, $package, $target, $define) = @_; @@ -210,7 +217,7 @@ sub _get_section { $section = $package->_get_section() } if ($package->is_debug()) { - $section = "${debug}_$section" + $section = "debug_$section" } # if section is provided, check this one is defined @@ -344,6 +351,22 @@ sub get_revisions { @packages; } +sub reject { + my ($self, $package, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + +} + +sub get_archive_dir { + my ($self, $package, $target, $define) = @_; + croak "Not a class method" unless ref $self; + + return + $self->{_archive_root} +} + + # 20060801 warly # # Upload steps diff --git a/lib/Youri/Upload/Action/Archive.pm b/lib/Youri/Upload/Action/Archive.pm index b13aa51..3626d88 100644 --- a/lib/Youri/Upload/Action/Archive.pm +++ b/lib/Youri/Upload/Action/Archive.pm @@ -29,11 +29,24 @@ sub _init { sub run { my ($self, $package, $repository, $target, $define) = @_; croak "Not a class method" unless ref $self; - + + my $section = $repository->_get_section($package, $target, $define); + my $main_section = $repository->_get_main_section($package, $target, $define); + print "section $section main_section $main_section\n" if $self->{_verbose}; + my $arch = $package->get_arch(); + $arch = $self->{_noarch} if $arch eq 'noarch'; + my $path = $arch eq 'src' ? "$target/SRPMS/" : "$target/$arch/media"; + $path = "$repository->{_install_root}/$path"; + $path =~ s,/+,/,g; + $self->{_verbose} = 1; foreach my $replaced_package ( $repository->get_replaced_packages($package, $target, $define) ) { my $file = $replaced_package->get_file(); + my ($rep_section, $rep_main_section) = $file =~ m,$path(([^/]+)/.*)/[^/]+.rpm,; + # We do accept duplicate version for other submedia of the same main media section + print "file $file section $rep_section main_section $rep_main_section ($path)\n" if $self->{_verbose}; + next if $rep_main_section eq $main_section && $rep_section ne $section; my $dest = $repository->get_archive_dir($package, $target, $define); print "archiving file $file to $dest\n" if $self->{_verbose}; diff --git a/lib/Youri/Upload/Action/Install.pm b/lib/Youri/Upload/Action/Install.pm index 45d7823..cf9891e 100644 --- a/lib/Youri/Upload/Action/Install.pm +++ b/lib/Youri/Upload/Action/Install.pm @@ -33,18 +33,24 @@ sub run { croak "Not a class method" unless ref $self; my $file = $package->get_file(); + my $rpm = $package->get_file_name(); my $dest = $repository->get_install_dir($package, $target, $define); - print "installing file $file to $dest\n" if $self->{_verbose}; + # FIXME remove prefix this should be done by a function + $rpm =~ s/^\d{14}\.\w+\.\w+\.\d+_//; + print "installing file $file to $dest/$rpm\n" if $self->{_verbose}; unless ($self->{_test}) { # create destination dir if needed - system("install -d -m " . ($self->{_perms} + 111) . " $dest") + system("install -d -m " . ($self->{_perms} + 111) . " $dest/") unless -d $dest; # install file to new location - system("install -m $self->{_perms} $file $dest"); + system("install -m $self->{_perms} $file $dest/$rpm"); } + $package->{_file} = "$dest/$rpm"; + print "deleting file $file\n" if $self->{_verbose}; + unlink $file unless $self->{_test}; } =head1 COPYRIGHT AND LICENSE diff --git a/lib/Youri/Upload/Action/Mail.pm b/lib/Youri/Upload/Action/Mail.pm index 74ce9d6..92aa87e 100644 --- a/lib/Youri/Upload/Action/Mail.pm +++ b/lib/Youri/Upload/Action/Mail.pm @@ -57,12 +57,13 @@ sub run { return unless $package->is_source(); my $from = $package->get_packager(); + my $section = $repository->_get_section($package, $target, $define); # force from adress if defined $from =~ s/<.*>/<$self->{_from}>/ if $self->{_from}; my $subject = - ($self->{_prefix} ? '[' . $self->{_prefix} . '] ' : '' ) . + ($self->{_prefix} ? '[' . $self->{_prefix} . '] ' : '' ) . ($section ? "$section " : '') . $package->get_revision_name(); my $information = $package->get_information(); my $last_change = $package->get_last_change(); diff --git a/lib/Youri/Upload/Check/SVN.pm b/lib/Youri/Upload/Check/SVN.pm index 6e7d57a..f824f4a 100644 --- a/lib/Youri/Upload/Check/SVN.pm +++ b/lib/Youri/Upload/Check/SVN.pm @@ -30,6 +30,13 @@ sub run { my ($self, $package, $repository, $target, $define) = @_; croak "Not a class method" unless ref $self; + my $section = $repository->_get_section($package, $target, $define); + if ($section =~ /\/(testing|backport)$/) { + # FIXME, right now ignore packages in SVN for testing and backports + # we need to find a clean way to handle them + return 1 + } + $package->is_source or return 1; my $file = $package->get_file_name; my $srpm_name = $package->get_canonical_name; diff --git a/lib/Youri/Upload/Reject/Clean.pm b/lib/Youri/Upload/Reject/Clean.pm index 7902472..ed2b99d 100644 --- a/lib/Youri/Upload/Reject/Clean.pm +++ b/lib/Youri/Upload/Reject/Clean.pm @@ -20,13 +20,9 @@ sub run { my ($self, $package, $errors, $repository, $target, $define) = @_; croak "Not a class method" unless ref $self; - foreach my $replaced_package ( - $repository->get_replaced_packages($package, $target, $define) - ) { - my $file = $replaced_package->get_file(); - print "deleting file $file\n" if $self->{_verbose}; - unlink $file unless $self->{_test}; - } + my $file = $package->get_file(); + print "deleting file $file\n" if $self->{_verbose}; + unlink $file unless $self->{_test}; } =head1 COPYRIGHT AND LICENSE diff --git a/lib/Youri/Upload/Reject/Install.pm b/lib/Youri/Upload/Reject/Install.pm index ae778ce..d35fe9d 100644 --- a/lib/Youri/Upload/Reject/Install.pm +++ b/lib/Youri/Upload/Reject/Install.pm @@ -24,6 +24,7 @@ sub _init { ); $self->{_perms} = $options{perms}; + $self->{_verbose} = $options{verbose}; } sub run { @@ -36,7 +37,7 @@ sub run { # FIXME remove prefix this should be done by a function $rpm =~ s/^\d{14}\.\w+\.\w+\.\d+_//; - print "installing file $file to $dest/$rpm\n" ;#if $self->{_verbose}; + print "installing file $file to $dest/$rpm\n" if $self->{_verbose}; unless ($self->{_test}) { # create destination dir if needed @@ -46,6 +47,9 @@ sub run { # install file to new location system("install -m $self->{_perms} $file $dest/$rpm"); } + $package->{_file} = "$dest/$rpm"; + print "deleting file $file\n" if $self->{_verbose}; + unlink $file unless $self->{_test}; } =head1 COPYRIGHT AND LICENSE |