On Sat, 17 Nov 2018, Julian Andres Klode wrote:

> On Fri, Nov 16, 2018 at 04:26:24PM -0500, Yaroslav Halchenko wrote:
> > and I guess I can demystify right away what is going on (although I
> > didn't try to reconfirm by rebuilding or debugging):

> > https://salsa.debian.org/apt-team/apt/blob/master/apt-private/private-show.cc#L488

> >      if (F.Flagged(pkgCache::Flag::NoPackages))
> >             continue;

> > so no apt entries are displayed if they provide no packages ATM.

> > Although I could see how it is useful generally, for our purpose it is
> > somewhat of a blow, since we are trying to use  apt-cache policy   output
> > to decide what APT sources in general are configured. and since we are
> > rolling back in time to use snapshots, they might have had packages at
> > that point in time, thus we better adjust them as well.

> I don't know if it helps, but you might want to look at apt-get indextargets?

wow -- that is a great to know command to provide structured output, Thanks! in
the future (seems to be not present even in stretch's version of apt 1.0.10.2)
we should use it instead of apt-cache policy for sure BUT unfortunately it
also falls short the same way:

        root@825f262c69cc:/# apt-get update
        Hit:2 http://cdn-fastly.deb.debian.org/debian buster InRelease
        Hit:1 http://security-cdn.debian.org/debian-security buster/updates 
InRelease
        Hit:3 http://cdn-fastly.deb.debian.org/debian buster-updates InRelease  
        Reading package lists... Done                     

        root@825f262c69cc:/# apt-get indextargets
        MetaKey: main/binary-amd64/Packages
        ShortDesc: Packages
        Description: http://deb.debian.org/debian buster/main amd64 Packages
        URI: 
http://deb.debian.org/debian/dists/buster/main/binary-amd64/Packages
        Filename: 
/var/lib/apt/lists/deb.debian.org_debian_dists_buster_main_binary-amd64_Packages.lz4
        Optional: no
        KeepCompressed: yes
        Codename: buster
        Label: Debian
        Origin: Debian
        Suite: testing
        Trusted: yes
        Architecture: amd64
        Base-URI: http://deb.debian.org/debian/dists/buster/
        By-Hash: yes
        Component: main
        CompressionTypes: xz bz2 lzma gz lz4 zst uncompressed
        Created-By: Packages
        DefaultEnabled: yes
        Fallback-Of: 
        Identifier: Packages
        KeepCompressedAs: lz4 zst gz xz bz2 lzma uncompressed
        PDiffs: yes
        Release: buster
        Repo-URI: http://deb.debian.org/debian/
        Site: http://deb.debian.org/debian
        Sourcesentry: /etc/apt/sources.list:1
        Target-Of: deb

I haven't looked in the apt sources yet either the same conditioning  on having
Packages is done.

> > Also documentation has no hint on such a "feature":

> >        policy [pkg...]
> >            policy is meant to help debug issues relating to the preferences 
> > file. With no
> >            arguments it will print out the priorities of each source. 
> > Otherwise it prints
> >            out detailed information about the priority selection of the 
> > named package.

> > so "each source", but not each source is printed out!

> > I wish this "feature" of skipping APT sources without packages was somehow
> > optional/configurable.  Otherwise, at least documentation should mention 
> > such
> > feature.

> I don't necessarily see it as skipping sources. I don't think the Packages 
> files
> for these sources exist in the cache (as none are downloaded), hence they 
> won't be
> shown.

yes, they do not exist, but it doesn't mean that the "source" doesn't exist.

> Clearly source is not a particularly helpful term, as it's a bit vague (it's 
> not
> a sources.list entry, after all). I think it should probably say "non-empty 
> Packages
> index" or something.

I think "source" is ok in the description of "apt" command (unless talking
about "source package")  since indeed we have sources.list and
sources.list.d, at least to me its semantic is clear.

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        

Reply via email to