4 佐々木流 Debian パッケージの作り方。 最初から最後まで

佐々木洋 平

PIC
____________________________________________________________________

4.1 は じ め に

... なんて大それたタイトルなんでしょう.. 私事で忙しくて訂正できなかった訳ですが、 我ながら恥ずしい です。

さて、 佐々木のパッケージ作成遍歴は以下の通りです:

  1. 売り物ソフトウェアを dpkg で管理するために弄り始める
  2. 自分達の作っているソフトウェアの deb パッケージを作成し始める。
  3. どうせなら本家に... ←イマココ

今日のお話は、 これらを踏まえての「パッケージ作成最初から最後まで」 です。 ここでは「最初」 を「ソースの取得」 、 「最後」 を「lintian & piuparts clean」 とします。 個々の How to、 特に一番ハマりやすい debian/rulesについては時間の紙面の都 合上参考文献へのポインタを示すに留めます。 是非質問して下さい。

4.2 Package

コンパイル後のソフトウェアなどをすぐ利用できる形にまとめたものをバイナリパッケージと呼びます。 Debian では拡張子が .deb のファイルがこれにあたります。 我々は普段 apt-getやaptitude を利用して、 バイナリパッケージを導入/更新/削除 したりしています。 バイナリパッケージは制御情報とデータを tar.gzに圧縮し、 バージョン情報とともに ar(1) でまとめた ものです。 これらは非常に一般的なコマンドですから、 バイナリパッケージを展開するだけならば多くのシステムで可能 です。

バ イ ナ リ パ ッケ ー ジ に 対 し て 、 こ れ を 作 成 す る た め の 素 材 を ま と め た も の を ソ ー ス パ ッケ ー ジ と 言 い ま す 。 こ れ は 二つないし 三つのファイルからなります:

ソースパッケージは導入したり削除したりする性質のパッケージではありません。 目的はバイナリパッケージの作成にあります。 Debian が提供しているバイナリパッケージには、 対応するソースパッケージが必ず存在しており、 必要に応じてソースパッ ケージを取得してバイナリパッケージを構築することができます。

4.2.1 deb package inside

dpkg-deb コマンドを利用して、 実際にパッケージを展開してみましょう。 例えば rabbit*3 というパッケージの deb ファイルを展開してみると...

  % dpkg-deb -x rabbit_0.6.1-1_all.deb rabbit
                 (rabbit  というパッケージを rabbit  というディレクトリに展開)
  % dpkg-deb -e rabbit_0.6.1-1_all.deb rabbit/DEBIAN
                 (rabbit  パッケージの制御情報を rabbit/DEBIAN  に展開)
  % cd rabbit ls
  DEBIAN/  usr/
  % tree
  .
  |-- DEBIAN
  |   |-- control
  |   |-- md5sums
  |   ‘-- preinst
  ‘-- usr
      |-- bin
      |   |-- rabbit
-------- snip ---------------
      |   ‘-- rabbit-theme-manager
      |-- lib
      |   ‘-- ruby
      |       ‘-- 1.8
      |           |-- rabbit
-------- snip ---------------
      |
      ‘-- share
          |-- doc
          |   ‘-- rabbit
          |       |-- NEWS.en.gz -> changelog.gz
-------- snip ---------------
          |       |-- README.Debian
          |       |-- README.en.gz
          |       |-- README.ja.gz
          |       |-- changelog.Debian.gz
          |       |-- changelog.gz
-------- snip ---------------
          ...
179 directories, 575 files

パッケージの制御情報は DEBIAN 以下に展開しました。 rabbit の場合、

  % ls -R DEBIAN
  DEBIAN:
  control  md5sums  preinst*

の三つからなります。 これらは

control
メンテナの名前、 対応するソースパッケージ名、 依存関係などが記述されたファイル
md5sums
提供される各ファイルの md5 checksum
preinst
インストール作業の前に実行される hook シェルスクリプト。 パッケージによっては、 preinst 以外に postinst、 prerm、 postrm などが存在します。

パッケージのデータは usr 以下に展開しました。 deb パッケージを導入した際には、 これらは /usr 以下に展開され ます。

というわけで上記構成になったディレクトリツリーを用意して tar.gz で圧縮したりするとバイナリパッケージができあがり ます。

4.2.2 余談: dpkg-deb でパッケージを再構築

