changeset 186:7febb8b5cb59

Patch our PORTVERSION into uwsgi that is returned with "uwsgi --version". The parser for the version in uwsgiconfig.py also needed to be adjusted therefore because all version parts up to and including the revision must be integers to be used in the Python plugins properly.
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 14 Mar 2025 12:34:09 +0100
parents 6aa5c9b981b2
children 13e07e75c111
files uwsginl/Makefile uwsginl/files/patch-uwsgiconfig.py
diffstat 2 files changed, 38 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/uwsginl/Makefile	Fri Mar 14 12:16:05 2025 +0100
+++ b/uwsginl/Makefile	Fri Mar 14 12:34:09 2025 +0100
@@ -78,6 +78,9 @@
 EXTRA_PROFILE_OVERRIDE+=	${bcvar:tl}=${BUILDCONF_${bcvar}:Ufalse}
 .endfor
 
+post-patch:
+	${REINPLACE_CMD} -i '' -e 's/2.1-dev/${PORTVERSION}/' ${WRKSRC}/uwsgiconfig.py
+
 do-configure:
 	@${DO_NADA}
 
--- a/uwsginl/files/patch-uwsgiconfig.py	Fri Mar 14 12:16:05 2025 +0100
+++ b/uwsginl/files/patch-uwsgiconfig.py	Fri Mar 14 12:34:09 2025 +0100
@@ -1,6 +1,35 @@
---- uwsgiconfig.py.orig	2024-10-26 09:59:26 UTC
+--- uwsgiconfig.py.orig	2024-10-26 09:39:02 UTC
 +++ uwsgiconfig.py
-@@ -1467,7 +1467,8 @@ def build_plugin(path, uc, cflags, ldflags, libs, name
+@@ -1218,11 +1218,24 @@ class uConf(object):
+         uver_min = '0'
+         uver_rev = '0'
+ 
+-        if len(uver_dots) > 2:
+-            uver_min = uver_dots[2]
++        # fag: handle our PORTVERSION strings properly
++        for plidx, uver_part in enumerate(uver_dots):
++            if uver_part[0].isalpha():
++                assert ((uver_part.startswith("pl") and (uver_part[2:]).isnumeric())
++                        or
++                        (uver_part.startswith("dev") and (uver_part[3:]).isnumeric()))
++                if uver_custom:
++                    uver_custom = ".".join(uver_dots[plidx:]) + "-" + uver_custom
++                else:
++                    uver_custom = ".".join(uver_dots[plidx:])
++                break
++        else:
++            # uWSGI standard
++            if len(uver_dots) > 2:
++                uver_min = uver_dots[2]
+ 
+-        if len(uver_dots) > 3:
+-            uver_rev = uver_dots[3]
++            if len(uver_dots) > 3:
++                uver_rev = uver_dots[3]
+ 
+         self.cflags.append('-DUWSGI_VERSION_BASE="' + uver_base + '"')
+         self.cflags.append('-DUWSGI_VERSION_MAJOR="' + uver_maj + '"')
+@@ -1497,7 +1510,8 @@ def build_plugin(path, uc, cflags, ldflags, libs, name
              gcc_list.append(path + '/' + cfile)
      for bfile in up.get('BINARY_LIST', []):
          try:
@@ -10,10 +39,10 @@
              print(binary_link_cmd)
              if subprocess.call(binary_link_cmd, shell=True) != 0:
                  raise Exception('unable to link binary file')
-@@ -1561,6 +1562,19 @@ def build_plugin(path, uc, cflags, ldflags, libs, name
-     print("build time: %d seconds" % (time.time() - plugin_started_at))
+@@ -1595,6 +1609,19 @@ def build_plugin(path, uc, cflags, ldflags, libs, name
      print("*** %s plugin built and available in %s ***" % (name, plugin_dest + '.so'))
  
+ 
 +
 +def get_default_target_emulation():
 +    """Need a target emulation on FreeBSD (ld, ld.lld when linking binary/raw"""
@@ -30,8 +59,8 @@
  def vararg_callback(option, opt_str, value, parser):
      assert value is None
      value = []
-@@ -1650,7 +1664,7 @@ if __name__ == "__main__":
-         print("*** uWSGI building and linking plugin %s ***" % options.plugin[0] )
+@@ -1684,7 +1711,7 @@ if __name__ == "__main__":
+         print("*** uWSGI building and linking plugin %s ***" % options.plugin[0])
          build_plugin(options.plugin[0], uc, cflags, ldflags, libs, name)
      elif options.extra_plugin:
 -        print("*** uWSGI building and linking plugin from %s ***" % options.extra_plugin[0])