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

Re: Function similar to {apt-cache recurse ...}?



On Fri 28 Jun 2019 at 09:21:31 (-0500), Richard Owlett wrote:
> On 06/28/2019 08:58 AM, tomas@tuxteam.de wrote:
> > On Fri, Jun 28, 2019 at 08:50:02AM -0500, David Wright wrote:
> > > On Fri 28 Jun 2019 at 08:04:43 (-0500), Richard Owlett wrote:
> > > > "apt-get install" will report the size of the new files to be
> > > > installed when it asks for confirmation.
> > > > 
> > > > I'm looking for something similar which will base its calculation
> > > > *ONLY* on the contents of /var/lib/apt/lists/ {ignoring what is
> > > > already on the current system}.
> > > 
> > > I thought it already did; I posted this here six days ago:
> > > 
> > >    Calculating upgrade... Done
> > >    The following packages will be upgraded:
> > >      …   …   …   …
> > >    9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> > >    Need to get 52.5 MB/52.5 MB of archives.
> > >    After this operation, 74.8 kB of additional disk space will be used.
> > >                          ↑↑↑↑↑↑↑    ↑↑↑↑↑↑↑↑↑↑
> > >    Do you want to continue? [Y/n]
> > > 
> > > If that's not what you mean, ask your question again avoiding words
> > > like "similar" and "based on".
> > 
> > I read the OP's question as "the total installed size including
> > dependencies" -- assuming none of those dependencies has been
> > installed before (ex nihilo, so to speak).
> 
> Explicitly *YES*!
> It's nice to have someone actually read what I write ;)
> 
> > 
> > While that question sounds reasonable, it is not -- do you count
> > the base system, for exampla? That means "installed size" is
> > /always/ relative to some "base installation".
> > 
> > But perhaps my interpretation is wrong.
> 
> No. Perfectly correct.

In which case, part of that interpretation says: "While that question
sounds reasonable, it is not". And that's why I asked you to
reformulate your question if my answer was unsatisfactory for you,
instead of just shouting about it.

Once again, you have posed an ambiguous question that is open to
several interpretations, and you don't like any responses that aren't
in agreement with whatever thought processes are going on inside your
head.

> I'm comparing possible approaches to a problem.

Which approaches are you comparing? Why don't you expound them here so
that people can weigh the pros and cons, instead of expecting them to
second-guess what you might be thinking of.

> The "base install" is only loosely defined at this time.

You didn't define it, loosely or otherwise, or mention it at all.
But if you really mean to consider just the information in
/var/lib/apt/lists, without reference to any system, current or
otherwise, then the answer is probably to use your facility with
tcl to write a script.

You might start by building hash table A of Installed-Size and
Depends&Pre-Depends, indexed by Package. I don't recall whether there
are existing tools that parse /var/lib/apt/lists files for you.

Then, given any packages to be installed, you can recursively follow
their dependencies using A, building hash table B indexed by the extra
packages needing to be installed. (The values in table B are
irrelevant.)

Whenever you reach a package that already has an index entry in B,
stop following that branch because it's already been done (and it
avoids any circularities).

Finally, when you've run out of branches to follow, sum all the
Installed-Size values in A for the packages you've indexed in B.

Repeat: if that's not what you mean, ask your question again avoiding
words like "similar" and "based on". And quit shouting.

Cheers,
David.


Reply to: