[lintian] 02/08: lintian: Move L::ProcPool initialisation into a sub
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 10b88e4caa8c5ec757888190f9ab9077babab5a6
Author: Niels Thykier <niels@thykier.net>
Date: Wed Jul 15 21:05:53 2015 +0200
lintian: Move L::ProcPool initialisation into a sub
Signed-off-by: Niels Thykier <niels@thykier.net>
---
frontend/lintian | 86 +++++++++++++++++++++++++++++---------------------------
1 file changed, 44 insertions(+), 42 deletions(-)
diff --git a/frontend/lintian b/frontend/lintian
index 66ccc13..5b6d7e3 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -901,49 +901,8 @@ v_msg("Setting up lab in $opt{'LINTIAN_LAB'} ...")
# {{{ Compile list of files to process
-$pool = Lintian::ProcessablePool->new($LAB);
-# process package/file arguments
-
-while (my $arg = shift) {
- # file?
- if (-f $arg) {
- if ($arg =~ m/\.(?:u?deb|dsc|changes)$/o){
- eval {$pool->add_file($arg);};
- if ($@) {
- print STDERR "Skipping $arg: $@";
- $exit_code = 2;
- }
- } else {
- fail(
- join(q{ },
- "bad package file name $arg",
- '(neither .deb, .udeb, .changes or .dsc file)'));
- }
- } else {
- # parameter is a package name--so look it up
- handle_lab_query($arg);
- }
-}
-
-if ($opt{'packages-from-file'}){
- my $fd = open_file_or_fd($opt{'packages-from-file'}, '<');
- while (my $file = <$fd>) {
- chomp $file;
- if ($file =~ m/^!query:\s*(\S(?:.*\S)?)/o) {
- my $query = $1;
- handle_lab_query($query);
- } else {
- $pool->add_file($file);
- }
- }
- # close unless it is STDIN (else we will see a lot of warnings
- # about STDIN being reopened as "output only")
- close($fd) unless fileno($fd) == fileno(STDIN);
-}
+$pool = setup_work_pool($LAB);
-# }}}
-
-# {{{ Some silent exit
if ($pool->empty()) {
v_msg('No packages selected.');
exit $exit_code;
@@ -1834,6 +1793,49 @@ sub configure_output {
return;
}
+sub setup_work_pool {
+ my ($lab) = @_;
+ my $pool = Lintian::ProcessablePool->new($lab);
+
+ for my $arg (@ARGV) {
+ # file?
+ if (-f $arg) {
+ if ($arg =~ m/\.(?:u?deb|dsc|changes)$/o){
+ eval {$pool->add_file($arg);};
+ if ($@) {
+ print STDERR "Skipping $arg: $@";
+ $exit_code = 2;
+ }
+ } else {
+ fail(
+ join(q{ },
+ "bad package file name $arg",
+ '(neither .deb, .udeb, .changes or .dsc file)'));
+ }
+ } else {
+ # parameter is a package name--so look it up
+ handle_lab_query($arg);
+ }
+ }
+
+ if ($opt{'packages-from-file'}){
+ my $fd = open_file_or_fd($opt{'packages-from-file'}, '<');
+ while (my $file = <$fd>) {
+ chomp $file;
+ if ($file =~ m/^!query:\s*(\S(?:.*\S)?)/o) {
+ my $query = $1;
+ handle_lab_query($query);
+ } else {
+ $pool->add_file($file);
+ }
+ }
+ # close unless it is STDIN (else we will see a lot of warnings
+ # about STDIN being reopened as "output only")
+ close($fd) unless fileno($fd) == fileno(STDIN);
+ }
+ return $pool;
+}
+
sub _update_profile {
my ($profile, $sup_check, $sup_tags, $only_check, $only_tags) = @_;
my %abbrev = ();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: