Score:1

About the usage of Python-apt

ch flag

my goal is to collect different executable files with the same source code in all Linux distros and all architectures, e.g. Ubuntu 18.04 and Debian 12 in amd64 and i386, as much as possible, and for scientific purposes only.

I don't know if there are any neat ways to do that, I'm currently trying to set a source.list cache in python-apt (so that others won't be influenced using apt), and then download executables and source codes of packages listed by my previous work.

My python-apt version is 2.4.0, and when I run the codes below, it shows the GPG public key error; after I added '[trusted=yes]' into the source, the package_list has no 'vim', it seems like it cached nothing.

It would be grateful if you could help me with this. Best regards.

with open('/home/etc/apt/source.list', 'w') as f:
    f.write('deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free \n')
cache = apt.Cache(rootdir=os.getcwd(), memonly=True)
# cache._run_fetcher(apt_pkg.Acquire(apt.progress.text.AcquireProgress()))
cache.update( sources_list='/tmp/source_2.list')
package_list = ['vim']  
print(cache.keys())
for package_name in package_list:
....
guiverc avatar
cn flag
Please refer https://askubuntu.com/help/on-topic, Ubuntu and *official* flavors of Ubuntu (https://ubuntu.com/download/flavours) are on-topic on this site. The on-topic link provides alternate SE sites for non-Ubuntu OSes.
karel avatar
sa flag
@guiverc I would be inclined to leave this question open because the author specifically mentioned Ubuntu 18.04. That was just an example suggests that this question was intended to be relevant to other Ubuntu versions generally.
guiverc avatar
cn flag
@karel the example code and `https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye` was the '*clincher*' for my decision... as that's not a Ubuntu release.. (*multiple references to off-topic Debian, with a single reference to 18.04 that is on-topic as if to circumnavigate rules...*)
karel avatar
sa flag
I also saw the single reference to 18.04, but since it was prefaced by "e.g." I interpreted that as being relevant to other Ubuntu versions generally, like the rmadison tool which is provided by the devscripts package in Ubuntu.
guiverc avatar
cn flag
@karel close-vote removed; the `python-apt` version mentioned matches up with Ubuntu (*jammy* or *kinetic*), closer than it does Debian in a quick query... so taking that as another reference to on-topic Ubuntu.
QiuSH avatar
ch flag
My bad, the version of my python-apt is '2.4.0+ubuntu1' to be specific. Thanks tons guys
Score:1
ch flag

problem solved, if you encounter the same issue, you can try this out:
and remember to check the 'rootdir' should contains your sources.list

with open('/home/BinDiff/etc/apt/sources.list', 'w') as f:
    f.write('deb [trusted=yes] https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main ')

cache = apt.Cache(rootdir=os.getcwd(), memonly=True)
cache._run_fetcher(apt_pkg.Acquire(apt.progress.text.AcquireProgress()),allow_unauthenticated=True)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.