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

Bug#825293: apt: please add support for Contents-udeb-* files



Package: apt
Version: 1.3~exp1
Severity: important

[ debian-boot@ and apt-file@ people in x-d-cc. ]

Hi,

apt-file now relies on apt/apt-get indextargets to download/list
Contents files, and Contents-udeb-* files are missing at the moment.

Tracing this down into apt, it seemed GetIndexTargets needed a few
changes to get the proper filenames. AFAICT it's important to have both
MetaKey and ShortDesc to match reality, given the 4th parameter passed
to the Indextarget sets the URI based on the MetaKey, which is then used
to return the filename used in DoIndexTargets (cmdline/apt-get.cc).

I'm entirely unsure this is the right place/way to patch those things,
but that seems to work for all intents and purposes:

    (sid-amd64-devel)kibi@wodi:~/hack/apt.git$ apt-file search efivars.ko|grep -- -di:
    efi-modules-4.5.0-2-amd64-di: /lib/modules/4.5.0-2-amd64/kernel/drivers/firmware/efi/efivars.ko

I'm not sure about the following parts, but I suppose d-i is special
enough that people having “main/debian-installer” bits in their
sources.list shouldn't be too shocked by possible inconsistencies…

    MetaKey: main/Contents-udeb-amd64
    ShortDesc: Contents-udeb-amd64
    Description: file:/srv/mirrors/debian sid/main/debian-installer amd64 Contents (deb)     <--- Contents (udeb)?
    URI: file:///srv/mirrors/debian/dists/sid/main/Contents-udeb-amd64
    Filename: /var/lib/apt/lists/_srv_mirrors_debian_dists_sid_main_Contents-udeb-amd64.lz4
    Optional: yes
    KeepCompressed: yes
    Codename: sid
    Label: Debian
    Origin: Debian
    Suite: unstable
    Trusted: yes
    Architecture: amd64
    Base-URI: file:///srv/mirrors/debian/dists/sid/
    By-Hash: yes
    Component: main/debian-installer
    CompressionTypes: xz bz2 lzma gz lz4 uncompressed
    Created-By: Contents-deb                                                                 <--- Doesn't seem to appear in dak, daklib/contents.py iterates on deb+udeb; apt-specific?
    DefaultEnabled: yes
    Fallback-Of: 
    Identifier: Contents-deb                                                                 <--- Contents-udeb? See above.
    KeepCompressedAs: lz4 gz xz bz2 lzma uncompressed
    PDiffs: yes
    Release: sid
    Repo-URI: file:///srv/mirrors/debian/
    Site: file:/srv/mirrors/debian
    Sourcesentry: /etc/apt/sources.list:1
    Target-Of: deb                                                                           <--- probably ok, either deb or deb-src AFAICT.

Thanks for considering.


KiBi.
>From 456b5f5c8b1a9a85615054673e70ad74f30da4e9 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Wed, 25 May 2016 17:54:58 +0200
Subject: [PATCH] Add support for retrieving and listing Contents-udeb-* files.

Since apt-file now relies on apt-get indextargets to figure out which Contents
files to look for, it's important for apt to downloads Contents-udeb-* instead
of trying to download non-existing debian-installer/Contents-* files.

Rewrite MetaKey and ShortDesc accordingly, which enables apt-file to search into
udebs.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
---
 apt-pkg/deb/debmetaindex.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc
index f756cdb..4184d00 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -238,6 +238,16 @@ static void GetIndexTargetsFor(char const * const Type, std::string const &URI,
 		     ShortDesc = SubstVar(ShortDesc, varname, O->second);
 		     LongDesc = SubstVar(LongDesc, varname, O->second);
 		     Identifier = SubstVar(Identifier, varname, O->second);
+
+		     // Rewrite debian-installer/Contents into Contents-udeb for
+		     // MetaKey and Contents into Contents-udeb for ShortDesc:
+                     std::string di_contents_token = "debian-installer/Contents-";
+                     std::string contents_token = "Contents-";
+                     size_t di_pos = MetaKey.find(di_contents_token);
+                     if (di_pos != std::string::npos) {
+                       MetaKey = MetaKey.substr(0, di_pos) + "Contents-udeb-" + MetaKey.substr(di_pos + di_contents_token.length());
+                       ShortDesc = "Contents-udeb-" + ShortDesc.substr(contents_token.length());
+                     }
 		  }
 
 		  {
-- 
2.8.1


Reply to: