diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2015-08-04 07:54:48 +0100 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-08-20 14:12:21 +0000 |
commit | 364d24dbe83b6b875db1088b10df73d06136ad5d (patch) | |
tree | 7449d62821f9f78e3a64a550e4c297a885846f7d | |
parent | efef4c95e5cc08aae57dca768b29d2a831995b3a (diff) | |
download | lorry-364d24dbe83b6b875db1088b10df73d06136ad5d.tar.gz |
Ignore extended header fields in tar archives
bsd tar stores file attributes as extended headers,
which are ignored by gnu tar. The tar importer currently
treats these headers as regular files, so regular files
containing attribute data are created on extraction even
though they never existed at archive creation.
This can be a problem for CPAN imports, some CPAN distributions
are created using bsd tar, the extended headers in these archives
result in a modified directory structure, e.g. where the structure
on the developer's machine would be
Foo:
META.json
META.yml
Makefile.PL
...
in trove we could have,
Foo:
Foo/
Foo/META.json
Foo/META.yml
Foo/Makefile.PL
PAXHeader/
PAXHeader/Foo
...
this structure causes the default build-commands to fail because they
expect to find Makefile.PL in the repo's root dir.
Change-Id: Ia8f90c3be7b31f7a4ac774022cb606fc1c57c002
-rwxr-xr-x | lorry.tar-importer | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lorry.tar-importer b/lorry.tar-importer index 904f8d8..d4d27f5 100755 --- a/lorry.tar-importer +++ b/lorry.tar-importer @@ -103,11 +103,16 @@ foreach my $tar_file (@ARGV) $mtime = oct $mtime; next if $typeflag == 5; # directory - print FI "blob\n", "mark :$next_mark\n"; if ($typeflag == 2) { # symbolic link + print FI "blob\n", "mark :$next_mark\n"; print FI "data ", length($linkname), "\n", $linkname; $mode = 0120000; + } elsif ($typeflag eq 'x') { # extended header + # skip header contents + $size -= 512 while ($size > 0 && read(I, $_, 512) == 512); + next; } else { + print FI "blob\n", "mark :$next_mark\n"; print FI "data $size\n"; while ($size > 0 && read(I, $_, 512) == 512) { print FI substr($_, 0, $size); |