Getting Started: -get and -remove


Grab a copy of Pacman from Pacman Headquarters. Unzip/tar it someplace, cd into the directory and do % source setup.csh or % source setup.sh depending on your shell. cd to a scratch directory somewhere and do % pacman -version to make sure that you have Pacman version 3.0 or greater. You're now ready to use Pacman.

At the user level, Pacman has two main concepts: Packages and Caches.

Packages

A package is a description of a software environment in the Pacman language. A package may be a single piece of software like Python v 2.2.3 or a complex multi-package environment.

Caches

A cache is a source of packages.
An easy way to get familiar with packages and caches is to install some software. Let's start with a nice text editing application called nEdit. The package nEdit can be found in the cache BU. To get this software, all you have to do is
% pacman -get BU:nEdit
Assuming that you agree to trust the cache BU (see below), installation may take from a few seconds to a few minutes to finish, depending on your internet connection. If the installation succeeds, you will have nEdit available to you. If the installation fails, you will get an error message. Here we come to an important point about Pacman - what to do if an installation fails:

If you follow this principle, then problems can be solved once for everyone by a cache manager rather than everyone repeatedly running into the same problems. The best way to help is to just complain and wait for a solution. In the case of registered caches, you can get a list of who to complain to by doing % pacman -registry.

Notice, also, that you had to indicate that you trusted the cache BU before Pacman would do anything. This is necessary because Pacman is downloading and executing instructions from the cache and executing them. In general, then,

Pacman provides several tools for you to gain confidence in remote caches. For example, you can browse the source code before it is executed (see -l and -lc below). You can also execute the installation one step at a time using -ask. Caches can also be accessed via ssh rather than http where access and authentication is handled by the standard ssh mechanisms.

In any case, try the nEdit install and while it's downloading, notice the following points:

  1. All Pacman operations are accomplished by doing % pacman with various unix-style command-line options. You can see what the options are by doing % pacman -help.
  2. Pacman keeps a registry of symbolic names like "BU" which get translated to URLs. You can use full URLs instead of symbolic names if you like or if you want to trust a cache that's not in the registry. Do % pacman -registry to see your current set of symbolic names.
  3. The -get part of the command line tells Pacman to fetch, install and setup the packages that you specify on the command line. For command line options, do % pacman -help.
  4. Pacman asks you if you trust BU before proceeding. Pacman will only use a cache if you agree to trust it. The list of caches that you are currently trusting is kept in a file called trusted.caches in your current directory. Pacman will modify this file as you agree to trust more caches, but you can also edit the file yourself at any time. If you do not specify a cache on the command line, Pacman will search the caches in the trusted.caches file in order.
  5. While the command is executing, several messages appear in your shell related to downloading, untarring, and so on. You can adjust what kinds of messages you get using the -v switch. Do % pacman -v help to see the options.
  6. Pacman commands always refer to the installation in the current working directory. To add and remove packages to this installation, you must % cd to this location.
If the installation of BU:nEdit succeeds, you will see that your directory now contains six files
% ls
o..pacman..o  nedit-5.3  setup.csh  setup.py  setup.sh  trusted.caches
Besides the trusted.caches file, Pacman also produces and maintains setup.csh, setup.sh and setup.py. To set up whatever software you have installed, just source setup.csh or setup.sh depending on your shell. In this particular case, source the appropriate setup file and you can then do % nEdit to use the editor. Each installation has at most one set of setup files. Sourcing the appropriate file (from any location) always sets up all of the software contained in your installation. You shouldn't edit these files by hand because they are regenerated by Pacman.

Finally the "o..pacman..o" file let's you know that the current directory contains a Pacman installation. It's actually a directory containing Pacman's internal representation of your environment.

Now let's add some more software to your installation with the following command

% pacman -get BU:Python nEdit Pacman:Pacman
and notice that
  1. You can specify multiple packages on the command line.
  2. Python depends on another package called PythonDocs which is automatically installed when you install Python.
  3. It does no harm if you already have nEdit installed.
  4. The package Pacman from the cache Pacman is a convenient way to treat Pacman in the same way that you treat any other package. After doing this, you can throw away your original untarred copy of Pacman.
The -l command line switch let's you browse the contents of your installation. For instance, do
% pacman -l
[*] Python, in cache [/home/youssef/Pacman/work]
    [*] PythonDocs, in cache [/home/youssef/Pacman/work]
[*] nEdit, in cache [/home/youssef/Pacman/work]
[*] Pacman, in cache [/home/youssef/Pacman/work]
to see a dependency tree view of the packages in your installation. The boxed character in front of each package indicates it's status. The "[*]" mean that each of the package has successfully installed. A package which can't be intalled on your system is indicated by "[X]" and "[ ]" indicates a package which might install correctly but the installation hasn't been attempted. In general, commands of the form % pacman -l {package 1} {package 2}... let you browse packages in your installation with display options controlled by the -d switch. For example, try
% pacman -d src -l Python
to list the source code of the Python package and it's dependents. You can also list all the packages in your installation cache in alphabetic order by doing % pacman -lc .. You can use same -l and -lc commands to browse remote caches as well. For example
% pacman -d 2 -l VDT:Condor
[ ] Condor, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]
    [ ] Condor-Installer, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]
        [ ] Condor-Environment, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
        [ ] Condor-Base, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
        [ ] VDT-Common, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
        [ ] VDT-Environment, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
        [ ] Licenses, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
    [ ] Condor-Environment, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]
        [ ] VDT-Common, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
        [ ] VDT-Environment, in cache [http://www.cs.wisc.edu/vdt/vdt_cache/]...
displays the package Condor from the cache VDT to maximum depth 2, and
% pacman -lc BU
lists the contents of the BU cache.

Removing packages

When removing packages, it is important to use the Pacman mechanisms for this rather then just doing % rm -r -f in the installation area. The reason for this is that, in general, Pacman packages may modify files outside of your installation area. To see if this is true, use

% pacman -domain
and you will see all parts of your system Pacman has modified or is keeping track of. To remove software correctly, use, for example,
% pacman -remove
This removes all packages from your installation recursively. See % pacman -help for more details.

Finally, when you are done, do

% pacman -remove-all
to remove all packages in your installation and remove the installation itself.


Pacman Headquarters