[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#766295: apt-file: please add support for udebs



Package: apt-file
Version: 2.5.1
Severity: normal
Tags: d-i patch

[ I've added debian-boot@ in the loop through X-D-Cc, feel free to keep
it in cc when replying. ]

Hi,

please add support for udebs. I've mentioned my findings on that topic
here: <https://lists.debian.org/debian-boot/2014/10/msg00404.html>.

I'm attaching a patch I've tested successfully on top of current svn
trunk, in an amd64 sid chroot with the following sources.list:
| deb http://localhost/debian sid main main/debian-installer non-free
| deb-src http://localhost/debian sid main
| 
| deb http://localhost/debian experimental main main/debian-installer
| deb-src http://localhost/debian experimental main

While this doesn't compensate for the missing test case additions, here
are some output examples:
| $ ./apt-file search /sbin/debian-installer
| debian-installer-launcher: /usr/sbin/debian-installer-launcher
| rootskel: /sbin/debian-installer
| rootskel: /sbin/debian-installer-startup

| $ ./apt-file search -a udeb-amd64 sata_mv.ko
| sata-modules-3.16-3-amd64-di: /lib/modules/3.16-3-amd64/kernel/drivers/ata/sata_mv.ko
| sata-modules-3.17-1-amd64-di: /lib/modules/3.17-1-amd64/kernel/drivers/ata/sata_mv.ko

Please note the FIXME (and the reference to it) in the patch. I strove for
minimal changes in the push side, and it was needed to filter in the
second part of the patch anyway to catch :debian-installer… Not quite
clean but seems to work fine even if one adds an extra "main/foobar" to
the above sources.list example.

Mraw,
KiBi.
>From 3c6359fddd670adfe876220230f4131edfaa4bac Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Wed, 22 Oct 2014 02:25:07 +0200
Subject: [PATCH] Add support for Contents-udeb-*.gz files (debian-installer).

When <foo>/debian-installer is detected in sources.list, fetch:
  <foo>/Contents-udeb-<arch>.gz

instead of:
  <foo>/Contents-<arch>.gz

This makes apt-file search look into new files automatically. It's also
possible to filter results using a tweaked architecture e.g.:

    apt-file search -a udeb-amd64 sata_mv.ko

Signed-off-by: Cyril Brulebois <kibi@debian.org>
---
 apt-file | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/apt-file b/apt-file
index 323b0c1..5a1c63c 100755
--- a/apt-file
+++ b/apt-file
@@ -178,8 +178,13 @@ sub parse_sources_list($) {
 
             my $fetch = [];
 
+            # Transform $area/debian-installer into $area:debian-installer for
+            # easy matching below, fetching Contents-udeb-<arch>.gz instead of
+            # Contents-<arch>.gz
+            #
+            # FIXME: What do we do if $2 is different from 'debian-installer'?
             foreach (@extra) {
-                push @$fetch, m{(.*?)/(?:.*)}o ? "$dist/$1" : "$dist/$_";
+                push @$fetch, m{(.*?)/(.*)}o ? "$dist/$1:$2" : "$dist/$_";
             }
 
             foreach ( @{ ( unique $fetch) } ) {
@@ -199,6 +204,15 @@ sub parse_sources_list($) {
                 $dest = $Conf->{destination};
                 my $cache = $Conf->{cache};
                 my $arch  = $Conf->{arch};
+                # udebs are indexed separately, tweak the architecture if
+                # needed:
+                if ( $dist =~ s{:debian-installer$}{} ) {
+                    $arch = "udeb-$arch";
+                }
+                elsif ( $dist =~ m{:[^/]*$} ) {
+                    # See FIXME above, ignore this entry for now.
+                    next;
+                }
                 my $cdrom = $Conf->{cdrom_mount};
                 foreach my $var (
                     qw/host port user passwd path dist pkg
-- 
2.1.1


Reply to: