Categorical determination of package manager Zypper/Apt

In some recent experiments with speech application Kaldi (see github) I came across an issue related to accurate determination of package manager. Compiling Kaldi depends on certain libraries and these can be determined on the local system with the proper labels, and we can get the labels via the package manager.
But which package manager? There are various: apt-get, pacman, zypper, yum, and so on. Kaldi needs to be prepared for a wide variety of possibilities.
As we know, openSUSE uses Zypper. However there is a slight twist introduced recently in Leap where a couple of packages install a version of


. It is clear that this version is not intended to be the package manager, since

dpkg -l

returns empty. A second machine running openSUSE 12.3 does not have an apt-get so the situation would not arise.

So a simple check “does apt-get exist on the system, in which case apt-get must be the package manager” is going to lead to problems.

Is there a standard reliable way to detect that zypper is in fact the true package manager reliable across all distros?

IMHO it is not so much about the package manager, but about the type of packages used. On openSUSE RPM packages are used.

On openSUSE package management is basicaly programmed in the libzypp software. There are different interfaces to this package:

  1. YaST > Software as GUI (but can also be used from the CLI through it’s ncurses interface);
  2. zypper (from the CLI);
  3. PackageKit (through things like Apper).

Thus, from the system manager’s point of view there is not one package manager on openSUSE, but there are more. Common is that they are based on RPM packages.

It might be possible to build apt-get on openSUSE, but it will not be of any practical use because it can not handle RPM packages.