売り物の (ソースが取得できない) ソフトウェアを Debian のパッケージシステムで管理したい時に佐々木がよくやる手 段は

として、 似非パッケージを作成することです。 当然配布はできません が*4 例と して、 大昔の Intel Compiler Ver.8 のパッケージ作成は以下の様にやっていました。

 % tar xvzf l_cc_pc_8.1.028.tar.gz
 % cd l_cc_pc_8.1.028
 % rm -rf *64*
 % sudo alien *.rpm
 % rm *.rpm
 % sudo chown $USER *.deb
 % mkdir tmp
 % dpkg-deb -e intel-icc8_8.1-29_i386.deb tmp/DEBIAN
 % dpkg-deb -x intel-icc8_8.1-29_i386.deb tmp/
 % echo DESTINATION=/opt/‘ls tmp/opt‘ >> tmp/DEBIAN/postinst
 % cat <<EOF >> tmp/DEBIAN/postinst
  for FILE in $(find $DESTINATION/bin/ -regex \
     ’.*[ei](cc|fort|fc|cpc)$\|.*cfg$\|.*pcl$\|.*vars[^/]*.c?sh$’ \
     2> /dev/null) do
      sed s@\@$DESTINATION@g $FILE > ${FILE}.abs
      mv ${FILE}.abs $FILE
      chmod 755 $FILE
  done
  for FILE in $(find $DESTINATION/bin/ -regex ’.*[ei]cc’ 2> /dev/null) do
      sed s@\@$DESTINATION@g $FILE > ${FILE}.abs
      mv ${FILE}.abs $FILE
      chmod 755 $FILE
  done
  for FILE in $(find $DESTINATION/bin/ -regex ’.*[ei]cpc’ 2> /dev/null) do
      sed s@\@$DESTINATION@g $FILE > ${FILE}.abs
      mv ${FILE}.abs $FILE
      chmod 755 $FILE
  done
  for FILE in $(find $DESTINATION/bin/ -regex ’.*[ei]fort’ 2> /dev/null) do
      sed s@\@$DESTINATION@g $FILE > ${FILE}.abs
      mv ${FILE}.abs $FILE
      chmod 755 $FILE
  done
  for FILE in $(find $DESTINATION/bin/ -regex ’.*[ei]fc’ 2> /dev/null) do
      sed s@\@$DESTINATION@g $FILE > ${FILE}.abs
      mv ${FILE}.abs $FILE
      chmod 755 $FILE
  done
 EOF
 % dpkg-deb -b tmp intel-icc8_8.1-29_i386.deb
 % dpkg -i intel-icc8_8.1-29_i386.deb
 % dpkg -i intel-iidb8_8.1-46_i386.deb
 % dpkg -i --force-overwrite intel-isubh8_8.1-29_i386.deb

最近は Intel Compiler に愛がない*5 の でやっていませんが。

4.3 パッケージ作成

さて、 単にバイナリパッケージを作成するだけならば前小節 (4.2.2) で示した通り

を作成して dpkg-deb でまとめれば良いだけです。 ですが、 あんまり一般的ではありませんね。 以下では、 GNU hello を例 に*6 、 実 際に配布まで含めたパッケージ作成方法について述べてみます。

4.3.1 前準備

環境変数の設定 パッケージメンテナの名前とメールアドレスを環境変数に設定します:

DEBFULLNAME="Youhei SASAKI"; export DEBFULLNAME
DEBEMAIL=uwabami@gfd-dennou.org ; export DEBEMAIL

配布も考えているなら GPG 鍵の記述に合わせておくと良いと思います。

最低限必要なパッケージの導入 build-essential メタパッケージを導入しておきます。 このパッケージは deb パッケージを構築するのに最低限必要とな るパッケージを導入するメタパッケージです。 具体的には

  1. libc6-dev—libc-dev
  2. g++
  3. make
  4. dpkg-dev

とこれに依存する幾つかのファイルが導入されます*7 。

