#4 Fix gawk API version number as per upstream
Opened 2 months ago by ajschorr. Modified 2 months ago
rpms/ ajschorr/gawk master  into  master

@@ -0,0 +1,53 @@ 

+ From ae1139c068702ede2d35002bdd14199a2c9eb4d8 Mon Sep 17 00:00:00 2001

+ From: "Andrew J. Schorr" <aschorr@telemetry-investments.com>

+ Date: Mon, 8 Jul 2019 09:25:01 -0400

+ Subject: [PATCH] Bump gawk_api_major_version due to incompatible namespace

+  changes.

+ 

+ ---

+  ChangeLog | 8 ++++++++

+  gawkapi.h | 5 ++++-

+  2 files changed, 12 insertions(+), 1 deletion(-)

+ 

+ diff --git a/ChangeLog b/ChangeLog

+ index 31bb6a5..9dda704 100644

+ --- a/ChangeLog

+ +++ b/ChangeLog

+ @@ -1,3 +1,11 @@

+ +2019-07-08         Andrew J. Schorr      <aschorr@telemetry-investments.com>

+ +

+ +	* gawkapi.h (gawk_api_major_version): Bump from 2 to 3 because the

+ +	namespace changes altered the function signatures in gawk_api_t.

+ +	And add a comment at the top of the structure with a reminder that

+ +	the version number should be bumped whenever the struct is altered

+ +	in any way.

+ +

+  2019-06-30         Arnold D. Robbins     <arnold@skeeve.com>

+  

+  	* interpret.h (r_interpret): Fix two more cases of warning

+ diff --git a/gawkapi.h b/gawkapi.h

+ index 3db8990..9d9cf87 100644

+ --- a/gawkapi.h

+ +++ b/gawkapi.h

+ @@ -296,7 +296,7 @@ typedef struct awk_two_way_processor {

+  	awk_const struct awk_two_way_processor *awk_const next;  /* for use by gawk */

+  } awk_two_way_processor_t;

+  

+ -#define gawk_api_major_version 2

+ +#define gawk_api_major_version 3

+  #define gawk_api_minor_version 0

+  

+  /* Current version of the API. */

+ @@ -458,6 +458,9 @@ typedef void *awk_ext_id_t;	/* opaque type for extension id */

+  /*

+   * The API into gawk. Lots of functions here. We hope that they are

+   * logically organized.

+ + *

+ + * !!! If you make any changes to this structure, please remember to bump !!!

+ + * !!! gawk_api_major_version and/or gawk_api_minor_version.              !!!

+   */

