Howto merge and build a Debian package for Ultimedia GNU/Linux (outdated)

{3 Comments}

To merge and build packages from Debian you’ll need the Ultimedia dpkg-extension which provides some bare written functions:

Note: Ultimedia dpkg-extension was not intended to use in the community, it is a verry speacial script working on ultimedia/blade build systems.

  • Defines a maintainer profile and includes verry related developer settings
  • Defines a default dist profile and archive related settings to sync and upload and re/backup
  • Search thru the Ultimedia archive and package apt-cache
  • Parse debian/watch files (udeh)
  • Close bugs with dpkg_close
  • Sign *.changes files
  • Cleanup buildsources
  • Obtain build-deps inside the build folder with dpkg_deb
  • Execute debchange with whiptail powered gui
  • Download sources, resolve dependencies, extract source, build and sign with dpkg_apt_source
  • Maintain the Ultimedia archive
  1. Login and Build Process
  2. Little Helper commands
  • Package Development Server: 10.1.2.254
  • Package Development Path: /debian/source/[username]
  • Scripts: /etc/profile.d/
  1. Note: Since using sudo it is no more needed to obtain root rights by su, just login as user.
  2. Note: As user it is possible you are not able to access the lockfile database and you will get this message:

Error 13 creating lock file '/srv/www/apt/repodata/ultimedia/db/lockfile': Permission denied!
There have been errors!
If performing "dpkg_search" or "dpkg_apt_source" you can save ignore this message!

This Example converts/includes autogen-5.10 into the Ultimedia
GNU/Linux package repository and shows the usage of
/etc/profile.d/dpkg-extension.sh. For further informations about the
commands you can type “man dpkg-extension.sh”.

Login Process

  • Login as root on “Console A” and login as [user]
    on “Console B”.
  • Update APT Package Database (if updates required in the core
    packages, perform them first).
  • Core Packages always need to be builded before you
    build/synchronize a Debian Squeeze Package.

On Console A:

$ apt-get update

  • Search for the Source Package name (inside the Ultimedia and
    Debian Package Database)

On Console A:

$ dpkg_search libopts25

I: no packages found
I: source package is autogen

The output message means, that the Package is not available inside the Ultimedia Package Database and the Source Package name is autogen.

  • Download Source Package from Debian Package Server

On Console B:

$ dpkg_apt_source autogen no

Error 13 creating lock file '/srv/www/apt/repodata/ultimedia/db/lockfile': Permission denied!
There have been errors!
mkdir: created directory `/debian/source/markus/autogen'
Reading package lists... Done
Building dependency tree
Reading state information... Done
NOTICE: 'autogen' packaging is maintained in the 'Git' version control system at:

http://git.brad-smith.co.uk/git/debian/pkg-autogen.git

Need to get 1400 kB of source archives.
Get:1 http://ftp.de.debian.org/debian/ squeeze/main autogen 1:5.10-1.1 (dsc) [1884 B]
Get:2 http://ftp.de.debian.org/debian/ squeeze/main autogen 1:5.10-1.1 (tar) [1385 kB]
Get:3 http://ftp.de.debian.org/debian/ squeeze/main autogen 1:5.10-1.1 (diff) [12.9 kB]
Fetched 1400 kB in 1s (1115 kB/s)
Download complete and in download only mode
gpgv: keyblock resource `/home/markus/.gnupg/trustedkeys.gpg': file open error
gpgv: Signature made Sun Jan 31 00:26:53 2010 CET using RSA key ID 8313B5F0
gpgv: Can't check signature: public key not found
dpkg-source: warning: failed to verify signature on ./autogen_5.10-1.1.dsc
dpkg-source: info: extracting autogen in autogen-5.10
dpkg-source: info: unpacking autogen_5.10.orig.tar.gz
dpkg-source: info: applying autogen_5.10-1.1.diff.gz
dpkg-source: info: upstream files that have been modified:
autogen-5.10/autoopts/autoopts-config.in

