#80123 Pre-Download hook

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Matt Zimmerman
Date:
2024-02-02 11:39:13 UTC
Severity:
wishlist
Tags:
#80123#5
Date:
2000-12-20 17:44:36 UTC
From:
To:
It would be nice to have a hook that would run before downloading any packages,
and be fed a pipeline of package info (version 1 or version 2, like
DPkg::Pre-Install-Pkgs).  This would allow something like apt-listchanges to
gather and display changelog information before any packages are downloaded,
once a facility exists for doing so.

#80123#16
Date:
2009-12-25 23:02:34 UTC
From:
To:
Hi!

This bug report (#80123) was filed quite some time ago (on December
2000!).
Having a Pre-Download hook would be very useful for at least two
packages: apt-listchages and apt-listbugs (I am a co-maintainer of the
latter).

Is there any progress on the implementation of this feature?

Please let me know.
Thanks in advance.

#80123#21
Date:
2010-01-03 13:42:34 UTC
From:
To:
2009/12/26 Francesco Poli <frx@firenze.linux.it>:
You might know or might not know that Matt Zimmerman is/was
a (previous) member of the APT Team, so this is/was always a todo
list entry which nobody has picked up by now - feel free to do this
now as it seems you are interested in it - you can consider this bug
(like many other wishlist bugs) as tagged as "gift" [0].

Some hints:
The current facility used for DPkg::Pre-Install-Pkgs is in apt-pkg/deb/dpkgpm.cc
mainly in the method RunScriptsWithPkgs() - this could be a small
help regarding how to create, manage and populate a pipe, through the
actual code which transmit the packages through the pipe isn't usable
for you as it uses a completely different data structure then the one
available before download.
An implementation of a pre-download hook is most likely called directly
from cmdline/apt-get.cc - but the actual implementation should resist
in a more global file so that it is possible for e.g. aptitude to use the
same, maybe the apt-pkg/{pkg,dep}cache.cc files are a good place for it.

Without thinking to deep about it i guess it is a good idea to implement
a possibility to generate from a given depCache a textual representation
(but machine parseable of course, apt already includes the human part)
of the scheduled statechanges - this representation could be piped
to an external application, apt-listbugs is e.g. only interest in packages
scheduled for installation or update -- bugcounts of packages going to be
removed aren't really interesting, but a different application maybe want
to warn the user about dubious removals (you used the app included in
this package 5 seconds ago, do you really want to remove it?) so we
should pass anything and let the user-application sort out his gems.


In the bigger picture sense a more general plugin interface for the
APT system would be fabulous (as it was implemented to a small extend
in apt-rpm with lua) but this will stay a wet dream for me a little longer,
i guess - and is nothing i would tag "gift", beside the fact that i am
not in the official position to tag anything as "gift". ;)


Feel free to contact the "team" (aka Michael, me or deity@ in general)
if you have interest, any questions, need help or just want to talk. :)


Best regards / Mit freundlichen Grüßen,

David "DonKult" Kalnischkies

[0] http://wiki.debian.org/qa.debian.org/GiftTag

#80123#26
Date:
2010-01-03 14:48:58 UTC
From:
To:
Ah, thanks for the clarification.
[...]

I don't know if I will be able to find the time for doing this: I am
not familiar at all with APT internals and code base, hence it would
take *much* longer to me than it would take to one of the deity team
(not counting that I am *not* a supernatural being like you members of
the *deity* team!).
[...]

Thanks for the hints, but they sound rather obscure to me.
Until I get to study APT implementation, I am afraid I won't understand
much of what you wrote!   ;-)

OK, *if* I find the time and decide I want to implement this new
feature by myself, I will definitely get in touch with you for help.

But anyway, I would be *much* happier to see it implemented by more
knowledgeable people (so that the risk to break the entire apt package
is minimized!).

Bye and thanks for your reply.

#80123#35
Date:
2014-06-14 16:29:02 UTC
From:
To:
On Sun, 3 Jan 2010 15:48:58 +0100 Francesco Poli wrote:

[...]
[...]

