[PATCH] waf: Fix the build on openbsd

Ralph Böhme rb at sernet.de
Mon Feb 9 04:41:56 MST 2015


On Sat, Feb 07, 2015 at 09:32:32AM +0100, Volker Lendecke wrote:
> On Tue, Feb 03, 2015 at 03:00:18PM +0100, Volker Lendecke wrote:
> > Right, but is it something close to binary code patching the
> > right strategy? We will have to revisit each and every of
> > those patches when someone imports a new waf. I think it's
> > easier to find all changes to wafadmin if they actually
> > happen in wafadmin/. You can do a 
> > 
> > cd buildtools/wafadmin; git log .
> > 
> > if you keep the changes in wafadmin. If we sprinkle patches
> > to wafadmin to wafsamba, they are completely separate and
> > much harder to find.
> 
> Any more opinions on this?

There are at least two different cases of changes to wafadmin:

1) backported upstream commits/bugfixes in wafadmin
2) (our) downstream bugfixes

We could stash our downstream wafadmin fixes in a dedicated file in
wafsamba. This should work for most if not all bugfixes.

Whenever we want to sync with upstream, we can review our fixes with a
simple git log buildtools/wafsamba/samba_wafadmin_fixes.py.

Thoughts? Cf attached patch.
-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de
-------------- next part --------------
From e10c703a6f8a19fd5119734d157c0911473e6727 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Mon, 9 Feb 2015 12:02:12 +0100
Subject: [PATCH 1/2] waf: add new file for wafadmin bugfixes

In order to facilitate differentation between

1) pristine upstream waf in wafadmin
2) backported upstream commits/bugfixes in wafadmin
3) downstream bugfixes

add a new file samba_wafadmin_fixes.py which is restricted to only
containing pure wafadmin bugfixes.

Thereby on future waf upstream imports we can easily review our own
fixes with a git log buildtools/wafsamba/samba_wafadmin_fixes.py.

TODO: consolidate previous bugfixes that modify other parts of wafsamba
in this file.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 buildtools/wafsamba/samba_wafadmin_fixes.py | 17 +++++++++++++++++
 buildtools/wafsamba/wafsamba.py             |  1 +
 2 files changed, 18 insertions(+)
 create mode 100644 buildtools/wafsamba/samba_wafadmin_fixes.py

diff --git a/buildtools/wafsamba/samba_wafadmin_fixes.py b/buildtools/wafsamba/samba_wafadmin_fixes.py
new file mode 100644
index 0000000..ef3953f
--- /dev/null
+++ b/buildtools/wafsamba/samba_wafadmin_fixes.py
@@ -0,0 +1,17 @@
+# This file contains *bugfixes* for wafadmin
+# In order to facilitate differentation between
+#
+# 1) prestine upstream waf in wafadmin
+# 2) backported upstream commits/bugfixes in wafadmin
+# 3) downstream bugfixes
+#
+# add a new file samba_wafadmin_fixes.py which is restricted to only
+# containing pure wafadmin bugfixes.
+#
+# Therefor on future waf upstream imports we can easily review our own
+# fixes with a git log buildtools/wafsamba/samba_wafadmin_fixes.py.
+
+import os
+import Build, Utils, Node
+from TaskGen import feature, after, before
+import preproc
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index c054315..f8d131c 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -20,6 +20,7 @@ from samba_perl import *
 from samba_deps import *
 from samba_bundled import *
 from samba_third_party import *
+from samba_wafadmin_fixes import *
 import samba_install
 import samba_conftests
 import samba_abi
-- 
1.9.3


From a8937a378be142bab345f4a93144548336351585 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Mon, 9 Feb 2015 12:26:36 +0100
Subject: [PATCH 2/2] wafsamba: add workaround for library naming on OpenBSD

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 buildtools/wafsamba/samba_wafadmin_fixes.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/buildtools/wafsamba/samba_wafadmin_fixes.py b/buildtools/wafsamba/samba_wafadmin_fixes.py
index ef3953f..9128079 100644
--- a/buildtools/wafsamba/samba_wafadmin_fixes.py
+++ b/buildtools/wafsamba/samba_wafadmin_fixes.py
@@ -15,3 +15,31 @@ import os
 import Build, Utils, Node
 from TaskGen import feature, after, before
 import preproc
+import ccroot
+
+waf_ccroot_get_target_name = ccroot.get_target_name
+def samba_get_target_name(self):
+    if self.env.DEST_OS != 'openbsd':
+        return waf_ccroot_get_target_name(self)
+
+    tp = 'program'
+    for x in self.features:
+        if x in ['cshlib', 'cstaticlib']:
+            tp = x.lstrip('c')
+
+    pattern = self.env[tp + '_PATTERN']
+    if not pattern: pattern = '%s'
+
+    dir, name = os.path.split(self.target)
+
+    if 'cshlib' in self.features and getattr(self, 'vnum', None):
+        nums = self.vnum.split('.')
+        if self.env.DEST_BINFMT == 'pe':
+            # include the version in the dll file name,
+            # the import lib file name stays unversionned.
+            name = name + '-' + nums[0]
+        elif self.env.DEST_OS == 'openbsd':
+            pattern = '.'.join([pattern]+[str(d) for d in nums][:2])
+
+    return os.path.join(dir, pattern % name)
+ccroot.get_target_name = samba_get_target_name
-- 
1.9.3



More information about the samba-technical mailing list