Move Legal stuff and link to source to the end
[packaging-tutorial.git] / pract1-grep.tex
1 \documentclass[10pt,final]{beamer}
2 \mode<presentation>
3 \usetheme{lucasdeb}
4 \usepackage{debiantutorial}
5
6 \hypersetup{pdftitle={Practical session 1: grep},bookmarks}
7 \title[Practical session 1: grep]{Practical session 1:\\ Modifying the grep package}
8 \author[]{Lucas Nussbaum\\{\small\texttt{lucas@debian.org}}}
9 \institute{\includegraphics[viewport=274 335 360 440,width=1cm]{figs/openlogo-nd.pdf}}
10 \date{}
11
12 \begin{document}
13
14 \frame{\titlepage}
15
16 \begin{frame}{Practical session: modifying the grep package}
17 \begin{enumerate}
18         \item Go to \url{http://ftp.debian.org/debian/pool/main/g/grep/} and
19                 download version 2.6.3-3 of the package
20         \item Look at the files in \texttt{debian/}.
21                 \begin{itemize}
22                         \item           How many binary packages are generated by this source package?
23                         \item           Which packaging helper does this package use?
24                 \end{itemize}
25         \item Build the package
26         \item We are now going to modify the package. Add a changelog entry and increase the version number.
27         \item Now disable perl-regexp support (it is a \texttt{./configure} option)
28         \item Rebuild the package
29         \item Compare the original and the new package with debdiff
30         \item Install the newly built package
31 \end{enumerate}
32 \end{frame}
33
34 \begin{frame}{Fetching the source}
35 \begin{enumerate}
36         \item Go to \url{http://ftp.debian.org/debian/pool/main/g/grep/} and
37                 download version 2.6.3-3 of the package
38 \end{enumerate}
39 \begin{itemize}
40         \item Use dget to download the \texttt{.dsc} file:\\
41                 {\small \texttt{dget http://cdn.debian.net/debian/pool/main/g/grep/grep\_2.6.3-3.dsc}}
42                 \hbr
43         \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:\\
44                 \texttt{apt-get source grep=2.6.3-3}\\
45                 or \texttt{apt-get source grep/stable}\\
46                 or, if you feel lucky: \texttt{apt-get source grep}
47         \hbr
48         \item The \texttt{grep} source package is composed of three files:
49                 \begin{itemize}
50                         \item \texttt{grep\_2.6.3-3.dsc}
51                         \item \texttt{grep\_2.6.3-3.debian.tar.bz2}
52                         \item \texttt{grep\_2.6.3.orig.tar.bz2}
53                 \end{itemize}
54                 This is typical of the "3.0 (quilt)" format.
55         \hbr
56 \item If needed, uncompress the source with\\
57         \texttt{dpkg-source -x grep\_2.6.3-3.dsc}
58 \end{itemize}
59 \end{frame}
60
61 \begin{frame}{Looking around and building the package}
62         \begin{enumerate}
63                         \setcounter{enumi}{1}
64         \item Look at the files in \texttt{debian/}.
65                 \begin{itemize}
66                         \item           How many binary packages are generated by this source package?
67                         \item           Which packaging helper does this package use?
68                 \end{itemize}
69         \end{enumerate}
70         \hbr
71         \begin{itemize}
72                 \item According to \texttt{debian/control}, this package only generates one binary package, named \texttt{grep}.
73                         \hbr
74                 \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}.
75         \end{itemize}
76         \hbr
77         \begin{enumerate}
78                         \setcounter{enumi}{2}
79
80                 \item Build the package
81         \end{enumerate}
82         \hbr
83         \begin{itemize}
84                 \item Use \texttt{apt-get build-dep grep} to fetch the build-dependencies
85                 \item Then \texttt{debuild} or \texttt{dpkg-buildpackage -us -uc} (Takes about 1 min)
86         \end{itemize}
87 \end{frame}
88
89 \begin{frame}{Editing the changelog}
90         \begin{enumerate}
91                         \setcounter{enumi}{3}
92
93         \item We are now going to modify the package. Add a changelog entry and increase the version number.
94         \end{enumerate}
95         \hbr
96         \begin{itemize}
97                 \item \texttt{debian/changelog} is a text file. You could edit it and add a new entry manually.
98         \hbr
99                 \item Or you can use \texttt{dch -i}, which will add an entry and open the editor
100         \hbr
101                 \item The name and email can be defined using the \texttt{DEBFULLNAME} and \texttt{DEBEMAIL} environment variables
102         \hbr
103                 \item After that, rebuild the package: a new version of the package is built
104         \hbr
105                 \item Package versioning is detailed in section 5.6.12 of the Debian policy\\
106                         \url{http://www.debian.org/doc/debian-policy/ch-controlfields.html}
107         \end{itemize}
108 \end{frame}
109
110 \begin{frame}{Disabling Perl regexp support and rebuilding}
111         \begin{enumerate}
112                         \setcounter{enumi}{4}
113
114         \item Now disable perl-regexp support (it is a \texttt{./configure} option)
115         \item Rebuild the package
116         \end{enumerate}
117         \hbr
118         \begin{itemize}
119                 \item Check with \texttt{./configure --help}: the option to disable Perl regexp is \texttt{--disable-perl-regexp}
120         \hbr
121                 \item Edit \texttt{debian/rules} and find the \texttt{./configure} line
122         \hbr
123                 \item Add \texttt{--disable-perl-regexp}
124         \hbr
125                 \item Rebuild with \texttt{debuild} or \texttt{dpkg-buildpackage -us -uc}
126         \end{itemize}
127 \end{frame}
128
129 \begin{frame}{Comparing and testing the packages}
130         \begin{enumerate}
131                         \setcounter{enumi}{6}
132
133         \item Compare the original and the new package with debdiff
134         \item Install the newly built package
135         \end{enumerate}
136         \hbr
137         \begin{itemize}
138                 \item Compare the binary packages: \texttt{debdiff ../*changes}
139         \hbr
140                 \item Compare the source packages: \texttt{debdiff ../*dsc}
141         \hbr
142                 \item Install the newly built package: \texttt{debi}\\
143                         Or \texttt{dpkg -i ../grep\_<TAB>}
144         \hbr
145                 \item \texttt{grep -P foo} no longer works!
146         \end{itemize}
147 \end{frame}
148
149
150
151 \end{document}