Source: autogen
Version: 1:5.10-1.1
Distribution: unstable
Urgency: low
Maintainer: Kurt Roeckx <kurt@roeckx.be>
Date: Sat, 30 Jan 2010 20:13:56 +0100
Closes: 562607 562791
Changes:
autogen (1:5.10-1.1) unstable; urgency=low
.
* Non-maintainer upload.
* Set shlibs so that other packages get proper Depends (Closes: #562791)
* Don't let autoopts-config return an rpath. This is not useful on any
Debian system. (Closes: #562607)

The above command will create the directory “autogen” (if not exists) chdir inside autogen, downloads the Source Package from the Debian Servers, extracts it and chdir inside the extracted folder. The no switch at the end will disable the direct start of the build process as you not have incremented the Version number. The gpg error (gpgv: keyblock resource `/home/markus/.gnupg/trustedkeys.gpg’: file open error) indicates that there are public keys missing on the build system, note to install the debian-maintainers keyring or you’re unable to verrify the source package, which is not allowed in the Debian Policy.

Note: There exists an alias for dpkg-parsechangelog: cl.

  • Update, increment or add Ultimedia/blade version suffix to
    current version.

On Console B:

$ dch --newversion=1:5.10-1.1ultimedia1 Synchronized with Debian Source

Check the new version with:

$ cl

or

$ dpkg-parsechangelog

Source: autogen
Version: 1:5.10-1.1ultimedia1
Distribution: unstable
Urgency: low
Maintainer: Markus Niewerth <mniewerth@ultimediaos.com>
Date: Fri, 30 Mar 2012 01:18:31 +0200
Changes:
autogen (1:5.10-1.1ultimedia1) unstable; urgency=low
.
* Synchronized with Debian Source

Notes to dfsg versions:
(dch warning: no orig tarball found for the new version.)

If we have a version like this: ntp_4.2.6.p2+dfsg-1, we won’t increment the Debian Free Software Guidelines TAG, so we remove this TAG from the Ultimedia release.

On Console B:

$ dch --newversion=1:4.2.6.p2+ultimedia-1 Synchronized with Debian source
dch warning: your current directory has been renamed to:
../ntp-4.2.6.p2+ultimedia
dch warning: no orig tarball found for the new version.

This warning appears because the original Tarball matches not our current version. A directory listing shows the issue we currently dealing with.

$ l
total 4125
drwxr-xr-x 24 markus markus 1840 Mar 29 16:17 ntp-4.2.6.p2+ultimedia
-rw-r--r-- 1 markus markus 3793444 Jul 13 2010 ntp_4.2.6.p2+dfsg.orig.tar.gz
-rw-r--r-- 1 markus markus 415786 Jul 13 2010 ntp_4.2.6.p2+dfsg-1.debian.tar.gz

The easy way to create the original Tarball with the Ultimedia version TAG, is to rename the current
ntp_4.2.6.p2+dfsg.orig.tar.gz
to
ntp_4.2.6.p2+ultimedia.orig.tar.gz
.

$ mv ntp_4.2.6.p2+dfsg.orig.tar.gz ntp_4.2.6.p2+ultimedia.orig.tar.gz
$ cd ntp-4.2.6.p2+ultimedia/
...
($ dpkg_build)

  • The Control Files in folder: debian/.
    • Open the file debian/control with gedit as a user not as
      root and edit the following lines.

Source: autogen
Section: devel
Priority: optional
Maintainer: Bradley Smith <bradsmith@debian.org>
Build-Depends: debhelper (>= 7), autotools-dev, gperf, guile-1.8-dev, libxml2-dev, texinfo, texlive, texi2html, quilt
Standards-Version: 3.8.3
Homepage: http://www.gnu.org/software/autogen/
Vcs-Git: http://git.brad-smith.co.uk/git/debian/pkg-autogen.git
Vcs-Browser: http://git.brad-smith.co.uk/?p=debian/pkg-autogen.git

In this control file the developers used a Git repository. Remove the field Vcs-Git and replace with Vcs-Svn as we now only using SubVersion as VCS system. Change the field Maintainer and if used the Uploaders field. Move on with the next step: Create a subversion repository.

This fields should be updated:

  1. Maintainer
  2. Uploaders
  3. Vcs-Browser
  4. Vcs-Svn

Don’t forget to rename the Maintainer field respectivly into XSBC-Original-Maintainer according the Debian Derivate Guidlines (Census).

In the autogen example i’ve changed the following fields:

  1. Maintainer: Markus Niewerth <mniewerth@ultimediaos.com>
  2. XSBC-Original-Maintainer: Bradley Smith <bradsmith@debian.org>
  3. Vcs-Svn: http://svn.ultimediaos.com/svn/pkg-autogen/trunk/
  4. Vcs-Browser:

    http://svn.ultimediaos.com/wsvn/pkg-autogen/trunk/

See the Debian Developer Documentation for more infos about the
control files.

  • Create a logentry inside the debian/changelog file with:

$ dpkg_edit_cl

  • Create a close logentry inside debian/changelog file with:

$ dpkg_close [BUGID]

  • Create a Subversion Repository.

This step requires root access on the production server, if you are not an Admin of the Ultimedia Version Control Systems, you might request the creation of a repository and move on with: Create a Subversion Project.

  1. Login as root and do the following steps to create the source
    storage.

$ cd /srv/vcs/source/
$ mkdir pkg-autogen
$ cd pkg-autogen

  1. Create the SubVersion Repository with UltimediaSVN usvn.

$ usvn -c pkg-autogen

DBG: #981 svnadmin returns: 1
DBG: #867 ShellCMD: /usr/bin/svn import /tmp/vcs-tmp file:///srv/vcs/svn/pkg-autogen --message "Initial structure import."
DBG: #871 Current Working Directory: /srv/vcs/source/pkg-autogen
Adding /tmp/vcs-tmp/trunk
Adding /tmp/vcs-tmp/branches
Adding /tmp/vcs-tmp/tags

Committed revision 1.

$ usvn -ac pkg-autogen

I: Restarting webserver...
Syntax OK

Now you created the SubVersion repository and you are able to administer the repository structure. Im personally using Eclipse with Subversive SVN connectors, which makes an administration and working verry easy.

The URL to the new repository should be:
http://svn.ultimediaos.com/svn/pkg-autogen

You will need a Developer account to have access to the subversion project. Remove the old TTB structure inside the repository, (only if you have a MULTI PROJECT) with the following log message:

Deleting old obsolete project layout.

Create a new Project Structure inside the repository, for
instance autogen. (In our example it is not needed!) Use this log
message if you create a new project inside an existing subversion
repository.

Creating new project layout: pkg-autogen/my-project

Go back to edit the control files in Step: The Control Files in folder: debian/, and edit the following fields. This URLS may be used for Vcs-Browser and Vcs-Svn control fields:

Vcs-Svn: http://svn.ultimediaos.com/svn/pkg-autogen/trunk/
Vcs-Browser: http://svn.ultimediaos.com/wsvn/pkg-autogen/trunk/

  • Start the build process.

Now you could try a first build as user by using the following
command:

On Console A:

$ apt-get build-dep autogen

On Console B:

$ dpkg_build

Sign the package with your username/password and your certificate which was obtained from the Ultimedia Key Server. See the GPG2 section for more informations about the keyservers.

signfile autogen_5.10-1.1ultimedia1.dsc

You need a passphrase to unlock the secret key for
user: "Markus Niewerth <mniewerth@ultimediaos.com>"
1024-bit DSA key, ID C27C484F, created 2011-07-22

dpkg-genchanges >../autogen_5.10-1.1ultimedia1_i386.changes
dpkg-genchanges: not including original source code in upload
signfile autogen_5.10-1.1ultimedia1_i386.changes

You need a passphrase to unlock the secret key for
user: "Markus Niewerth <mniewerth@ultimediaos.com>"
1024-bit DSA key, ID C27C484F, created 2011-07-22

dpkg-source --after-build autogen-5.10
dpkg-buildpackage: binary and diff upload (original source NOT included)

Now the package was builded and you can cleanup the package and
build a TARBALL for the Subversion Repository.

On Console A:

$ dpkg_clean_source


$ cd .. $ tar cjf autogen-5.10.tar.bz2 autogen-5.10 $ scp
autogen-5.10.tar.bz2 root@ultimediaos.com:/srv/vcs/source/pkg-autogen/

Now extract the source on the package server and import the
source into the subversion repository.

$ cd /srv/vcs/source/pkg-autogen
$ tar xf autogen-5.10.tar.bz2
$ cd

On Console B:

$ svn import . http://svn.example.com/svn/pkg-autogen/trunk --message "Initial source import"

Adding ….

  • Maintainer Upload.

Now it is needed to publish the source and debian packages to
the Ultimedia package server.

On Console B:

$ mkdir build
$ mv autogen_*.{gz,dsc,changes} build
$ mv *.deb build
$ cd build
$ l

total 2542
-rw-r--r-- 1 markus markus 1385329 Nov 17 2009 autogen_5.10.orig.tar.gz
-rw-r--r-- 1 markus markus 13227 Mar 30 23:07 autogen_5.10-1.1ultimedia1.diff.gz
-rw-r--r-- 1 markus markus 1283 Mar 30 23:13 autogen_5.10-1.1ultimedia1.dsc
-rw-r--r-- 1 markus markus 2328 Mar 30 23:13 autogen_5.10-1.1ultimedia1_i386.changes
-rw-r--r-- 1 markus markus 1018232 Mar 30 23:11 autogen_5.10-1.1ultimedia1_i386.deb
-rw-r--r-- 1 markus markus 101348 Mar 30 23:11 libopts25-dev_5.10-1.1ultimedia1_i386.deb
-rw-r--r-- 1 markus markus 62718 Mar 30 23:11 libopts25_5.10-1.1ultimedia1_i386.deb

$ dpkg_include

autogen_5.10-1.1ultimedia1.dsc: component guessed as 'main'
I: changelog upload...
I: changelog uploaded to: /srv/www/apt/repodata/changelogs/pool/main/a/autogen/autogen_1:5.10-1.1ultimedia1/
Created directory "/srv/www/apt/repodata/ultimedia/pool/main/a/autogen"
Exporting indices...
Successfully created '/srv/www/apt/repodata/ultimedia/dists/blade/Release.gpg.new'
Successfully created '/srv/www/apt/repodata/ultimedia/dists/blade/InRelease.new'
Skipping inclusion of 'autogen' '1:5.10-1.1ultimedia1' in 'blade|main|source', as it has already '1:5.10-1.1ultimedia1'.
Exporting indices...
Successfully created '/srv/www/apt/repodata/ultimedia/dists/blade/Release.gpg.new'
Successfully created '/srv/www/apt/repodata/ultimedia/dists/blade/InRelease.new'

Now sync the local package and changelog repository with the
online repository. (root password required)

$ dpkg_sync

dpkg_sync: Variable setup ...
dpkg_sync: source_dir=/srv/www/apt/repodata/ultimedia/
dpkg_sync: destin_dir=upackage@10.1.2.254:/srv/www/vhosts/packages.ultimedia-box.de/httpdocs/ultimedia/
dpkg_sync: excludes=
dpkg_sync: rsync_params=-azv --progress --delete
dpkg_sync: Full command-line ...
/usr/bin/rsync -azv --progress --delete \
/srv/www/apt/repodata/ultimedia/ \
upackage@10.1.2.254:/srv/www/vhosts/packages.ultimedia-box.de/httpdocs/ultimedia/ \

Password:

Now the package is uploaded and the servers are in sync. You should now do a apt-get update on the Ultimedia system.

Little Helper commands:

  • SVN import (inconsistent newlines)

If you are troubled with a message on “svn import” like this:

svn: File 'html/drivers/driver44.html' has inconsistent newlines
svn: Inconsistent line ending style

The solution to this issue is dos2unix and the conversion of inconsitent files.

$ ultimedia # find my-project-folder -name "*" -type f | xargs dos2unix

  • Create a new debian/changelog file

The following command should be used to create a new debian/changelog file for an initial release. Note: the package example is uucp-1.07-20blade1

$ ultimedia:/src/uucp/uucp-1.07 # mv debian/changelog ../../~debian.changelog
$ ultimedia:/src/uucp/uucp-1.07 # dch --create --package=uucp --newversion=1.07-20blade1 --distribution=unstable Initial release.

Update a Non-Maintainer-Upload package

A Non-Maintainer-Upload version should be raised/updated this way:

Note: the package example is po-debconf (1.0.16+nmu1)

$ ultimedia:/src/po-debconf/po-debconf-1.0.16+nmu1] # mv debian/changelog ../../~debian.changelog
$ ultimedia:/src/po-debconf/po-debconf-1.0.16+nmu1] # dch --newversion=1.0.16+nmu2ultimedia1 \
                                                      --distribution=unstable Merged with Debian squeeze.

dch warning: your current directory has been renamed to:
../po-debconf-1.0.16+nmu2ultimedia1
dch warning: no orig tarball found for the new version.

$ ultimedia:/src/po-debconf/po-debconf-1.0.16+nmu2ultimedia1] # mv ../po-debconf_1.0.16+nmu1.tar.gz \
                                                                ../po-debconf_1.0.16+nmu2ultimedia1.tar.gz

3 Comments…

 Share your views
  1. Currently the dpkg-extension is updated … some of the above information is obsolete!

  2. nice site the text becomes a bit hard to read on your background after a while tho. jus a friendly suggestion =)

    • Ty for visiting my blog and your reflections. This post is also a little outdated and the scripts are not available to the public, this makes it even harder to undertand what im doing there… :)

Leave a Comment