You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2024/01/11 00:15:34 UTC

(couchdb) 01/01: Pick up dev/run defaults from install.mk

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch read-install-mk-defaults
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit f20ab4f7321eabc9e0ebca820a4e79d4a69b5d88
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed Jan 10 19:12:28 2024 -0500

    Pick up dev/run defaults from install.mk
    
    To avoid having to specify --enable-nouveau and --with-nouveau twice.
    
    Once it's configured, dev/run should keep starting it. Until we run configure again to disable.
---
 dev/run | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/dev/run b/dev/run
index 79dc29a2b..7864c8300 100755
--- a/dev/run
+++ b/dev/run
@@ -117,6 +117,7 @@ def setup_argparse():
 
 
 def get_args_parser():
+    install_mk = get_install_mk()
     parser = optparse.OptionParser(description="Runs CouchDB dev cluster")
     parser.add_option(
         "-a",
@@ -230,7 +231,7 @@ def get_args_parser():
     parser.add_option(
         "--with-nouveau",
         dest="with_nouveau",
-        default=False,
+        default = install_mk.get('with_nouveau') == 'true',
         action="store_true",
         help="Start Nouveau server",
     )
@@ -538,6 +539,7 @@ def maybe_boot_nouveau(ctx):
         return boot_nouveau(ctx)
 
 
+@log("Booting nouveau")
 def boot_nouveau(ctx):
     config = os.path.join(ctx["devdir"], "lib", "nouveau.yaml")
     cmd = [
@@ -1203,6 +1205,28 @@ def reboot_nodes(ctx):
     boot_nodes(ctx)
     ensure_all_nodes_alive(ctx)
 
+def get_install_mk():
+    fpath = os.path.abspath(__file__)
+    rootdir = os.path.dirname(os.path.dirname(fpath))
+    install_mk_path = os.path.join(rootdir, "install.mk")
+    install_mk = {}
+    with open(install_mk_path) as fh:
+        for line in fh.readlines():
+            line = line.strip()
+            if not line:
+                continue
+            if line.startswith('#'):
+                continue
+            split = line.split('=', 1)
+            if len(split) != 2:
+                continue
+            [key, val] = split
+            key = key.strip()
+            val = val.strip()
+            if not key or not val:
+                continue
+            install_mk[key] = val
+    return install_mk
 
 if __name__ == "__main__":
     try: