lava commented on a change in pull request #327: Updated glog to 0.3.5 and then 
to 0.4.0, added microseconds to LogSink::send().
URL: https://github.com/apache/mesos/pull/327#discussion_r268567530
 
 

 ##########
 File path: src/python/native_common/ext_modules.py.in
 ##########
 @@ -71,75 +94,101 @@ def _create_module(module_name):
         os.path.join(abs_top_builddir, libprocess, '.libs', 'libprocess.a')
     ]
 
+    def cond_add_extra_objects(true_subst, false_subst, bundled, system):
+        """
+            Depending on the provided results of substitution by the configure
+            script, add either bundled or system ones to EXTRA_OBJECTS.
+            If adding bundled objects, check their existence
+            and fail if they are missing.
+        """
+        use_bundled = _get_ac_subst_bool(true_subst, false_subst)
+        if isinstance(bundled, basestring):
+            bundled = [bundled]
+        if isinstance(system, basestring):
+            system = system
+        if use_bundled:
+            for obj in bundled:
+                if not os.path.exists(obj):
+                    raise RuntimeError("{} does not exist.".format(obj))
+            EXTRA_OBJECTS.extend(bundled)
+        else:
+            EXTRA_OBJECTS.extend(system)
     # For leveldb, we need to check for the presence of libleveldb.a, since
     # it is possible to disable leveldb inside mesos.
-    libglog = os.path.join(abs_top_builddir, glog, '.libs', 'libglog.a')
     libleveldb = os.path.join(abs_top_builddir, leveldb, 'out-static', 
'libleveldb.a')
-    libzookeeper = os.path.join(
-        abs_top_builddir, zookeeper, '.libs', 'libzookeeper_mt.a')
-    libprotobuf = os.path.join(
-        abs_top_builddir, protobuf, 'src', '.libs', 'libprotobuf.a')
-
-    if os.path.exists(libleveldb):
-        EXTRA_OBJECTS.append(libleveldb)
-    else:
-        EXTRA_OBJECTS.append('-lleveldb')
-
-    if os.path.exists(libzookeeper):
-        EXTRA_OBJECTS.append(libzookeeper)
-    else:
-        EXTRA_OBJECTS.append('-lzookeeper_mt')
-
-    if os.path.exists(libglog):
-        EXTRA_OBJECTS.append(libglog)
-    else:
-        EXTRA_OBJECTS.append('-lglog')
-
-    if os.path.exists(libprotobuf):
-      EXTRA_OBJECTS.append(libprotobuf)
-    else:
-      EXTRA_OBJECTS.append('-lprotobuf')
+    cond_add_extra_objects(
+        "@WITH_BUNDLED_LEVELDB_TRUE@",
+        "@WITH_BUNDLED_LEVELDB_FALSE@",
+        libleveldb,
+        '-lleveldb'
+    )
+    cond_add_extra_objects(
+        "@WITH_BUNDLED_ZOOKEEPER_TRUE@",
+        "@WITH_BUNDLED_ZOOKEEPER_FALSE@",
+        os.path.join(abs_top_builddir, zookeeper, '.libs', 
'libzookeeper_mt.a'),
+        '-lzookeeper_mt'
+    )
+    cond_add_extra_objects(
+        "@WITH_BUNDLED_GLOG_TRUE@",
+        "@WITH_BUNDLED_GLOG_FALSE@",
+        os.path.join(abs_top_builddir, glog, '.libs', 'libglog.a'),
+        '-lglog'
+    )
+    cond_add_extra_objects(
+        "@WITH_BUNDLED_PROTOBUF_TRUE@",
+        "@WITH_BUNDLED_PROTOBUF_FALSE@",
+        os.path.join(abs_top_builddir, protobuf, 'src', '.libs', 
'libprotobuf.a'),
+        '-lprotobuf'
+    )
 
     if '@ENABLE_SECCOMP_ISOLATOR_TRUE@' == '':
         libseccomp = os.path.join('3rdparty', 'libseccomp-2.3.3')
         libseccomp = os.path.join(
-            abs_top_builddir, libseccomp, 'src', '.libs', 'libseccomp.a')
-
-        if os.path.exists(libseccomp):
-            EXTRA_OBJECTS.append(libseccomp)
-        else:
-            EXTRA_OBJECTS.append('-lseccomp')
+            abs_top_builddir, libseccomp, 'src', '.libs', 'libseccomp.a'),
+        cond_add_extra_objects(
+            "@WITH_BUNDLED_LIBSECCOMP_TRUE@",
+            "@WITH_BUNDLED_LIBSECCOMP_FALSE@",
+            libseccomp,
+            '-lseccomp'
+        )
 
     # libev is a special case because it needs to be enabled only when
     # libevent *is not* enabled through the top level ./configure.
     #
     # TODO(hartem): this entire block MUST be removed once libev is deprecated
     # in favor of libevent.
-    if '@ENABLE_LIBEVENT_TRUE@' == '#':
+    if not _get_ac_subst_bool(
+        '@ENABLE_LIBEVENT_TRUE@',
+        '@ENABLE_LIBEVENT_FALSE@'
+        ):
         libev = os.path.join('3rdparty', 'libev-4.22')
-        libev = os.path.join(abs_top_builddir, libev, '.libs', 'libev.a')
-
-        if os.path.exists(libev):
-            EXTRA_OBJECTS.append(libev)
-        else:
-            EXTRA_OBJECTS.append('-lev')
+        cond_add_extra_objects(
+            "@WITH_BUNDLED_LIBEV_TRUE@",
+            "@WITH_BUNDLED_LIBEV_FALSE@",
+            os.path.join(abs_top_builddir, libev, '.libs', 'libev.a'),
+            '-lev'
+        )
     else:
         libevent_dir = os.path.join('3rdparty', 'libevent-2.0.22-stable')
         libevent_dir = os.path.join(abs_top_builddir, libevent_dir, '.libs')
 
-        libevent_core = os.path.join(libevent_dir, 'libevent_core.a')
-
-        # Check if a bundled version of libevent was built.
-        if os.path.exists(libevent_core):
-            EXTRA_OBJECTS.append(libevent_core)
-            EXTRA_OBJECTS.append(os.path.join(libevent_dir, 
'libevent_pthreads.a'))
-            if '@ENABLE_SSL_TRUE@' == '':
-                EXTRA_OBJECTS.append(os.path.join(libevent_dir, 
'libevent_openssl.a'))
-        else:
-            EXTRA_OBJECTS.append('-levent_core')
-            EXTRA_OBJECTS.append('-levent_pthreads')
-            if '@ENABLE_SSL_TRUE@' == '':
-                EXTRA_OBJECTS.append(-levent_openssl)
 
 Review comment:
   I wonder how that line ever worked, did we accidentally have a variable 
called `levent_openssl` somewhere? :D

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to