Pacman File Syntax

By "Pacman file," we mean those files with extension .pacman which sit in the various "Pacman caches" which can be found across the internet (for a sample list, do % pacman -registry). Each file contains a collection of ``attributes'' which determine how a particular package is fetched, installed and set up. We describe the syntax of these files here.

The simplest Pacman file is an empty test file which represents a package with no downloads, no dependencies, no description, no url etc. You can optionally add any or all of the attributes below. Each attribute may appear only once in a file. The order of attributes is not significant. We will illustrate each of these attributes with an example.

description = 'Text Editor'

This is a short description of the package which appears on the installation web page. It should be short so that it doesn't take up too much space in the % pacman -info page.

url = 'http://www.nedit.org/'

This should point to some generic web site for the software. The variable localdoc below points to any local documentation. Both of these show up on the % pacman -info installation display.

localdoc = 'doc/index.html'

It is sometimes convenient to point to local documentation as well as web documentation.

download = { '*' : 'nedit-5.1.1-linux-glibc.tar.gz' }

Download causes Pacman to download a file. In this example, for any platform (that's what the "*" means), the file nedit-5.1.1-linux-glibc.tar.gz is downloaded. The file to be downloaded can depend upon the platform, so for example download = { 'linux-redhat':'nedit-5.1.1-redhat.tar.gz', 'unix':'nedit-5.1.1.tar.gz' } would cause the nedit-5.1.1-redhat.tar.gz to be downloaded for RedHat Linux machines, nedit-5.1.1.tar.gz to be downloaded for all other unix machines, and an error message to appear for any non-unix machine. Do % pacman -platforms to get an explanation of what platforms are available.

Pacman automatically handles untarring, unzipping and rpm handling. If you want to do this manually in an install attribute, you can suppress all suffix handling with

suffixHandling = 0

The attribute

source = 'http://www.nedit.org/ftp/v5_1_1/executables/'

determines where any downloaded files come from. This can be a URL as in the example above or can refer to a relative location in the file system where the Pacman file is located. For example source='' (which is the default) causes Pacman to download any file from the same place that contains the Pacman file for the package.

The depends attribute

depends = [ 'nedit', 'Pacman:Python', 'BU:gnuplot' ]

gives a list of Pacman packages which must be fetched and installed before the package in question can be fetched or installed. The syntax is a list of packages where you can optionally specify the cache name as well as the name of the package. In this example, Pacman will look in the list of trusted caches for the first Pacman package called nedit and will get the package Python from the cache Pacman and will get the package gnuplot from the cache BU. Caches may be specified with symbolic names such as "BU" or with an explicit URL or with a location in the file system. To see the registry of caches with symbolic names, do % pacman -registry.

exists = [ '/usr/X11R6/lib/libXmu.so', '/cern' ]

exists is a list of required files which have to exist in the local file system or pacman won't attempt to install. Here, for example, /usr/X11R6/lib/libXmu.so is the motif sharable library. The nice thing about doing it this way rather than just letting the build fail is that the user get's informed about what is missing rather than just finding out that a build fails.

inpath = [ 'gcc', 'python' ]

Similarly, inpath is a list of files which must be visible in $path for a build to proceed. This example requires the gnu C++ compiler and python.

enviros = [ ['XXXROOT',''], ['XXXBIN','bin'], ['XXXLIB','lib'] ]

enviros sets up environment variables needed to install or use the software. If you need to set an absolute location as in /usr/local/bin, use absolute value bars as in enviros = [['XXXROOT',''],['XXXBIN','|/usr/local/bin|']]. When you define environment variables this way, they are currently set within Pacman from when your package is installed. These are also put in the setup.csh and setup.sh files created for setting up your software. For convenience, an environment variable PACMAN_INSTALLATION is provided which points to the location of your Pacman installation; the location where you are executing pacman commands, in other words.

Besides plain environment variables, Pacman has an attribute for specifying path variables like the standard unix $PATH or $LD_LIBRARY_PATH. The following, for example,

paths = [ ['PATH','bin'], ['LD_LIBRARY_PATH','lib'] ]

causes the bin subdirectory of a package to be added to $PATH and the lib subdirectory of the package to be added to $LD_LIBRARY_PATH. The root directory of a package is added to the file specification by default. To suppress this, use absolute value bars as in the case of plain environment variables.

localdoc = 'doc/index.html'

localdoc points to any local installation web documentation that's available. This is clickable on the pacman -info display.

daemons = [ 'daemon1', 'daemon2' ]

This is a list of daemons associated with the package. Pacman doesn't do anything with this information other than check if they are running and add this information to the display gotten by pacman -info.

install = { 'root': [ './configure', 'make depend', 'make', 'make install' ], \ '*' : [ './configure', 'make depend', 'make' ] }

install includes any arbitrary shell commands which are needed to install a package assuming that it is unzipped and untarred. The install above is pretty typical. It indicates that if root is doing the installing, do ./configure followed by make depend followed by make install. If anyone else is installing, do the same thing except omitting the make install. It is better to have a separate list of commands rather than to use semicolons because in the former case, if any of the commands fails, pacman will realize that the package has not been installed correctly. If you run everything together with semicolons, pacman only gets the error code from the last one.

The installation commands in install can ask questions via shell commands or guis. For an example of this, do % pacman -get -ask BU:mozilla. This will use the standard mozilla installer via an install command. If you want to be cautious about what Pacman is doing, use the -ask switch and Pacman will ask before executing any shell commands such as the ones in the install attribute.

uninstall = ['cd $XXXROOT','rm *']

You can optionally list a sequence of shell commands which get executed when a package is "uninstalled." This typically does not need to be used because Pacman handles the routine parts of tarring, zipping and rpm handling automatically.

nativelyInstalled = { 'inpath': ['perl','cc','tar'], 'enviros':['PERLROOT','PWD'], 'scripts':['perlisok.csh'] }

The nativelyInstalled attribute allows you to define conditions which cause Pacman to consider a Package to be natively installed and to skip Pacman's normal installation procedure. This is particularly useful for very standard software like perl which is usually available, but occasionally may have to be installed from scratch. In the example above, if perl, cc and tar are in the users $PATH, and if the environment variables $PERLROOT and $PWD are defined and if the script perlisok.csh returns 1 when executed, then this package is considered to be "natively Installed." Besides inpath, enviros and scripts above, you can use 'commands':['com1','com2','com3'] etc. to require that shell commands com1, com2 and com3 return without an error code. Similarly, 'rpms':['rpm1','rpm2','rpm3'] checks if rpms named rpm1, rpm2 and rpm3 are installed. If so, the package is accepted as natively installed. Try the natively installed tutorial for an example.

setup = [ 'source $XXXROOT/setup.SHELL' ]

setup is a list of shell commands. "SHELL" is a convenience for shell dependent operations. It is replaced with "csh" or "sh" as appropriate. setup.csh file for setting up all installed packages.

demo = 'bin/demobinary'

If this attribute occurs in XXX.pacman, then the string XXX_demo will be aliased to "bin/demobinary" with the root directory of the package prepended.


Pacman Home