Commit 70f23596 authored by Lucas Nussbaum's avatar Lucas Nussbaum

Merge practical sessions answers into the main document

parent 144fe78a
......@@ -7,4 +7,3 @@
*.toc
*.vrb
packaging-tutorial.pdf
pract*.pdf
......@@ -12,6 +12,5 @@ LATEXFILTER=/usr/share/texmf/scripts/latex-make/latexfilter.pl |\
grep -v 'OT1/cmss/././. ../..'
printable:
pdftk packaging-tutorial.pdf pract1-grep.pdf pract2-gnujump.pdf pract3-java.pdf output tutorial-all.pdf
pdfnup --paper a4paper --no-landscape --nup 2x4 --frame true --offset '0cm 0cm' --delta '0.5mm 0.5mm' --scale 0.965 --suffix 8 tutorial-all.pdf
pdfnup --paper a4paper --landscape --nup 2x2 --frame true --offset '0cm 0cm' --delta '1mm 1mm' --scale 0.96 --suffix 4 tutorial-all.pdf
pdfnup --paper a4paper --no-landscape --nup 2x4 --frame true --offset '0cm 0cm' --delta '0.5mm 0.5mm' --scale 0.965 --suffix 8 packaging-tutorial.pdf
pdfnup --paper a4paper --landscape --nup 2x2 --frame true --offset '0cm 0cm' --delta '1mm 1mm' --scale 0.96 --suffix 4 packaging-tutorial.pdf
......@@ -7,12 +7,10 @@ This tutorial is an introduction to Debian packaging. It teaches prospective
developers how to modify existing packages, how to create their own packages,
and how to interact with the Debian community.
it is composed of four documents:
+ packaging-tutorial.{tex,pdf}: the tutorial itself
+ pract1-grep.{tex,pdf}: a practical session about modifying the 'grep' package
+ pract2-gnujump.{tex,pdf}: a practical session about packaging the 'gnujump'
game from scratch
+ pract3-java.{tex,pdf}: a practical session about packaging a Java library
It includes a tutorial and three practical sessions:
- modifying the 'grep' package
- packaging the 'gnujump' game from scratch
- packaging a Java library
Contributing to this tutorial
-----------------------------
......
README
packaging-tutorial.pdf
pract1-grep.pdf
pract2-gnujump.pdf
pract3-java.pdf
This diff is collapsed.
\documentclass[10pt,final]{beamer}
\mode<presentation>
\usetheme{debian}
\usepackage{debiantutorial}
\hypersetup{pdftitle={Practical session 1: grep},bookmarks}
\title[Practical session 1: grep]{Practical session 1:\\ Modifying the grep package}
\author[]{Lucas Nussbaum\\{\small\texttt{lucas@debian.org}}}
\institute{\includegraphics[viewport=274 335 360 440,width=1cm]{figs/openlogo-nd.pdf}}
\date{}
\begin{document}
\frame{\titlepage}
\begin{frame}{Practical session: modifying the grep package}
\begin{enumerate}
\item Go to \url{http://ftp.debian.org/debian/pool/main/g/grep/} and
download version 2.6.3-3 of the package
\item Look at the files in \texttt{debian/}.
\begin{itemize}
\item How many binary packages are generated by this source package?
\item Which packaging helper does this package use?
\end{itemize}
\hbr
\item Build the package
\hbr
\item We are now going to modify the package. Add a changelog entry and increase the version number.
\hbr
\item Now disable perl-regexp support (it is a \texttt{./configure} option)
\hbr
\item Rebuild the package
\hbr
\item Compare the original and the new package with debdiff
\hbr
\item Install the newly built package
\hbr
\item Cry if you messed up ;)
\end{enumerate}
\end{frame}
\begin{frame}{Fetching the source}
\begin{enumerate}
\item Go to \url{http://ftp.debian.org/debian/pool/main/g/grep/} and
download version 2.6.3-3 of the package
\end{enumerate}
\begin{itemize}
\item Use dget to download the \texttt{.dsc} file:\\
{\small \texttt{dget http://cdn.debian.net/debian/pool/main/g/grep/grep\_2.6.3-3.dsc}}
\hbr
\item According to \texttt{http://packages.qa.debian.org/grep}, \texttt{grep} version 2.6.3-3 is currently in \textsl{stable} (\textsl{squeeze}). If you have \texttt{deb-src} lines for \textsl{squeeze} in your \texttt{/etc/apt/sources.list}, you can use:\\
\texttt{apt-get source grep=2.6.3-3}\\
or \texttt{apt-get source grep/stable}\\
or, if you feel lucky: \texttt{apt-get source grep}
\hbr
\item The \texttt{grep} source package is composed of three files:
\begin{itemize}
\item \texttt{grep\_2.6.3-3.dsc}
\item \texttt{grep\_2.6.3-3.debian.tar.bz2}
\item \texttt{grep\_2.6.3.orig.tar.bz2}
\end{itemize}
This is typical of the "3.0 (quilt)" format.
\hbr
\item If needed, uncompress the source with\\
\texttt{dpkg-source -x grep\_2.6.3-3.dsc}
\end{itemize}
\end{frame}
\begin{frame}{Looking around and building the package}
\begin{enumerate}
\setcounter{enumi}{1}
\item Look at the files in \texttt{debian/}.
\begin{itemize}
\item How many binary packages are generated by this source package?
\item Which packaging helper does this package use?
\end{itemize}
\end{enumerate}
\hbr
\begin{itemize}
\item According to \texttt{debian/control}, this package only generates one binary package, named \texttt{grep}.
\hbr
\item According to \texttt{debian/rules}, this package is typical of \textsl{classic} debhelper packaging, without using \textsl{CDBS} or \textsl{dh}. One can see the various calls to \texttt{dh\_*} commands in \texttt{debian/rules}.
\end{itemize}
\hbr
\begin{enumerate}
\setcounter{enumi}{2}
\item Build the package
\end{enumerate}
\hbr
\begin{itemize}
\item Use \texttt{apt-get build-dep grep} to fetch the build-dependencies
\item Then \texttt{debuild} or \texttt{dpkg-buildpackage -us -uc} (Takes about 1 min)
\end{itemize}
\end{frame}
\begin{frame}{Editing the changelog}
\begin{enumerate}
\setcounter{enumi}{3}
\item We are now going to modify the package. Add a changelog entry and increase the version number.
\end{enumerate}
\hbr
\begin{itemize}
\item \texttt{debian/changelog} is a text file. You could edit it and add a new entry manually.
\hbr
\item Or you can use \texttt{dch -i}, which will add an entry and open the editor
\hbr
\item The name and email can be defined using the \texttt{DEBFULLNAME} and \texttt{DEBEMAIL} environment variables
\hbr
\item After that, rebuild the package: a new version of the package is built
\hbr
\item Package versioning is detailed in section 5.6.12 of the Debian policy\\
\url{http://www.debian.org/doc/debian-policy/ch-controlfields.html}
\end{itemize}
\end{frame}
\begin{frame}{Disabling Perl regexp support and rebuilding}
\begin{enumerate}
\setcounter{enumi}{4}
\item Now disable perl-regexp support (it is a \texttt{./configure} option)
\item Rebuild the package
\end{enumerate}
\hbr
\begin{itemize}
\item Check with \texttt{./configure --help}: the option to disable Perl regexp is \texttt{--disable-perl-regexp}
\hbr
\item Edit \texttt{debian/rules} and find the \texttt{./configure} line
\hbr
\item Add \texttt{--disable-perl-regexp}
\hbr
\item Rebuild with \texttt{debuild} or \texttt{dpkg-buildpackage -us -uc}
\end{itemize}
\end{frame}
\begin{frame}{Comparing and testing the packages}
\begin{enumerate}
\setcounter{enumi}{6}
\item Compare the original and the new package with debdiff
\item Install the newly built package
\end{enumerate}
\hbr
\begin{itemize}
\item Compare the binary packages: \texttt{debdiff ../*changes}
\hbr
\item Compare the source packages: \texttt{debdiff ../*dsc}
\hbr
\item Install the newly built package: \texttt{debi}\\
Or \texttt{dpkg -i ../grep\_<TAB>}
\hbr
\item \texttt{grep -P foo} no longer works!
\end{itemize}
\br
\begin{enumerate}
\setcounter{enumi}{8}
\item Cry if you messed up ;)
\end{enumerate}
\hbr
Or not: reinstall the previous version of the package:
\begin{itemize}
\item \texttt{apt-get install --reinstall grep=2.6.3-3} \textit{(= previous version)}
\end{itemize}
\end{frame}
\end{document}
\documentclass[10pt,final]{beamer}
\mode<presentation>
\usetheme{debian}
\usepackage{debiantutorial}
\hypersetup{pdftitle={Practical session 2: gnujump},bookmarks}
\title[Practical session 2: gnujump]{Practical session 2:\\ Packaging GNUjump}
\author[]{Lucas Nussbaum\\{\small\texttt{lucas@debian.org}}}
\institute{\includegraphics[viewport=274 335 360 440,width=1cm]{figs/openlogo-nd.pdf}}
\date{}
\begin{document}
\frame{\titlepage}
\begin{frame}{Practical session 2: packaging GNUjump}
\begin{enumerate}
\item Download GNUjump 1.0.6 from
\url{http://ftp.gnu.org/gnu/gnujump/1.0.6/gnujump-1.0.6.tar.gz}
\br
\item Create a Debian package for it
\begin{itemize}
\item Install build-dependencies so that you can build the package
\item Get a basic working package
\item Finish filling \texttt{debian/control} and other files
\end{itemize}
\br
\item Enjoy
\end{enumerate}
\centerline{\includegraphics[width=5cm]{figs/gnujump.png}}
\end{frame}
\begin{frame}[fragile]
\frametitle{Step by step\ldots}
\begin{itemize}
\item \texttt{wget http://ftp.gnu.org/gnu/gnujump/1.0.6/gnujump-1.0.6.tar.gz}
\hbr
\item \texttt{mv gnujump-1.0.6.tar.gz gnujump\_1.0.6.orig.tar.gz}
\hbr
\item \texttt{tar xf gnujump\_1.0.6.orig.tar.gz}
\hbr
\item \texttt{cd gnujump-1.0.6/}
\hbr
\item \texttt{dh\_make}
\begin{itemize}
\item \small Type of package: single binary (for now)
\end{itemize}
\end{itemize}
\begin{lstlisting}[basicstyle=\ttfamily\small]
gnujump-1.0.6$ ls debian/
changelog gnujump.default.ex preinst.ex
compat gnujump.doc-base.EX prerm.ex
control init.d.ex README.Debian
copyright manpage.1.ex README.source
docs manpage.sgml.ex rules
emacsen-install.ex manpage.xml.ex source
emacsen-remove.ex menu.ex watch.ex
emacsen-startup.ex postinst.ex
gnujump.cron.d.ex postrm.ex
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Step by step \ldots (2)}
\begin{itemize}
\item Look at \texttt{debian/changelog}, \texttt{debian/rules}, \texttt{debian/control}\\
(auto-filled by \textbf{dh\_make})
\hbr
\item In \texttt{debian/control}:\\
\texttt{Build-Depends: debhelper (>= 7.0.50~), autotools-dev}\\
Lists the \textsl{build-dependencies} = packages needed to build the package
\hbr
\item Try to build the package as-is (thanks to \textbf{dh} magic)
\begin{itemize}
\item And add build-dependencies, until it builds
\item Hint: use \texttt{apt-cache search} and \texttt{apt-file} to find the packages
\item Example:
\begin{lstlisting}[basicstyle=\ttfamily\footnotesize]
checking for sdl-config... no
checking for SDL - version >= 1.2.0... no
[...]
configure: error: *** SDL version 1.2.0 not found!
\end{lstlisting}
$\rightarrow$ Add \textbf{libsdl1.2-dev} to Build-Depends and install it.
\hbr
\item Better: use \textbf{pbuilder} to build in a clean environment
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Step by step \ldots (3)}
\begin{itemize}
\item After installing \texttt{libsdl1.2-dev, libsdl-image1.2-dev, libsdl-mixer1.2-dev}, the package builds fine.
\hbr
\item Use \texttt{debc} to list the content of the generated package.
\hbr
\item Use \texttt{debi} to install it and test it.
\hbr
\item Fill in \texttt{debian/control} using \url{http://www.debian.org/doc/debian-policy/ch-controlfields.html}
\hbr
\item Test the package with \texttt{lintian}
\hbr
\item Remove the files that you don't need in \texttt{debian/}
\hbr
\item Compare your package with the one already packaged in Debian:
\begin{itemize}
\item It splits the data files to a second package, that is the same across all architectures ($\rightarrow$ saves space in the Debian archive)
\item It installs a .desktop file (for the GNOME/KDE menus) and also integrates into the Debian menu
\item It fixes a few minor problems using patches
\end{itemize}
\end{itemize}
\end{frame}
\end{document}
\documentclass[10pt,final]{beamer}
\mode<presentation>
\usetheme{debian}
\usepackage{debiantutorial}
\hypersetup{pdftitle={Practical session 3: a Java library},bookmarks}
\title[Practical session 3: Java library]{Practical session 3:\\ Packaging a Java library}
\author[]{Lucas Nussbaum\\{\small\texttt{lucas@debian.org}}}
\institute{\includegraphics[viewport=274 335 360 440,width=1cm]{figs/openlogo-nd.pdf}}
\date{}
\begin{document}
\frame{\titlepage}
\begin{frame}{Practical session 3: packaging a Java library}
\begin{enumerate}
\item Take a quick look at some documentation about Java packaging:\\
\begin{itemize}
\item \url{http://wiki.debian.org/Java}
\hbr
\item \url{http://wiki.debian.org/Java/Packaging}
\hbr
\item \url{http://www.debian.org/doc/packaging-manuals/java-policy/}
\hbr
\item \url{http://pkg-java.alioth.debian.org/docs/tutorial.html}
\hbr
\item Paper and slides from a Debconf10 talk about javahelper:\\
{\footnotesize
\url{http://pkg-java.alioth.debian.org/docs/debconf10-javahelper-paper.pdf}\\
\url{http://pkg-java.alioth.debian.org/docs/debconf10-javahelper-slides.pdf}}
\end{itemize}
\br
\item Download IRClib from \url{http://moepii.sourceforge.net/}
\br
\item Package it
\end{enumerate}
\end{frame}
\begin{frame}[fragile]
\frametitle{Step by step\ldots}
\begin{itemize}
\item \texttt{apt-get install javahelper}
\hbr
\item Create a basic source package: \texttt{jh\_makepkg}
\begin{itemize}
\item Library
\item None
\item Default Free compiler/runtime
\end{itemize}
\hbr
\item Look at and fix \texttt{debian/*}
\hbr
\item \texttt{dpkg-buildpackage -us -uc} or \texttt{debuild}
\hbr
\item \texttt{lintian}, \texttt{debc}, etc.
\hbr
\item Compare your result with the \texttt{libirclib-java} source package
\end{itemize}
\end{frame}
\end{document}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment