ケイススタディ
入門 Debian パケジの 4.2.6 節をなぞってみる。
手順は以下との事
- ソース入手、展開
- dh_make で debian ディレクトリの雛形作成
- debian 配下の調整
- Debian ポリシと整合
- パケジ作成と lint なチェック
- インストールやアンインストールの動作確認
- パケジ導入後の動作確認
あるいはパケジ構築云々の前に普通にインストールしてみよ、ともある。そこでチェックすべきは
- 必要な開発環境
- configure のオプション等
- make のオプション等
との事。そろそろ出かけるんですが、手を付けてみる。
hello の入手
$ wget ftp://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz --10:31:29-- ftp://ftp.gnu.org/gnu/hello/hello-2.1.1.tar.gz => `hello-2.1.1.tar.gz' ftp.gnu.org をDNSに問いあわせています... 140.186.70.20 ftp.gnu.org|140.186.70.20|:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! (snip 10:31:35 (182.57 KB/s) - `hello-2.1.1.tar.gz' を保存しました [389363] $ ls hello-2.1.1.tar.gz $
で、展開
$ tar zxvf hello-2.1.1.tar.gz (略 $
で、dh_make
$ cd hello-2.1.1 $ dh_make bash: dh_make: command not found $
入ってない。ので入れる。build-essential だったか
# apt-get install -fy build-essential
でも駄目。dpkg-dev も入ってるんですが NG。dh_make は別なパケジになってる模様。
# apt-get install -fy dh-make
で、再度 dh_make
$ dh_make Type of package: single binary, multiple binary, library, kernel module or cdbs? [s/m/l/k/b]
あ、オプション入れたらナニ、と書いてあるな。リトライ
$ dh_make --single --copyright=gpl Maintainer name : rms Email-Address : rms@debian Date : Thu, 20 Mar 2008 10:38:41 +0900 Package Name : hello Version : 2.1.1 License : gpl Type of Package : Single Hit <enter> to confirm: Could not find hello_2.1.1.orig.tar.gz Either specify an alternate file to use with -f, or add --createorig to create one. $
あらら。テキストは sarge なのかな。etch だと微妙に違う?? --createorig すれば良いのだろうか。中途半端ですがそろそろ出かけます。
つづき
帰宅。確認作業続行。
$ dh_make -c gpl -s -r Maintainer name : rms Email-Address : rms@debian Date : Thu, 20 Mar 2008 17:10:10 +0900 Package Name : hello Version : 2.1.1 License : gpl Type of Package : Single Hit <enter> to confirm: Done. Please edit the files in the debian/ subdirectory now. hello uses a configure script, so you probably don't have to edit the Makefiles. $
debian ディレクトリができた。しかも一つ上に .orig なディレクトリもできている。
$ ls .. hello-2.1.1 hello-2.1.1.orig hello-2.1.1.tar.gz $
テキストでは以下を必要としてそれ以外を削除、との事。このあたりは case by case なのでしょうが、今回は書いてある通りで。
- changelog
- compat
- control
- copyright
- dirs
- docs
- info
- rules
あとは copyright と control を修正したら debuild でパケジ自体はできあがるはず。ただ、Debian なパスに格納、なソレは configure のオプションを適切に指定してさしあげる必要がある。hello だと以下かなぁ。
$ ./configure --prefix=/usr --sysconfdir=/etc
rules を見てみると以下になっている模様。
config.status: configure dh_testdir # Add here commands to configure the package. ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ --prefix=/usr --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" \ LDFLAGS="-Wl,-z,defs"
-
- sysconfdir を指定する必要があるんだろな。とりあえず修正して debuild してみた。
$ debuild bash: debuild: command not found $
げ。devscripts を入れれば良いのかな。インストール後、リトライ
$ debuild (中略 dpkg-buildpackage (debuild emulation): full upload (original source is included) Now signing changes and any dsc files... signfile hello_2.1.1-1.dsc rms <rms@debian> gpg: keyring `/home/rms/.gnupg/secring.gpg' created gpg: skipped "rms <rms@debian>": secret key not available gpg: [stdin]: clearsign failed: secret key not available debsign: gpg error occurred! Aborting.... debuild: fatal error at line 1155: running debsign failed $
しまった。テキストによれば -us -uc 付けれ、との事。リトライ
$ debuild -us -uc (中略 $
一応、lintian なエラーは出てなかった様子。gpg の鍵はきちんとしたのを持っておいた方が良いな。てか、lintian 本当に動いてるのかなぁ。もしかしてインストールされてない、とか??
$ dpkg --get-selections|grep lint xserver-xorg-video-glint install $
とほほ。インストールしてリトライ。
$ debuild -us -uc (中略 Now running lintian... W: hello source: maintainer-not-full-name rms E: hello source: maintainer-address-malformed rms <rms@debian> E: hello: description-is-dh_make-template E: hello: debian-changelog-file-contains-invalid-email-address rms@debian W: hello: wrong-bug-number-in-closes l3:#nnnn W: hello: maintainer-not-full-name rms E: hello: maintainer-address-malformed rms <rms@debian> W: hello: info-document-has-wrong-extension usr/share/info/dir.old.gz W: hello: info-document-missing-dir-section usr/share/info/dir.old.gz W: hello: info-document-missing-dir-section usr/share/info/dir.gz Finished running lintian. $
結構出てます。lintian で NG でもパケジはできる模様。
$ ls .. -lt 合計 900 -rw-r--r-- 1 rms rms 31835 2008-03-20 19:24 hello_2.1.1-1_i386.build -rw-r--r-- 1 rms rms 704 2008-03-20 19:24 hello_2.1.1-1_i386.changes -rw-r--r-- 1 rms rms 55638 2008-03-20 19:24 hello_2.1.1-1_i386.deb drwxr-xr-x 11 rms rms 4096 2008-03-20 19:24 hello-2.1.1 -rw-r--r-- 1 rms rms 20084 2008-03-20 19:24 hello_2.1.1-1.diff.gz -rw-r--r-- 1 rms rms 311 2008-03-20 19:24 hello_2.1.1-1.dsc -rw-r--r-- 1 rms rms 0 2008-03-20 19:15 hello_2.1.1-1.dsc.asc -rw-r--r-- 1 rms rms 392702 2008-03-20 19:15 hello_2.1.1.orig.tar.gz -rw-r--r-- 1 rms rms 389363 2008-03-20 10:31 hello-2.1.1.tar.gz $
むむ。とりあえず lintian な不具合から、なんでしょうがとりあえず別途ゆっくり、という事でエントリ投入。