On Thu, Dec 15, 2016 at 01:35:14AM +0000, Ian Jackson wrote:
> I would like a way to get the [In]Release file corresponding to the
> source from which apt got (or, I guess, would install) a particular
> package.

Got vs. would is a HUGE difference – and the information of 'got' is not
stored anywhere so what you want to know is not possible, especially if
the system isn't fully upgraded yet and you have to consider pinning
(ignoring that users could be changing it at runtime).  You can
approximate all this with guesswork, but the amount of times you will
guess wrong will make this whole endevour borderline useless as a user
will never be able to reasonably predict what the result of a command
issued will be (in my opinion at least).


> I can use `apt-cache madison' to find the archive URL and the
> locations within that archive.  The [In]Release file has a predictable
> filename (derived from the URL) in the apt cache.
> 
> May I fish the [In]]Release file out of the apt cache ?

No. The filenames are not stable. We need less things fiddling with our
files directly, not more, as that stops us from doing changes easily
(changing sources.list format, keeping files compressed, …).

Also, have you considered that some repositories are flat, some users
have CD-ROM (DVD, USB, …) sources and stuff. You really don't want to
get into that kind of business…. Especially the flat repos have no
concept of "suite" so you are out in the dark there.


> Do you have advice for me ?  If there is not currently a good way of

My advice is don't.

'apt source' defaults to the newest version if no default release is
configured simply because people tend to want the latest source. The
"few" which don't tend to be the people the suite is the hardest to
find: stretch, stretch/updates, stretch-backports are all perfectly
valid choices…

If you want people to be able to easy get the version they have
installed you need a version based interface, trying to do it via
suite/codenames will not end well [disclaimer: I know nothing about
dgit].


> getting this information (which there may not be) then please take
> this wishlist bug as a request for a way to get it.  Also, in that

Johannes Schauer had asked about the inclusion of Release files in
'apt-get indextargets' a while ago. It's a slight stretch, but its the
only place where this would make sense & relatively easy to add.


> case, please let me know whether it would be bad of me to implement my
> approach as described above, in the meantime.

Yes it would as already explained – beside you are the first person in
years I hear using 'apt-cache madison'…

Given that I haven't understood why you want to access the Release file
at all I can't offer specific advice, but a solution is likely to
involve 'apt-get indextargets' in some way. Something like getting all
Sources files, grepping for the version in them and for the Sources file(s)
which include the version you where looking for use the attached
release information like suite and co [I am assuming you want to get to
that as not that many people are interested in hashsums…].

| apt-get indextargets "Created-By: Sources" --format='$(FILENAME) $(CODENAME) 
$(SUITE)' | while read file codename suite; do
|   if /usr/lib/apt/apt-helper cat-file "$file" | grep-dctrl -q -PX apt -a -F 
Version -X '1.4~beta2'; then
|     echo "FOUND in: $codename ($suite) $file";
|   fi
| done


Best regards

David Kalnischkies

Attachment: signature.asc
Description: PGP signature

Reply via email to