Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Debian Packages Debian packaging tutorial Amaya Rodrigo, Soissons Feb 2007.

Similar presentations


Presentation on theme: "Building Debian Packages Debian packaging tutorial Amaya Rodrigo, Soissons Feb 2007."— Presentation transcript:

1 Building Debian Packages Debian packaging tutorial Amaya Rodrigo, Soissons Feb 2007

2 What is Distribution? ● Kernel ● Installer ● Package manager Why is Debian different? ● Free ● Volunteer, not comercial ● High quality standards

3 Packaging for Debian ● You don't need to be a Developer ● You don't need a Debian Tattoo ● You don't need to include your packages in Debian... But if you do... ● Think of packaging as a journey ● Learn as you go ● Don't be afraid to ask

4 Debian Policy ● Documents the quality standards ● Describes packaging procedures to obtain this quality ● Works best with the Developer's Reference ● Is the reason why Debian works so well ● Comes from common usage and consensus ● If there is disagreement, there is a Technical Committee to help decide

5 FHS: Filesystem Hierarchy Standard ● Describes directories in the system ● Describe where files should live ● Helps vendors ensure their (propietary) solutions will work in any Distribution ● Helps System Administrators find their way around any system ● Packagers must know and follow these guidelines

6 Linux Standard Base ● Interoperability between applications and the Linux operating system. ● Includes the FHS, but goes further ● Tests are provided ● Certification for distributions ● Debian complies with the LSB

7 Why packages? ● Make it easy to install software ● Precompiled, configured, free license ● Dependencies, upgrades, security ● Make it easy to uninstall software ● Know which packages own each file ● All software works together

8 Choosing your package ● The license is free according to DFSG – GPL – BSD – Artistic... ● You use it, know it and like it ● You know “a bit” the programming language ● You intend to work with upstream

9 Overview ● ITP: Announce your Intent To Package ● Check "WNPP" for existing ITPs ● Fetch and unpack ● Check license ● Add Debian specific changes ● Build Debian source package ● Build Debian binary package(s) ● Test and fix and repeat until done – Install & Remove – Upgrade

10 Helpful Tools ● devscripts – Scripts to make the life of a Debian Package easier ● fakeroot – Gives a fake root environnment ● dpkg-dev – Package building tools for Debian ● dh-make – tool that converts source archives into Debian package source

11 Our environment /home/user/.bash_profile /home/user/.bashrc EMAIL="Debian User " DEBFULLNAME="The Happy Debian user" DEBEMAIL="debian@user.net" DEBSIGN_KEYID="3FCC2A90"

12 Download the tarball http://www.sukria.net/fr/libreast/hello-1.0.tar.gz $ hello hello world!

13

14 Rename the tarball $ mv hello-1.0.tar.gz hello_1.0.orig.tar.gz Make the basic structure: $ tar -zxvf hello_1.0.orig.tar.gz $ cd hello-1.0/ $ dh_make Answer the questions

15 dh_make Maintainer name : Debian User Email-Address : debian@user.net Date : Fri, 22 Apr 2005 16:55:23 +0200 Package Name : hello Version : 1.0 License : blank Type of Package : Single Hit to confirm:

16 dh_make environment Values for «Maintainer name» and «Email-Address» are taken from environment variables: – DEBFULLNAME – DEBEMAIL

17 dh_make options ● dh_make options ✔ -n, --native ✔ -c, --copyright : gpl, lgpl, artistic or bsd ✔ -e, --email ✔ -l, --library ✔ -s, --single ✔ -m, --multi ✔ -k, --kmod

18 The result Debian packaging files in debian/ – changelog – control – copyright – rules – Sometimes more files as well Sometimes also changes to upstream source – Bug fixes, configuration, etc

19 Celaning the structure ● Before editing the package key files, we clean to see better what we are doing ● The created structure has plenty of example files with the extension.ex or.EX ● We don't need them all, so let's clean it up!

20 debian/control Source: hello Section: unknown Priority: optional Maintainer: Debian User Build-Depends: debhelper (>= 5.0.0) Standards-Version: 3.7.2 Package: hello Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description:

21 debian/changelog hello (1.0-1) unstable; urgency=low * Initial Release (Closes: #1234). -- Debian User Fri, 22 Apr 2005 21:18:11 +0200

22 debchange ● To make our life easier, we can use dch (Debian Changelog) : – --increment, -i – --append, -a

23 debian/compat 5 ● Only contains one single character ● Describing the compatibility mode for the debhelper tools we are using

24 debian/copyright ● Legal stuff regarding our package This package was debianized by Debian User on Fri, 22 Apr 2005 17:03:01 +0200. It was downloaded from http://www.sukria.net/confs/libreast_2005/hello-1.0.tar.gz Copyright Holder: This software is copyleft (C) 2005 Alexis Sukrieh. License: This program is released under the terms of the GPL licence. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

25 debian/dirs Using the debhelper script dh_installdirs, we create the directories needed to install our software. It can be removed. $ rm -f debian/dirs

26 debian/docs We can list all the documentation files we want to include in our package.

27 debian/rules This is the file that really builds the package ● Makefile format ● Describes targets (stages of the package creation)

28 debian/rules ● build: compile the program ● binary: create binary package – Install program under debian/tmp – Install packaging meta data into ● debian/tmp/DEBIAN ● clean: clean up afterwards

29 debian/rules #!/usr/bin/make ­f build: $(MAKE) CFLAGS=­O2 LDFLAGS=­s clean: $(MAKE) clean rm -rf debian/files debian/substvars debian/tmp binary: binary­arch binary­indep binary­indep:

30 debian/rules install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package $(MAKE) install DESTDIR=$(CURDIR)/debian/hello

31 Building ● Run debian/rules by hand until all is correct ● dpkg­buildpackage ­us ­uc ­rfakeroot – Does a full "real" package build (without signing) – Also builds source package ● sudo pbuilder build foo_1.0­1.dsc – Does full real build in "chroot" to check for build dependencies; still unsigned (advanced stuff)

32 Build results hello_1.0.orig.tar.gz Manually renamed from original, not really built foo_1.0­1.diff.gz foo_1.0­1.dsc foo_1.0­1_i386.changes foo_1.0­1_i386.deb

33 Test the package Automatic checks for some common problems ● lintian *.changes ● linda *.changes Installation tests: ● Install on fresh system, remove ● Upgrade from earlier version – piuparts does this (advanced) Use the package yourself

34 You are not alone ● Debian-Edu French Mailing List: – debian-edu-fr@lists.debian.org debian-edu-fr@lists.debian.org – Coordination ● French Developer Mailing List: – debian-devel-french@lists.debian.org debian-devel-french@lists.debian.org – Packaging questions ● irc.debian.org: #skolelinux.fr

35 Suggested Reading ● Debian Packaging School http://liw.iki.fi/liw/talks/debian- packaging-tutorial.pdfhttp://liw.iki.fi/liw/talks/debian- packaging-tutorial.pdf ● Debian New Maintainer's Guide http://www.debian.org/doc/maint-guide/ http://www.debian.org/doc/maint-guide/ ● Debian Developer's Reference http://www.debian.org/doc/manuals/developers-reference/ http://www.debian.org/doc/manuals/developers-reference/ ● Debian Policy Manual http://www.debian.org/doc/debian- policy/ http://www.debian.org/doc/debian- policy/


Download ppt "Building Debian Packages Debian packaging tutorial Amaya Rodrigo, Soissons Feb 2007."

Similar presentations


Ads by Google