[Pkg-bazaar-commits] ./bzr-builddeb/trunk r207: * Treat hardlinks in tarballs as a copy of the file. This at least
James Westby
jw+debian at jameswestby.net
Thu May 15 13:29:37 UTC 2008
------------------------------------------------------------
revno: 207
committer: James Westby <jw+debian at jameswestby.net>
branch nick: trunk
timestamp: Fri 2008-01-25 17:27:29 +0000
message:
* Treat hardlinks in tarballs as a copy of the file. This at least
gets the data, and is representable in bzr.
modified:
debian/changelog
import_dsc.py
tests/test_import_dsc.py
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog 2008-01-25 12:22:42 +0000
+++ b/debian/changelog 2008-01-25 17:27:29 +0000
@@ -17,8 +17,10 @@
* Exclude more files/directories than just .bzr when importing.
* Normalise filenames from the tarballs when extracting to import a
dsc to avoid errors on strange tarballs.
+ * Treat hardlinks in tarballs as a copy of the file. This at least
+ gets the data, and is representable in bzr.
- -- James Westby <jw+debian at jameswestby.net> Fri, 25 Jan 2008 11:16:09 +0000
+ -- James Westby <jw+debian at jameswestby.net> Fri, 25 Jan 2008 16:48:56 +0000
bzr-builddeb (0.92) unstable; urgency=low
=== modified file 'import_dsc.py'
--- a/import_dsc.py 2008-01-25 15:58:32 +0000
+++ b/import_dsc.py 2008-01-25 17:27:29 +0000
@@ -153,7 +153,7 @@
tt.set_executability(None, trans_id)
tt.cancel_creation(trans_id)
seen.add(member.name)
- if member.isreg():
+ if member.isreg() or member.islnk():
tt.create_file(file_iterator(archive_file.extractfile(member)),
trans_id)
executable = (member.mode & 0111) != 0
@@ -163,6 +163,8 @@
elif member.issym():
tt.create_symlink(member.linkname, trans_id)
else:
+ warning('skipping creation of "%s" as it is an unsupported type' \
+ % relative_path)
continue
if tt.tree_file_id(trans_id) is None:
if (file_ids_from is not None and
=== modified file 'tests/test_import_dsc.py'
--- a/tests/test_import_dsc.py 2008-01-25 15:15:03 +0000
+++ b/tests/test_import_dsc.py 2008-01-25 17:27:29 +0000
@@ -1143,6 +1143,25 @@
DscImporter([self.native_dsc_1]).import_dsc(self.target)
self.failUnlessExists(self.target)
+ def test_import_hardlink(self):
+ write_to_file('README', 'hello\n')
+ os.system('ln README NEWS')
+ tar = tarfile.open(self.native_1, 'w:gz')
+ try:
+ tar.add('./', recursive=False)
+ tar.add('./README')
+ tar.add('./NEWS')
+ finally:
+ tar.close()
+ os.unlink('README')
+ os.unlink('NEWS')
+ self.make_dsc(self.native_dsc_1, '0.1', self.native_1)
+ DscImporter([self.native_dsc_1]).import_dsc(self.target)
+ self.failUnlessExists(self.target)
+ self.failUnlessExists(os.path.join(self.target, 'NEWS'))
+ self.failUnlessExists(os.path.join(self.target, 'README'))
+
+
class _TarInfo(tarfile.TarInfo):
"""Subclass TarInfo to stop it normalising its path. Sorry Mum."""
More information about the Pkg-bazaar-commits
mailing list