summaryrefslogtreecommitdiff
path: root/mu-aux/gencl
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-04-03 21:47:00 +0300
committerSergey Poznyakoff <gray@gnu.org>2017-04-03 21:55:46 +0300
commit7ed1178111e1a266b8a14ca806f7bcf84f8caf70 (patch)
treeb6b6bf8d40b73be8d5f1b07c38bc25b866f720df /mu-aux/gencl
parentcaac7dea4cb65a8bed723d705bb6a0b89cf13da1 (diff)
downloadmailutils-7ed1178111e1a266b8a14ca806f7bcf84f8caf70.tar.gz
mailutils-7ed1178111e1a266b8a14ca806f7bcf84f8caf70.tar.bz2
Minor improvements in gencl
* mu-aux/gencl: Don't use Time::ParseDate. Work over bug in Text::Wrap 2012.0818. New option --ignore-errors (-i). Ensure consistent error code. * Makefile.am (dist-hook): Relax checking for intermediate releases.
Diffstat (limited to 'mu-aux/gencl')
-rwxr-xr-xmu-aux/gencl78
1 files changed, 54 insertions, 24 deletions
diff --git a/mu-aux/gencl b/mu-aux/gencl
index f124cacde..82ebcce68 100755
--- a/mu-aux/gencl
+++ b/mu-aux/gencl
@@ -11,3 +11,2 @@ use threads;
use Thread::Queue;
-use Time::ParseDate;
use Safe;
@@ -27,11 +26,5 @@ my %amendment;
my $append_dot;
+my $ignore_errors;
-sub set_date {
- my ($time, $err) = parsedate($_[1], PREFER_PAST => 1, UK => 1);
- unless (defined($time)) {
- print STDERR "--$_[0]=$_[1]: $err\n";
- exit(1);
- }
- return strftime('%Y-%m-%d', localtime($time));
-}
+my $exit_status = 0;
@@ -44,3 +37,3 @@ gencl - generate ChangeLog from git log output
B<gencl>
-[B<-fv>]
+[B<-fiv>]
[B<-a> I<FILE>]
@@ -52,2 +45,3 @@ B<gencl>
[B<--force>]
+[B<--ignore-errors>]
[B<--since=>I<DATE>]
@@ -103,2 +97,7 @@ Force recreating the ChangeLog, even if no new commits were added to the
repository since its creation.
+
+=item B<-i>, B<--ignore-errors>
+
+Ignore non-fatal errors. With this option in effect, B<gencl> exits with
+code 0 even if some errors were encountered while running.
@@ -110,4 +109,3 @@ Increase output verbosity.
-Convert only the logs since I<DATE>. See B<Time::ParseDate>(3), for
-a list of valid I<DATE> formats.
+Convert only the logs since I<DATE> (B<YYYY-MM-DD>).
@@ -115,4 +113,3 @@ a list of valid I<DATE> formats.
-Convert only the logs until I<DATE>. See B<Time::ParseDate>(3), for
-a list of valid I<DATE> formats.
+Convert only the logs until I<DATE> (B<YYYY-MM-DD>).
@@ -134,2 +131,21 @@ punctuation the end.
+=head1 EXIT CODES
+
+=over 4
+
+=item B<0>
+
+Success.
+
+=item B<1>
+
+Fatal error.
+
+=item B<2>
+
+Non-fatal error. The B<--ignore-errors> (B<-i>) option instructs B<gencl>
+to exit with code B<0>, instead of B<2>.
+
+=back
+
=head1 DIFFERENCES FROM GITLOG-TO-CHANGELOG
@@ -165,3 +181,3 @@ Each entry is reformatted using B<Text::Wrap>.
The following B<gitlab-to-changelog> options are not implemented: B<--cluster>,
-B<--ignore-matching>, B<--ignore_line>.
+B<--ignore-matching>, B<--ignore-line>.
@@ -206,7 +222,8 @@ GetOptions(
'verbose|v' => \$verbose,
- 'since=s' => sub { $since_date = set_date(@_) },
- 'until=s' => sub { $until_date = set_date(@_) },
+ 'since=s' => \$since_date,
+ 'until=s' => \$until_date,
'strip-cherry-pick' => \$strip_cherry_pick,
'amend=s' => \$amend_file,
- 'append-dot' => \$append_dot
+ 'append-dot' => \$append_dot,
+ 'ignore-errors|i' => \$ignore_errors
) or exit(1);
@@ -220,5 +237,8 @@ read_amend_file($amend_file) if $amend_file;
$Text::Wrap::columns = 72;
-
+# Work over bug #79766 in Text::Wrap
+$Text::Wrap::huge = 'overflow' if $Text::Wrap::VERSION eq '2012.0818';
+
create_changelog();
-
+$exit_status = 0 if $ignore_errors;
+exit $exit_status;
@@ -305,2 +325,3 @@ sub read_amend_file {
warn $amendment{$hash}{locus} . ": previously defined here";
+ $exit_status = 2;
}
@@ -315,2 +336,3 @@ sub read_amend_file {
unless $silent;
+ $exit_status = 2;
$silent = 1;
@@ -350,2 +372,3 @@ sub tokenize_gitlog {
warn "unexpected input: '$_'";
+ $exit_status = 2;
next;
@@ -371,2 +394,3 @@ sub tokenize_gitlog {
warn $amendment{$ent{hash}}{locus} . ": code was defined here";
+ $exit_status = 2;
}
@@ -435,6 +459,8 @@ sub tokenize_gitlog {
}
- foreach my $ent (sort { $a->[0] <=> $b->[0] } @unused) {
- warn "$ent->[1]: unused entry: $ent->[2]\n";
+ if (@unused) {
+ $exit_status = 2;
+ foreach my $ent (sort { $a->[0] <=> $b->[0] } @unused) {
+ warn "$ent->[1]: unused entry: $ent->[2]\n";
+ }
}
-
print STDERR "tokenize_gitlog finished\n" if $verbose > 1;
@@ -494,3 +520,6 @@ sub create_changelog {
$cvt_thr->join();
-
+ if ($tok_thr->error() || $cvt_thr->error()) {
+ exit 1;
+ }
+
# Print additional files
@@ -507,2 +536,3 @@ sub create_changelog {
warn "can't open $file: $!";
+ $exit_status = 2;
}

Return to:

Send suggestions and report system problems to the System administrator.