ok i discovered dpkg -l output to be unsuitable because it truncates important fields lukilly the list of installed packages is in /var/lib/dpkg/status in plain text

however this file is not sorted in any way which could make compareing harder