gbranden pushed a commit to branch master
in repository groff.
commit 1141fe44a8dd95813745e6445baf59203d0bdd1a
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Aug 21 08:11:29 2024 -0500
src/utils/afmtodit/afmtodit.pl: Refactor (3/4).
* src/utils/afmtodit/afmtodit.pl: Reorganize scalar representation of
version information: new `groff_version`, which is populated at build
time, new `short_version` which is `groff_version` stripped of any Git
revision and partial hash information; new `version_stub` which holds
the prefixed information identifying the program and project; new
`output_version` which holds the stub and the short version; and
existing `afmtodit_version`, which holds the stub and the (full) groff
version. Write `output_version` instead of `afmtodit_version` to the
generated file.
---
ChangeLog | 11 ++++++++++-
src/utils/afmtodit/afmtodit.pl | 12 ++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5dab3a9d2..1190f3a00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,16 @@
less garrulous; see Savannah #65110. Add new `opt_w` scalar to
separate it from existing `space_width` scalar so that we can
report the options we were invoked with in a comment in the
- generated file.
+ generated file. Reorganize scalar representation of version
+ information: new `groff_version`, which is populated at build
+ time, new `short_version` which is `groff_version` stripped of
+ any Git revision and partial hash information; new
+ `version_stub` which holds the prefixed information identifying
+ the program and project; new `output_version` which holds the
+ stub and the short version; and existing `afmtodit_version`,
+ which holds the stub and the (full) groff version. Write
+ `output_version` instead of `afmtodit_version` to the generated
+ file.
2024-08-21 G. Branden Robinson <[email protected]>
diff --git a/src/utils/afmtodit/afmtodit.pl b/src/utils/afmtodit/afmtodit.pl
index 8d8426db6..e6ad84eee 100644
--- a/src/utils/afmtodit/afmtodit.pl
+++ b/src/utils/afmtodit/afmtodit.pl
@@ -41,7 +41,15 @@ GetOptions( "a=s", "c", "d=s", "e=s", "f=s", "i=s", "k",
"m", "n",
# We keep these two scalars separate so we can report out the option.
$space_width = $opt_w if defined $opt_w;
-my $afmtodit_version = "GNU afmtodit (groff) version @VERSION@";
+# Preserve the Git revision and partial hash from development builds in
+# `--version` output, but scrub it from comments written to files.
+my $groff_version = "@VERSION@";
+my $short_version = $groff_version;
+$short_version =~ s/(\d+\.\d+.\d+).*/$1/;
+
+my $version_stub = "GNU afmtodit (groff) version";
+my $afmtodit_version = "$version_stub $groff_version";
+my $output_version = "$version_stub $short_version";
if ($opt_v) {
print "$afmtodit_version\n";
@@ -461,7 +469,7 @@ open(FONT, ">$outfile") ||
croak("unable to open '$outfile' for writing: $!\n");
select(FONT);
-print("# This file was generated with $afmtodit_version.\n");
+print("# generated by $output_version\n");
print("#\n");
print("# $fullname\n") if defined $fullname;
print("# $version\n") if defined $version;
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit