From 0980989206fec5b59ef2a7c5fca9606e7e7bbcf5 Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Fri, 18 Aug 2017 15:15:26 -0500 Subject: [PATCH 1/2] check_source: remove DIFFCOUNT algorithm and instead always add review_team. --- check_source.py | 15 ++------------- source-checker.pl | 41 +---------------------------------------- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/check_source.py b/check_source.py index eea359e9..8223a89c 100755 --- a/check_source.py +++ b/check_source.py @@ -104,23 +104,12 @@ class CheckSource(ReviewBot.ReviewBot): shutil.rmtree(dir) self.review_messages['accepted'] = 'Check script succeeded' - # Look for DIFFCOUNT in output. - if len(checked) and checked[-1].startswith('DIFFCOUNT'): - # This is a major break through in perl<->python communication! - diff = int(checked.pop().split(' ')[1]) - output = ' '.join(checked).translate(None, '\033') - if not new_version: - diff = 12345 - else: # e.g. new package - diff = 13579 - if len(checked): self.review_messages['accepted'] += "\n\nOutput of check script (non-fatal):\n" + output if not self.skip_add_reviews: - if diff > 8: - if self.review_team is not None: - self.add_review(self.request, by_group=self.review_team, msg='Please review sources') + if self.review_team is not None: + self.add_review(self.request, by_group=self.review_team, msg='Please review sources') if self.only_changes(): self.logger.debug('only .changes modifications') diff --git a/source-checker.pl b/source-checker.pl index 21e5f577..6bc146a8 100644 --- a/source-checker.pl +++ b/source-checker.pl @@ -280,39 +280,6 @@ sub prepare_package($) { print SPEC join('', @lines); close(SPEC); } - - my $dir = getcwd(); - my $diffcount = 0; - - for my $file (glob "*") { - my $oldfile = $files->{$file}; - if ($oldfile) { - - for my $line (split(/\n/, diff($oldfile, $file))) { - next unless $line =~ m/^[-+]/; - next if $line =~ m/^\Q---/; - next if $line =~ m/^\Q+++/; - if ($file =~ m/\.spec$/) { - $diffcount++; - - for my $command (qw(chmod chown rm)) { - if ($line =~ m/\b$command\b/) { - $diffcount += 3000; - last; - } - } - } else { - $diffcount += 7777; - last; - } - } - delete $files->{$file}; - } - else { - $files->{$file} = "$dir/$file"; - } - } - return $diffcount; } # move it back so we also diff the service file @@ -325,11 +292,5 @@ chdir($old); prepare_package(\%files); chdir($odir); chdir($dir); -my $diff = prepare_package(\%files); - -for my $file (keys %files) { - $diff += 10000; -} - -print "DIFFCOUNT $diff\n"; +prepare_package(\%files); exit(0); From 6afbc550ad9c92b47a5b7eb1640081d1130893ec Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Fri, 18 Aug 2017 15:18:04 -0500 Subject: [PATCH 2/2] check_source: rename perl and asciidoc to match name. --- source-checker.pl => check_source.pl | 0 check_source.py | 4 ++-- docs/{checksource.asciidoc => check_source.asciidoc} | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename source-checker.pl => check_source.pl (100%) rename docs/{checksource.asciidoc => check_source.asciidoc} (96%) diff --git a/source-checker.pl b/check_source.pl similarity index 100% rename from source-checker.pl rename to check_source.pl diff --git a/check_source.py b/check_source.py index 8223a89c..3b5a561f 100755 --- a/check_source.py +++ b/check_source.py @@ -81,8 +81,8 @@ class CheckSource(ReviewBot.ReviewBot): self.review_messages['declined'] = "A package submitted as %s has to build as 'Name: %s' - found Name '%s'" % (target_package, target_package, new_info['name']) return False - # Run source-checker.pl script and interpret output. - source_checker = os.path.join(CheckSource.SCRIPT_PATH, 'source-checker.pl') + # Run check_source.pl script and interpret output. + source_checker = os.path.join(CheckSource.SCRIPT_PATH, 'check_source.pl') civs = '' new_version = None if old_info['version'] and old_info['version'] != new_info['version']: diff --git a/docs/checksource.asciidoc b/docs/check_source.asciidoc similarity index 96% rename from docs/checksource.asciidoc rename to docs/check_source.asciidoc index db6d061f..51ea5f6d 100644 --- a/docs/checksource.asciidoc +++ b/docs/check_source.asciidoc @@ -33,7 +33,7 @@ ln -sr ./osc-check_source.py ./osclib ~/.osc-plugins ------------------------------------------------------------------------------- The program will search also some external scripts (like -source-checker.pl) inside the cloned directory (following the symlink). +check_source.pl) inside the cloned directory (following the symlink). Command line