I use python apt library and I would like that the commit() function doesn't produce any output.
I've searched on the web and saw that the fork function can do the trick but I don't know how to do that or if there exists another way. I don't use any GUI, I work via the terminal.
The easiest solution is probably to use something like:
class LogInstallProgress(apt.progress.base.InstallProgress):
def fork(self):
pid = os.fork()
if pid == 0:
logfd = os.open("dpkg.log", os.O_RDWR | os.O_APPEND | os.O_CREAT, 0o644)
os.dup2(logfd, 1)
os.dup2(logfd, 2)
return pid
and then in commit():
cache.commit(install_progress=LogInstallProgress())
But be careful, note that deb packages may do conffile prompts and similar things, so you will want to override conffile() (and error too).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With