[PATCH] s3: Fix the build when compiling without JSON support

Philipp Gesang philipp.gesang at intra2net.com
Tue Sep 25 14:14:30 UTC 2018


Hi Andrew, all,

-<| Quoting Andrew Bartlett <abartlet at samba.org>, on Tuesday, 2018-09-25 05:35:47 AM |>-
> On Mon, 2018-09-24 at 09:29 +0200, Philipp Gesang via samba-technical
> wrote:
> > -<| Quoting Andrew Bartlett <abartlet at samba.org>, on Monday, 2018-09-
> > 24 04:02:33 PM |>-
> > > 
> > > On Sun, 2018-09-23 at 14:45 -0700, Ralph Böhme wrote:
> > > > 
> > > > On Sun, Sep 23, 2018 at 11:23:39AM -0700, Andrew Bartlett wrote:
> > > > > 
> > > > > 
> > > > > Sure the build needs to be fixed, but it still needs to be
> > > > > controlled
> > > > > by a --without-json, otherwise this remains untested and we get
> > > > > back to
> > > > > the unsatisfactory 'build contents depends on what is on the
> > > > > build
> > > > > host' situation.
> > > > yep. :)
> > > > 
> > > > -slow
> > > Philipp,
> > > 
> > > Can you have a go at addressing this by making all of our JSON
> > > functionality controlled by a --without-json similar to the
> > > current 
> > > --without-json-audit?

for a draft see the attached patch. CI (incomplete as of yet)
available at https://gitlab.com/samba-team/devel/samba/pipelines/31151475

Since there now are JSON users in multiple components, I found it
reasonable to move the switch into the main wscript.

Any plans to relocate the JSON code out of the audit component
too?

> > Is --without-json to supersede --without-json-audit or should
> > the latter continue to exist so JSON can be disabled locally for
> > the audit component?
> 
> It should supersede --without-json-audit.

The patch drops --without-json-audit entirely, but that switch is
present in the 4.9 release. Is it alright to break backward
compatibility of the build like that?

Best,
Philipp

-------------- next part --------------
From 6a6d7dc89a951a385c0415d4ec304957b682adcb Mon Sep 17 00:00:00 2001
From: Philipp Gesang <philipp.gesang at intra2net.com>
Date: Tue, 25 Sep 2018 14:09:18 +0200
Subject: [RFC PATCH] turn --with-json-audit into global --with-json

Fold the build option --with-json-audit into the toplevel wscript
to reflect the fact that JSON support is no longer local to the
audit subsystem.

Signed-off-by: Philipp Gesang <philipp.gesang at intra2net.com>
---
 docs-xml/smbdotconf/logging/loglevel.xml |  2 +-
 lib/audit_logging/wscript                | 36 ------------------------
 script/autobuild.py                      |  2 +-
 wscript                                  | 31 ++++++++++++++++++--
 4 files changed, 31 insertions(+), 40 deletions(-)
 delete mode 100644 lib/audit_logging/wscript

diff --git a/docs-xml/smbdotconf/logging/loglevel.xml b/docs-xml/smbdotconf/logging/loglevel.xml
index 9a029263070..42912720655 100644
--- a/docs-xml/smbdotconf/logging/loglevel.xml
+++ b/docs-xml/smbdotconf/logging/loglevel.xml
@@ -56,7 +56,7 @@
 
     <para>Authentication and authorization audit information is logged
     under the auth_audit, and if Samba was not compiled with
-    --without-json-audit, a JSON representation is logged under
+    --without-json, a JSON representation is logged under
     auth_json_audit.</para>
 
     <para>Support is comprehensive for all authentication and authorisation
