Last active
March 23, 2026 07:59
-
-
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 :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /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