and more
[~madcoder/fosdem.git] / git.tex
1 \documentclass[10pt]{beamer}%{{{
2
3 \mode<presentation> {
4   \usetheme{Warsaw}
5   \setbeamercovered{transparent}
6 }
7
8 \usepackage[english]{babel}
9 \usepackage[utf8]{inputenc}
10 \usepackage{graphicx}
11
12 \usepackage{times}
13 %\usepackage[T1]{fontenc}
14 \newcommand{\git}{GIT}
15
16
17 \title{Packaging with \git}
18
19 \author{Pierre Habouzit}
20
21 \institute{FOSDEM 2008 - Debian Room}
22
23 \date{23 Feb. 2008}
24
25 \AtBeginSubsection[] {
26   \begin{frame}<beamer>{Why choosing \git}
27     \tableofcontents[currentsection,currentsubsection]
28   \end{frame}
29 }
30
31 \begin{document}
32
33 \begin{frame}
34   \titlepage
35 \end{frame}
36
37 \begin{frame}
38   \tableofcontents
39 \end{frame}
40 %}}}
41 \section{Why choosing \git}%{{{
42
43 \begin{frame}{Because SVN isn't good enough}
44   I've packaged with SVN on svn.debian.org for a long time…
45   \uncover<2->{\alert{well, it sucks}:}
46   \begin{itemize}
47     \item<3-> I wasn't able to work without network access;
48     \item<4-> I couldn't work incrementally: you have to get other's patches;
49     \item<5-> I couldn't "try and see" and maybe discard some work without
50               reverting patches: SVN never forgets;
51     \item<6-> I like having the full upstream source at hand, but svn explodes
52               doing that for large sources (KDE …).
53   \end{itemize}
54 \end{frame}
55
56 \begin{frame}{Because \git{} does what I need}
57   With \git, as a DSCM, most of the issues are gone.
58   \begin{itemize}
59     \item<2-> Off-line work is possible, in fact you always work off-line;
60     \item<3-> Incremental work is possible;
61     \item<4-> \git{} allow you to completely erase a wrong idea if you didn't
62               shared it yet;
63     \item<5-> \git{} storage is extremely efficient: the marginal cost of
64               commits decreases with the number of commits.
65   \end{itemize}
66 \end{frame}
67
68 \begin{frame}{A bit more about \git{} storage}
69   \git{} storage is very efficient and optimized. Some numbers:
70
71   \vspace{1em}
72   \uncover<2->{
73     xorg-xserver.git, goes back to 2000, is \alert{20Mo} big. The last
74     orig.tar.gz is 8Mo big, more than 84Mo unpacked.
75   }
76
77   \vspace{1em}
78   \uncover<3->{
79     dpkg.git, whole history since April 1996, generates a git pack of
80     \alert{15Mo}. The last dpkg release is 17Mo big unpacked.
81   }
82
83   \vspace{1em}
84   \uncover<4->{
85     GNU libc version 2.7 weights 115Mo unpacked. The full glibc history
86     (starts in the eighties) generates a \git{} pack of \alert{104Mo}.
87   }
88
89   \vspace{1em}
90   \uncover<5->{
91     Though, this won't probably true for packages with a lot of binary stuff
92     in it, where delta compression is less likely to produce good results
93     (games data packages come to mind).
94   }
95 \end{frame}
96
97 \begin{frame}{A real maintainer toolbox}
98   \git{} is special, because it was designed by a {\bf Maintainer}.  This has
99   several implications:
100   \begin{itemize}
101     \item<2-> \git{} operations to look at the history are blazingly fast;
102     \item<3-> \git{} operations to integrate patches are blazingly fast;
103     \item<4-> \git{} supports advanced merging features;
104     \item<5-> \git{} has advanced patch manipulation features.
105   \end{itemize}
106
107   \vspace{1ex}
108
109   \uncover<6->{
110     In other words, \git{} is a suitable replacement for both SVN and
111     quilt\footnote{or your preferred patch system}.
112   }
113 \end{frame}
114
115 %}}}
116 \section{Repository layout}%{{{
117 \begin{frame}{The repository layout: upstream}
118   First of all, my repositories contain upstream sources.
119   \begin{enumerate}
120     \item<2-> if upstream uses a public SVN or \git{} repository, I track
121               their SCM under the {\tt upstream/*} namespace.
122     \item<3-> if upstream tarballs differ from the SCM, I also add a
123               {\tt upstream/tarballs} branch that replicates the tarball
124               directly.
125     \item<4-> if upstream only releases tarballs, I only have an
126               {\tt upstream} branch that is the successive import of tarballs.
127
128     \item<5-> last and not least, {\tt pristine-tar} helps me saving the
129               pristine upstream tarballs inside git.
130   \end{enumerate}
131 \end{frame}
132
133 \begin{frame}{The repository layout: upstream}
134   \vspace{1ex}
135   {\bf Demo}: tokyocabinet packaging:
136   \begin{itemize}
137     \item Step 1: importing upstream;
138     \item Step 2: backing up the orig.tar.gz.
139   \end{itemize}
140 \end{frame}
141
142 \begin{frame}{The repository layout: patches}
143   Second of all, instead of using quilt, I use a private git branch to hold my
144   patch queue (usually called {\tt \$\{upstream\_branch\}+patches}). There are many
145   reasons to that:
146   \begin{itemize}
147     \item<2-> I only use one tool: \git{};
148     \item<3-> quilt doesn't know about diff3, unpractical for partially merged
149               patches;
150     \item<4-> I believe it to be nicer to browse or to cherry-pick for
151               upstreams.
152   \end{itemize}
153   \vspace{1ex}
154   \uncover<5->{
155     {\bf Demo:} let's rebase our patch branch for tokyocabinet !
156   }
157 \end{frame}
158
159 \begin{frame}{The repository layout: debian packaging}
160   Finally, everything that is Debian specific is kept into a debian branch.
161   \begin{itemize}
162     \item<2-> One branch per suite: {\tt debian-etch}, {\tt debian-sid}, {\tt
163               debian-exp};
164     \item<3-> the corresponding upstreams are merged into this {\tt debian}
165               branch;
166     \item<4-> the {\tt upstream+patches} branch is serialized under
167               {\tt debian/patches}.
168   \end{itemize}
169   \vspace{1ex}
170   \uncover<5->{
171     {\bf Demo:} let's release our tokyocabinet package !
172   }
173 \end{frame}
174 %}}}
175 \section{How to turn mud into gold efficiently}%{{{
176 \begin{frame}{Hiding to the world you're a dirty pig}
177   There is nothing more useless than a crappy SCM history. I don't know how
178   {\it you} work, but I tend to do everything at the same time.
179
180   \vspace{1em}
181   \uncover<2->{
182     Well, then just bind {\tt :wa} to {\tt :wa<cr>:!git commit -a} in your
183     editor…
184   }
185
186   \vspace{1em}
187   \uncover<3->{
188     Then work like a pig, compulsively saving\^{}Wcommiting your stuff…
189   }
190
191   \vspace{1em}
192   \uncover<4->{
193     And when you're happy of the current sate, let's pretend that you're a good
194     boy.
195   }
196
197   \vspace{1em}
198   \uncover<5->{
199     {\bf Demo}: the same in pictures.
200   }
201 \end{frame}
202 \begin{frame}{Using \git{} for other's packages}
203   \git{} is not only useful as a versioning tool, it also helps to work fast
204   with NMUs and security uploads.
205   \begin{enumerate}
206     \item<2-> {\tt \$ git init \&\& git add .\@{} \&\& git commit -asm.}
207     \item<3-> {\it hack, hack …} {\tt \$ git commit -asm'try this'}
208     \item<4-> {\it hack, hack …} {\tt \$ git commit -asm'try that'}
209     \item<5-> {\it rebuild… Ok it works, let's produce a clean patch:}\\
210               {\tt \$ git rebase -i [...]}
211   \end{enumerate}
212
213   \vspace{1ex}
214   \uncover<6->{
215     Some packages don't rebuild twice in a row properly, because their
216     {\tt clean} target is broken…
217   }
218
219   \uncover<7->{
220     \alert{I laugh at those}:\\
221     {\tt \$ git clean -d \&\& git reset --hard}
222   }
223 \end{frame}
224 %}}}
225 \section{The END !}%{{{
226
227 \begin{frame}{The END !}
228   If you're not too bored already, I'll gladly answer your questions now.
229
230   \vspace{2em}
231
232   And remember, git has a tremendous community.
233
234   \begin{center}
235   {\tt <mailto:git@vger.kernel.org>}
236   \end{center}
237
238   Also consult the documentation:
239   {\tt /usr/share/doc/git-doc/index.html}\footnote{I assume you have git-doc
240   installed, it will soon be part of base}.
241 \end{frame}
242 %}}}
243 \end{document}
244 % vim:tw=78 spell spelllang=en: