Pārlūkot izejas kodu

HUE-22. Allow relcoation of a Hue installation

bc Wong 15 gadi atpakaļ
vecāks
revīzija
83ff095446
4 mainītis faili ar 23 papildinājumiem un 25 dzēšanām
  1. 3 4
      Makefile.sdk
  2. 0 6
      README.rst
  3. 1 3
      apps/Makefile
  4. 19 12
      tools/app_reg/registry.py

+ 3 - 4
Makefile.sdk

@@ -43,7 +43,7 @@
 #
 #   install-bdist
 #   	Responsible for installing a built distribution to a target directory,
-#   	as specified by $(INSTALL_DIR) and $(INSTALL_CONF_DIR).
+#   	as specified by $(INSTALL_DIR).
 #
 
 include $(ROOT)/Makefile.vars
@@ -225,9 +225,8 @@ bdist: ext-eggs compile
 
 #
 # install-bdist
-# 	Install the built distribution in $(INSTALL_DIR), and any conf file in
-# 	$(INSTALL_CONF_DIR). NOTE that this does NOT install the app into the
-# 	virtual environment.
+# 	Install the built distribution in $(INSTALL_DIR).
+# 	NOTE that this does NOT install the app into the virtual environment.
 #
 .PHONY: install-bdist
 install-bdist: bdist

+ 0 - 6
README.rst

@@ -61,25 +61,19 @@ Development Prerequisites
 
     Debian:
       * gcc
-      * libldap2-dev
       * libmysqlclient-dev
-      * libsasl2-dev
       * libsqlite3-dev
-      * libssl-dev
       * libxml2-dev
       * libxslt-dev
       * python-dev
       * python-setuptools
 
     CentOS:
-      * cyrus-sasl-devel
       * gcc
       * libxml2-devel
       * libxslt-devel
       * mysql
       * mysql-devel
-      * openldap-devel
-      * openssl
       * python-devel
       * python-setuptools
       * sqlite-devel

+ 1 - 3
apps/Makefile

@@ -61,9 +61,7 @@ env-install: $(EGG_INFO_TARGETS)
 ################################################
 INSTALL_BDIST_TARGETS := $(APPS:%=.recursive-install-bdist/%)
 .recursive-install-bdist/%: %
-	INSTALL_DIR=$(INSTALL_DIR)/apps/$< \
-		INSTALL_CONF_DIR=$(INSTALL_DIR)/desktop/conf \
-		$(MAKE) -C $< install-bdist
+	INSTALL_DIR=$(INSTALL_DIR)/apps/$< $(MAKE) -C $< install-bdist
 
 .PHONY: install
 install: install-source-parts $(INSTALL_BDIST_TARGETS)

+ 19 - 12
tools/app_reg/registry.py

@@ -165,27 +165,34 @@ class HueApp(object):
 
     for target in self.get_conffiles():
       link_name = os.path.join(common.HUE_CONF_DIR, os.path.basename(target))
+
+      # Does the link already exists?
+      if os.path.islink(link_name):
+        try:
+          cur = os.readlink(link_name)
+          if cur == target:
+            LOG.warn("Symlink for configuration already exists: %s" % (link_name,))
+            installed.append(link_name)
+            continue
+          # Remove broken link
+          if not os.path.exists(cur):
+            os.unlink(link_name)
+            LOG.warn("Removing broken link: %s" % (link_name,))
+        except OSError, ex:
+          LOG.warn("Error checking for existing link %s: %s" % (link_name, ex))
+
+      # Actually install the link
       try:
         os.symlink(target, link_name)
         LOG.info('Symlink config %s -> %s' % (link_name, target))
         installed.append(link_name)
       except OSError, ex:
-        # Does the link already exists?
-        if ex.errno == errno.EEXIST and os.path.islink(link_name):
-          try:
-            cur = os.readlink(link_name)
-            if cur == target:
-              LOG.warn("Symlink for configuration already exists: %s" % (link_name,))
-              continue
-          except:
-            pass
-        # Nope. True error. Cleanup.
         LOG.error("Failed to symlink %s to %s: %s" % (target, link_name, ex))
         for lnk in installed:
           try:
             os.unlink(lnk)
-          except:
-            LOG.error("Failed to cleanup link %s" % (link_name,))
+          except OSError, ex2:
+            LOG.error("Failed to cleanup link %s: %s" % (link_name, ex2))
         return False
     return True