Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help

Writing Programs for local system installation (DRAFT)

Locally we use RPM (the RPM Package Manager) to store, query, verify, install, upgrade and remove packages.

  rpm -qa

will list our RPMs. Doing

  rpm -qa | grep cued

will list the locally produced ones. If you want to know which package a particular installed file comes from, you can use something like the following

  rpm  -q --whatprovides /usr/local/bin/xcc

Locally produced programs are stored as RPMs (preferably source RPMs - SRPMs) according to the naming scheme below. If you can't produce such files, mail teaching-support. checkinstall could be handy for making packages from ordinary Make-built software.

Naming Scheme

All locally generated teaching system RPMs should feature 'cued' somewhere in the name of the RPM. Having it only as part of the version string causes problems when updates come along.

Where the local version replaces a standard RPM then the RPM should provide the original RPM name plus any other provisions it inherits. e.g. cups-cued provides cups. This will satisfy other RPMs which depend on cups.

Where a RPM is completely bespoke, the name should start with cued. e.g. cued-dpo-tools. (some existing ones don't follow this rule, because they predate it).

All spec files ought to specify a buildroot in their header, then install files relative to $RPM_BUILD_ROOT. This keeps the install process from interfering with the underlying OS and possibly files from that being accidentally packaged without being installed.

Directory layout

Assume a GNU-like layout. Binaries to be executed by non-root users should live in /usr/local/bin. /usr/local/lib, /usr/local/share, etc should be used appropriately.

Repository

All distribution RPMs should be under /infra/src/ (mounted from file-serv:/servpool/nfsdata/infra/src. This area is backed up. At the very minimum the .src.rpm must be preserved in which the source and spec file to generate the binary RPM ought to reside.

.../tarballs is one location for the source of locally generated .tar.gz files to live, but is not mandatory. That the .tar.gz files used for generating our RPMs to be in the .src.rpm is mandatory.

RPM spec file headers

Here's sample spec file
Summary: C++ graphics library
Name: cued-glue
Packager: tl136
Version: 1
Release: 1
Copyright: GPL
Group: CUED
Source0: cued-glue-1.tar.gz 

%description
This library is used in 1A C++ teaching.
%prep
%setup -q
%build
g++ -I/usr/include/GL -fPIC -c glue.cc
g++ -shared -Wl,-soname,libglue.so.1 -o libglue.so.1 glue.o

%install
install -s -m 755 -o 0 -g 0 libglue.so.1 /usr/local/lib
install -m 644 -o 0 -g 0 glue.h /usr/local/include
install -m 644 -o 0 -g 0 glue.1 /usr/man/man1

%files
%doc README 
/usr/local/lib/libglue.so.1
/usr/local/include/glue.h
/usr/man/man1/glue.1

See also

© Cambridge University Engineering Dept
Information provided by Tim Love (tpl)
Last updated: June 2008