% apt-cache show build-essential
Package: build-essential
Priority: optional
Section: devel
Installed-Size: 48
Maintainer: Matthias Klose <doko@debian.org>
Architecture: amd64
Version: 11.4
Depends: libc6-dev | libc-dev, g++ (>= 4:4.3.1), make, dpkg-dev (>= 1.13.5)
Filename: pool/main/b/build-essential/build-essential_11.4_amd64.deb
Size: 7126
MD5sum: 86a942017ad93721c91212398a828a0c
SHA1: 5ac2ba90444e1eaed96b2163389a8812eb107b01
SHA256: 3dbd2e6b4e998412a6ad4d32b242523559b536168bcce7f227c7ce30256808a5
Description: Informational list of build-essential packages
 If you do not plan to build Debian packages, you don’t need this
 package.  Starting with dpkg (>= 1.14.18) this package is required
 for building Debian packages.
 .
 This package contains an informational list of packages which are
 considered essential for building Debian packages.  This package also
 depends on the packages on that list, to make it easy to have the
 build-essential packages installed.
 .
----- snip -----
% sudo aptitude install build-essential

ソースの取得、 確認 動かないソフトウェアをパッケージ化するのは大変ですよね? 事前にソースを取得して動作確認しておくと良いでしょう。 また「動作させるために patch を書いた!」 という猛者は、 そのパッチを保管しておくと幸せになれるかもしれま せん。

GNU hello は次の URL から取得できます。 http://www.gnu.org/software/hello/

GNU hello は configure ; make ; make install で導入するソフトウェアです。 実際に configure を動かしてみます。

% cd hello-2.4
% ./configure
...

エラーがでなければこれで終了です。 もし./configure が必要なファイルを探せずエラー終了する場合には、 apt-file コ マンドで必要なファイルを提供している Debian パッケージを探してみましょう。

% sudo aptitude install apt-file
% sudo apt-file update
% apt-file search [file  名]

足りないファイルを導入したら、 もう一度 ./configure を走らせます。 これをくりかえして、 必要なファイルを導入して いきます。

無事 ./configure が通るようになったらmake を実行してみます。

% make
make all-recursive
make[1]: Entering directory ‘/home/uwabami/Desktop/hello-2.4’
Making all in contrib
make[2]: Entering directory ‘/home/uwabami/Desktop/hello-2.4/contrib’
make[2]: Nothing to be done for ‘all’.
make[2]: Leaving directory ‘/home/uwabami/Desktop/hello-2.4/contrib’
...
make[2]: Entering directory ‘/home/uwabami/Desktop/hello-2.4’
make[2]: Leaving directory ‘/home/uwabami/Desktop/hello-2.4’
make[1]: Leaving directory ‘/home/uwabami/Desktop/hello-2.4’

コンパイルも正常に終了したので、 試しに実行してみます。

% ./src/hello
% ./src/hello -t
% ./src/hello -g "Good Night。 .."

ここまでがパッケージ作成前の動作確認作業です。

実際に配布するためのパッケージを作成する場合には、 動作確認以外にも Copyright や License を確認しておくべき で す 。

4.3.2 パッケージ作成

雛形の作成 dh_makeコマンドでパッケージの雛形を作成します。 dh_makeは、 dh-makeパッケージで提供されていますので、 これを導 入します

% sudo aptitude install dh-make
% dh_make --help
dh_make - prepare Debian packaging for an original source archive, version 0.50

Copyright (C) 1998-2009 Craig Small <csmall@debian.org>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  Usage: dh_make [options]
  -c, --copyright <type>    use <type> of license in copyright file
                            (apache|artistic|bsd|gpl|gpl2|gpl3|lgpl|lgpl2|lgpl3)
      --dpatch              using dpatch to maintain patches
      --quilt               using quilt to maintain patches
  -e, --email <address>     use <address> as the maintainer e-mail address
  -n, --native              the program is Debian native, don’t generate .orig
  -f, --file <file>         specify file to use as the original source archive
  -r, --createorig          make a copy for the original source archive
  -s, --single              set package class to single
  -i, --indep                           set package class to arch-independent
  -m, --multi               set package class to multiple binary
  -l, --library             set package class to library
  -k, --kmod                set package class to kernel module
      --kpatch              set package class to kernel patch
  -b, --cdbs                set package class to cdbs
  -a, --addmissing          reprocess package and add missing files
  -t, --templates <dir>      apply customizing templates in <dir>
  -d  --defaultless         skip the default debian and package class templates
  -o, --overlay <dir>       reprocess package using template in <dir>
  -p, --packagename <name>  force package name to be <name>
  -h, --help                display this help screen and exit
  -v, --version             show the version and exit

By Craig Small <csmall@debian.org>
Based on deb-make by Christoph Lameter <clameter@debian.org>.
Custom template support by Bruce Sass <bmsass@shaw.ca>.

ここでは

–createorig, -r
オリジナルのソースファイル (.orig.tar.gz) を作成する
–copyright gpl, -c gpl
ソースのライセンスが gpl3 なので。 ライセンスが代表的なモノの場合、 指定しておくと雛形 の時点で結構できあがっていて、 非常に楽です。
–single, -s
シングルバイナリのパッケージを作成します。 ライブラリの場合には -l としてすると良いでしょう。
–cdbs, -b
CDBS(後述) を使用するので指定します。
–quilt, –dpatch
パッチを当てることが決まっているのであれば--dpatch もしくは--quilt を指定しておくと良い でしょう。 今回は指定しません。

以下のコマンドを実行します。

% dh_make --createorig --copyright gpl --single --cdbs
(もしくは)
% dh_make -r -c gpl -s -b

実行すると以下のようなメッセージが表示されるので、 確認して Enter を押します。

Maintainer name : Youhei SASAKI
Email-Address   : uwabami@gfd-dennou.org
Date            : Sun, 25 Oct 2009 00:08:43 +0900
Package Name    : hello
Version         : 2.4
License         : gpl3
Using dpatch    : no
Using quilt     : no
Type of Package : cdbs
Hit <enter> to confirm:

うまく動作すると、 debian ディレクトリができ、 このディレクトリ以下に雛形 (.ex, .EX) ができます。 debian ディレクト リは以下のような状態になっています。

.
|-- README.Debian        (パッケージの README)
|-- changelog            (パッケージのチェンジログ)
|-- compat               (パッケージのバージョン)
|-- control              (パッケージ情報)
|-- copyright            (パッケージのコピーライト情報)
|-- cron.d.ex            (パッケージで cron  を使う場合の設定ファイル)
|-- dirs                 (パッケージでデータを配置するディレクトリ名の設定)
|-- docs                 (パッケージに含めるドキュメントファイルを指定する)
|-- emacsen-install.ex   (emacs  用設定ファイル)
|-- emacsen-remove.ex    (emacs  用設定ファイル)
|-- emacsen-startup.ex   (emacs  用設定ファイル)
|-- hello.default.ex     (パッケージで debfonf  を使う場合の設定ファイル)
|-- hello.doc-base.EX    (パッケージで doc-base  を使う場合の設定ファイル)
|-- init.d.ex            (パッケージで init.d  を使う場合の設定ファイル)
|-- init.d.lsb.ex        (パッケージで init.d  を使う場合の設定ファイル)
|-- manpage.1.ex         (manpage  の雛形)
|-- manpage.sgml.ex      (manpage  の雛形)
|-- manpage.xml.ex       (manpage  の雛形)
|-- menu.ex              (メニューの雛形)
|-- postinst.ex          (postinst メンテナファイルの雛形)
|-- postrm.ex            (postrm メンテナファイルの雛形)
|-- preinst.ex           (preinst メンテナファイルの雛形)
|-- prerm.ex             (prerm メンテナファイルの雛形)
|-- rules                (パッケージビルドスクリプト)
‘-- watch.ex             (アップストリームチェック用ファイル)

ちなみにパッケージを作成する場合にはこのディレクトリの中以外は触りません。 オリジナルのソースに変更を加える場合に はquilt や dpatch 等のパッチシステムを利用すると良いでしょう。

今回はおもむろに .ex, .EX を削除します。