+  typedef struct gawk_api {

+  	/* First, data fields. */

+ -- 

+ 1.8.3.1

+ 

file modified
+14 -4

@@ -30,10 +30,13 @@ 

  # For more info: https://fedoraproject.org/wiki/Packaging:Guidelines#PIE

  %global _hardened_build 1

  

- # Extract the API major & minor versions, so we can export them below:

- %global gawk_api_major %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout 2>/dev/null | \

+ # Extract the API major & minor versions, so we can export them below.

+ # Ensure that the major version is >= 3, since that patch is not yet

+ # in the tarball.

+ %global gawk_api_major %%(x=`tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout 2>/dev/null | \

                            grep -i -e "gawk_api_major.*[[:digit:]]" | \

-                           grep -o -e "[[:digit:]]" || :)

+                           grep -o -e "[[:digit:]]"`; \

+ 			  [ "$x" -lt 3 ] && x=3; echo $x)

  

  %global gawk_api_minor %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout 2>/dev/null | \

                            grep -i -e "gawk_api_minor.*[[:digit:]]" | \

@@ -44,7 +47,7 @@ 

  Name:             gawk

  Summary:          The GNU version of the AWK text processing utility

  Version:          5.0.1

- Release:          2%{?dist}

+ Release:          3%{?dist}

  

  License:          GPLv3+ and GPLv2+ and LGPLv2+ and BSD

  

@@ -120,6 +123,7 @@ 

  Patch006: gawk-inplace-namespace-part2.patch

  #Parts of the patch dealing with .info files, were removed, some parts of documentation might be broken

  Patch007: gawk-inplace-namespace-part3.patch

+ Patch008: gawk-api-version.patch

  

  

  

@@ -277,6 +281,12 @@ 

  # =============================================================================

  

  %changelog

+ * Sat Jul 20 2019 Andrew Schorr <ajschorr@fedoraproject.org> - 5.0.1-4

+ - Force api_major_version >= 3 because patch is not in tarball yet

+ 

+ * Thu Jul 11 2019 Andrew Schorr <ajschorr@fedoraproject.org> - 5.0.1-3

+ - Add upstream patch to fix the API version number

+ 

  * Thu Jun 27 2019 Jakub Martisko <jamartis@redhat.com> - 5.0.1-2

  - Fix the bacward compatibility of the inplace extension

  - (renaming of some variables due to introduction of namespaces)

This incorporates upstream patch ae1139c068702ede2d35002bdd14199a2c9eb4d8

Thanks for the patch, I had to slightly modify the changelog parts. Modified version should be in the git.

Ugh. I screwed up the version number in the changelog. I put 5.0.10-3 instead of 5.0.1-3. Sorry. It looks like it's still wrong in the master branch after you merged the patch. Should I fix it, or will you? Sorry again. Very sloppy typing on my part.

1 new commit added

  • Fix changelog version number typo in last patch
2 months ago

No problem, I've already pushed the modified version 1 to the git, so no need for further fixes.

When I look at the master gawk rawhide branch, I still see the wrong entry in the changelog (5.0.10-3). So I'm confused. Did you fix it? I'm happy to fix it if you prefer...

My bad, in my original reply, I was talking about the changelog file and I didn't realize you mean the changelog in the spec file. Should be fixed now.

1 new commit added

  • Fix gawk_api_major spec file macro to ensure that it is >= 3
2 months ago

Ugh, Fedora Rawhide gawk is still broken because the spec file
pulls the api version from the tarball like so:

Extract the API major & minor versions, so we can export them below:

%global gawk_api_major %%(tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout 2>/dev/null | \
grep -i -e "gawk_api_major.*[[:digit:]]" | \
grep -o -e "[[:digit:]]" || :)

This logic doesn't work when there's a patch such as gawk-api-version.patch
that changes the api version number in gawkapi.h. The next release
of gawk will incorporate this fix, but until then, the gawk rpm
is broken:

bash-4.2$ rpm --provides -qp gawk-5.0.1-3.fc31.x86_64.rpm
/bin/awk
/bin/gawk
gawk = 5.0.1-3.fc31
gawk(abi) = 2.0
gawk(x86-64) = 5.0.1-3.fc31

This is not correct for gawk(abi): it should be 3.0, not 2.0. I'm not sure
whether there's any elegant way to fix this. I guess we may need to set a
minimum of 3 in the gawk_api_major macro. Does this look OK?

%global gawk_api_major %%(x=tar -xf %{SOURCE0} gawk-%{version}/gawkapi.h --to-stdout 2>/dev/null | \ grep -i -e "gawk_api_major.*[[:digit:]]" | \ grep -o -e "[[:digit:]]"; \
[ "$x" -lt 3 ] && x=3; echo $x)

I added a patch to my fork that makes this change. Does this look OK to merge?

Wouldn't it be a bit cleaner to just hardcode the version to 3.0 and not use these greps until the new upstream version is released and then revert this back to the current state? I suppose we would have to do cleanup of the proposed changes later anyway...

Wouldn't it be a bit cleaner to just hardcode the version to 3.0 and not use these greps until the new upstream version is released and then revert this back to the current state? I suppose we would have to do cleanup of the proposed changes later anyway...

I really can't tell that right now, I've been "disconnected" from gawk for almost a year now.

However, the newly updated macro is IMHO inccorrect, and won't build correctly from my quick look at it. Seems like it's missing the closing ), and the || : is missing as well, which is used to not fail build if the command fails IIRC.

... My 2 cents. :)

I think the closing ) is present, but I confess that I did not test building after this patch.

I am fine with hardcoding a value of 3 until fixed by upstream gawk. We just need to find some way to bump the gawk(abi) version to the currently correct value of 3.0. I don't care how we do it, as long as we do it...

Note: I tested the patch, and it seems to work for me.

But yes, the error handling is weak. I felt that this was OK because this is a very temporary patch until we can upgrade to the next gawk release...

I've applied the patch. Do you have any idea when is the new upstream version coming?

I do not know. The maintainer is very busy with other things...

But I expect it soon. I just patched rawhide gawk.spec to bump the release number to 4 and am trying to build it.