gentree.py: do not add full path into tar
authorHauke Mehrtens <hauke@hauke-m.de>
Mon, 21 Oct 2013 21:01:35 +0000 (23:01 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 21 Oct 2013 21:15:00 +0000 (23:15 +0200)
dir_to_tar could be the absolute path to the directory to to tar, but
we do not want the full patch in the tar, just the basename.
In addition the second close is not necessary.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
gentree.py

index 42cf37d293e4db6e814ae533f3b99565c8a128b7..daf90330a3176ed6422dfdb2cfa2329322c00080 100755 (executable)
@@ -363,9 +363,9 @@ def create_tar_and_bz2(tar_name, dir_to_tar):
     in the backend decompresses and verifies the tarball against
     our signature.
     """
-    parent = os.path.dirname(tar_name)
+    basename = os.path.basename(dir_to_tar)
     tar = tarfile.open(tar_name, "w")
-    tar.add(dir_to_tar)
+    tar.add(dir_to_tar, basename)
     tar.close()
 
     tar_file = open(tar_name, "r")
@@ -374,8 +374,6 @@ def create_tar_and_bz2(tar_name, dir_to_tar):
     bz2_file.write(tar_file.read())
     bz2_file.close()
 
-    tar.close()
-
 def upload_release(args, rel_prep, logwrite=lambda x:None):
     """
     Given a path of a relase make tarball out of it, PGP sign it, and