[PATCH] Print the version for warnings about incorrect changelog range parameters

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Print the version for warnings about incorrect changelog range parameters

Paul Wise via nm
Within scripts operating on lots of different package changelogs,
this can help track down where these warnings come from.
---
 scripts/Dpkg/Changelog.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/scripts/Dpkg/Changelog.pm b/scripts/Dpkg/Changelog.pm
index db8e3eb09..35e48ef02 100644
--- a/scripts/Dpkg/Changelog.pm
+++ b/scripts/Dpkg/Changelog.pm
@@ -254,7 +254,7 @@ sub __sanity_check_range {
         push @versions, $version->as_string();
     }
     if ((defined($r->{since}) and not exists $versions{$r->{since}})) {
-        warning(g_("'%s' option specifies non-existing version"), 'since');
+        warning(g_("'%s' option specifies non-existing version '%s'"), 'since', $r->{since});
         warning(g_('use newest entry that is earlier than the one specified'));
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{since})) {
@@ -270,7 +270,7 @@ sub __sanity_check_range {
         }
     }
     if ((defined($r->{from}) and not exists $versions{$r->{from}})) {
-        warning(g_("'%s' option specifies non-existing version"), 'from');
+        warning(g_("'%s' option specifies non-existing version '%s'"), 'from', $r->{from});
         warning(g_('use oldest entry that is later than the one specified'));
         my $oldest;
         foreach my $v (@versions) {
@@ -281,12 +281,12 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $r->{from} = $oldest;
         } else {
-            warning(g_("no such entry found, ignoring '%s' parameter"), 'from');
+            warning(g_("no such entry found, ignoring '%s' parameter '%s'"), 'from', $r->{from});
             delete $r->{from}; # No version was oldest
         }
     }
     if (defined($r->{until}) and not exists $versions{$r->{until}}) {
-        warning(g_("'%s' option specifies non-existing version"), 'until');
+        warning(g_("'%s' option specifies non-existing version '%s'"), 'until', $r->{until});
         warning(g_('use oldest entry that is later than the one specified'));
         my $oldest;
         foreach my $v (@versions) {
@@ -297,12 +297,12 @@ sub __sanity_check_range {
         if (defined($oldest)) {
             $r->{until} = $oldest;
         } else {
-            warning(g_("no such entry found, ignoring '%s' parameter"), 'until');
+            warning(g_("no such entry found, ignoring '%s' parameter '%s'"), 'until', $r->{until});
             delete $r->{until}; # No version was oldest
         }
     }
     if (defined($r->{to}) and not exists $versions{$r->{to}}) {
-        warning(g_("'%s' option specifies non-existing version"), 'to');
+        warning(g_("'%s' option specifies non-existing version '%s'"), 'to', $r->{to});
         warning(g_('use newest entry that is earlier than the one specified'));
         foreach my $v (@versions) {
             if (version_compare_relation($v, REL_LT, $r->{to})) {
@@ -312,17 +312,17 @@ sub __sanity_check_range {
         }
         if (not exists $versions{$r->{to}}) {
             # No version was earlier
-            warning(g_("no such entry found, ignoring '%s' parameter"), 'to');
+            warning(g_("no such entry found, ignoring '%s' parameter '%s'"), 'to', $r->{to});
             delete $r->{to};
         }
     }
 
     if (defined($r->{since}) and $data->[0]->get_version() eq $r->{since}) {
- warning(g_("'since' option specifies most recent version, ignoring"));
+ warning(g_("'since' option specifies most recent version '%s', ignoring"), $r->{since});
  delete $r->{since};
     }
     if (defined($r->{until}) and $data->[-1]->get_version() eq $r->{until}) {
- warning(g_("'until' option specifies oldest version, ignoring"));
+ warning(g_("'until' option specifies oldest version '%s', ignoring"), $r->{until});
  delete $r->{until};
     }
     ## use critic
--
2.15.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Print the version for warnings about incorrect changelog range parameters

Guillem Jover
Hi!

On Mon, 2017-12-04 at 15:12:50 +0800, Paul Wise wrote:
> Within scripts operating on lots of different package changelogs,
> this can help track down where these warnings come from.

Definitely! Merged locally, thanks. Will be in my next push.

BTW, always happy to get patches or get pointed out to unclear
strings that can be clarified in similar ways. :)

Thanks,
Guillem