Przeglądaj źródła

Move find_closes() into Dpkg::Changelog::Entry::Debian

Raphaël Hertzog 16 lat temu
rodzic
commit
1f67f4b22b
2 zmienionych plików z 27 dodań i 29 usunięć
  1. 0 24
      scripts/Dpkg/Changelog.pm
  2. 27 5
      scripts/Dpkg/Changelog/Entry/Debian.pm

+ 0 - 24
scripts/Dpkg/Changelog.pm

@@ -47,7 +47,6 @@ use Dpkg::Vendor qw(run_vendor_hook);
 use base qw(Exporter);
 
 our %EXPORT_TAGS = ( 'util' => [ qw(
-                find_closes
                 data2rfc822
                 data2rfc822_mult
                 get_dpkg_changes
@@ -706,29 +705,6 @@ with only one of the options specified.
 
 =head1 UTILITY FUNCTIONS
 
-=head3 find_closes
-
-Takes one string as argument and finds "Closes: #123456, #654321" statements
-as supported by the Debian Archive software in it. Returns all closed bug
-numbers in an array reference.
-
-=cut
-
-sub find_closes {
-    my $changes = shift;
-    my %closes;
-
-    while ($changes &&
-	   ($changes =~ /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/ig)) {
-	$closes{$_} = 1 foreach($& =~ /\#?\s?(\d+)/g);
-    }
-
-    my @closes = sort { $a <=> $b } keys %closes;
-    return \@closes;
-}
-
-=pod
-
 =head3 data2rfc822
 
 Takes a single argument, either a Dpkg::Changelog::Entry object

+ 27 - 5
scripts/Dpkg/Changelog/Entry/Debian.pm

@@ -22,13 +22,12 @@ use warnings;
 use Exporter;
 use Dpkg::Changelog::Entry;
 use base qw(Exporter Dpkg::Changelog::Entry);
-our @EXPORT_OK = qw($regex_header $regex_trailer);
+our @EXPORT_OK = qw($regex_header $regex_trailer find_closes);
 
 use Date::Parse;
 
 use Dpkg::Control::Changelog;
 use Dpkg::Version;
-use Dpkg::Changelog qw(:util);
 
 =head1 NAME
 
@@ -208,9 +207,9 @@ sub get_optional_fields {
 	    }
 	}
     }
-    my $closes = find_closes(join("\n", @{$self->{changes}}));
-    if (@$closes) {
-	$f->{Closes} = join(" ", @$closes);
+    my @closes = find_closes(join("\n", @{$self->{changes}}));
+    if (@closes) {
+	$f->{Closes} = join(" ", @closes);
     }
     return $f;
 }
@@ -243,6 +242,29 @@ sub get_timestamp {
 
 =back
 
+=head1 UTILITY FUNCTIONS
+
+=head3 my @closed_bugs = find_closes($changes)
+
+Takes one string as argument and finds "Closes: #123456, #654321" statements
+as supported by the Debian Archive software in it. Returns all closed bug
+numbers in an array.
+
+=cut
+
+sub find_closes {
+    my $changes = shift;
+    my %closes;
+
+    while ($changes &&
+           ($changes =~ /closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*/ig)) {
+        $closes{$_} = 1 foreach($& =~ /\#?\s?(\d+)/g);
+    }
+
+    my @closes = sort { $a <=> $b } keys %closes;
+    return @closes;
+}
+
 =head1 AUTHOR
 
 Raphaël Hertzog <hertzog@debian.org>.