Hallo,
seahawk1986 schrieb:
Vielleicht hilft dir dieses Skript: https://forum.ubuntuusers.de/post/9314493/
ja, danke, hat mir geholfen. Ich habe es um die Spalte "Server" erweitert, das brauchte ich für meinen Zweck:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | #!/usr/bin/env python3
import apt
import re
ORIGIN_RE = re.compile(r'/pool/(?P<source>[^/]+)/')
cache = apt.Cache()
def get_server(string):
x = string.find("/", string.find("/") + 2)
return string[:x]
for pkg_entry in cache:
if (pkg := pkg_entry.installed) and pkg.uri and (m := ORIGIN_RE.search(pkg.uri)):
third_slash_index = pkg.uri.rfind("/")
print (pkg_entry.fullname, pkg.version, m['source'], get_server(pkg.uri), pkg.uri, sep='\t')
|
Output ist dann:
a2ps:amd64 1:4.14-5 universe http://de.archive.ubuntu.com http://de.archive.ubuntu.com/ubuntu/pool/universe/a/a2ps/a2ps_4.14-5_amd64.deb
accountsservice:amd64 0.6.55-0ubuntu12~20.04.5 main http://de.archive.ubuntu.com http://de.archive.ubuntu.com/ubuntu/pool/main/a/accountsservice/accountsservice_0.6.55-0ubuntu12~20.04.5_amd64.deb
acl:amd64 2.2.53-6 main http://de.archive.ubuntu.com http://de.archive.ubuntu.com/ubuntu/pool/main/a/acl/acl_2.2.53-6_amd64.deb
acpi:amd64 1.7-1.1 universe http://de.archive.ubuntu.com http://de.archive.ubuntu.com/ubuntu/pool/universe/a/acpi/acpi_1.7-1.1_amd64.deb
acpi-support:amd64 0.143 main http://de.archive.ubuntu.com http://de.archive.ubuntu.com/ubuntu/pool/main/a/acpi-support/acpi-support_0.143_amd64.deb
Sorry, der Code der Erweiterung ist grausig, ich kann Python (noch) nicht.