Skip to content

Instantly share code, notes, and snippets.

@zerwes
Last active March 23, 2026 07:59
Show Gist options
  • Select an option

  • Save zerwes/9df84303ae6b3a5faaf5fc4275e955d2 to your computer and use it in GitHub Desktop.

Select an option

Save zerwes/9df84303ae6b3a5faaf5fc4275e955d2 to your computer and use it in GitHub Desktop.
find packages not distributed by the current distro - for example after doing what you should never do: a dist upgrade from ubuntu to debian :-)
#! /usr/bin/env python3
#
# requirements:
# apt install python3-apt
import apt
# as the script will list manual installed deb's,
# you can ignore them by adding the name to this list
IGNORE_PKG = ['check-mk-agent', 'yet-another-package-name']
cache = apt.Cache()
for pkg in cache:
pv_downloadable = False
if len(pkg.versions) > 0:
for pv in pkg.versions:
if pv.downloadable:
pv_downloadable = True
continue
if not pv_downloadable:
if pkg.name not in IGNORE_PKG:
print(pkg.name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment