Bug #277902 - When excluding config files, instead of using an empty file as a
authorZac Medico <zmedico@gentoo.org>
Sat, 30 Jan 2010 09:46:28 +0000 (09:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 30 Jan 2010 09:46:28 +0000 (09:46 -0000)
placeholder, use a file containing a comment like this:
# empty file because --include-config=n when `quickpkg` was used

svn path=/main/trunk/; revision=15278

pym/portage/dbapi/vartree.py

index 46b7f8333154c66d0216b3e263be8ff189a04b92..33967e21b076ca53100becb33c20f27602bbbf00 100644 (file)
@@ -53,6 +53,7 @@ import logging
 import os as _os
 import stat
 import sys
+import tempfile
 import time
 import warnings
 
@@ -4591,8 +4592,14 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None):
                        if protect and protect(path):
                                # Create an empty file as a place holder in order to avoid
                                # potential collision-protect issues.
-                               tarinfo.size = 0
-                               tar.addfile(tarinfo)
+                               f = tempfile.TemporaryFile()
+                               f.write("# empty file because --include-config=n " + \
+                                       "when `quickpkg` was used\n")
+                               f.flush()
+                               f.seek(0)
+                               tarinfo.size = os.fstat(f.fileno()).st_size
+                               tar.addfile(tarinfo, f)
+                               f.close()
                        else:
                                f = open(_unicode_encode(path,
                                        encoding=object.__getattribute__(os, '_encoding'),