% rm -f debian/*.ex debian/*.EX

CDBS パッケージの実際の構築は debian/rules で行なわれます。 debian/rules はいわゆる Makefile ですので、 make の文法 で必要となる設定を行なっていきます。

GNU hello は./configure ; make ; make install で install しますのでこの場合は cdbs を使用した方が幸せになれま す*8 。 dh_make に -b を指定した場合、 debian/rules は次の様になっています。

 #!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk


# Add here any variable or target overrides you need.

include されているのは

という命令セットです。

CDBS の詳細については、 例えば [CDBS 1st step]、 [Online CDBS Gallery]、 [CDBS Documentation Rev. 0.4.0]を参 照下さい。

rules の調整 ここで一旦バイナリパッケージを作成してみましょう。

  % sudo aptitude install fakeroot
  % fakeroot debian/rules binary
  ...

rules の binary ターゲットを実行することで、 ソースの一つ上のディレクトリにバイナリパッケージが作成されます。 この 時点ではバイナリパッケージには見向きもせずdebian ディレクトリの下に生成されるdebian/hello 以下を確認します。

|-- DEBIAN
|   |-- control
|   ‘-- md5sums
‘-- usr
    |-- local
    |   |-- bin
    |   |   ‘-- hello
    |   ‘-- share
    |       |-- info
    |       |   ‘-- hello.info
    |       |-- locale
    |       |   |-- bg
    |       |   |   ‘-- LC_MESSAGES
    |       |   |       ‘-- hello.mo
--------- snip -------------------
...
103 directories, 61 files

hello が /usr/local/bin に install されています。 これは変ですよね? build 時の log を注意深く見ていると、 configure 実行時に --prefix が指定されておらず、 /usr/local 以下に設定されています。

よってcdbs に対して configure 実行時に --prefix=/usr を指定するようにします。

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_EXTRA_FLAGS:= --prefix=/usr

もういちど fakeroot debian/rules binary を実行します。 これを繰り返して、 ファイルが望んだ配置になるまで debian/rules を修正していきます。

制御情報の編集 具体的には

  1. debian/control
  2. debian/changelog
  3. debian/copyright

の三つです。 特記事項が無いならば debian/README.Debian は削除しても良いでしょう。

control の例:

Source: hello
Section: devel
Priority: optional
Maintainer: Youhei SASAKI <uwabami@gfd-dennou.org>
Build-Depends: cdbs, debhelper (>= 7), autotools-dev
Standards-Version: 3.8.3
Homepage: http://www.gnu.org/software/hello

Package: hello
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: The classic greeting, and a good example
 The GNU hello program produces a familiar, friendly greeting.  It
 allows non-programmers to use a classic computer science tool which
 would otherwise be unavailable to them.
 .
 Seriously, though: this is an example of how to do a Debian package.
 It is the Debian version of the GNU Project’s ‘hello world’ program
 (which is itself an example for the GNU Project).

changelog の例:

% cat debian/changelog
hello (2.4-1) unstable; urgency=low

  * Initial release

 -- Youhei SASAKI <uwabami@gfd-dennou.org>  Sun, 25 Oct 2009 00:08:43 +0900

雛形には ITP のバグ番号を記述するところがあります。 ITP している場合には埋めておくと良いと思い ます。

copyright の例:

This work was packaged for Debian by:

    Youhei SASAKI <uwabami@gfd-dennou.org> on Sun, 25 Oct 2009 00:08:43 +0900

It was downloaded from:

    http://www.gnu.org/software/hello/

Upstream Author:

Authors of GNU Hello.

  Copyright (C) 1999, 2005, 2006 Free Software Foundation, Inc.

  Copying and distribution of this file, with or without modification,
  are permitted in any medium without royalty provided the copyright
  notice and this notice are preserved.

The following contributions warranted legal paper exchanges with the
Free Software Foundation.  See also the ChangeLog and THANKS files.

Mike Haertel
David MacKenzie
Jan Brittenson
Roland McGrath
Charles Hannum
Bruce Korb              hello.c, configure.ac.
Karl Eichwalder         all files.
Karl Berry              all files.
The King                releases.

License:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This package is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

On Debian systems, the complete text of the GNU General
Public License version 3 can be found in ‘/usr/share/common-licenses/GPL-3’.

The Debian packaging is:

    Copyright (C) 2009 Youhei SASAKI <uwabami@gfd-dennou.org>

and is licensed under the GPL version 3, see above.

ソースに AUTHORS とか COPYING とかある場合には、 編集が非常に楽ですね。

debuild, lintian バイナリパッケージとソースパッケージの作成、 パッケージのポリシー違反の確認を行ないます。 devscriptsとlinitian を導入します。

% sudo aptitude install debuild lintian

その後、 debuild コマンドを実行します:

% debuild -rfakeroot -uc -us
...
W: hello source: configure-generated-file-in-source config.status
W: hello source: configure-generated-file-in-source config.log
W: hello: new-package-should-close-itp-bug
Finished running lintian.

-uc、 -us は GPG サインをしない設定です。 GPG でサインする場合にはこのオプションを省略して下 さい。

最後に出てきたのが lintian によるチェック結果です。 これを解決しましょう。 最後の ITP は今回しょうがないですが、 上の二つは config.status、 config.log を clean ターゲットが呼ばれた時に消去するようにすれば良いのです

% cat debian/rules
#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/autotools.mk

DEB_CONFIGURE_EXTRA_FLAGS:= --prefix=/usr

clean::
rm -f config.status config.log

この後でもう一度 debuild してみます。

% debuild -rfakeroot -uc -us
...
dpkg-deb: ‘../hello_2.4-1_amd64.deb’  にパッケージ ‘hello’  を構築しています。
 dpkg-genchanges  >../hello_2.4-1_amd64.changes
dpkg-genchanges: including full source code in upload
dpkg-buildpackage: full upload (original source is included)
Now running lintian...
W: hello: new-package-should-close-itp-bug
Finished running lintian.

ITP したならば、 debian/changelog に ITP の番号を書いておくと最後の warning も消せますね。

これでオシマイ。 メデタシメデタシ…ではありません。

4.4 パッケージのビルド・インストールテスト

まず、 ビルドテストを行ないます。 ビルドテストは大雑把に言えば、 ソースパッケージを元に

ことをテストします。

ビルドテストには pbuilder を使用します。 pbuilder は必要最小限の Debian パッケージが導入された環境 の tar.gz を用いて、 パッケージのビルド時にその tar.gz を展開し chroot してパッケージの作成を行ない ます。

まずは pbuilder 環境を導入します

% sudo aptitude install pbuilder
% sudo pbuilder  --create --distribution sid

ちょっと時間がかかりますが気長に待ちます。 これによって /var/cache/pbuilder/base.tgz が生成されます。 これを使用し てビルドテストを行ないます。

% sudo pbuilder --build --distribution sid --basetgz /var/cache/pbuilder/base.tgz hello_2.4-1.dsc

無事に build テストが通りましたか? きちんとパッケージができているなら/var/cache/pbuilder/result 以下にパッ ケージが置かれています。

さてパッケージのビルドテストが通ったら、 次はインストール/アンインストールテストです。 これには piupartsパッケー ジを使用します。

% sudo aptitude install piuparts

piuparts も pbuilder と同様に最低限の環境からインストール/アンインストールテストを実行します。 pbuilder で作成し た base.tgz を使用してみましょう。

% sudo piuparts -d sid -b /var/cache/pbuilder/base.tgz hello_2.4-1_amd64.deb
...
0m50.1s DEBUG: No broken symlinks as far as we can find.
0m51.3s INFO: PASS: Installation, upgrade and purging tests.
0m51.3s DEBUG: Starting command: [’chroot’, ’/tmp/tmpZ2-nup’, ’umount’, ’/proc’]
0m51.3s DEBUG: Command ok: [’chroot’, ’/tmp/tmpZ2-nup’, ’umount’, ’/proc’]
0m51.7s DEBUG: Removed directory tree at /tmp/tmpZ2-nup
0m51.7s INFO: PASS: All tests.
0m51.7s INFO: piuparts run ends.

ここまできたらパッケージは一通り作成完了です。

4.5 まとめ

というわけで GNU hello を題材にパッケージ作成を最初から最後まで眺めてみました。 実際には、 単一のソースから複数の バイナリパッケージを作成したり、 ライブラリパッケージ (共有ライブラリ、 静的ライブラリ + ヘッダ、 デバッグ シンボル) を作成したり、 カーネルパッケージを作成したり、 と覚える事は一杯あります。 ですが、 必要 になったらその都度覚える、 で良いのではないでしょうか? 大丈夫です。 lintian がちゃんと怒ってくれ ます。

あ と 、 個 人 的 に は 魔 法 の 様 な debhelper の使い方を取得したいです。 例えば、 先日 unstable に入った libdap パッケー ジの debian/rules はこれだけなんですよ:

#!/usr/bin/make -f

DEB_CONFIGURE_EXTRA_FLAGS := --with-gnu-ld

# The magic debhelper rule:
%:
dh --with quilt $@

override_dh_auto_configure:
# remove out of date files
rm -f conf/config.guess conf/config.sub
autoreconf -fi
dh_auto_configure

build:
dh build
$(MAKE) docs

clean:
dh clean
rm -rf docs

これもスゴいなぁと。 下手したら、 CDBS より覚えやすいんじゃないだろうか? とか。