aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-10-17 16:04:49 +0000
committerFlorent Villard <warly@mandriva.com>2006-10-17 16:04:49 +0000
commit1dc5e5210b35dcce9f36c315fa7170ef874c27e3 (patch)
tree185b0b7ce17ef9ae97f6c2a0b77cc6406c0edb32
parent36dc49a0fee40e68284ac1422255787fb740fee3 (diff)
downloadmga-youri-submit-1dc5e5210b35dcce9f36c315fa7170ef874c27e3.tar
mga-youri-submit-1dc5e5210b35dcce9f36c315fa7170ef874c27e3.tar.gz
mga-youri-submit-1dc5e5210b35dcce9f36c315fa7170ef874c27e3.tar.bz2
mga-youri-submit-1dc5e5210b35dcce9f36c315fa7170ef874c27e3.tar.xz
mga-youri-submit-1dc5e5210b35dcce9f36c315fa7170ef874c27e3.zip
now checks must return the error message
-rw-r--r--lib/Youri/Submit/Check/ACL.pm4
-rw-r--r--lib/Youri/Submit/Check/Host.pm7
-rw-r--r--lib/Youri/Submit/Check/Queue_recency.pm5
-rw-r--r--lib/Youri/Submit/Check/Rpmlint.pm2
-rw-r--r--lib/Youri/Submit/Check/SVN.pm7
-rw-r--r--lib/Youri/Submit/Check/Source.pm7
-rw-r--r--lib/Youri/Submit/Check/Version.pm15
7 files changed, 17 insertions, 30 deletions
diff --git a/lib/Youri/Submit/Check/ACL.pm b/lib/Youri/Submit/Check/ACL.pm
index dcf38ac..1719c36 100644
--- a/lib/Youri/Submit/Check/ACL.pm
+++ b/lib/Youri/Submit/Check/ACL.pm
@@ -42,12 +42,10 @@ sub run {
if ($user =~ /$users/) {
return 1
} else {
- $self->{_error} = "$user is not authorized to upload packages belonging to $srpm (authorized persons: " . join(', ', split '\|', $users) . ")";
- return 0
+ return "$user is not authorized to upload packages belonging to $srpm (authorized persons: " . join(', ', split '\|', $users) . ")";
}
}
}
- 1
}
sub get_acl {
diff --git a/lib/Youri/Submit/Check/Host.pm b/lib/Youri/Submit/Check/Host.pm
index 50fc24f..284b0ac 100644
--- a/lib/Youri/Submit/Check/Host.pm
+++ b/lib/Youri/Submit/Check/Host.pm
@@ -31,15 +31,14 @@ sub run {
croak "Not a class method" unless ref $self;
my $file = $package->get_file;
my $arch = $package->get_arch;
- my $buildhost = $package->get_buildhost;
+ my $buildhost = $package->as_formated_string('%{buildhost}');
foreach my $h (keys %$host) {
next if $buildhost !~ $h;
if ($arch =~ $host->{$h}) {
- return 1
+ return
}
}
- $self->{_error} = "Packages build on host $buildhost are not authorized";
- 0
+ "Packages build on host $buildhost are not authorized";
}
sub get_host {
diff --git a/lib/Youri/Submit/Check/Queue_recency.pm b/lib/Youri/Submit/Check/Queue_recency.pm
index af48e9a..208575f 100644
--- a/lib/Youri/Submit/Check/Queue_recency.pm
+++ b/lib/Youri/Submit/Check/Queue_recency.pm
@@ -24,11 +24,8 @@ sub run {
my @newer_revisions =
$repository->get_upload_newer_revisions($package, $target, $define);
if (@newer_revisions) {
- $self->{_error} = "Newer revisions already exists for $target in upload queue: " . join(', ', @newer_revisions);
- return 0;
+ return "Newer revisions already exists for $target in upload queue: " . join(', ', @newer_revisions);
}
-
- return 1;
}
=head1 COPYRIGHT AND LICENSE
diff --git a/lib/Youri/Submit/Check/Rpmlint.pm b/lib/Youri/Submit/Check/Rpmlint.pm
index c7bdf01..7bd13db 100644
--- a/lib/Youri/Submit/Check/Rpmlint.pm
+++ b/lib/Youri/Submit/Check/Rpmlint.pm
@@ -54,7 +54,9 @@ sub _init {
croak "no results to check" unless $options{results};
croak "fatal should be an arrayref" unless ref $options{results} eq 'ARRAY';
+ $self->{_path} = $options{path};
$self->{_pattern} = '^(?:' . join('|', @{$options{results}}) . ')$';
+ print "PATTERN $self->{_pattern}\n";
}
sub run {
diff --git a/lib/Youri/Submit/Check/SVN.pm b/lib/Youri/Submit/Check/SVN.pm
index 0c92ce4..8295656 100644
--- a/lib/Youri/Submit/Check/SVN.pm
+++ b/lib/Youri/Submit/Check/SVN.pm
@@ -34,7 +34,7 @@ sub run {
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
+ return
}
$package->is_source or return 1;
@@ -42,14 +42,11 @@ sub run {
my $srpm_name = $package->get_canonical_name;
if ($repository->package_in_svn($srpm_name)) {
if ($file !~ /(^|\/|$define->{prefix}_)@\d+:\Q$srpm_name/) {
- $self->{_error} = "package $srpm_name is in the SVN, the uploaded SRPM must look like @<svn rev>:$srpm_name-<version>-<release>.src.rpm (created with getsrpm-mdk $srpm_name)";
- return 0
+ return "package $srpm_name is in the SVN, the uploaded SRPM must look like @<svn rev>:$srpm_name-<version>-<release>.src.rpm (created with getsrpm-mdk $srpm_name)";
} else {
print "Package $file is correct\n";
- return 1
}
}
- 1
}
sub simple_prompt {
diff --git a/lib/Youri/Submit/Check/Source.pm b/lib/Youri/Submit/Check/Source.pm
index 4fde7d0..962b709 100644
--- a/lib/Youri/Submit/Check/Source.pm
+++ b/lib/Youri/Submit/Check/Source.pm
@@ -27,13 +27,10 @@ sub _init {
sub run {
my ($self, $package, $repository, $target, $define) = @_;
croak "Not a class method" unless ref $self;
- my $file = $package->get_file();
+ my $file = $package->as_file();
if (!$package->is_source()) {
- print
- $self->{_error} = "Package $file is not a source rpm";
- return 0
+ return "Package $file is not a source rpm";
}
- return 1;
}
=head1 COPYRIGHT AND LICENSE
diff --git a/lib/Youri/Submit/Check/Version.pm b/lib/Youri/Submit/Check/Version.pm
index a66b14f..2d3d268 100644
--- a/lib/Youri/Submit/Check/Version.pm
+++ b/lib/Youri/Submit/Check/Version.pm
@@ -33,18 +33,17 @@ sub run {
my ($self, $package, $repository, $target, $define) = @_;
croak "Not a class method" unless ref $self;
my $opt = $self->{$target};
- return 1 if $opt->{mode} eq 'normal';
+ return if $opt->{mode} eq 'normal';
my $section = $repository->_get_section($package, $target, $define);
my $name = $package->get_canonical_name;
- return 1 if $name =~ /$opt->{authorized_packages}/;
+ return if $name =~ /$opt->{authorized_packages}/;
my $arch = $repository->get_arch($package, $target, $define);
- return 1 if $arch =~ /$opt->{authorized_arches}/;
+ return if $arch =~ /$opt->{authorized_arches}/;
if ($opt->{mode} eq 'version_freeze') {
- return 1 if $section =~ /$opt->{authorized_sections}/
+ return if $section =~ /$opt->{authorized_sections}/
} elsif ($opt->{mode} eq 'freeze') {
if ($section !~ /$opt->{authorized_sections}/) {
- $self->{_error} = "FREEZE: repository $target section $section is frozen, you can still submit your packages in testing\nTo do so use your.devel --define section=<section> $target <package 1> <package 2> ... <package n>";
- return 0
+ return "FREEZE: repository $target section $section is frozen, you can still submit your packages in testing\nTo do so use your.devel --define section=<section> $target <package 1> <package 2> ... <package n>";
}
}
my $source = $package->get_source_package;
@@ -53,10 +52,8 @@ sub run {
my @revisions = $repository->get_revisions($package, $target, $define, sub { my $source_package = $_[0]->get_source_package; my ($version) = $source_package =~ /-([^-]+)-[^-]+\.src\.rpm$/; print STDERR "Found version $version\n"; URPM::ranges_overlap("== $version", "< $package_version") });
$define->{arch} = '';
if (@revisions) {
- $self->{_error} = "VERSION FREEZE, package @revisions of different versions exist in cooker\n";
- return 0
+ return "VERSION FREEZE, package @revisions of different versions exist in cooker\n";
}
- return 1
}
=head1 COPYRIGHT AND LICENSE