display all rpm debug messages in debug mode
[platform/upstream/mic.git] / mic / pluginbase.py
index cf98cd7..ffdd993 100644 (file)
@@ -27,11 +27,11 @@ class _Plugin(object):
                 cls.plugins = {}
 
             elif 'mic_plugin_type' in attrs:
-                    if attrs['mic_plugin_type'] not in cls.plugins:
-                        cls.plugins[attrs['mic_plugin_type']] = {}
+                if attrs['mic_plugin_type'] not in cls.plugins:
+                    cls.plugins[attrs['mic_plugin_type']] = {}
 
             elif hasattr(cls, 'mic_plugin_type') and 'name' in attrs:
-                    cls.plugins[cls.mic_plugin_type][attrs['name']] = cls
+                cls.plugins[cls.mic_plugin_type][attrs['name']] = cls
 
         def show_plugins(cls):
             for cls in cls.plugins[cls.mic_plugin_type]:
@@ -45,7 +45,7 @@ class ImagerPlugin(_Plugin):
 
     @classmethod
     def check_image_exists(self, destdir, apacking=None,
-                                          images=[],
+                                          images=(),
                                           release=None):
 
         # if it's a packing file, reset images
@@ -64,15 +64,18 @@ class ImagerPlugin(_Plugin):
             image = os.path.join(destdir, name)
             if not os.path.exists(image):
                 continue
-
             if msger.ask("Target image/dir: %s already exists, "
-                         "clean up and continue?" % image):
+                         "clean up the old files and continue?" % image):
                 if os.path.isdir(image):
-                    shutil.rmtree(image)
+                    for path, dirs, files in os.walk(os.path.abspath(image)):
+                        for fname in files:
+                            fpath = os.path.join(path, fname)
+                            if not fpath.endswith('.log'):
+                                os.remove(fpath)
                 else:
                     os.unlink(image)
             else:
-                raise errors.Abort("Cancled")
+                raise errors.Abort("Canceled")
 
     def do_create(self):
         pass
@@ -83,11 +86,6 @@ class ImagerPlugin(_Plugin):
 class BackendPlugin(_Plugin):
     mic_plugin_type="backend"
 
-    # suppress the verbose rpm warnings
-    if msger.get_loglevel() != 'debug':
-        import rpm
-        rpm.setVerbosity(rpm.RPMLOG_ERR)
-
     def addRepository(self):
         pass