1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
|
<chapter id="update"><title>Updating the package</title>
<para>
The rewrite of this tutorial document with updated contents and more practical examples is available as <ulink url="&guidedeb;">Guide for Debian Maintainers</ulink>. Please use this new tutorial as the primary tutorial document.
</para>
<para>
After you release a package, you will soon need to update it.
</para>
<section id="newrevision"><title>New Debian revision</title>
<para>
Let's say that a bug report was filed against your package as
<literal>#654321</literal>, and it describes a problem that you can solve.
Here's what you need to do to create a new Debian revision of the package:
</para>
<itemizedlist>
<listitem>
<para>
If this is to be recorded as a new patch, do the following:
</para>
<itemizedlist>
<listitem>
<para>
<literal>dquilt new <replaceable>bugname.patch</replaceable></literal> to set
the patch name;
</para>
</listitem>
<listitem>
<para>
<literal>dquilt add <replaceable>buggy-file</replaceable></literal> to declare
the file to be modified;
</para>
</listitem>
<listitem>
<para>
Correct the problem in the package source for the upstream bug;
</para>
</listitem>
<listitem>
<para>
<literal>dquilt refresh</literal> to record it to
<filename><replaceable>bugname.patch</replaceable></filename>;
</para>
</listitem>
<listitem>
<para>
<literal>dquilt header -e</literal> to add its description;
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
If this is to update an existing patch, do the following:
</para>
<itemizedlist>
<listitem>
<para>
<literal>dquilt pop <replaceable>foo.patch</replaceable></literal> to recall
the existing <filename><replaceable>foo.patch</replaceable></filename>;
</para>
</listitem>
<listitem>
<para>
Correct the problem in the old
<filename><replaceable>foo.patch</replaceable></filename>;
</para>
</listitem>
<listitem>
<para>
<literal>dquilt refresh</literal> to update
<filename><replaceable>foo.patch</replaceable></filename>;
</para>
</listitem>
<listitem>
<para>
<literal>dquilt header -e</literal> to update its description;
</para>
</listitem>
<listitem>
<para>
<literal>while dquilt push; do dquilt refresh; done</literal> to apply all
patches while removing <emphasis>fuzz</emphasis>;
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Add a new revision at the top of the Debian <filename>changelog</filename>
file, for example with <literal>dch -i</literal>, or explicitly with
<literal>dch -v
<replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>
and then insert the comments using your preferred editor. <footnote><para>To
get the date in the required format, use <literal>LANG=C date -R</literal>.
</para> </footnote>
</para>
</listitem>
<listitem>
<para>
Include a short description of the bug and the solution in the changelog entry,
followed by <literal>Closes: #654321</literal>. That way, the bug report will
be <emphasis>automagically</emphasis> closed by the archive maintenance
software the moment your package gets accepted into the Debian archive.
</para>
</listitem>
<listitem>
<para>
Repeat what you did in the above to fix more bugs while updating the Debian
<filename>changelog</filename> file with <literal>dch</literal> as needed.
</para>
</listitem>
<listitem>
<para>
Repeat what you did in <xref linkend="completebuild"/> and <xref linkend="checkit"/>.
</para>
</listitem>
<listitem>
<para>
Once you are satisfied, you should change the distribution value in <filename>changelog</filename> from
<literal>UNRELEASED</literal> to the target distribution value
<literal>unstable</literal> (or even <literal>experimental</literal>).<footnote><para>If you
use the <literal>dch -r</literal> command to make this last change, please
make sure to save the <filename>changelog</filename> file explicitly by the
editor.</para></footnote>
</para>
</listitem>
<listitem>
<para>
Upload the package as in <xref linkend="upload"/>. The difference is that
this time, the original source archive won't be included, as it hasn't been
changed and it already exists in the Debian archive.
</para>
</listitem>
</itemizedlist>
<para>
One tricky case can occur when you make a local package, to experiment with
the packaging before uploading the normal version to the official archive,
e.g.,
<literal><replaceable>1.0.1</replaceable>-<replaceable>1</replaceable></literal>.
For smoother upgrades, it is a good idea to create a
<filename>changelog</filename> entry with a version string such as
<literal><replaceable>1.0.1</replaceable>-<replaceable>1~rc1</replaceable></literal>.
You may unclutter <filename>changelog</filename>
by consolidating such local change entries into a single entry for the official package.
See <xref linkend="namever"/> for the order of version strings.
</para>
<para>
</para>
</section>
<section id="inspectnewupstream"><title>Inspection of the new upstream release</title>
<para>
When preparing packages of a new upstream release for the Debian archive, you
must check the new upstream release first.
</para>
<para>
Start by reading the upstream <filename>changelog</filename>,
<filename>NEWS</filename>, and whatever other documentation they may have
released with the new version.
</para>
<para>
You can then inspect changes between the old and new upstream sources as follows,
watching out for anything suspicious:
</para>
<screen>
$ diff -urN <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable> <replaceable>foo</replaceable>-<replaceable>newversion</replaceable>
</screen>
<para>
Changes to some auto-generated files by Autotools such as
<filename>missing</filename>, <filename>aclocal.m4</filename>,
<filename>config.guess</filename>, <filename>config.h.in</filename>,
<filename>config.sub</filename>, <filename>configure</filename>,
<filename>depcomp</filename>, <filename>install-sh</filename>,
<filename>ltmain.sh</filename>, and <filename>Makefile.in</filename> may be
ignored. You may delete them before running <command>diff</command> on the
source for inspection.
</para>
</section>
<section id="newupstream"><title>New upstream release</title>
<para>
If a package <systemitem role="package"><replaceable>foo</replaceable></systemitem> is properly packaged
in the newer <literal>3.0 (native)</literal> or <literal>3.0 (quilt)</literal>
formats, packaging a new upstream version is essentially moving the old
<filename>debian</filename> directory to the new source. This can be done by
running <literal>tar xvzf
/<replaceable>path</replaceable>/<replaceable>to</replaceable>/<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.debian.tar.gz</literal>
in the new extracted source. <footnote><para> If a package <systemitem role="package"><replaceable>foo</replaceable></systemitem> is packaged in the
old <literal>1.0</literal> format, this can be done by running <literal>zcat
/<replaceable>path</replaceable>/<replaceable>to</replaceable>/<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.diff.gz|patch
-p1</literal> in the new extracted source, instead. </para> </footnote> Of
course, you need to do some obvious chores:
</para>
<itemizedlist>
<listitem>
<para>
Create a copy of the upstream source as the
<filename>foo_<replaceable>newversion</replaceable>.orig.tar.gz</filename> file.
</para>
</listitem>
<listitem>
<para>
Update the Debian <filename>changelog</filename> file with <literal>dch -v
<replaceable>newversion</replaceable>-<replaceable>1</replaceable></literal>.
</para>
<itemizedlist>
<listitem>
<para>
Add an entry with <literal>New upstream release</literal>.
</para>
</listitem>
<listitem>
<para>
Describe concisely the changes <emphasis>in the new upstream release</emphasis>
that fix reported bugs and close those bugs by adding <literal>Closes: #<replaceable>bug_number</replaceable></literal>.
</para>
</listitem>
<listitem>
<para>
Describe concisely the changes <emphasis>to the new upstream release</emphasis>
by the maintainer that fix reported bugs and close those bugs by adding <literal>Closes: #<replaceable>bug_number</replaceable></literal>.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
<literal>while dquilt push; do dquilt refresh; done</literal> to apply all
patches while removing <emphasis>fuzz</emphasis>.
</para>
</listitem>
</itemizedlist>
<para>
If the patch/merge did not apply cleanly, inspect the situation (clues are left
in <filename>.rej</filename> files).
</para>
<itemizedlist>
<listitem>
<para>
If a patch you applied to the source was integrated into the upstream source,
</para>
<itemizedlist>
<listitem>
<para>
<literal>dquilt delete</literal> to remove it.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
If a patch you applied to the source conflicted with new changes in the
upstream source,
</para>
<itemizedlist>
<listitem>
<para>
<literal>dquilt push -f</literal> to apply old patches while forcing rejects as
<filename><replaceable>baz</replaceable>.rej</filename>.
</para>
</listitem>
<listitem>
<para>
Edit the <filename><replaceable>baz</replaceable></filename> file manually to
bring about the intended effect of
<filename><replaceable>baz</replaceable>.rej</filename>.
</para>
</listitem>
<listitem>
<para>
<literal>dquilt refresh</literal> to update the patch.
</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>
Continue as usual with <literal>while dquilt push; do dquilt refresh; done</literal>.
</para>
</listitem>
</itemizedlist>
<para>
This process can be automated using the <citerefentry>
<refentrytitle>uupdate</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
command as follows:
</para>
<screen>
$ apt-get source <replaceable>foo</replaceable>
...
dpkg-source: info: extracting <replaceable>foo</replaceable> in <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>
dpkg-source: info: unpacking <replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.orig.tar.gz
dpkg-source: info: applying <replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.debian.tar.gz
$ ls -F
<replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>/
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.debian.tar.gz
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.dsc
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.orig.tar.gz
$ wget http://example.org/<replaceable>foo</replaceable>/<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>.tar.gz
$ cd <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>
$ uupdate -v <replaceable>newversion</replaceable> ../<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>.tar.gz
$ cd ../<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>
$ while dquilt push; do dquilt refresh; done
$ dch
... document changes made
</screen>
<para>
If you set up a <filename>debian/watch</filename> file as described in <xref linkend="watch"/>, you can skip the <command>wget</command> command. You
simply run <citerefentry> <refentrytitle>uscan</refentrytitle>
<manvolnum>1</manvolnum> </citerefentry> in the
<filename><replaceable>foo</replaceable>-<replaceable>oldversion</replaceable></filename>
directory instead of the <command>uupdate</command> command. This will
<emphasis>automagically</emphasis> look for the updated source, download it,
and run the <command>uupdate</command> command. <footnote><para> If the
<command>uscan</command> command downloads the updated source but it does not
run the <command>uupdate</command> command, you should correct the
<filename>debian/watch</filename> file to have <literal>debian
uupdate</literal> at the end of the URL. </para> </footnote>
</para>
<para>
You can release this updated source by repeating what you did in <xref linkend="completebuild"/>, <xref linkend="checkit"/>, and <xref linkend="upload"/>.
</para>
</section>
<section id="packagestyle"><title>Updating the packaging style</title>
<para>
Updating the package style is not a required activity for the update of a
package. However, doing so lets you use the full capabilities of the modern
<systemitem role="package">debhelper</systemitem> system and the <literal>3.0</literal>
source format. <footnote><para> If your sponsor or other
maintainers object to updating the existing packaging style, don't bother
arguing. There are more important things to do. </para>
</footnote>
</para>
<itemizedlist>
<listitem>
<para>
If you need to recreate deleted template files for any reason, you can run
<command>dh_make</command> again in the same Debian package source tree with
the <literal>--addmissing</literal> option. Then edit them appropriately.
</para>
</listitem>
<listitem>
<para>
If the package has not been updated to use the <systemitem role="package">debhelper</systemitem> v7+ <command>dh</command> syntax for the
<filename>debian/rules</filename> file, update it to use <command>dh</command>.
Update the <filename>debian/control</filename> file accordingly.
</para>
</listitem>
<listitem>
<para>
If you want to update the <filename>rules</filename> file created with the
<filename>Makefile</filename> inclusion mechanism of the Common Debian Build
System (<systemitem role="package">cdbs</systemitem>) to the
<command>dh</command> syntax, see the following to understand its
<literal>DEB_*</literal> configuration variables.
</para>
<itemizedlist>
<listitem><para>local copy of <filename>&cdbs-doc;</filename></para></listitem>
<listitem><para><ulink url="&cdbs-tutorial;">The Common Debian Build System (CDBS), FOSDEM 2009</ulink></para></listitem>
</itemizedlist>
<!--
<footnote><para> In the
<systemitem role="package">cdbs</systemitem> (0.4.74) package, there are some
negative descriptions of the <filename>rules</filename> file created by the
<command>dh_make</command> command for the non-<systemitem role="package">cdbs</systemitem> choices. Do not worry about it. It applies
only for <literal>lenny</literal> which created explicit targets with long lists
of <command>dh_*</command> commands. </para> </footnote>
-->
</listitem>
<listitem>
<para>
If you have a <literal>1.0</literal> source package without the
<filename><replaceable>foo</replaceable>.diff.gz</filename> file, you can
update it to the newer <literal>3.0 (native)</literal> source format by
creating <filename>debian/source/format</filename> with <literal>3.0
(native)</literal>. The rest of the <filename>debian/*</filename> files can just be
copied.
</para>
</listitem>
<listitem>
<para>
If you have a <literal>1.0</literal> source package with the
<filename><replaceable>foo</replaceable>.diff.gz</filename> file, you can
update it to the newer <literal>3.0 (quilt)</literal> source format by creating
<filename>debian/source/format</filename> with <literal>3.0 (quilt)</literal>.
The rest of the <filename>debian/*</filename> files can just be copied. Import the
<filename>big.diff</filename> file generated by the command <literal>filterdiff -z -x
'*/debian/*' <replaceable>foo</replaceable>.diff.gz > big.diff</literal>
to your <command>quilt</command> system, if needed. <footnote><para>
You can split <filename>big.diff</filename> into many small incremental patches
using the <command>splitdiff</command> command. </para> </footnote>
</para>
</listitem>
<listitem>
<para>
If it was packaged using another patch system such as <systemitem role="package">dpatch</systemitem>, <systemitem role="package">dbs</systemitem>, or <systemitem role="package">cdbs</systemitem> with <literal>-p0</literal>,
<literal>-p1</literal>, or <literal>-p2</literal>, convert it to
<systemitem role="package">quilt</systemitem> using
<filename>deb3</filename> at <ulink url="&deb3;"/>.
</para>
</listitem>
<listitem>
<para>
If it was packaged with the <command>dh</command> command with the
<literal>--with quilt</literal> option or with the
<command>dh_quilt_patch</command> and <command>dh_quilt_unpatch</command>
commands, remove these and make it use the newer <literal>3.0
(quilt)</literal> source format.
</para>
</listitem>
</itemizedlist>
<para>
You should check <ulink url="&dep;">DEP - Debian Enhancement Proposals</ulink> and adopt ACCEPTED proposals.
</para>
<para>
You need to do the other tasks described in <xref linkend="newupstream"/>, too.
</para>
</section>
<section id="utf8"><title>UTF-8 conversion</title>
<para>
If upstream documents are encoded in old encoding schemes, converting them to <ulink url="&utf8;">UTF-8</ulink> is a good idea.
</para>
<itemizedlist>
<listitem>
<para>
Use <citerefentry> <refentrytitle>iconv</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> to convert encodings of plain text files.
</para>
<screen>
iconv -f latin1 -t utf8 <replaceable>foo_in.txt</replaceable> > <replaceable>foo_out.txt</replaceable>
</screen>
</listitem>
<listitem>
<para>
Use <citerefentry> <refentrytitle>w3m</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> to convert from HTML files to UTF-8 plain text files. When you do this, make sure to execute it under UTF-8 locale.
</para>
<screen>
LC_ALL=en_US.UTF-8 w3m -o display_charset=UTF-8 \
-cols 70 -dump -no-graph -T text/html \
< <replaceable>foo_in.html</replaceable> > <replaceable>foo_out.txt</replaceable>
</screen>
</listitem>
</itemizedlist>
</section>
<section id="reminders"><title>Reminders for updating packages</title>
<para>
Here are a few reminders for updating packages:
</para>
<itemizedlist>
<listitem>
<para>
Preserve old <filename>changelog</filename> entries (sounds obvious, but there
have been cases of people typing <literal>dch</literal> when they should have typed
<literal>dch -i</literal>.)
</para>
</listitem>
<listitem>
<para>
Existing Debian changes need to be reevaluated; throw away stuff that upstream
has incorporated (in one form or another) and remember to keep stuff that
hasn't been incorporated by upstream, unless there is a compelling reason not
to.
</para>
</listitem>
<listitem>
<para>
If any changes were made to the build system (hopefully you'd know from
inspecting upstream changes) then update the <filename>debian/rules</filename>
and <filename>debian/control</filename> build dependencies if necessary.
</para>
</listitem>
<listitem>
<para>
Check the <ulink url="&bts;">Debian Bug Tracking
System (BTS)</ulink> to see if someone has provided patches to bugs that are
currently open.
</para>
</listitem>
<listitem>
<para>
Check the contents of the <filename>.changes</filename> file to make sure you
are uploading to the correct distribution, the proper bug closures are listed
in the <literal>Closes</literal> field, the <literal>Maintainer</literal> and
<literal>Changed-By</literal> fields match, the file is GPG-signed, etc.
</para>
</listitem>
</itemizedlist>
</section>
</chapter>
|