Annvix:User Guide/Packaging/Ports

From linsec.ca
Jump to: navigation, search

This page contains content from the old Annvix.org wiki and has been moved here to preserve content. These pages have been retained for historical and nostalgic purposes only.
Please be aware that Annvix is no longer in development!


Creating Packages Via Ports

Similar to FreeBSD's ports, Mandriva's contribs, and other similar repositories, Annvix's ports collection is a (slowly growing) collection of packages that are not part of the default Annvix main package base. These are "third-party" additions that extend the functionality of Annvix but also don't burden the development team with maintenance. Annvix ports are packages that may be of interest to very few and may also be maintained by individuals who are not necessarily part of the development team. Examples of ports packages include the joe, various DJB programs such as djbdns, and other small utilities like pine and tree.

Ports are source-based; the only thing provided are a manifest (md5sum list) of source files, patches, and an RPM spec file. The ports builder program is a script that downloads the appropriate source files and, using the included patches and RPM spec, builds an RPM file that is in turn placed in an apt repository which can then be installed from. The concept is similar to that of Gentoo's portage.

The builder script is fairly basic and attempts to be moderately smart and install packages required to properly build a package, but it is not yet intelligent enough to build another package (or set of packages) that may be required to build the requested package. For instance if package "bar" requires package "libfoo" (which is not in main, but is in ports), it will just error out and you will need to manually build "libfoo" first. Then you can proceed to build "bar". builder needs to be extended at some point to do this for you. It also needs to be able to provide RPM signatures on generated files for integrity purposes; it does not yet do this.

Contents

Setting up the ports collection

To begin with the ports collection, you need to install the annvix-ports RPM package (using apt-get install annvix-ports). Note that the annvix-ports package will add the appropriate media configuration entry to /etc/apt/sources.list. At this point, if you are an admin user, you can begin building ports packages. The first step is to download the current ports collection using:

$ builder -u

This connects to the Annvix rsync repository and and downloads the entire ports tree. Because the ports tree consists of patches, spec files, and scripts, the download will be fairly quick. This same command also refreshes the ports tree; it should be executed periodically to look for changed spec files, new ports packages, etc.

Creating a ports package

To create an RPM for the package joe you would use:

$ builder -p joe
Password:
builder - build interface for Annvix ports
version: 1.5 - $Id: builder 542 2007-01-03 23:37:03Z vdanen $

Building port package joe
Comparing md5sum of the downloaded file (joe-3.5.tar.gz)

Creating the source rpm file...
Wrote: /usr/local/ports/override/ubuild-joe-3.5-18249/SRPMS/joe-3.5-80avx.src.rpm

Checking to ensure we have all build dependencies installed...
Reading Package Lists... Done
Building Dependency Tree... Done
0 upgraded, 0 newly installed, 0 removed and 0 not upgraded.

Creating the rpm package from joe.spec...

Note that you do not need to be root in order to run builder; any admin user (in the admin group) can do so. The builder command is a shellscript wrapper that calls the real /usr/local/ports/builder script via sudo (executed as user "builder").

The above command will parse the /usr/local/ports/ports/joe/joe.spec file to determine what files to download and will download them from the noted FTP or HTTP site in the spec file. It then matches the md5sum of the downloaded file to what is in the manifest (archive.md5sum) and if the md5sums match, will proceed to compile the program and package it in an RPM package. The resulting RPM files are then copied into /usr/local/ports/packages/{RPMS.ports,SRPMS.ports} and the appropriate apt meta-data for the repository is generated and stored in /usr/local/ports/packages/base.

Status Flags

Builder will show status flags if a port isn't explicitly marked "ok" for the current version. This allows you to know whether or not the package has been tested and certified for the current version of Annvix. The possible status flags are:

  • ok: the package has been tested; it compiles and should work
  • untested: the package has not been tested; build at your own risk
  • broken: the package has been tested and either does not compile or does not work -- builder will not allow you to build a broken package spec/patch files and you must rebuild the package again.

Options

The following commandline options can be used with builder:

  • -h - help
  • -u - update ports
  • -c - cleanup the override directory (the temporary directory where files are unpacked and compiled)
  • -l - force an update of apt's metadata
  • -i - install the package after building it
  • -v - show verbose rpm build output
  • -p [package] - build package "package"

For instance:

# builder -i -p gdb

would build then install the gdb ports package.

Installing the Ports Package

Once the package is built, it can be installed via apt-get:

$ apt-get install joe

Alternatively, you can build then immediately install the ports package, skipping the need to use apt-get to install it manually:

$ builder -i -p joe

Security Precautions

Only users in the admin group are able to run the builder tool, which is why it asks for your password. builder is being executed via sudo to run as the user "builder". This guarantees there will be no permissions issues regardless of which admin user creates the package. The installation of annvix-ports will configure sudo (via /etc/sudoers) to allow admin users to execute the builder script. This script can never be run by a non-admin user.

In fact, /usr/bin/builder is simply a wrapper script that executes /usr/local/ports/builder as the user "builder". The latter script can never be run by any user other than builder, and cannot be run without being invoked by sudo.

As well, upon installation of this package, /etc/apt/sources.list is updated to point to the local ports repository so that packages can be easily installed.

PLEASE NOTE: Annvix ports are unsupported. They may not receive security updates on a regular basis like packages in the main repository. Use these packages at your own risk. As well, if a ports package is updated, you must refresh the repository in order to obtain the updated.

<< Return to User Guide

Personal tools
other sites