diff --git a/lib/audit_logging/wscript b/lib/audit_logging/wscript
deleted file mode 100644
index f99df055731..00000000000
--- a/lib/audit_logging/wscript
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-
-from waflib import Logs, Options, Errors
-import samba3
-
-def options(opt):
-    help = ("Build with JSON auth audit support (default=True). "
-            "This requires the jansson devel package.")
-
-    opt.SAMBA3_ADD_OPTION('json-audit', default=None, help=(help))
-
-    return
-
-def configure(conf):
-    conf.SET_TARGET_TYPE('jansson', 'EMPTY')
-
-    if Options.options.with_json_audit != False:
-        if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
-                          msg='Checking for jansson'):
-            conf.CHECK_FUNCS_IN('json_object', 'jansson')
-
-    if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
-        if Options.options.with_json_audit != False:
-            conf.fatal("Jansson JSON support not found. "
-                       "Try installing libjansson-dev or jansson-devel. "
-                       "Otherwise, use --without-json-audit to build without "
-                       "JSON support. "
-                       "JSON support is required for the JSON "
-                       "formatted audit log feature and the AD DC")
-        if not Options.options.without_ad_dc:
-            raise Errors.WafError('--without-json-audit requires '
-                                 '--without-ad-dc. '
-                                 'Jansson JSON library is required for '
-                                 'building the AD DC')
-        Logs.info("Building without Jansson JSON log support")
-
diff --git a/script/autobuild.py b/script/autobuild.py
index 02fff41204b..1dbdf8ccc26 100755
--- a/script/autobuild.py
+++ b/script/autobuild.py
@@ -135,7 +135,7 @@ tasks = {
 
     # We split out this so the isolated ad_dc tests do not wait for ad_dc_ntvfs tests (which are long)
     "samba-fileserver": [("random-sleep", "script/random-sleep.sh 60 600", "text/plain"),
-                           ("configure", "./configure.developer --without-ad-dc --without-ldap --without-ads --without-json-audit --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"),
+                           ("configure", "./configure.developer --without-ad-dc --without-ldap --without-ads --without-json --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"),
                            ("make", "make -j", "text/plain"),
                            ("test", "make test FAIL_IMMEDIATELY=1 "
                             "TESTS='${PY3_ONLY}"
diff --git a/wscript b/wscript
index 155de7c2826..ae1b929c495 100644
--- a/wscript
+++ b/wscript
@@ -35,7 +35,6 @@ def system_mitkrb5_callback(option, opt, value, parser):
 def options(opt):
     opt.BUILTIN_DEFAULT('NONE')
     opt.PRIVATE_EXTENSION_DEFAULT('samba4')
-    opt.RECURSE('lib/audit_logging')
     opt.RECURSE('lib/replace')
     opt.RECURSE('dynconfig')
     opt.RECURSE('packaging')
@@ -103,6 +102,13 @@ def options(opt):
     opt.load('python') # options for disabling pyc or pyo compilation
     # enable options related to building python extensions
 
+    opt.add_option('--with-json',
+                   action='store_true', dest='with_json',
+                   help=("Build with JSON support (default=True). This "
+                         "requires the jansson development headers."))
+    opt.add_option('--without-json',
+                   action='store_false', dest='with_json',
+                   help=("Build without JSON support."))
 
 def configure(conf):
     version = samba_version.load_version(env=conf.env)
@@ -234,7 +240,6 @@ def configure(conf):
     # system-provided or embedded Heimdal build
     if conf.CONFIG_GET('KRB5_VENDOR') in (None, 'heimdal'):
         conf.RECURSE('source4/heimdal_build')
-    conf.RECURSE('lib/audit_logging')
     conf.RECURSE('source4/lib/tls')
     conf.RECURSE('source4/dsdb/samdb/ldb_modules')
     conf.RECURSE('source4/ntvfs/sysdep')
@@ -274,6 +279,28 @@ def configure(conf):
                 Logs.warn("pthreadpool support cannot be enabled when __thread support was not found")
             conf.undefine('WITH_PTHREADPOOL')
 
+    conf.SET_TARGET_TYPE('jansson', 'EMPTY')
+
+    if Options.options.with_json != False:
+        if conf.CHECK_CFG(package='jansson', args='--cflags --libs',
+                          msg='Checking for jansson'):
+            conf.CHECK_FUNCS_IN('json_object', 'jansson')
+
+    if not conf.CONFIG_GET('HAVE_JSON_OBJECT'):
+        if Options.options.with_json != False:
+            conf.fatal("Jansson JSON support not found. "
+                       "Try installing libjansson-dev or jansson-devel. "
+                       "Otherwise, use --without-json to build without "
+                       "JSON support. "
+                       "JSON support is required for the JSON "
+                       "formatted audit log feature, the AD DC, and "
+                       "the JSON printers of the net utility")
+        if not Options.options.without_ad_dc:
+            raise Errors.WafError('--without-json requires --without-ad-dc. '
+                                 'Jansson JSON library is required for '
+                                 'building the AD DC')
+        Logs.info("Building without Jansson JSON log support")
+
     conf.RECURSE('source3')
     conf.RECURSE('lib/texpect')
     conf.RECURSE('python')
-- 
2.17.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180925/ad8dc53d/signature.sig>


More information about the samba-technical mailing list