Răsfoiți Sursa

HUE-17. `make install' fails if the working tree is not clean

bc Wong 15 ani în urmă
părinte
comite
9124eee4fe
3 a modificat fișierele cu 8 adăugiri și 3 ștergeri
  1. 2 0
      desktop/Makefile
  2. 1 1
      tools/app_reg/app_reg.py
  3. 5 2
      tools/app_reg/registry.py

+ 2 - 0
desktop/Makefile

@@ -156,3 +156,5 @@ SOURCE_PARTS = \
 install-source-parts:
 	@mkdir -p $(INSTALL_DIR)/desktop
 	@tar cf - $(SOURCE_PARTS) | tar -C $(INSTALL_DIR)/desktop -xf -
+	@# Remove the application configuration files
+	@find $(INSTALL_DIR)/desktop/conf -type l -exec rm {} \;

+ 1 - 1
tools/app_reg/app_reg.py

@@ -148,11 +148,11 @@ def do_remove(app_name):
   reg = registry.AppRegistry()
   try:
     app = reg.unregister(app_name)
-    app.uninstall_conf()
   except KeyError:
     LOG.error("%s is not installed" % (app_name,))
     return False
 
+  app.uninstall_conf()
   reg.save()
 
   # Update the pth file

+ 5 - 2
tools/app_reg/registry.py

@@ -192,7 +192,9 @@ class HueApp(object):
 
   def uninstall_conf(self):
     """uninstall_conf() -> True/False"""
-    app_conf_dir = os.path.join(self.path, 'conf')
+    app_conf_dir = os.path.abspath(os.path.join(self.path, 'conf'))
+    if not os.path.isdir(app_conf_dir):
+      return True
 
     # Check all symlink in the conf dir and remove any that point to this app
     for name in os.listdir(common.HUE_CONF_DIR):
@@ -200,7 +202,8 @@ class HueApp(object):
       if not os.path.islink(path):
         continue
       target = os.readlink(path)
-      if os.path.samefile(os.path.dirname(target), app_conf_dir):
+      target_dir = os.path.abspath(os.path.dirname(target))
+      if target_dir == app_conf_dir:
         try:
           os.unlink(path)
           LOG.info('Remove config symlink %s -> %s' % (path, target))