Info
Upkg version1.4.0
Packages1143
Package Search

How to build a source package using upkg (the paldo package system)

written by Nicolas Christener in jan 2006


Abstract

This howto should help you to get a source package built using upkg. Upkg is the package management and build system used in the Paldo Linux distribution.

A concrete problem

I like the Paldo philosophy of having one tool for every task. But I don't want to install k3b (and its dependencies) for making 1:1 copies of a CD. Therefore I checked the availability of Gnome Baker in the Paldo package repository. Unfortunately Gnome Baker is not in the main repository. Thus I decided to build Gnome Baker from source. Because I want a clean filesystem I don't want to just run "./configure, make and make install". It would be nicer to install the binaries, the docs... using the package manager after building everything from source. Read on to find out what I did to achieve this.

Create a local Paldo repository

First of all we need to create a place for all our source packages. It doesn't matter where you create this local repository. I put mine in my home folder:

    [nicolas@gandalf:~]$mkdir PaldoRepo
    [nicolas@gandalf:~]$mkdir PaldoRepo/binaries
    [nicolas@gandalf:~]$mkdir PaldoRepo/sources
    [nicolas@gandalf:~]$mkdir PaldoRepo/specs


Now we need to tell upkg about the new local repository. Open /etc/upkg.conf as root and add your repository. The content of the file then looks something like the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <local>
      <cachedir>/var/cache/upkg</cachedir>
      <repositories>
              <repository>http://www.paldo.org/paldo</repository>
              <repository>/home/nicolas/PaldoRepo/</repository>
      </repositories>
      <branch>testing</branch>
      <arch>x86</arch>
    </local>


Get the source

Now download the source code of the application you want to install. In my case I downloaded the zipped source-tarball from http://gnomebaker.sourceforge.net. Upkg needs the source distribution as tar (tar file), or tar.bz2 file (bzip2 compressed tar file). Please ensure that your source package is in a supported file format, then copy or move it into the sources dir of your repository. Take care, that the file has the same name which you will later use as the package-name. See the <package name>-tag in the spec file chapter later.


upkg will only find the source package if you save it under $REPODIR/sources/$PACKAGENAME


  [nicolas@gandalf:~/temp/gnome-baker]ls
  gnome-baker-0.5.0.tar.bz2
  [nicolas@gandalf:~/temp/gnome-baker]mv gnome-baker-0.5.0.tar.bz2 ~/PaldoRepo/sources/gnome-baker/


btw: If you like to use a tar.gz file, you need to add the following to your spec file: <archive name="...." compression="gz">

Create spec file for upkg

Now we need to tell upkg how it has to handle the source code. This is done using a simple XML File. You need to create this file in the specs dir in your repository. The name of the file should be the application name. In my case I name it gnome-baker.xml. The content of the file then looks something like the following:

    <?xml version="1.0"?>
    <package name="gnome-baker">
          <description>gnome cd burning application</description>
          <releases>
                  <release version="0.5.0" revision="1" branch="testing">
                          <deps>
                                  <dep name="libgnomeui-2.0"/>
                                  <dep name="gtk+-2.0"/>
                                  <dep name="glib-2.0"/>
                                  <dep name="libglade-2.0"/>
                                  <dep name="gstreamer-0.8"/>
                          </deps>
                          <build>
                                  <script>
                                          <archive name="gnome-baker-$VERSION">
                                                  <cmd>./configure --prefix=/usr 
                                                                   --infodir=/usr/share/info 
                                                                   --mandir=/usr/share/man 
                                                                   --sysconfdir=/etc</cmd>
                                                  <cmd>make -j 2</cmd>
                                                  <cmd>make install</cmd>
                                          </archive>
                                  </script>
                          </build>
                  </release>
          </releases>
    </package>


Most parts of this file are self describing. I think I just need to describe the dep-fields. In order to let upkg automatically resolve the dependencies you need to tell upkg which packages your tool needs to get compiled. To find out which other packages are needed, you can try the following approaches: Here is a somewhat unofficial list of build essentials: You don't need to mention this dependencies because those packages are installed on every paldo installation.

Start compiling and installation

Now you're ready to compile and install your application. The following command will invoke everything:

    [root@gandalf:~]# upkg-build gnome-baker
    Generating script...
    Writing script...
    Executing script...
    The following extra packages will be installed:
    gnome-baker

    The following packages will be built from source:
    gnome-baker

    Do you want to continue? [Y/n]
    Building gnome-baker-0.5.0-1 (testing)...
    [root@gandalf:~]#
  


If you want to see verbose output, you can pass --verbose to upkg-build:

    [root@gandalf:~]# upkg-build --verbose gnome-baker


You should now be able to run your application.

Log Files of upkg-build

If you want to see, what upkg exactly did, take a look at /var/lib/upkg/logs/PACKAGE-VERSION.log.bz2. In my case I see all the steps upkg took in /var/lib/upkg/logs/gnome-baker-x86-glibc-2.3-gcc-4.0-1-0.5.0-1.log.bz2

Remove the package again

If you would like to delete the self made package, just run the following command:

    [root@gandalf:~]# upkg-remove gnome-baker


This will delete all installed files properly from your filesystem.