fix local repo metadata override issue
authorGui Chen <gui.chen@intel.com>
Mon, 3 Dec 2012 07:54:27 +0000 (15:54 +0800)
committerGui Chen <gui.chen@intel.com>
Wed, 12 Dec 2012 11:33:44 +0000 (19:33 +0800)
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/rpmmisc.py

index d762061..c9c2ba7 100644 (file)
@@ -35,9 +35,15 @@ def myurlgrab(url, filename, proxies, progress_obj = None):
         progress_obj = TextProgress()
 
     if url.startswith("file:/"):
-        filename = "/%s" % url.replace("file:", "").lstrip('/')
-        if not os.path.exists(filename):
-            raise CreatorError("URLGrabber error: can't find file %s" % file)
+        filepath = "/%s" % url.replace("file:", "").lstrip('/')
+        if not os.path.exists(filepath):
+            raise CreatorError("URLGrabber error: can't find file %s" % url)
+        if url.endswith('.rpm'):
+            return filepath
+        else:
+            # untouch repometadata in source path
+            runner.show(['cp', '-f', filepath, filename])
+
     else:
         try:
             filename = g.urlgrab(url = url, filename = filename,