Bug 134 : Fix charm copy from descriptor package 21/821/1
authorPhilip Joseph <philip.joseph@riftio.com>
Wed, 21 Dec 2016 10:38:31 +0000 (16:08 +0530)
committerPhilip Joseph <philip.joseph@riftio.com>
Wed, 21 Dec 2016 18:17:29 +0000 (18:17 +0000)
Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/package.py

index 355b23b..45d8ba8 100644 (file)
@@ -314,7 +314,14 @@ class DescriptorPackage(object):
                 continue
 
             # Copy the contents of the file to the correct path
-            dest_file_path = os.path.join(dest_root_dir, filename)
+            # Remove the common prefix and create the dest filename
+            if src_dir is not None:
+                fname = filename[len(src_dir):]
+                if fname[0] == '/':
+                    fname = fname[1:]
+            else:
+                fname = filename
+            dest_file_path = os.path.join(dest_root_dir, fname)
             dest_dir_path = os.path.dirname(dest_file_path)
             if not os.path.exists(dest_dir_path):
                 os.makedirs(dest_dir_path)