continued.
[packaging-tutorial.git] / packaging-tutorial.tex
1 \documentclass[10pt,final]{beamer}
2 \mode<presentation>
3 \usetheme{lucasdeb}
4 \usepackage{wasysym}
5 \definecolor{darkgreen}{rgb}{0,.7,0}
6 \definecolor{darkred}{rgb}{.7,0,0}
7 \newcommand{\Smiley}{{\color{darkgreen}\smiley}}
8 \newcommand{\Frownie}{{\color{darkred}\frownie}}
9 \usepackage[utf8]{inputenc}
10 \usepackage{helvet}
11 \usepackage[OT1]{fontenc}
12 \usepackage{xspace}
13 \usepackage{verbatim}
14 \usepackage{comment}
15 \usepackage{tabularx}
16 \usepackage{listings}
17 \lstset{basicstyle=\ttfamily}
18 \beamertemplatetransparentcovereddynamic
19 \setbeamercovered{invisible}
20 \newcommand{\br}{\vskip 1em}
21 \newcommand{\hbr}{\vskip 0.5em}
22 \newcommand{\hhbr}{\vskip 0.25em}
23 \newcommand{\Arr}{\textbf{$\Rightarrow$}\xspace}
24 \newcommand{\arr}{\textbf{$\rightarrow$}\xspace}
25 \newcommand{\fixme}[1]{ {\color{red}\footnotesize\bf #1}}
26 \usepackage{listings}
27 \usepackage{tikz}
28 \usepackage{pgfplots}
29 \usetikzlibrary{dateplot}
30
31 \renewcommand{\ttdefault}{aett}
32 \usepackage{aecompl}
33
34 \newcommand{\pedp}{\NoAutoSpaceBeforeFDP}
35
36 \usebackgroundtemplate{\includegraphics[width=\paperwidth]{figs/dslide8.pdf}}
37 \logo{\includegraphics[viewport=274 335 360 440,width=0.5cm]{figs/openlogo-nd.pdf}}
38 \hypersetup{pdftitle={An Introduction to Debian Packaging},bookmarks}
39 \title{An Introduction to Debian Packaging}
40 \author[]{Lucas Nussbaum\\{\small\texttt{lucas@debian.org}}}
41 \institute{\includegraphics[viewport=274 335 360 440,width=1cm]{figs/openlogo-nd.pdf}}
42 \date{}
43
44 \newcommand{\nospace}[1]{{\NoAutoSpaceBeforeFDP{}#1}}%
45
46 \AtBeginSection[]
47 {
48   \begin{frame}
49     \frametitle{Outline}
50     \tableofcontents[hideothersubsections]
51   \end{frame}
52 }
53
54 \begin{document}
55
56 \frame{\titlepage}
57
58 \section{Introduction}
59 \subsection{Legal stuff}
60 \begin{frame}
61 \frametitle{Legal stuff}
62
63 Copyright \copyright 2011 Lucas Nussbaum -- lucas@debian.org
64 \br
65
66 {\small 
67 \textbf{This document is free software}: you can redistribute it and/or modify
68 it under either (at your option):
69 \hbr
70 \begin{itemize}
71 \item The terms of the GNU General Public License as published by
72     the Free Software Foundation, either version 3 of the License, or
73     (at your option) any later version.\\
74     \url{http://www.gnu.org/licenses/gpl.html}
75     \br
76 \item The terms of the Creative Commons Attribution-ShareAlike 3.0 Unported License.\\
77         \url{http://creativecommons.org/licenses/by-sa/3.0/}
78 \end{itemize}
79 }
80 \end{frame}
81
82 \subsection{About this tutorial}
83 \begin{frame}{About this tutorial}
84 \begin{itemize}
85 \item Goal: tell you what you really need to know about Debian packaging
86         \br
87 \item Tries to keep a reasonable size
88         \begin{itemize}
89         \hbr
90                 \item No attempt to be complete
91                         \hbr
92                 \item You might need to read more documentation
93         \end{itemize}
94 \end{itemize}
95 \vfill
96 \begin{itemize}
97 \item Latest version:\\
98 \url{http://git.debian.org/?p=users/lucas/packaging-tutorial.git}
99         \br
100 \item Contribute:\\
101         \texttt{git clone git://git.debian.org/\~{}lucas/packaging-tutorial.git}
102         \br
103 \item Feedback: \href{mailto:lucas@debian.org}{\textbf{\texttt{lucas@debian.org}}}
104 \end{itemize}
105 \end{frame}
106
107 \subsection{The Deb package format}
108 \begin{frame}[fragile]
109         \frametitle{Introduction: the Deb package format}
110 \begin{itemize}
111         \item One of the two most common packages format (with RPM)
112         \item Used by Debian and its derivatives (including Ubuntu)
113         \item A very powerful and convenient way to distribute software to users
114         \item \texttt{.deb} file: an \texttt{ar} archive
115 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
116 $ ar tv wget_1.12-2.1_i386.deb
117 rw-r--r-- 0/0      4 Sep  5 15:43 2010 debian-binary
118 rw-r--r-- 0/0   2403 Sep  5 15:43 2010 control.tar.gz
119 rw-r--r-- 0/0 751613 Sep  5 15:43 2010 data.tar.gz
120 \end{lstlisting}
121 \begin{itemize}
122         \item \texttt{debian-binary}: version of the deb file format, \texttt{"2.0\textbackslash{}n"}
123         \item \texttt{control.tar.gz}: metadata about the package\\
124                 {\small \texttt{\textbf{control}, md5sums, (pre|post)(rm|inst), triggers, shlibs}, \ldots}
125         \item \texttt{data.tar.gz}: data files of the package
126 \end{itemize}
127 \item You could create your \texttt{.deb} files manually\\
128         {\footnotesize \url{http://tldp.org/HOWTO/html\_single/Debian-Binary-Package-Building-HOWTO/}}
129 \item But most people don't do it that way
130 \end{itemize}
131 \hbr
132 \centerline{\textbf{This tutorial: create Debian packages, the Debian way}}
133 \end{frame}
134
135 \subsection{Tools you will need}
136 \begin{frame}{Tools you will need}
137         \begin{itemize}
138                 \item A Debian (or Ubuntu) system
139                         \br
140                 \item Some packages:
141         \begin{itemize}
142                 \item \textbf{build-essential}: has dependencies on the packages that will be assumed to be available on the developers' machine (no need to specify them in the \texttt{Build-Depends:} control field of your package)
143                 \begin{itemize}
144                         \item includes a dependency on \textbf{dpkg-dev}, which contains basic Debian-specific tools to create packages
145                 \end{itemize}
146                 \hbr
147         \item \textbf{devscripts}: contains many useful scripts for Debian maintainers
148                 \hbr
149         \item \textbf{lintian}: package checker (static analyzer)
150         \end{itemize}
151         \end{itemize}
152
153         \br
154         Many other tools will also be mentioned later, such as \textbf{debhelper}, \textbf{cdbs}, \textbf{quilt}, \textbf{pbuilder}, \textbf{sbuild}, \textbf{svn-buildpackage}, \textbf{git-buildpackage}, \ldots
155 \end{frame}
156
157 \subsection{General packaging workflow}
158 \begin{frame}{General packaging workflow}
159 \begin{center}
160 \begin{tikzpicture}[
161         node1/.style={shape=rectangle,draw=rouge,fill=debianbackgroundblue,thick},
162         arr/.style={very thick},
163         command/.style={text=rouge,font=\ttfamily},
164 ]
165         \node[node1] (us) at (1.5, 0) {upstream source};
166         \node[node1] (da) at (-1.5, 0) {Debian mirror};
167         \node[node1] (sp) at (0, -2) {source package};
168         \draw[arr,<-,dashed] (sp) -- (2.5,-2) node[right=0cm,text width=2.98cm,text centered,font=\small] {where most of the manual work is done};
169         \node[node1] (b1) at (-1.5, -4) {binary package};
170         \node[node1] (b2) at (1.5, -4) {binary package};
171         \draw[arr,<-,dashed] (b2) -- (3.5,-4) node[right,text centered,font=\ttfamily] {.deb\normalfont};
172         \draw[arr,->] (us) -- (sp) node[pos=0.5,right,command] {dh\_make};
173         \draw[arr,->] (da) -- (sp) node[pos=0.5,left,command] {apt-get source};
174         \draw[arr,->] (sp) -- (b1);
175         \draw[arr,->] (sp) -- (b2) node[pos=0.5,right] {\texttt{\color{rouge}debuild} (build and test with \texttt{\color{rouge}lintian})};
176         \draw[arr,->] (0,-4.5) -- (-1,-6) node[pos=0.5,left] {install (\texttt{\color{rouge}debi})};
177         \draw[arr,->] (0,-4.5) -- (1,-6) node[pos=0.5,right] {upload (\texttt{\color{rouge}dput})};
178         \useasboundingbox (-4,-6) rectangle (6,0); % hack hack hack
179 \end{tikzpicture}
180 \end{center}
181 \end{frame}
182
183 \section{Creating source packages}
184 \subsection{Source packages basics}
185 \begin{frame}
186 \frametitle{Source package}
187 \begin{itemize}
188         \item One source package can generate several binary packages\\
189                 {\small e.g the \texttt{\bfseries libtar} source generates the \texttt{\bfseries libtar} and \texttt{\bfseries libtar-dev} binary packages}
190                 \hbr
191         \item Two kinds of packages: (if unsure, use non-native)
192                 \begin{itemize}
193                                 \small
194                         \item Native packages: software developed inside Debian (\textsl{dpkg}, \textsl{apt})
195                         \item Non-native packages: software developed outside Debian
196                 \end{itemize}
197                 \hbr
198         \item Main file: \texttt{.dsc} (metadata)
199                 \hbr
200         \item Other files depending on the source format version
201         \begin{itemize}
202                 \item 1.0 -- native: \texttt{package\_version.tar.gz}
203                 \hbr
204                 \item 1.0 -- non-native:
205                 \begin{itemize}
206                         \item \texttt{pkg\_ver.orig.tar.gz} : upstream source
207                         \item \texttt{pkg\_debver.diff.gz} : patch to add Debian-specific changes
208                 \end{itemize}
209                 \hbr
210                 \item 3.0 (quilt) -- also non-native, more recent:
211                 \begin{itemize}
212                         \item \texttt{pkg\_ver.orig.tar.gz} : upstream source
213                         \item \texttt{pkg\_debver.debian.tar.gz} : tarball with the Debian changes
214                 \end{itemize}
215         \end{itemize}
216 \end{itemize}
217 \br
218 (See \texttt{dpkg-source(1)} for exact details)
219 \end{frame}
220
221 \begin{frame}[fragile]
222         \frametitle{Source package example (wget\_1.12-2.1.dsc)}
223 \begin{lstlisting}[basicstyle=\ttfamily\small]
224 Format: 3.0 (quilt)
225 Source: wget
226 Binary: wget
227 Architecture: any
228 Version: 1.12-2.1
229 Maintainer: Noel Kothe <noel@debian.org>
230 Homepage: http://www.gnu.org/software/wget/
231 Standards-Version: 3.8.4
232 Build-Depends: debhelper (>> 5.0.0), gettext, texinfo, libssl-dev (>= 0.9.8), dpatch, info2man
233 Checksums-Sha1: 
234  50d4ed2441e67db7aa5061d8a4dde41ee0e94248 2464747 wget_1.12.orig.tar.gz
235  d4c1c8bbe431d6131cbd7ed2e4fc37dd7cef3611 48308 wget_1.12-2.1.debian.tar.gz
236 Checksums-Sha256: 
237  7578ed0974e12caa71120581fa3962ee5a69f7175ddc3d6a6db0ecdcba65b572 2464747 wget_1.12.orig.tar.gz
238  1e9b0c4c00eae6b4172baae219a14857f4002382b9d7a289de7ab789c402ad78 48308 wget_1.12-2.1.debian.tar.gz
239 Files: 
240  141461b9c04e454dc8933c9d1f2abf83 2464747 wget_1.12.orig.tar.gz
241  e93123c934e3c141916f472f380278c2 48308 wget_1.12-2.1.debian.tar.gz
242 \end{lstlisting}
243 \end{frame}
244
245 \subsection{Retrieving source packages}
246 \begin{frame}
247 \frametitle{Retrieving an existing source package}
248 \begin{itemize}
249 \item From the Debian archive:
250         \begin{itemize}
251                 \item \texttt{apt-get source \textsl{package}}
252                 \item \texttt{apt-get source \textsl{package=version}}
253                 \item \texttt{apt-get source \textsl{package/release}}
254         \end{itemize}
255         (You need \texttt{deb-src} lines in \texttt{sources.list})
256         \br
257 \item From the Internet:
258         \begin{itemize}
259                 \item \texttt{dget \textsl{url-to.dsc}}
260                 \item \texttt{dget http://snapshot.debian.org/archive/debian-archive/\\20090802T004153Z/debian/dists/bo/main/source/web/\\wget\_1.4.4-6.dsc}\\
261                         (\href{http://snapshot.debian.org/}{\ttfamily snapshot.d.o} provides all packages from Debian since 2005)
262         \end{itemize}
263 \br
264 \item Once downloaded, extract with \texttt{dpkg-source -x \textsl{file.dsc}}
265 \end{itemize}
266 \end{frame}
267
268 \subsection{Creating a basic source package}
269 \begin{frame}
270 \frametitle{Creating a basic source package}
271 \begin{itemize}
272         \item Download the upstream source
273                 \hbr
274         \item Rename to \texttt{\textsl{source\_package}\_\textsl{upstream\_version}.orig.tar.gz}
275                 \hbr
276         \item Untar it
277                 \hbr
278         \item \texttt{cd \textsl{upstream\_source} \&\& dh\_make} (from the \textbf{dh-make} package)
279                 \hbr
280         \item There are some alternatives to \texttt{dh\_make} for specific sets of packages: \textbf{dh-make-perl}, \textbf{dh-make-php}, \ldots
281                 \hbr
282         \item \texttt{debian/} directory created, with a lot of files in it
283 \end{itemize}
284 \end{frame}
285
286 \subsection{Files in debian/}
287 \begin{frame}{Files in debian/}
288         All the packaging work should usually be made by modifying files in \texttt{debian/}
289 \hbr
290 \begin{itemize}
291         \item Main files:
292         \begin{itemize}
293                 \item changelog
294                 \item copyright
295                 \item control
296                 \item rules
297         \end{itemize}
298         \hbr
299         \item Optional files:
300         \begin{itemize}
301                 \item compat
302                 \item watch
303                 \item dh\_install* targets\\
304                         {\small *.dirs, *.docs, *.manpages, \ldots}
305                 \item maintainer scripts\\
306                         {\small *.postinst, *.prerm, \ldots}
307                 \item source/format
308                 \item patches
309         \end{itemize}
310 \end{itemize}
311 \end{frame}
312
313 \begin{frame}[fragile]{debian/changelog}
314         \begin{itemize}
315                 \item Lists the Debian packaging changes
316                 \item Edited manually or with \texttt{dch}
317                 \item Special format to automatically close Debian or Ubuntu bugs\\
318                         Debian: \texttt{Closes:~\#595268} ; Ubuntu: \texttt{LP:~\#616929}
319                 \item Installed as \texttt{/usr/share/doc/\textit{package}/changelog.Debian.gz} in your package
320         \end{itemize}
321 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
322 mpich2 (1.2.1.1-5) unstable; urgency=low
323
324   * Use /usr/bin/python instead of /usr/bin/python2.5. Allow
325     to drop dependency on python2.5.  Closes: #595268
326   * Make /usr/bin/mpdroot setuid. This is the default after
327     the installation of mpich2 from source, too. LP: #616929
328     + Add corresponding lintian override.
329
330  -- Lucas Nussbaum <lucas@debian.org>  Wed, 15 Sep 2010 18:13:44 +0200
331 \end{lstlisting}
332 \end{frame}
333
334 \begin{frame}[fragile]{debian/copyright}
335         \hbr
336         \begin{itemize}
337                 \item Copyright and license information for the source and the packaging
338                 \item Traditionally written as a text file
339                 \item New machine-readable format: \url{http://dep.debian.net/deps/dep5/}
340         \end{itemize}
341 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
342 Format: <VERSIONED_FORMAT_URL>
343 Upstream-Name: X Solitaire
344 Source: ftp://ftp.example.com/pub/games
345
346 Files: *
347 Copyright: Copyright 1998 John Doe <jdoe@example.com>
348 License: GPL-2+
349  This program is free software; you can redistribute it
350  [...]
351  .
352  On Debian systems, the full text of the GNU General Public
353  License version 2 can be found in the file
354  `/usr/share/common-licenses/GPL-2'.
355
356 Files: debian/*
357 Copyright: Copyright 1998 Jane Smith <jsmith@example.net>
358 License:
359  [LICENSE TEXT]
360 \end{lstlisting}
361 \end{frame}
362
363 \begin{frame}[fragile]{debian/control}
364         \hbr
365         \begin{itemize}
366                 \item Package metadata
367                         \begin{itemize}
368                                 \item For the source package itself
369                                 \item For each binary package built from this source
370                         \end{itemize}
371                         \hbr
372                 \item Package name, section, priority, maintainer, uploaders, build-dependencies, dependencies, description, homepage, \ldots
373                         \hbr
374                 \item Documentation: Debian Policy chapter 5\\
375                         \url{http://www.debian.org/doc/debian-policy/ch-controlfields.html}
376         \end{itemize}
377 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
378 Source: wget
379 Section: web
380 Priority: important
381 Maintainer: Noel Kothe <noel@debian.org>
382 Build-Depends: debhelper (>> 5.0.0), gettext, texinfo,
383  libssl-dev (>= 0.9.8), dpatch, info2man
384 Standards-Version: 3.8.4
385 Homepage: http://www.gnu.org/software/wget/
386
387 Package: wget
388 Architecture: any
389 Depends: ${shlibs:Depends}, ${misc:Depends}
390 Description: retrieves files from the web
391  Wget is a network utility to retrieve files from the Web
392 \end{lstlisting}
393 \end{frame}
394
395 \begin{frame}{Architecture: all or any}
396 Two kinds of binary packages:
397 \hbr
398 \begin{itemize}
399         \item Packages with a different content on each Debian architecture
400         \begin{itemize}
401         \item Example: C program
402         \item \texttt{Architecture:\ any} in \texttt{debian/control}
403                 \begin{itemize}
404                         \item Or, if it only works on a subset of architectures:\\
405                                 \texttt{Architecture:\ amd64 i386 ia64 hurd-i386}
406                 \end{itemize}
407         \item Packages for other architectures built by the Debian infrastructure
408         \item Named \texttt{\textsl{package}\_\textsl{version}\_\textsl{architecture}.deb}
409         \end{itemize}
410 \br
411         \item Packages with the same content on all architectures
412         \begin{itemize}
413         \item Example: Perl library
414         \item \texttt{Architecture:\ all} in \texttt{debian/control}
415         \item Named \texttt{\textsl{package}\_\textsl{version}\_\textbf{all}.deb}
416 \end{itemize}
417 \end{itemize}
418 \end{frame}
419
420 \begin{frame}[fragile]{debian/rules}
421         \hbr
422         \begin{itemize}
423                 \item Makefile
424                         \br
425                 \item Interface used to build Debian packages
426                         \br
427                 \item Documented in Debian Policy, chapter 4.8\\
428                         {\small \texttt{http://www.debian.org/doc/debian-policy/ch-source.html\#s-debianrules}}
429                         \br
430                 \item Five required targets:
431                 \begin{itemize}
432                         \item \texttt{build}: should perform all the configuration and compilation of the package
433                                 \hbr
434                         \item \texttt{binary, binary-arch, binary-indep}: build the binary packages produced by this source package
435                                 \begin{itemize}
436                                         \item \texttt{dpkg-buildpackage} will call \texttt{binary} to build all the packages, or \texttt{binary-arch} to build only the \texttt{Architecture:~any} packages
437                                 \end{itemize}
438                                 \hbr
439                         \item \texttt{clean}: clean up the source directory
440                 \end{itemize}
441         \end{itemize}
442 \end{frame}
443
444 \subsection{Packaging helpers}
445 \begin{frame}{Packaging helpers -- debhelper}
446 \begin{itemize}
447         \item You could write shell code in \texttt{debian/rules} directly
448         \begin{itemize}
449                 \item See the \texttt{adduser} package for example
450         \end{itemize}
451         \hbr
452         \item But most packages in Debian use a \textsl{Packaging helper}
453         \hbr
454         \item Most popular one: \textbf{debhelper} (used by 98\% of packages)
455         \hbr
456         \item Goal: factor the common tasks in external tools used by all packages\\
457                 {\footnotesize dh\_installdirs, dh\_installchangelogs, dh\_installdocs, dh\_installexamples, dh\_install, dh\_installdebconf, dh\_installinit, dh\_link, dh\_strip, dh\_compress, dh\_fixperms, dh\_perl, dh\_makeshlibs, dh\_installdeb, dh\_shlibdeps, dh\_gencontrol, dh\_md5sums, dh\_builddeb, \ldots}
458                 \begin{itemize}
459                         \item Called from \texttt{debian/rules}
460                         \item Behaviour changed using command parameters or files in \texttt{debian/}\\
461                                 {\footnotesize \ttfamily dirs, package.docs, package.examples, package.install, package.menu, package.logrotate, package.manpages, \ldots}
462                 \end{itemize}
463         \hbr
464 \item Third-party helpers for sets of packages: \textbf{python-support}, \textbf{dh\_ocaml}, \ldots
465         \hbr
466 \item Gotcha: \texttt{debian/compat}: Debhelper compatibility version (use "7")
467 \end{itemize}
468 \end{frame}
469
470 \begin{frame}[fragile]{debian/rules using debhelper (1/2)}
471 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
472 #!/usr/bin/make -f
473
474 # Uncomment this to turn on verbose mode.
475 #export DH_VERBOSE=1
476
477 build: 
478         $(MAKE)
479         #docbook-to-man debian/packagename.sgml > packagename.1
480
481 clean: 
482         dh_testdir
483         dh_testroot
484         rm -f build-stamp configure-stamp
485         $(MAKE) clean
486         dh_clean 
487
488 install: build
489         dh_testdir
490         dh_testroot
491         dh_clean -k 
492         dh_installdirs
493         # Add here commands to install the package into debian/packagename.
494         $(MAKE) DESTDIR=$(CURDIR)/debian/packagename install
495 \end{lstlisting}
496 \end{frame}
497
498 \begin{frame}[fragile]{debian/rules using debhelper (2/2)}
499 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
500
501 # Build architecture-independent files here.
502 binary-indep: build install
503
504 # Build architecture-dependent files here.
505 binary-arch: build install
506         dh_testdir
507         dh_testroot
508         dh_installchangelogs 
509         dh_installdocs
510         dh_installexamples
511 #       dh_install
512         dh_installman
513         dh_link
514         dh_strip
515         dh_compress
516         dh_fixperms
517         dh_installdeb
518         dh_shlibdeps
519         dh_gencontrol
520         dh_md5sums
521         dh_builddeb
522
523 binary: binary-indep binary-arch
524 .PHONY: build clean binary-indep binary-arch binary install configure
525 \end{lstlisting}
526 \end{frame}
527
528 \begin{frame}[fragile]{CDBS}
529 \hbr
530 \begin{itemize}
531 \item Still a lot of redundancy between packages
532 \hbr
533 \item Second-level helpers that factor what packages typically require
534         \begin{itemize}
535         \item Building with \texttt{./configure \&\& make \&\& make install}, CMake
536         \item Support for Perl, Python, Ruby, GNOME, KDE, Java, Haskell, \ldots
537         \end{itemize}
538 \hbr
539 \item CDBS:
540         \begin{itemize}
541                 \item Introduced in 2005, based on advanced \textsl{GNU make} magic
542                 \item Documentation: \texttt{/usr/share/doc/cdbs/}
543                 \item But some people hate it:
544                         \begin{itemize}
545                                 \item Sometimes difficult to customize package builds:\\
546                                 "\textsl{twisty maze of makefiles, environment vars and black magic}"
547                                 \item Slower than plain debhelper (many useless calls to dh\_*)
548                         \end{itemize}
549 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
550 #!/usr/bin/make -f
551 include /usr/share/cdbs/1/rules/debhelper.mk
552 include /usr/share/cdbs/1/class/autotools.mk
553
554 # add an action after the build
555 build/mypackage::
556     /bin/bash debian/scripts/foo.sh
557 \end{lstlisting}
558         \end{itemize}
559 \end{itemize}
560 \end{frame}
561
562 \begin{frame}[fragile]{Debhelper 7 (aka dh7, or just dh)}
563 \begin{itemize}
564 \item Introduced in 2008 as a \textsl{CDBS killer}
565 \hbr
566 \item \textbf{dh} command that calls \texttt{dh\_*}
567 \hbr
568 \item Simple \textsl{debian/rules}, listing only overrides
569 \hbr
570 \item Easier to customize than CDBS
571 \hbr
572 \item Doc: slides from Joey Hess' Debconf9 talk\\\
573         \url{http://kitenet.net/~joey/talks/debhelper/debhelper-slides.pdf}
574         \br
575 \begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
576 #!/usr/bin/make -f
577 %:
578     dh $@
579
580 override_dh_auto_configure:
581      dh_auto_configure -- --with-kitchen-sink
582
583 override_dh_auto_build:
584      make world
585
586 \end{lstlisting}
587 \end{itemize}
588 \end{frame}
589
590 \begin{frame}{Plain debhelper vs CDBS vs debhelper 7}
591         \hbr
592 \begin{itemize}
593 \item Market shares: (feb'11)\\
594 Plain debhelper: 45\% \hskip 1em CDBS: 24\% \hskip 1em  debhelper7: 29\%
595 \hbr
596 \item Which one should I learn?
597 \begin{itemize}
598         \item Probably all of them
599         \item You need to know debhelper to use CDBS and dh7
600         \item You might have to modify CDBS packages
601 \end{itemize}
602 \hbr
603 \item Which one should I use for a new package?
604 \begin{itemize}
605         \item Debhelper 7 (only solution with an increasing market share)
606 \end{itemize}
607 \end{itemize}
608
609 \hbr
610 \begin{center}
611 \begin{tikzpicture}
612 \begin{axis}[small,label style={font=\footnotesize},xlabel={\small Time},ylabel={\small Market share (\%)},
613         date coordinates in=x,height=4.85cm,width=9cm,xticklabel={\month/\year},
614              legend style={font=\footnotesize,at={(1.02,1)},anchor=north west},max space between ticks=82,try min ticks=5,ymin=0]
615         \addplot[mark=none,blue,thick] table[x=date,y=dh] {cdbs-dh7.txt};
616         \addplot[mark=none,red,thick] table[x=date,y=dh7] {cdbs-dh7.txt};
617         \addplot[mark=none,green,thick] table[x=date,y=cdbs] {cdbs-dh7.txt};
618         \legend{debhelper, dh7, CDBS}
619 \end{axis}
620 \end{tikzpicture}
621 \end{center}
622
623 \end{frame}
624
625 \section{Building and testing packages}
626 \subsection{Building packages}
627 \subsection{Testing packages}
628
629 \section{Practical session 1 : modifying the wget package}
630 \begin{frame}{Practical session 1: modifying the wget package}
631 \begin{enumerate}
632         \item Go to \url{http://ftp.debian.org/debian/pool/main/w/wget/} and
633                 download version 1.12-2.1 of the package
634         \item Look at the files in \texttt{debian/}.
635                 \begin{itemize}
636                         \item           How many binary packages are generated by this source package?
637                         \item           Which packaging helper does this package use?
638                 \end{itemize}
639         \item Build the package
640         \item We are now going to modify the package. Add a changelog entry and increase the version number.
641         \item The lintian warning \textsl{more-than-one-patch-system} is caused by the build-dependency on \texttt{dpatch}. Remove it, and add an appropriate changelog entry.
642         \item Now disable IPv6 support (it is a \texttt{./configure} option)
643         \item Rebuild the package
644         \item Install the newly built package
645         \item Compare the original and the new package with debdiff
646 \end{enumerate}
647 \end{frame}
648
649 \section{Maintaining packages in Debian}
650 \subsection{Becoming a Debian contributor}
651 \begin{frame}
652 \frametitle{Becoming a Debian contributor}
653 Several ways to contribute:
654 \hbr
655 \begin{itemize}
656 \item Bring new software to Debian
657 \begin{itemize}
658 \item Is that new software interesting/useful enough?
659 \item Are there alternatives already packaged in Debian?
660 \end{itemize}
661 \br
662 \item Adopt existing unmaintained packages
663 \begin{itemize}
664         \item Many unmaintained packages in Debian
665         \item Including some that you rely on, probably
666         \item Use \texttt{wnpp-alert} to find out if you have some installed
667 \end{itemize}
668 \br
669 \item Get involved in packaging teams
670 \begin{itemize}
671 \item Many teams that focus on set of packages, and need help
672 \item Full list on \url{http://wiki.debian.org/Teams}
673 \item An excellent way to work with more experienced contributors
674 \end{itemize}
675 \end{itemize}
676 \end{frame}
677
678 \subsection{More interested in Ubuntu?}
679 \begin{frame}
680 \frametitle{More interested in Ubuntu?}
681 \begin{itemize}
682         \item Ubuntu mainly manages the divergence with Debian
683         \br
684         \item Do not really focus on specific packages\\
685                 Instead, collaborate with Debian teams
686         \br
687         \item Usually recommend uploading new packages to Debian first\\
688                 \url{https://wiki.ubuntu.com/UbuntuDevelopment/NewPackages/}
689         \br
690         \item Possibly a better plan:
691         \begin{itemize}
692                 \item Get involved in a Debian team and act as a bridge with Ubuntu
693                         \hbr
694                 \item Help reduce divergence, triage bugs in Launchpad
695                         \hbr
696                 \item Many Debian tools can help:
697                 \begin{itemize}
698                 \item Ubuntu column on the Developer' packages overview
699                 \item Ubuntu box on the Packages Tracking System
700                 \item Receive launchpad bugmail via the PTS
701                 \end{itemize}
702         \end{itemize}
703 \end{itemize}
704 \end{frame}
705
706 \subsection{Adopting orphaned packages}
707 \begin{frame}{Adopting orphaned packages}
708 \begin{itemize}
709         \item Full list: \url{http://www.debian.org/devel/wnpp/}
710         \item Installed on your machine: \texttt{wnpp-alert}
711         \item Different states:
712         \begin{itemize}
713                 \item \textbf{O}rphaned: the package is unmaintained\\
714                         Feel free to adopt it
715                 \item \textbf{RFA}: \textbf{R}equest \textbf{F}or \textbf{A}dopter\\
716                         Maintainer looking for adopter, but continues work in the meantime\\
717                         Feel free to adopt it. A mail to the current maintainer is polite
718                 \item \textbf{ITA}: \textbf{I}ntent \textbf{T}o \textbf{A}dopt\\
719                         Someone intends to adopt the package\\
720                         You could propose your help!
721                 \item \textbf{RFH} (\textbf{R}equest \textbf{F}or \textbf{H}elp\\
722                         The maintainer is looking for help
723         \end{itemize}
724         \item Some unmaintained packages not detected \arr not orphaned yet
725         \item When in doubt, ask \texttt{debian-qa@lists.debian.org}
726         \end{itemize}
727 \end{frame}
728
729
730 \section{Resources}
731 \subsection{Where to find help?}
732 \begin{frame}
733 \frametitle{Where to find help?}
734 Help you will need:
735 \begin{itemize}
736         \item Various advices and answers to your questions, code reviews
737         \item Sponsorship of your uploads, when your package is ready
738 \end{itemize}
739 \br
740 You can get help from:
741 \begin{itemize}
742         \item Other members of a packaging team $\leftarrow$ the best solution
743                 \begin{itemize}
744                         \item They know the specifics of your package
745                         \item You can become a member of the team
746                         \item See \url{http://wiki.debian.org/Teams}
747                 \end{itemize}
748         \hbr
749         \item The Debian Mentors group (if your package doesn't fit in a team)
750                 \begin{itemize}
751                         \item \url{http://wiki.debian.org/DebianMentorsFaq}
752                         \item Mailing list: \url{debian-mentors@lists.debian.org}
753                         \item IRC: \texttt{\#debian-mentors} on \texttt{irc.debian.org}
754                         \item \url{http://mentors.debian.net/}
755                 \end{itemize}
756 \end{itemize}
757 \end{frame}
758
759 \subsection{Official documentation}
760 \begin{frame}{Official documentation}
761         \begin{itemize}
762                 \item Debian Developers' Corner\\
763                         \url{http://www.debian.org/devel/}\\
764                         {\small Links to many resources about Debian development}
765                         \hbr
766                 \item Debian New Maintainers' Guide\\
767                         \url{http://www.debian.org/doc/maint-guide/}\\
768                         {\small An introduction to Debian packaging, but could use an update}
769                         \hbr
770                 \item Debian Developer's Reference\\
771                       \url{http://www.debian.org/doc/developers-reference/}\\
772                       {\small Mostly about Debian procedures, but also some best packaging practices (part 6)}
773                         \hbr
774
775               \item Debian Policy\\
776                     \url{http://www.debian.org/doc/debian-policy/}\\
777                     {\small All the requirements that every package must satisfy}
778                         \hbr
779
780                 \item Ubuntu Packaging Guide\\
781                         \url{https://wiki.ubuntu.com/PackagingGuide}
782         \end{itemize}
783 \end{frame}
784
785 \section{TODO}
786 \begin{frame}
787         \frametitle{Things not covered (yet)}
788 Packaging:
789 \begin{itemize}
790 \item Example: removing IPv6 support from wget
791 \item New source formats
792 \item Modifying the upstream source + patch systems
793 \item Maintainer scripts
794 \item Debconf
795 \item watch
796 \end{itemize}
797 Processes:
798 \begin{itemize}
799 \item Building packages -- dpkg-buildpackage pbuilder sbuild debi lintian debdiff debc
800 \item Uploading debsign / dput -- private archive -- reprepro
801 \item Packaging with VCSes debcheckout debcommit debrelease git-buildpackage svn-buildpackage
802 \end{itemize}
803 \end{frame}
804
805
806 \end{document}