X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fdebbugs-loadsql;h=608fad67728bd6a6b96a5b53921fcb6a8465bafc;hb=10494ebcf2126e0264e6e4299a2466ffbfb50257;hp=293f644d7c92d74bfa28690b42fe2e7dd61ba73c;hpb=7e2665492e61346354e7d93b3429cb4a1a82a70d;p=debbugs.git diff --git a/bin/debbugs-loadsql b/bin/debbugs-loadsql index 293f644..608fad6 100755 --- a/bin/debbugs-loadsql +++ b/bin/debbugs-loadsql @@ -80,7 +80,7 @@ Display this manual. use vars qw($DEBUG); -use Debbugs::Common qw(checkpid lockpid get_hashname getparsedaddrs getbugcomponent make_list); +use Debbugs::Common qw(checkpid lockpid get_hashname getparsedaddrs getbugcomponent make_list getsourcemaintainers); use Debbugs::Config qw(:config); use Debbugs::Status qw(read_bug split_status_fields); use Debbugs::Log; @@ -160,13 +160,15 @@ if (exists $options{spool_dir} and defined $options{spool_dir}) { my $prog_bar; if ($options{progress}) { $prog_bar = eval "Term::ProgressBar->new({count => 1,ETA=>q(linear)})"; - warn "Unable to initialize progress bar: $@" if not $p; + warn "Unable to initialize progress bar: $@" if not $prog_bar; } +my ($subcommand) = shift @ARGV; + my $opts = handle_arguments(\@ARGV,$subcommands{$subcommand}{arguments},$gop); -$subcommands{$subcommand}{function}->($options,$opts,$prog_bar,$config,\@ARGV); +$subcommands{$subcommand}{function}->(\%options,$opts,$prog_bar,\%config,\@ARGV); sub add_bugs { my ($options,$opts,$p,$config,$argv) = @_; @@ -294,12 +296,14 @@ sub add_debinfo { my ($options,$opts,$p,$config,$argv) = @_; my @files = @{$argv}; + my $s = db_connect($options); my %arch; $p->target(@files) if $p; for my $file (@files) { my $fh = IO::File->new($file,'r') or die "Unable to open $file for reading: $!"; + my $f_stat = stat($file); while (<$fh>) { chomp; next unless length $_; @@ -337,7 +341,8 @@ sub add_debinfo { sub add_maintainers { my ($options,$opts,$p,$config,$argv) = @_; - my $maintainers = getmaintainers(); + my $s = db_connect($options); + my $maintainers = getsourcemaintainers(); $p->target(scalar keys %{$maintainers}) if $p; for my $pkg (keys %{$maintainers}) { my $maint = $maintainers->{$pkg}; @@ -357,7 +362,13 @@ sub add_maintainers { correspondent => $correspondent, }); } - # add the maintainer to the source package + # add the maintainer to the source package for packages with + # no maintainer + $s->txndo(sub { + $s->resultset('SrcPkg')-> + search_related_rs('SrcVer',{ maintainer_id => undef})-> + update_all({maintainer_id => $maint_r}); + }); $p->update() if $p; } $p->remove() if $p;