How to test for Linux Kernel, gcc versions etc.


If you are writing some Pacman source code and you want to require that a particular package be available at a particular point in your installation, you just do something like

package('Demo:Python | versionGE("2.2")')
Sometimes, however, it is useful to be able to test for non-Pacman installed software or to test for system properties. The language contains special atoms for you to test common "natively installed software" such as gcc, perl, the linux kernel, etc. You can also test many other system properties. For an example of this, do
% pacman -get Demo:system
% pacman -d cmp -l 
to some of these atoms in action on your system. The language let's you, in effect, decide to accept non-Pacman installed software optionally depending on conditions that you define. You can test the conditions, and if they are not satisified, install the package as a Pacman package. Here's a simple example that installs Python > 2.2 from the Demo cache, but only if necessary.
{ pythonVersionGE("2.2") OR package('Demo:Python | versionGE("2.2")' }

One other nice trick is to use ShellOutputGE to execute a shell command and test on the value of the output. For instance, this bit of code

shellOutputGE('wget -V','GNU Wget 1.9')
makes sure that wget version 1.9 or greater is installed on the system.


Pacman Headquarters