Hello David, hello APT Development Team,
it would be really really really great, if you could implement the
long-awaited Pre-Download hook (wishlist bug #80123), so that
apt-listbugs (and other packages such as apt-listchanges) could take
advantage of it.

Could this be done?
Thanks a lot for your time and dedication!

Bye.

#80123#42
Date:
2015-02-17 05:53:40 UTC
From:
To:
Hello,

I'm a newbie to debian development, looking to find a spot to settle and
start contributing.

The requested feature I believe I can do with some investigation of the
code and time to get familiar - so not sure if I should go ahead and try or
if I might want to stay away from this particular request?

However, I'm also very interested in the plugin API you have stated would
be a good idea.  I'd be interested to help with that - especially if you
guys would consider a more modern and universal approach (such as JS rather
than LUA).

Please let me know -> I have experience with v8 more specifically ...also
with LUA and with building LUA plug-in systems (though mostly for games).

Please keep in mind all of my extravagant ranting above is
pre-looking-at-any-code.  I'm just  basing my input on the *.cc reference
above.


Best,



*Richard B. Winters*

#80123#47
Date:
2015-08-21 14:49:17 UTC
From:
To:
Hi Richard (and everyone else reading the buglog),

sry to take so long to reply but I somehow didn't receive your mail and
just got prodded about it @ DebConf earlier this week… If that should
happen again, feel free to poke me by mail/IRC or any other method
available!

No, you absolutely don't want to stay away from it! ;)

I know, famous last words, but I don't envision it to be very hard to
implement, which is why I tagged it 'gift' – which is now 'newcomer'
– it is certainly a slightly bigger project than most newcomer-bugs, but
doable.

So, just start & get in touch with us. On the other hand, if you don't
want to do that it is fine as well, just say so, as I think we should
eventually fix this and if no newcomer is interested we might end up
doing it by ourselves (just that this usually takes longer as there are
many other things to do, too).

I was totally dreaming at that point and I will now continue with it,
but please realize that this will be a HUGE project if we ever going to
do this. Certainly nothing which is on the short-term list.

What this probably would include is simple C++ plugin interface in which
you could implement e.g. a python, lua, js, whatever "meta"-plugin so
that plugins could be written in these, too. The point here is mostly,
that apt is pretty low in the dependency chain, so it can't easily pull
in new dependencies and regardless of which language interpreter that
would be, it would be a huge tree, which would need to be in a minimal
chroot as well as (cross-)bootstrappable among other things.

The (semi-)dead apt-rpm got away with a lua hook system mainly as rpm
already needs it – and this is certainly interesting to look at, but
very likely at most as an inspiration rather than a patch source…


Best regards

David Kalnischkies

#80123#52
Date:
2016-10-13 20:31:03 UTC
From:
To:
I'd propose a new package in Debian apt repository called netbsd-pkgsrc.
`netbsd-pkgsrc` is the NetBSD packages collection for building
third-party software on NetBSD and other UNIX-like systems. pkgsrc maybe
very useful tool for maintaining packages and a good alternative for
apt. Please consider my proposition.

#80123#63
Date:
2020-02-19 12:52:55 UTC
From:
To:
On Fri, 21 Aug 2015 16:49:17 +0200 David Kalnischkies

I would love to see this implemented so that apt-listbugs can show the
bugs before downloading the megs of packages.

Regards,
Avinash Sonawane (rootKea)
PICT, Pune
https://rootkea.wordpress.com

#80123#68
Date:
2020-02-19 14:24:29 UTC
From:
To:

We have hooks now that run before downloads, even before the y/n prompt,
at least for apt's own command-line tools. apt-listbugs could use that
I'm sure. See the doc for json-rpc hooks in the tree.

#80123#73
Date:
2020-02-20 22:45:52 UTC
From:
To:
[...]

Hello Julian,
apt-listbugs maintainer speaking!

This interesting development has been just been [pointed out] to me by
Avinash.

[pointed out]: <https://bugs.debian.org/192787#50>

Are you referring to the [json hooks]?

[json hooks]: <https://salsa.debian.org/apt-team/apt/blob/master/doc/json-hooks-protocol.md>

They seem to be completely different from the DPkg::Pre-Install-Pkgs
hook and its version 3 protocol. Or am I misinterpreting the
documentation?

Isn't there a simple Pre-Download-Pkgs hook that speaks the version 3
protocol, so that I can just change /etc/apt/apt.conf.d/10apt-listbugs,
without redesigning all the interaction between apt-listbugs and
libapt-pkg?

Please let me know, thanks for your time!

#80123#78
Date:
2024-02-02 06:42:10 UTC
From:
To:
Greetings.

I'm writing to you because I have a humanitarian request that I believe
could be incredibly impactful. I'm reaching out about the recent
devastating storm that tragically claimed many lives and affected numerous
individuals in Libya, including one of my clients. I would like to discuss
a proposal with you that could enable us to extend a helping hand to these
victims.

Looking forward to discussing this further with you.

Warm regards,
Mrs. Nathalie Herolds