برنامهٔ زیر چنین کاری میکنه.
یک لیست از مخازن مورد نظر را در ابتدا مشخص میکنیم بستههایی که نصب شدند و توی اون لیست نیستند را در خروجی میریزد.
#!/usr/bin/env python3
import apt
cache = apt.Cache()
package_count = 0
desired_list = ["bullseye/main", "main", "contrib",
"non-free", "stable-security", "bullseye-security"]
for package in cache:
if (
package.is_installed
and package.candidate.origins[0].component not in desired_list
):
package_origin = package.candidate.origins[0]
print(
package.name,
package_origin.origin, # The Origin, as set in the Release file
package_origin.archive, # The archive (eg. Ubuntu release name)
package_origin.component, # The component (eg. main/universe)
package_origin.site, # The hostname of the site.
package_origin.label, # The Label, as set in the Release file
package_origin.trusted,
)
package_count += 1
print(package_count, "packages not from given list")
خودتون با تغییر لیست میتونید بستههای مخزن خاصی را ببینید.
چند نمونه
linux-headers-5.10.0-11-amd64 now now False
linux-headers-5.10.0-11-common now now Falsenypatchy now now False
perl-modules-5.28 now now Falserpi-imager now now False
virtualbox-6.1 now now False
xfce4-notes now now False
منبع
https://askubuntu.com/a/1355067/678872