Part VII. Packaging a Grid Application

We will use pacman (Package Manager) for this part of the exercise. Pacman is a packaging tool that has many useful features including fetching, installing and updating software packages with simple commands. If you are familiar with tools such as apt or yum, you will find this tool similar) (pacman manual)

Check that pacman is installed

Pacman should be installed for you already. You can check it like this:

$ pacman -version
Pacman version:  3.20
Python version:  2.5.1c1 (release25-maint, Apr 12 2007, 21:00:25) 
Your platform [Ubuntu-7] satisfies { *, Debian, Debian-7, Linux, linux, linux-debian-7, Ubuntu, Ubuntu-7, unix, Unix }

So pacman is ready to use. You could now download the whole VDT with a single command.

Caution

Do not start this installation on the training machines. Installing the VDT require a great deal of time and space. But if you had time and space, you would do this:
$ pacman -get VDT:VDT 

Pacman caches

From pacman documentation:

 

A Pacman cache is a just a URL or location in a local file system containing files with the .pacman extension. Each such file defines how a package is fetched, installed and set up.

 
 --Pacman manual

Example pacman file

description = 'Text Editor'
url = 'http://www.nedit.org/'
download = {'*': 'nedit-5.1.1-linux-glibc.tar.gz' }
paths = [['PATH','']]

Exercise

In this part of the exercise, we will create a local cache and package our application with pacman. Then, we will install the application in a seperate directory using this cache.

Create a directory for the cache and temporary directory for installing your dprime application.

$ mkdir localcache
$ mkdir installs

Create a directory for your application and copy prime.c to the directory:

$ mkdir dprime
$ cp /home/benc//prime.c dprime

Create a Makefile in the application directory to compile your application. You can use the following Makefile. Copy it to the dprime directory.

$ cat Makefile
primetest: prime.c
	cc -o primetest prime.c

clean:
	rm -f primetest

Note

Make sure that the spaces before cc and rm in the above file are actually tabs!

Tar and gzip the files to make a source distribution of the prime checking application.

$ tar zcvf dprime.tar.gz dprime/prime.c dprime/Makefile 

Copy the zipped file to localcache directory:

$ mv dprime.tar.gz localcache/
$ cd localcache

Create a file named dprime.pacman in the localcache directory. The file should contain:

# Descprtion of the package
description = 'Prime Number Finder'
# What to download?
download    = {'unix' : 'dprime.tar.gz'}
# How to install
install     = {'*':['make']}

Go to installs directory and run pacman:

$ cd ../installs
$ pacman -get ../localcache:dprime

Do you want to add [../localcache] to [trusted.caches]? (y or n): y
Package [dprime] found in [../localcache]...
Downloading [dprime.tar.gz] from [localcache]...
Untarring [dprime.tar.gz]...
gcc -o prime prime.c 

You can see which packages you have installed, like this:

$ pacman -l
[*] dprime

You can make changes to the dprime.pacman file, maybe simply changing the description. Update the software with pacman -update-check.

$ pacman -update-check
Package [dprime] found in [../localcache]...
Update of [../localcache:dprime] found...

$ pacman -l
[*] dprime, in cache [/home/YOURLOGIN/test-lab6/installs] ==> UPDATE AVAILABLE 

$ pacman -update