Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: configuration depending variables
......................................................................

packaging: configuration depending variables

- removed unused INTERFACE_VERSION from config.py
- added SYSCONFDIR and DATADIR to config.py
- config.py is created at make execution instead of at
  configure execution. It is possible to change prefix
  passing it to make.
- removed unused LOCALSTATEDIR from FileLocations
- in FileLocations build paths using config.py variables
  for paths depending by configuration

Change-Id: I4a68802381480bf8de7547c2e66ccb817a35b857
Signed-off-by: Sandro Bonazzola <[email protected]>
---
M configure.ac
M src/ovirt_hosted_engine_setup/Makefile.am
M src/ovirt_hosted_engine_setup/config.py.in
M src/ovirt_hosted_engine_setup/constants.py
4 files changed, 24 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/79/17779/1

diff --git a/configure.ac b/configure.ac
index 6334f57..a28848d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,7 +90,6 @@
        src/Makefile
        src/bin/Makefile
        src/ovirt_hosted_engine_setup/Makefile
-       src/ovirt_hosted_engine_setup/config.py
        src/ovirt_hosted_engine_setup/ovf/Makefile
        src/plugins/Makefile
        src/plugins/ovirt-hosted-engine-setup/Makefile
diff --git a/src/ovirt_hosted_engine_setup/Makefile.am 
b/src/ovirt_hosted_engine_setup/Makefile.am
index 303155f..2bef5b8 100644
--- a/src/ovirt_hosted_engine_setup/Makefile.am
+++ b/src/ovirt_hosted_engine_setup/Makefile.am
@@ -31,6 +31,10 @@
        config.py \
        $(NULL)
 
+EXTRA_DIST = \
+       config.py.in \
+       $(NULL)
+
 dist_ovirthostedenginelib_PYTHON = \
        __init__.py \
        check_liveliness.py \
@@ -40,13 +44,17 @@
        tasks.py \
        $(NULL)
 
-ovirthostedenginelib_PYTHON = \
+nodist_ovirthostedenginelib_PYTHON = \
        config.py \
        $(NULL)
 
-config.py:     \
-       $(top_srcdir)/configure.ac \
-       $(NULL)
+config.py: config.py.in
+       sed \
+       -e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+       -e 's|@datadir[@]|$(datadir)|g' \
+       -e 's|@prefix[@]|$(prefix)|g' \
+       -e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
+       -e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' < $< > $@
 
 clean-local: \
        python-clean \
diff --git a/src/ovirt_hosted_engine_setup/config.py.in 
b/src/ovirt_hosted_engine_setup/config.py.in
index d413a38..ef59b00 100644
--- a/src/ovirt_hosted_engine_setup/config.py.in
+++ b/src/ovirt_hosted_engine_setup/config.py.in
@@ -23,7 +23,8 @@
 
 PACKAGE_NAME = '@PACKAGE_NAME@'
 PACKAGE_VERSION = '@PACKAGE_VERSION@'
-INTERFACE_VERSION = '@INTERFACE_VERSION@'
+SYSCONFDIR = '@sysconfdir@'
+DATADIR = '@datadir@'
 
 
 # vim: expandtab tabstop=4 shiftwidth=4
diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 516fe7b..ee74ec1 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -26,6 +26,7 @@
 
 
 from otopi import util
+from ovirt_hosted_engine_setup import config
 
 
 def ohostedattrsclass(o):
@@ -55,9 +56,7 @@
 @util.export
 @util.codegen
 class FileLocations(object):
-    #TODO: fix paths while packaging
     SYSCONFDIR = '/etc'
-    LOCALSTATEDIR = '/var'
     DATADIR = '/usr/share'
     LIBEXECDIR = '/usr/libexec'
     OVIRT_HOSTED_ENGINE = 'ovirt-hosted-engine'
@@ -67,50 +66,50 @@
         'vdsm',
     )
     ENGINE_VM_TEMPLATE = os.path.join(
-        DATADIR,
+        config.DATADIR,
         OVIRT_HOSTED_ENGINE_SETUP,
         'templates',
         'vm.conf.in'
     )
     ENGINE_VM_CONF = os.path.join(
-        SYSCONFDIR,
+        config.SYSCONFDIR,
         OVIRT_HOSTED_ENGINE,
         'vm.conf'
     )
     OVIRT_HOSTED_ENGINE_TEMPLATE = os.path.join(
-        DATADIR,
+        config.DATADIR,
         OVIRT_HOSTED_ENGINE_SETUP,
         'templates',
         'hosted-engine.conf.in'
     )
     OVIRT_HOSTED_ENGINE_SETUP_CONF = os.path.join(
-        SYSCONFDIR,
+        config.SYSCONFDIR,
         OVIRT_HOSTED_ENGINE,
         'hosted-engine.conf'
     )
     OVIRT_HOSTED_ENGINE_ANSWERS = os.path.join(
-        SYSCONFDIR,
+        config.SYSCONFDIR,
         OVIRT_HOSTED_ENGINE,
         'answers.conf'
     )
     HOSTED_ENGINE_IPTABLES_TEMPLATE = os.path.join(
-        DATADIR,
+        config.DATADIR,
         OVIRT_HOSTED_ENGINE_SETUP,
         'templates',
         'iptables.default.in'
     )
     HOSTED_ENGINE_IPTABLES_EXAMPLE = os.path.join(
-        SYSCONFDIR,
+        config.SYSCONFDIR,
         OVIRT_HOSTED_ENGINE,
         'iptables.example'
     )
     HOSTED_ENGINE_FIREWALLD_EXAMPLE_DIR = os.path.join(
-        SYSCONFDIR,
+        config.SYSCONFDIR,
         OVIRT_HOSTED_ENGINE,
         'firewalld'
     )
     HOSTED_ENGINE_FIREWALLD_TEMPLATES_DIR = os.path.join(
-        DATADIR,
+        config.DATADIR,
         OVIRT_HOSTED_ENGINE_SETUP,
         'templates',
         'firewalld',


-- 
To view, visit http://gerrit.ovirt.org/17779
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4a68802381480bf8de7547c2e66ccb817a35b857
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to