[PATCH] python/osmo-python-tests[master]: osmodumpdoc: fix finding cfg when not calling from source tree

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Sep 19 01:37:21 UTC 2017


osmodumpdoc: fix finding cfg when not calling from source tree

When the binary has not been built in the source tree, it was impossible to
call osmodumpdoc.py despite the -p <config-path> option. Look for config files
in that config-path.

Make sure a relative config-path is adjusted when changing to the workdir.

Change-Id: I5427d354c289ec4602411c7059c8d80e2b451f7c
---
M osmopy/osmodumpdoc.py
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/python/osmo-python-tests refs/changes/74/3974/2

diff --git a/osmopy/osmodumpdoc.py b/osmopy/osmodumpdoc.py
index 0ff1f6b..ce9fec4 100644
--- a/osmopy/osmodumpdoc.py
+++ b/osmopy/osmodumpdoc.py
@@ -28,7 +28,7 @@
 Returns the number of apps configs could not be dumped for."""
 
 
-def dump_configs(apps, configs):
+def dump_configs(apps, configs, confpath):
     failures = 0
     successes = 0
 
@@ -41,7 +41,7 @@
         appname = app[3]
         print "Starting app for %s" % appname
         proc = None
-        cmd = [app[1], "-c", configs[appname][0]]
+        cmd = [app[1], "-c", os.path.join(confpath, configs[appname][0])]
         try:
             proc = subprocess.Popen(cmd, stdin=None, stdout=None)
         except OSError:  # Probably a missing binary
@@ -82,9 +82,10 @@
     osmoappdesc = osmoutil.importappconf_or_quit(
         confpath, "osmoappdesc", args.p)
 
+    confpath = os.path.relpath(confpath, workdir)
     os.chdir(workdir)
     num_fails, num_sucs = dump_configs(
-        osmoappdesc.apps, osmoappdesc.app_configs)
+        osmoappdesc.apps, osmoappdesc.app_configs, confpath)
     if num_fails > 0:
         print >> sys.stderr, "Warning: Skipped %s apps" % num_fails
         if 0 == num_sucs:

-- 
To view, visit https://gerrit.osmocom.org/3974
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5427d354c289ec4602411c7059c8d80e2b451f7c
Gerrit-PatchSet: 2
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list