Package: apt-file
Version: 2.5.2
Followup-For: Bug #525813

I had a problem where a file was missing in a suite but it was present in
others. So I found this bug and kinda fixed it.

It feels hackish but it works

Also. I saw some other bugs mentioning apt-file 3.0 since the interface in 2.x
is not very good...

Is there any progress at all in that front?

Now that I took the effort to look at the apt-file source, I might look at some
of the other wish list bugs.
I wont bother at all/look at the new version if its going to be rewritten from
the ground up anyway



-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt-file depends on:
ii  curl                              7.34.0-1
ii  libapt-pkg-perl                   0.1.29+b1
ii  libconfig-file-perl               1.50-2
ii  liblist-moreutils-perl            0.33-1+b2
ii  libregexp-assemble-perl           0.35-8
ii  perl                              5.18.1-5
ii  perl-modules [libfile-temp-perl]  5.18.1-5

Versions of packages apt-file recommends:
ii  python      2.7.5-5
ii  python-apt  0.9.1

Versions of packages apt-file suggests:
ii  openssh-client  1:6.4p1-2
ii  sudo            1.8.8-2

-- no debconf information
diff --git a/apt-file b/apt-file
index fdab342..102b4dd 100755
--- a/apt-file
+++ b/apt-file
@@ -365,6 +365,7 @@ sub do_grep($$) {
 
     foreach (@$data) {
         my $file = find_newest($_->{dest}) or next;
+        my $dist = $Conf->{suite} ? "$_->{dist} " : "";
 
         # Skip already searched files:
         next if $seen{$file}++;
@@ -387,8 +388,8 @@ sub do_grep($$) {
             debug_line ".";
             foreach ( split /,/, $pkgs ) {
 
-                # Put leading slash on file name
-                push @{ $ret->{"/$fname"} }, basename $_;
+                # Add Suite and leading slash on file name
+                push @{ $ret->{"$dist/$fname"} }, basename $_;
             }
         }
         close ZCAT;
@@ -557,6 +558,7 @@ Configuration options:
     --package-only     -l               Only display packages name
     --regexp           -x               pattern is a regular expression
     --sources-list     -s  <file>       sources.list location
+    --suite            -S               Show suite where the match was found
     --verbose          -v               run in verbose mode
     --help             -h               Show this help.
                        --               End of options (neccessary if pattern
@@ -573,6 +575,7 @@ EOF
 
 sub get_options() {
     my %options = (
+        "suite|S"           => \$Conf->{suite},
         "sources-list|s=s"  => \$Conf->{sources_list},
         "cache|c=s"         => \$Conf->{cache},
         "architecture|a=s"  => \$Conf->{arch},
diff --git a/apt-file.1.sgml b/apt-file.1.sgml
index 4411124..9857552 100644
--- a/apt-file.1.sgml
+++ b/apt-file.1.sgml
@@ -264,6 +264,17 @@ Use <literal>cdrom-mount-point</literal> instead of
 
       <varlistentry>
 	<term>
+	  <option>-S, --suite</option>
+	</term>
+	<listitem>
+	  <para>
+	   Show suite where the match was found or list the package on all suites found
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
 	  <option>-v, --verbose</option>
 	</term>
 	<listitem>

Reply via email to