[rhmessaging-commits] rhmessaging commits: r1956 - in mgmt: cumin/bin and 2 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Apr 22 14:55:24 EDT 2008


Author: justi9
Date: 2008-04-22 14:55:24 -0400 (Tue, 22 Apr 2008)
New Revision: 1956

Added:
   mgmt/cumin/bin/cumin-instance-init
Modified:
   mgmt/cumin/Makefile
   mgmt/etc/Makefile.common
   mgmt/mint/Makefile
Log:
Changes to support autotool-esque "make install"s and to improve the
rpm building process.

The command cumin-instance-init sets up the symlinks for a
system-installed cumin instance.



Modified: mgmt/cumin/Makefile
===================================================================
--- mgmt/cumin/Makefile	2008-04-22 18:51:37 UTC (rev 1955)
+++ mgmt/cumin/Makefile	2008-04-22 18:55:24 UTC (rev 1956)
@@ -5,32 +5,25 @@
 name := cumin
 ver := 0.1
 
-home := ${PREFIX}/share/${name}
+home := ${SHARE_DIR}/${name}
 lib := ${PYTHON_LIB_DIR}/${name}
-doc := ${PREFIX}/share/doc/${name}-${ver}
+doc := ${DOC_DIR}/${name}-${ver}
 log := ${VAR_DIR}/log/${name}
 
 build:
-	python-compile python
+	../bin/python-compile python
 
 install: build
 	install -d ${PYTHON_LIB_DIR}/wooly
-	install python/wooly/*.py python/wooly/*.pyc python/wooly/*.strings ${PYTHON_LIB_DIR}/wooly
+	install -pm 0644 python/wooly/*.py python/wooly/*.pyc python/wooly/*.strings ${PYTHON_LIB_DIR}/wooly
 	install -d ${lib}
-	install python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
+	install -pm 0644 python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
 	install -d ${BIN_DIR}
-	install bin/* ${BIN_DIR}
+	install -pm 0755 bin/* ${BIN_DIR}
 	install -d ${doc}
-	install LICENSE COPYING ${doc}
+	install -pm 0644 LICENSE COPYING ${doc}
 	install -d ${home}/resources
-	install resources/* ${home}/resources
+	install -pm 0644 resources/* ${home}/resources
 	install -d ${ETC_DIR}
-	install etc/* ${ETC_DIR}
+	install -pm 0644 etc/* ${ETC_DIR}
 	install -d ${log}
-
-	install -d ${home}/lib
-	ln -sf ${PYTHON_LIB_DIR} ${home}/lib/python
-	ln -sf ${BIN_DIR} ${home}/bin
-	ln -sf ${ETC_DIR} ${home}/etc
-	ln -sf ${doc} ${home}/doc
-	ln -sf ${log} ${home}/log

Added: mgmt/cumin/bin/cumin-instance-init
===================================================================
--- mgmt/cumin/bin/cumin-instance-init	                        (rev 0)
+++ mgmt/cumin/bin/cumin-instance-init	2008-04-22 18:55:24 UTC (rev 1956)
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+import sys, os
+from os.path import *
+
+def usage():
+    print "Usage: cumin-instance-init [system|local]"
+    sys.exit(1)
+
+def check_home(dir):
+    if not isdir(dir):
+        print "Error: home dir '%s' not found" % dir
+        sys.exit(1)
+
+if "-h" in sys.argv or "--help" in sys.argv:
+    usage()
+
+try:
+    type = sys.argv[1]
+except IndexError:
+    usage()
+
+if type == "system":
+    home = join(sep, "usr", "share", "cumin")
+
+    check_home(home)
+
+    map = ((join(sep, "usr", "bin"), join(home, "bin")),
+           (join(sep, "etc"), join(home, "etc")),
+           (join(sep, "var", "log", "cumin"), join(home, "log")))
+elif type == "local":
+    home = join(sep, "usr", "local", "share", "cumin")
+
+    check_home(home)
+
+    map = ((join(sep, "usr", "local", "bin"), join(home, "bin")),
+           (join(sep, "usr", "local", "etc"), join(home, "etc")),
+           (join(sep, "var", "local", "log", "cumin"), join(home, "log")))
+else:
+    print "Error: '%s' is not a recognized instance type" % type
+    usage()
+
+for src, dst in map:
+    if exists(dst):
+        print "File already exists: %s" % dst
+    elif islink(dst):
+        print "Link already exists: %s" % dst
+    else:
+        print "Creating symlink: %s -> %s" % (dst, src)
+        os.symlink(src, dst)


Property changes on: mgmt/cumin/bin/cumin-instance-init
___________________________________________________________________
Name: svn:executable
   + *

Modified: mgmt/etc/Makefile.common
===================================================================
--- mgmt/etc/Makefile.common	2008-04-22 18:51:37 UTC (rev 1955)
+++ mgmt/etc/Makefile.common	2008-04-22 18:55:24 UTC (rev 1956)
@@ -14,6 +14,18 @@
     ETC_DIR := ${PREFIX}/etc
 endif
 
+ifndef DOC_DIR
+    DOC_DIR := ${PREFIX}/share/doc
+endif
+
+ifndef SHARE_DIR
+    SHARE_DIR := ${PREFIX}/share
+endif
+
 ifndef VAR_DIR
-    VAR_DIR := ${PREFIX}/var
+    ifeq (${PREFIX}, /usr/local)
+	VAR_DIR := /var/local
+    else
+	VAR_DIR := ${PREFIX}/var
+    endif
 endif

Modified: mgmt/mint/Makefile
===================================================================
--- mgmt/mint/Makefile	2008-04-22 18:51:37 UTC (rev 1955)
+++ mgmt/mint/Makefile	2008-04-22 18:55:24 UTC (rev 1956)
@@ -7,13 +7,13 @@
 name := mint
 ver := 0.1
 
-home := ${PREFIX}/share/${name}
+home := ${SHARE_DIR}/${name}
 lib := ${PYTHON_LIB_DIR}/${name}
-doc := ${PREFIX}/share/doc/${name}-${ver}
+doc := ${DOC_DIR}/${name}-${ver}
 log := ${VAR_DIR}/log/${name}
 
 build:
-	python-compile python
+	../bin/python-compile python
 
 install: build
 	install -d ${lib}




More information about the rhmessaging-commits mailing list