From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Cc: John Levon <levon@movementarian.org>
Subject: [PATCH] tools: get rid of hardcoded config dirs
Date: Wed, 20 May 2009 09:53:05 +0200 [thread overview]
Message-ID: <200905200953.05427.Christoph.Egger@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 447 bytes --]
Hi,
attached patch gets rid of hardcoded config dirs.
Solaris related changes acknowleged by John Levon.
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
[-- Attachment #2: xen_configdir.diff --]
[-- Type: text/x-diff, Size: 5845 bytes --]
diff -r e0221531d0e5 Config.mk
--- a/Config.mk Tue May 19 14:17:56 2009 +0100
+++ b/Config.mk Tue May 19 18:19:55 2009 +0200
@@ -87,6 +87,13 @@ define absolutify_xen_root
export XEN_ROOT
endef
+define buildmakevars2shellvars
+ PREFIX="$(PREFIX)"; \
+ XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
+ export PREFIX; \
+ export XEN_SCRIPT_DIR
+endef
+
ifeq ($(debug),y)
CFLAGS += -g
endif
diff -r e0221531d0e5 config/StdGNU.mk
--- a/config/StdGNU.mk Tue May 19 14:17:56 2009 +0100
+++ b/config/StdGNU.mk Tue May 19 18:19:55 2009 +0200
@@ -40,6 +40,14 @@ SBINDIR = $(PREFIX)/sbin
PRIVATE_PREFIX = $(LIBDIR)/xen
PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
+ifeq ($(PREFIX),/usr)
+CONFIG_DIR = /etc
+else
+CONFIG_DIR = $(PREFIX)/etc
+endif
+XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
+XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
+
SOCKET_LIBS =
CURSES_LIBS = -lncurses
PTHREAD_LIBS = -lpthread
diff -r e0221531d0e5 config/SunOS.mk
--- a/config/SunOS.mk Tue May 19 14:17:56 2009 +0100
+++ b/config/SunOS.mk Tue May 19 18:19:55 2009 +0200
@@ -34,6 +34,14 @@ SBINDIR = $(PREFIX)/sbin
PRIVATE_PREFIX = $(LIBDIR)/xen
PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
+ifeq ($(PREFIX),/usr)
+CONFIG_DIR = /etc
+else
+CONFIG_DIR = $(PREFIX)/etc
+endif
+XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
+XEN_SCRIPT_DIR = $(PRIVATE_PREFIX)/scripts
+
SunOS_LIBDIR = /usr/sfw/lib
SunOS_LIBDIR_x86_64 = /usr/sfw/lib/amd64
diff -r e0221531d0e5 stubdom/Makefile
--- a/stubdom/Makefile Tue May 19 14:17:56 2009 +0100
+++ b/stubdom/Makefile Tue May 19 18:19:55 2009 +0200
@@ -270,8 +270,7 @@ libxc-$(XEN_TARGET_ARCH)/libxenctrl.a li
ioemu: cross-zlib cross-libpci libxc
[ -f ioemu/config-host.mak ] || \
( $(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- export PREFIX; \
+ $(buildmakevars2shellvars); \
cd ioemu ; \
LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) \
TARGET_CPPFLAGS="$(TARGET_CPPFLAGS)" \
diff -r e0221531d0e5 tools/Makefile
--- a/tools/Makefile Tue May 19 14:17:56 2009 +0100
+++ b/tools/Makefile Tue May 19 18:19:55 2009 +0200
@@ -93,8 +96,7 @@ ioemu-dir-find:
fi
set -e; \
$(absolutify_xen_root); \
- PREFIX=$(PREFIX); \
- export PREFIX; \
+ $(buildmakevars2shellvars); \
cd ioemu-dir; \
./xen-setup $(IOEMU_CONFIGURE_CROSS)
diff -r e0221531d0e5 tools/Rules.mk
--- a/tools/Rules.mk Tue May 19 14:17:56 2009 +0100
+++ b/tools/Rules.mk Tue May 19 18:19:55 2009 +0200
@@ -8,10 +8,6 @@ include $(XEN_ROOT)/Config.mk
export _INSTALL := $(INSTALL)
INSTALL = $(XEN_ROOT)/tools/cross-install
-CONFIG_DIR = /etc
-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
-
XEN_INCLUDE = $(XEN_ROOT)/tools/include
XEN_XC = $(XEN_ROOT)/tools/python/xen/lowlevel/xc
XEN_LIBXC = $(XEN_ROOT)/tools/libxc
diff -r e0221531d0e5 tools/python/Makefile
--- a/tools/python/Makefile Tue May 19 14:17:56 2009 +0100
+++ b/tools/python/Makefile Tue May 19 18:19:55 2009 +0200
@@ -23,6 +23,7 @@ genpath:
echo "LIBEXEC=\"$(LIBEXEC)\"" >> ${xenpath}
echo "LIBDIR=\"$(LIBDIR)\"" >> ${xenpath}
echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> ${xenpath}
+ echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> ${xenpath}
buildpy: genpath
CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build
diff -r e0221531d0e5 tools/python/xen/util/auxbin.py
--- a/tools/python/xen/util/auxbin.py Tue May 19 14:17:56 2009 +0100
+++ b/tools/python/xen/util/auxbin.py Tue May 19 18:19:55 2009 +0200
@@ -20,6 +20,7 @@ import os
import os.path
import sys
from xen.util.path import SBINDIR,BINDIR,LIBEXEC,LIBDIR,PRIVATE_BINDIR
+from xen.util.path import XEN_SCRIPT_DIR
def execute(exe, args = None):
exepath = pathTo(exe)
@@ -45,3 +46,6 @@ def path():
def libpath():
return LIBDIR
+
+def scripts_dir():
+ return XEN_SCRIPT_DIR
diff -r e0221531d0e5 tools/python/xen/xend/XendOptions.py
--- a/tools/python/xen/xend/XendOptions.py Tue May 19 14:17:56 2009 +0100
+++ b/tools/python/xen/xend/XendOptions.py Tue May 19 18:19:55 2009 +0200
@@ -32,6 +32,7 @@ import sys
from xen.xend import sxp, osdep, XendLogging
from xen.xend.XendError import XendError
+from xen.util import auxbin
if os.uname()[0] == 'SunOS':
from xen.lowlevel import scf
@@ -40,10 +41,10 @@ class XendOptions:
"""Configuration options."""
"""Where network control scripts live."""
- network_script_dir = osdep.scripts_dir
+ network_script_dir = auxbin.scripts_dir()
"""Where block control scripts live."""
- block_script_dir = osdep.scripts_dir
+ block_script_dir = auxbin.scripts_dir()
"""Default path to the log file. """
logfile_default = "/var/log/xen/xend.log"
@@ -355,7 +356,7 @@ class XendOptions:
s = self.get_config_string('resource-label-change-script')
if s:
result = s.split(" ")
- result[0] = os.path.join(osdep.scripts_dir, result[0])
+ result[0] = os.path.join(auxbin.scripts_dir(), result[0])
return result
else:
return None
diff -r e0221531d0e5 tools/python/xen/xend/osdep.py
--- a/tools/python/xen/xend/osdep.py Tue May 19 14:17:56 2009 +0100
+++ b/tools/python/xen/xend/osdep.py Tue May 19 18:19:55 2009 +0200
@@ -20,11 +20,6 @@
import os
import commands
-_scripts_dir = {
- "Linux": "/etc/xen/scripts",
- "SunOS": "/usr/lib/xen/scripts",
-}
-
_xend_autorestart = {
"NetBSD": True,
"Linux": True,
@@ -221,7 +255,6 @@ _get_postfork = {
def _get(var, default=None):
return var.get(os.uname()[0], default)
-scripts_dir = _get(_scripts_dir, "/etc/xen/scripts")
xend_autorestart = _get(_xend_autorestart)
pygrub_path = _get(_pygrub_path, "/usr/bin/pygrub")
vif_script = _get(_vif_script, "vif-bridge")
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2009-05-20 7:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-20 7:53 Christoph Egger [this message]
2009-05-20 10:12 ` [PATCH] tools: get rid of hardcoded config dirs Christoph Egger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905200953.05427.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=levon@movementarian.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.