vendor version/revision string

Michael Tokarev mjt at tls.msk.ru
Thu Jun 20 06:46:50 UTC 2024


Hi!

After Andrew added --vendor-name & --vendor-patch-revision options, I decided to give
it another try to embed downstream (distribution) version info into the binaries
(yes, I know all that stuff were there before too, in a form of VERSION file).

And faced the same old issue which I faced before, when I tried that previously and
failed.

The prob is that --vendor-patch-revision expects just a number.  While in debian,
version string is a string with many words, - even the debian revision "number"
(everything after the upstream version) isn't a number but a string.  For example,
4.17.12+dfsg-0+deb12u1~bpo11+1 - there, --vendor-patch-revision is "0+deb12u1~bpo11+1".
So --vendor-patch-revision can't be used obviously (as it fails right away if something
besides a number is specified).

So I tried to (ab-)use --vendor-name instead, - adding debian version string right to
this one (there's no need to have both options, one is definitely enough).  And while
at first it worked (for a simple version like 4.20.2+dfsg-1), it still fails later during
build process with a version string which contains a tilde, like 4.20.2+dfsg-1~mjt-ubt24 -
it fails at link time because linker script will contain tilde in a symbol name:

SAMBA_4.20.2_UBUNTU_4.20.2_DFSG_1~MJT_UBT24_PRIVATE_SAMBA {
..
}

The wafsamba thing is tough to deal with (it's probably the most uneasy build system in
the world).  I tried this change:

--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -288,3 +288,3 @@ def abi_build_vscript(task):
  def VSCRIPT_MAP_PRIVATE(bld, libname, orig_vscript, version, private_vscript):
-    version = version.replace("-", "_").replace("+","_").upper()
+    version = version.replace("-", "_").replace("+","_").replace("~","_").upper()
      t = bld.SAMBA_GENERATOR(private_vscript,
@@ -317,3 +317,3 @@ def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None, p
      libname = libname.replace("-", "_").replace("+","_").upper()
-    version = version.replace("-", "_").replace("+","_").upper()
+    version = version.replace("-", "_").replace("+","_").replace("~","_").upper()

(ugly but ok).

This made the build succeed.  However, while whole version string sort of made it
into the executables, there's still a prob in manpages:

Samba 4.20.2-Debian-4.

Yes, it is cut at the first dot.

I'll keep it this way for now, - at least the binaries now properly log whole version
string finally, which is something.

JFYI.

Thanks,

/mjt

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt



More information about the samba-technical mailing list