Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created October 17, 2013 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/7020726 to your computer and use it in GitHub Desktop.
Save bessarabov/7020726 to your computer and use it in GitHub Desktop.
$ git show aa2facfcf73dbe7cbcdaa83a26049785943d963b|cat
commit aa2facfcf73dbe7cbcdaa83a26049785943d963b
Author: Lasse Makholm <lasse@unity3d.com>
Date: Thu Jan 10 15:44:44 2013 +0100
Fix repo_source_to_contents_paths() to also work on Ubuntu
Make sure to generate paths both with and without components to
be compatible with both old and new apt-file versions. See:
https://bugs.launchpad.net/ubuntu/+source/dh-make-perl/+bug/1034881
LP: #1034881
diff --git a/lib/Debian/AptContents.pm b/lib/Debian/AptContents.pm
index 8e1f887..bab2765 100644
--- a/lib/Debian/AptContents.pm
+++ b/lib/Debian/AptContents.pm
@@ -196,8 +196,13 @@ sub repo_source_to_contents_paths {
s{^/}{} for ( $host, $dir, $dist ); # remove initial /
s{/}{_}g for ( $host, $dir, $dist ); # replace remaining /
+ # Make sure to generate paths both with and without components to
+ # be compatible with both old and new apt-file versions. See:
+ # https://bugs.launchpad.net/ubuntu/+source/dh-make-perl/+bug/1034881
+ push(@components, '');
+
return map
- { $host . "_" . join( "_", $dir || (), "dists", $dist, $_ ) }
+ { $host . "_" . join( "_", grep( { defined and length } $dir, "dists", $dist, $_ ) ) }
@components;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment