[Ocfs2-test-devel] [PATCH 09/11] ocfs2-test: Changed python_common files to allow RPM install.

Marcos Matsunaga Marcos.Matsunaga at oracle.com
Thu Oct 30 12:32:48 PDT 2008


The Makefile, Config.make and setup.sh need to be adapted to allow
RPM install, specially in the way that it does deal with the configuration
of the config.sh and config.py files and the install directory.

Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
---
 programs/python_common/Config.make |    9 +++++++--
 programs/python_common/Makefile    |    2 ++
 programs/python_common/setup.sh    |   16 +++++++++++-----
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/programs/python_common/Config.make b/programs/python_common/Config.make
index 0121532..04384b3 100644
--- a/programs/python_common/Config.make
+++ b/programs/python_common/Config.make
@@ -5,9 +5,14 @@ CONFIG_SCRIPT := setup.sh
 
 CURDIR = $(shell pwd)
 
-config-script: $(CONFIG_SCRIPT)
+ifdef RPM_BUILD_ROOT
+INSTALLDIR = /usr/local
+endif
+
+config-script: $(CONFIG_SCRIPT) 
+
 ifdef CONFIG_SCRIPT
-	$(SHELL) $(CURDIR)/$(CONFIG_SCRIPT) $(DESTDIR)
+	$(SHELL) $(CURDIR)/$(CONFIG_SCRIPT) $(DESTDIR) $(INSTALLDIR)
 endif
 
 	mkdir -p  $(DESTDIR)/workfiles $(DESTDIR)/log
diff --git a/programs/python_common/Makefile b/programs/python_common/Makefile
index 68493ca..a85deee 100644
--- a/programs/python_common/Makefile
+++ b/programs/python_common/Makefile
@@ -10,6 +10,8 @@ SUBDIRS =
 
 DIST_FILES = 	config_py.skel \
 		config_shell.skel \
+		Config.make \
+		setup.sh \
 		o2tf.py \
 		single_run.sh \
 		multiple_run.sh \
diff --git a/programs/python_common/setup.sh b/programs/python_common/setup.sh
index 21f77f1..45ba6e1 100755
--- a/programs/python_common/setup.sh
+++ b/programs/python_common/setup.sh
@@ -18,8 +18,8 @@
 # Boston, MA 021110-1307, USA.
 
 #
-if [ $# -ne 1 ]; then
-   echo -e 'Usage: $0 <DESTDIR>';
+if [ $# -ne 1 -a $# -ne 2 ]; then
+   echo -e 'Usage: $0 <DESTDIR> [INSTALLDIR]';
    exit 1;
 fi;
 
@@ -34,14 +34,20 @@ else
 	else
 		MPIDIR=/usr/bin
 	fi
-fi
+fi;
+
+if [ $# -eq 1 ]; then
+	INSTALLDIR=DESTDIR;
+else
+	INSTALLDIR=${2};
+fi;
 
 BINDIR=${1}/bin
-sed "s;<DESTDIR>;${1};g" ${BINDIR}/config_py.skel >  ${BINDIR}/config.py
+sed "s;<DESTDIR>;${INSTALLDIR};g" ${BINDIR}/config_py.skel >  ${BINDIR}/config.py
 mv ${BINDIR}/config.py  ${BINDIR}/config_py.skel
 sed "s;<MPIDIR>;${MPIDIR};g" ${BINDIR}/config_py.skel >  ${BINDIR}/config.py
 #
-sed "s;<DESTDIR>;${1};g" ${BINDIR}/config_shell.skel >  ${BINDIR}/config.sh
+sed "s;<DESTDIR>;${INSTALLDIR};g" ${BINDIR}/config_shell.skel >  ${BINDIR}/config.sh
 mv ${BINDIR}/config.sh ${BINDIR}/config_shell.skel
 sed "s;<MPIDIR>;${MPIDIR};g" ${BINDIR}/config_shell.skel >  ${BINDIR}/config.sh
 rm -f ${BINDIR}/config_py.skel ${BINDIR}/config_shell.skel
-- 
1.5.6.3




More information about the Ocfs2-test-devel mailing list