I am looking for a way to get a list of all the upgradable packages for Debian and RHEL distros. I know that dpkg stores some data in /var/lib/dpkg/status, but I have found nothing there indicating that a given package has a new version available for update.
I guess that since apt list --upgradable lists all the available upgrades very fast, it must rely on some cache: is it available as a file somewhere?
I have no clue about the same thing with RHEL: dnf seems to have a cache in /var/cache/dnf, but it is mostly binary files.
strace apt list --upgradablewill print you all system calls (so mainly the file that are opened or read). For Debian, it seems/var/lib/apt/extended_statesis the file which it is parsed. In any case, you should use the libraries (which are provided for various languages) and not directly reading the internal files, if you are not following closely the development of internal work in distributions.