save
[~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}{It's a DSCM [1/2]}
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}{It's a DSCM [2/2]}
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
67   \vspace{1ex}
68
69   \uncover<6->{
70     GNU libc version 2.7 weights weights 115Mo unpacked. The full glibc
71     history (from before 1984) weights less than \alert{120Mo}.
72   }
73
74   \vspace{1ex}
75
76   \uncover<7->{
77     My experience shows that \git{} storage, for a project with quite some
78     history, is smaller than 2.5 times the size of the last upstream release
79     (unpacked).
80   }
81 \end{frame}
82
83 \begin{frame}{A real maintainer toolbox}
84   Though \git{} is special, because it was designed by a {\bf Maintainer}.
85   This has several implications:
86   \begin{itemize}
87     \item<2-> \git{} operations to look at the history are blazingly fast;
88     \item<3-> \git{} operations to integrate patches are blazingly fast;
89     \item<4-> \git{} supports advanced merging features;
90     \item<5-> \git{} has advanced patch manipulation features.
91   \end{itemize}
92
93   \vspace{1ex}
94
95   \uncover<6->{
96     In other words, \git{} is a suitable replacement for both SVN and
97     quilt\footnote{or your preferred patch system}.
98   }
99 \end{frame}
100
101 %}}}
102 \section{Repository layout}%{{{
103 \begin{frame}{The repository layout: upstream}
104   First of all, my repositories contain upstream sources.
105   \begin{enumerate}
106     \item<2-> if upstream uses a public SVN or \git{} repository, I track
107               their SCM under the {\tt upstream/*} namespace.
108     \item<3-> if upstream tarballs differ from the SCM, I also add a
109               {\tt upstream/tarballs} branch that replicates the tarball
110               directly.
111     \item<4-> if upstream only releases tarballs, I only have an
112               {\tt upstream} branch that is the successive import of tarballs.
113
114     \item<5-> last and not least, {\tt pristine-tar} helps me saving the
115               pristine upstream tarballs inside git.
116   \end{enumerate}
117 \end{frame}
118
119 \begin{frame}{The repository layout: upstream}
120   \vspace{1ex}
121   {\bf Demo}: tokyocabinet packaging:
122   \begin{itemize}
123     \item Step 1: importing upstream;
124     \item Step 2: backing up the orig.tar.gz.
125   \end{itemize}
126 \end{frame}
127
128 \begin{frame}{The repository layout: patches}
129   Second of all, instead of using quilt, I use a private git branch to hold my
130   patch queue (usually called {\tt \$\{upstream\_branch\}+patches}). There are many
131   reasons to that:
132   \begin{itemize}
133     \item<2-> I only use one tool: \git{};
134     \item<3-> quilt doesn't know about diff3, unpractical for partially merged
135               patches;
136     \item<4-> I believe it to be nicer to browse or to cherry-pick for
137               upstreams.
138   \end{itemize}
139   \vspace{1ex}
140   \uncover<5->{
141     {\bf Demo:} let's rebase our patch branch for tokyocabinet !
142   }
143 \end{frame}
144
145 \begin{frame}{The repository layout: debian packaging}
146   Finally, everything that is Debian specific is kept into a debian branch.
147   \begin{itemize}
148     \item<2-> One branch per suite: {\tt debian-etch}, {\tt debian-sid}, {\tt
149               debian-exp};
150     \item<3-> the corresponding upstreams are merged into this {\tt debian}
151               branch;
152     \item<4-> the {\tt upstream+patches} branch is serialized under
153               {\tt debian/patches}.
154   \end{itemize}
155   \vspace{1ex}
156   \uncover<5->{
157     {\bf Demo:} let's release our tokyocabinet package !
158   }
159 \end{frame}
160 %}}}
161 \section{How to turn mud into gold efficiently}%{{{
162 \begin{frame}{Hiding to the world you're a dirty pig}
163   There is nothing more useless than a crappy SCM history. I don't know how
164   {\it you} work, but I tend to do everything at the same time.
165
166   \vspace{1em}
167   \uncover<2->{
168     Well, then just bind {\tt :wa} to {\tt :wa<cr>:!git commit -a} in your
169     editor…
170   }
171
172   \vspace{1em}
173   \uncover<3->{
174     Then work like a pig, compulsively saving\^{}Wcommiting your stuff…
175   }
176
177   \vspace{1em}
178   \uncover<4->{
179     And when you're happy of the current sate, let's fake that you're a good
180     boy.
181   }
182
183   \vspace{1em}
184   \uncover<5->{
185     {\bf Demo}: the same in pictures.
186   }
187 \end{frame}
188 \begin{frame}{Using \git{} for other's packages}
189   \git{} is not only useful as a versioning tool, it also helps to work fast
190   with NMUs and security uploads.
191   \begin{enumerate}
192     \item<2-> {\tt \$ git init \&\& git add .\@{} \&\& git commit -asm.}
193     \item<3-> {\it hack, hack …} {\tt \$ git commit -asm'try this'}
194     \item<4-> {\it hack, hack …} {\tt \$ git commit -asm'try that'}
195     \item<5-> {\it rebuild… Ok it works, let's produce a clean patch:}\\
196               {\tt \$ git rebase -i [...]}
197   \end{enumerate}
198
199   \vspace{1ex}
200   \uncover<6->{
201     Some packages don't rebuild twice in a row properly, because their
202     {\tt clean} target is broken…
203   }
204
205   \uncover<7->{
206     \alert{I laugh at those}:\\
207     {\tt \$ git clean -d \&\& git reset --hard}
208   }
209 \end{frame}
210 %}}}
211 \section{The END !}%{{{
212
213 \begin{frame}{The END !}
214   If you're not too bored already, I'll gladly answer your questions now.
215
216   \vspace{2em}
217
218   And remember, git has a tremendous community.
219
220   \begin{center}
221   {\tt <mailto:git@vger.kernel.org>}
222   \end{center}
223
224   Also consult the documentation:
225   {\tt /usr/share/doc/git-doc/index.html}\footnote{I assume you have git-doc
226   installed, it will soon be part of base}.
227 \end{frame}
228 %}}}
229 \end{document}
230 % vim:tw=78 spell spelllang=en: