Devserver: make the shadow file easier to use
Using the shadow config that is installed with the devserver is a pain.
Instead, let's always use it from the source dir.
Otherwise in order to propagate shadow config changes you needed to
cros_workon --host start cros-devutils
sudo emerge -1 cros-devutils
Now after this change it always just works after you save the file.
BUG=None
TEST=Ran it and checked shadow_config path.
Change-Id: I1ea9741a4463f1516ad7d3f3f8c82bfd9cbae559
Reviewed-on: https://chromium-review.googlesource.com/67003
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/Makefile b/Makefile
index 0827d95..057a17a 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,6 @@
gsutil_util.py \
log_util.py \
strip_package.py \
- shadow_xbuddy_config.ini\
xbuddy.py \
xbuddy_config.ini\
"${DESTDIR}/usr/lib/devserver"
diff --git a/xbuddy.py b/xbuddy.py
index 13a1285..2659002 100644
--- a/xbuddy.py
+++ b/xbuddy.py
@@ -29,6 +29,9 @@
PATH_REWRITES = 'PATH_REWRITES'
GENERAL = 'GENERAL'
+# Path for shadow config in chroot.
+CHROOT_SHADOW_DIR = '/mnt/host/source/src/platform/dev'
+
# XBuddy aliases
TEST = 'test'
BASE = 'base'
@@ -197,7 +200,12 @@
raise XBuddyException('%s not found' % (CONFIG_FILE))
# Read the shadow file if there is one.
- shadow_config_file = os.path.join(self.devserver_dir, SHADOW_CONFIG_FILE)
+ if os.path.isdir(CHROOT_SHADOW_DIR):
+ shadow_config_file = os.path.join(CHROOT_SHADOW_DIR, SHADOW_CONFIG_FILE)
+ else:
+ shadow_config_file = os.path.join(self.devserver_dir, SHADOW_CONFIG_FILE)
+
+ _Log('Using shadow config file stored at %s', shadow_config_file)
if os.path.exists(shadow_config_file):
shadow_xbuddy_config = ConfigParser.ConfigParser()
shadow_xbuddy_config.read(shadow_config_file)