From 55e8450e4898f34169524fe80984f72461205df8 Mon Sep 17 00:00:00 2001
From: Don Armstrong <don@volo>
Date: Sat, 3 Feb 2007 00:07:39 -0800
Subject: [PATCH]  * Stop useless overspecification of variables in
 Debbugs::Packages  * Comment better some of the complex maps and slices  *
 Fix notfound writing in makestatus  * Import binarytosource from
 Debbugs::Packages

---
 Debbugs/Packages.pm | 5 +++--
 Debbugs/Status.pm   | 6 ++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/Debbugs/Packages.pm b/Debbugs/Packages.pm
index 12741936..5284e2c5 100644
--- a/Debbugs/Packages.pm
+++ b/Debbugs/Packages.pm
@@ -122,10 +122,11 @@ sub binarytosource {
 
     # TODO: This gets hit a lot, especially from buggyversion() - probably
     # need an extra cache for speed here.
+    return () unless defined $gBinarySourceMap;
 
     if (tied %_binarytosource or
 	    tie %_binarytosource, 'MLDBM',
-		$Debbugs::Packages::gBinarySourceMap, O_RDONLY) {
+		$gBinarySourceMap, O_RDONLY) {
 	# avoid autovivification
 	my $binary = $_binarytosource{$binname};
 	return () unless defined $binary;
@@ -178,7 +179,7 @@ sub sourcetobinary {
 
     if (tied %_sourcetobinary or
 	    tie %_sourcetobinary, 'MLDBM',
-		$Debbugs::Packages::gSourceBinaryMap, O_RDONLY) {
+		$gSourceBinaryMap, O_RDONLY) {
 	# avoid autovivification
 	my $source = $_sourcetobinary{$srcname};
 	return () unless defined $source;
diff --git a/Debbugs/Status.pm b/Debbugs/Status.pm
index 6badbf3b..3a7df96b 100644
--- a/Debbugs/Status.pm
+++ b/Debbugs/Status.pm
@@ -31,7 +31,7 @@ use Params::Validate qw(validate_with :types);
 use Debbugs::Common qw(:util :lock :quit);
 use Debbugs::Config qw(:config);
 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
-use Debbugs::Packages qw(makesourceversions getversions);
+use Debbugs::Packages qw(makesourceversions getversions binarytosource);
 use Debbugs::Versions;
 use Debbugs::Versions::Dpkg;
 use POSIX qw(ceil);
@@ -189,6 +189,8 @@ sub read_bug{
 	 $data{$field} = [split ' ', $data{$field}];
     }
     for my $field (qw(found fixed)) {
+	 # create the found/fixed hashes which indicate when a
+	 # particular version was marked found or marked fixed.
 	 @{$data{$field}}{@{$data{"${field}_versions"}}} =
 	      (('') x (@{$data{"${field}_date"}} - @{$data{"${field}_versions"}}),
 	       @{$data{"${field}_date"}});
@@ -257,7 +259,7 @@ sub makestatus {
     }
 
     for my $field (qw(found_versions fixed_versions found_date fixed_date)) {
-	 $newdata{$field} = [split ' ', $newdata{$field}||''];
+	 $newdata{$field} = join ' ', @{$newdata{$field}||[]};
     }
 
     if ($version < 3) {
-- 
2.39.5