Control: tag -1 + patch
On Fri, 02 Oct 2020 at 15:22:21 +0200, Guilhem Moulin wrote:
> Lintian::Processable::Orig produces an incorrect file listing when
> the common prefix of secondary tarballs isn't equal to the component
> name. dpkg-source(1) reads
>
> Extracting
>
> The main original tarball is extracted first, then all additional
> original tarballs are extracted in subdirectories named after the
> component part of their filename (any pre-existing directory is
> replaced).
>
> however Lintian::Processable::Orig's following snippet yields a
> different behavior:
>
> # keep common prefix when equal to the source component
> if ($unwanted ne $component) {
> $subindex->drop_common_prefix;
> $subindex->drop_basedir_segment;
> }
I'm not sure why Lintian::IO::Select:unpack_and_index_piped_tar()
doesn't use ‘--strip-components=1’ for orig tarballs, is it so that
Lintian could check that each orig tarball contains a single prefix?
AFAICT there is no such check right now though, and since all tarballs
are unpacked in the same directory the current logic would break if the
prefix of a secondary orig tarball is an existing file/directory.
Attached is a dirty patch to extract secondary orig tarballs in a
directory named after the component name and later “rebase” the catalog
to match the main base directory. I guess a better fix would be to move
the logic into Lintian::Index:merge_in() and allow merging children
directories into a parent and/or change Lintian::Index:drop_*() to allow
re-rooting there.
Cheers,
--
Guilhem.
--- lintian-0.96/lib/Lintian/Processable/Orig.pm
+++ lintian-0.96/lib/Lintian/Processable/Orig.pm
@@ -90,6 +90,7 @@
# so far, all archives with components had an extra level
my $component_dir = $index->basedir;
+ $component_dir .= SLASH . $component unless $component eq EMPTY;
my $subindex = Lintian::Index->new;
$subindex->basedir($component_dir);
@@ -147,11 +148,16 @@
# inserts missing directories; must occur afterwards
$subindex->load;
- # keep common prefix when equal to the source component
- if ($unwanted ne $component) {
+ if ($unwanted ne EMPTY) {
$subindex->drop_common_prefix;
$subindex->drop_basedir_segment;
}
+ if ($component ne EMPTY) {
+ for my $item (values %{$subindex->catalog}) {
+ $item->name($component . SLASH . $item->name);
+ }
+ $subindex->basedir($index->basedir);
+ }
$index->merge_in($subindex);
Attachment:
signature.asc
Description: PGP signature