From Paldo

Jump to: navigation, search


[edit] Come costruire un pacchetto usando upkg (gestore pacchetti Paldo)

Scritto da Paolo Stivanin nel dicembre 2008

[edit] Astratto

Questo howto dovrebbe aiutarti a ottenre un pacchetto sorgenti costruito usando upkg. Upkg รจ il gestore pacchetti e il tool che si usa per pacchettizzare su Paldo Linux distribution.

[edit] 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.

[edit] 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"?>

[edit] 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 . 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]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">

[edit] 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 filename (and therefore the package name) should fit the following rules:

  • use the pkg-config name if available
  • for packages without a pkg-config file use the source tarball name (at least if there is no clear reason to use a different name)

Often you can find a pkg-config file in the source directory (also check subdirs) of the source package. Such a pkg-config file is called For example However gnome-baker does not provide such a file. Therefore I use the name of the source tarball and call the file 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>
        <release version="0.5.0" revision="1" branch="testing">
                <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"/>
                    <archive name="gnome-baker-$VERSION">
                        <cmd>./configure --prefix=/usr \
                             --infodir=/usr/share/info \
                             --mandir=/usr/share/man \
                        <cmd>make -j 2</cmd>
                        <cmd>make install</cmd>

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:

  • Read or in the source distribution. You will probably find something like: PKG_CHECK_MODULES(GNOME, libgnomeui-2.0 gtk+-2.0 >= 2.4.0 glib-2.0 >= 2.4.0 libglade-2.0 gstreamer-0.8,,exit) in this case it's probably easy to find the needed packages. Just use the libraries that are listed in the PKG_CHECK_MODULES-list. In most cases Paldo uses exactly these names. For example libgnomeui-2.0 is also called libgnomeui-2.0 in the paldo repository. However use to get the right name.
  • Check the README, INSTALL,... files in the source distribution. Some projects list the dependencies in one of these files.
  • Copy from an other distribution. If nothing helps, you can still take alook at what other distributions list as dependencies.

Here is a somewhat unofficial list of build essentials:

  • glibc
  • gcc
  • binutils
  • make
  • coreutils
  • bzip2
  • gzip
  • patch
  • tar
  • bash

You don't need to mention this dependencies because those packages are installed on every paldo installation.

[edit] How Paldo handles branches

Paldo knows four different branches:

  • experimental
  • unstable
  • testing
  • stable

They have the following meaning/purpose:

[edit] experimental

This is the place for bleeding edge tools,libs,... which will probably break some stuff. This could for example be a svn,git.. snapshot of a tool,lib,...

[edit] unstable

More tested but still not as "stable" released software gets placed here. For example a beta version of a tool,lib,... could be added to unstable.

[edit] testing

If a tool,lib,... gets released as "stable" by the developers, we put it into the testing branch.

[edit] stable

All tools,libs,... from testing are moved to stable when a new paldo stable version gets released

You can use arbitrary branches in principle, they are just considered even more unstable than experimental.

If you add a package to your testing branch, it will also be available in the "higher" branches ("unstable" & "experimental" in this case). Therefore you don't need to add a <release>...</release> for every branch. Just add one for the "lowest" branch.

[edit] 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:

    The following packages will be built from source:

    Do you want to continue? [Y/n]
    Building gnome-baker-0.5.0-1 (testing)...

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.

[edit] 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

[edit] 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.

[edit] Tips / tricks

  • In some cases errors of specific commands are not fatal to the package build and should be ignored. In such situations you can use <cmd check="no">...</cmd> which will ensure, that upkg won't stop if one of the commands fail.

[edit] Spec-Template

  <?xml version="1.0"?>
  <package name="PACKAGE NAME">
  	<description>PACKAGE DESCRIPTION</description>
  		<release version="RLS VERSIONS NUMBER" revision="1" branch="testing">  
  				<dep name="DEPENDENCY NAME"/>
  				<dep name="DEPENDENCY NAME"/>
  					<archive name="PACKAGE NAME-$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>

[edit] Spec gen

kim88 wrote us a spec gen. This speeds it up:

Personal tools