Provided by: debhelper_12.7.3ubuntu1_all bug

名前

       dh - debhelper コマンドシーケンサー

書式

       dh sequence [--with addon[,addon ...]] [--list] [debhelper オプション]

説明

       dh は一連の debhelper コマンドを実行します。debian/rules ファイルに記載されたターゲットに
       対応する sequenceをサポートします。サポートするターゲット: build-arch, build-indep, build,
       clean, install-indep, install-arch, install, binary-arch, binary-indep, binary です。

override ターゲット

       dh が利用する debian/rules にて、override ターゲットを指定することで、呼び出される一連の処
       理途中で動作を変更できます。

       ターゲット dh_command を変更するためには、override_dh_command というターゲットを rule ファ
       イルに記載します。こちらが指定されていると、dh_command が動作する代わりに
       override_dh_command ターゲットを呼び出します。override ターゲットでは、コマンドにオプショ
       ンを追加したり、コマンド全てを置き換えたりできます。後に例を挙げます。

       アーキテクチャ依存パッケージを作るときのみ、あるいはアーキテクチャ非依存パッケージを作ると
       きのみ動作するように override ターゲットを定義することもできます。その場
       合、override_dh_command-arch や、override_dh_command-indep を使ってください (なお、この機
       能を使うには、Build-Depends 行で debhelper バージョン 8.9.7 以上を指定する必要がありま
       す)。

オプション

       --with addon[,addon ...]
           一連のコマンド中の適切な位置で実行するアドオンを、debhelper コマンドへ指定します。この
           オプションは繰り返し指定することもできますし、複数のアドオンをカンマ区切りで列挙して指
           定できます。このオプションは debhelper コマンドを提供するサードパーティ製パッケージと
           共に利用する時に使います。PROGRAMMING ファイルに、一連のアドオン用インターフェースにつ
           いてのドキュメントがあります。

           A Build-Depends relation on the package dh-sequence-addon implies a --with addon. This
           avoids the need for an explicit --with in debian/rules that only duplicates what is
           already declared via the build dependencies in debian/control.  The relation can
           (since 12.5) be made optional via e.g.  build-profiles.  This enables you to easily
           disable an addon that is only useful with certain profiles (e.g. to facilitate
           bootstrapping).

           Since debhelper 12.5, addons can also be activated in indep-only mode (via Build-
           Depends-Indep) or arch-only mode (via Build-Depends-Arch). Such addons are only active
           in the particular sequence (e.g. binary-indep) which simplifies dependency management
           for cross-builds.

           Please note that addons activated via Build-Depends-Indep or Build-Depends-Arch are
           subject to additional limitations to ensure the result is deterministic even when the
           addon is unavailable (e.g. during clean).  This implies that some addons are
           incompatible with these restrictions and can only be used via Build-Depends (or
           manually via debian/rules).  Currently, such addons can only add commands to
           sequences.

       --without addon
           --with とは逆に、指定されたアドオンを無効にします。このオプションは繰り返し指定するこ
           ともできますし、アドオン名をカンマ区切りで指定もできます。

       --list, -l
           利用可能なアドオン一覧を表示する。

           When called only with this option, dh can be called from any directory (i.e. it does
           not need access to files from a source package).

       --no-act
           指定された一連の処理でのコマンドを表示しますが、表示だけして実際にはコマンドは実行しま
           せん。

           通常、dh は何も実行しないであろうとわかっている動作コマンドをスキップすることに注意し
           てください。--no-act を指定すると、一連の動作内でのコマンド一覧をすべて出力します。

       dh に渡された他のオプションは、実行される各コマンドにも渡されます。これは、-v, -X, -N のよ
       うなオプションをセットするのに利用できます。また、他の特別なオプションについても同様となり
       ます。

使用例

       コマンドを実際には動作させず、一連の動作でどのコマンドが実行されるかを見る:

               dh binary-arch --no-act

       以下は非常にシンプルな rules ファイルです。ここではパッケージに対して追加オプション無しで
       デフォルトのコマンド群が呼び出されます。

               #!/usr/bin/make -f
               %:
                       dh $@

       特定の debhelper コマンドへオプションを渡したい事がよくあります。これを簡単に行う方法
       は、そのコマンドへ override を追加することです。

               #!/usr/bin/make -f
               %:
                       dh $@

               override_dh_strip:
                       dh_strip -Xfoo

               override_dh_auto_configure:
                       dh_auto_configure -- --with-foo --disable-bar

       dh_auto_configure(1) や dh_auto_build(1) が処理をする際、何を処理すればよいか判断できない
       ような変わったパッケージがたまに存在します。ここでは、dh_auto_configure(1) や
       dh_auto_build(1) を実行せずに、代わりのコマンドを実行させる方法を示します。

               #!/usr/bin/make -f
               %:
                       dh $@

               override_dh_auto_configure:
                       ./mondoconfig

               override_dh_auto_build:
                       make universe-explode-in-delight

       別のよくある例として、特定の debhelper コマンドが実行される前後で手動で何かをしたい場合が
       あります。

               #!/usr/bin/make -f
               %:
                       dh $@

               override_dh_fixperms:
                       dh_fixperms
                       chmod 4755 debian/foo/usr/bin/foo

       Python tools are not run by dh by default, due to the continual change in that area. Here
       is how to use dh_python2.

               #!/usr/bin/make -f
               %:
                       dh $@ --with python2

       こちらは Perl による Module::Build ビルドシステムを強制的に使う方法です。これは、debhelper
       が誤ってパッケージが MakeMaker を使っていると認識する場合に必要となります。

               #!/usr/bin/make -f
               %:
                       dh $@ --buildsystem=perl_build

       以下に dh_auto_* コマンドがどこにパッケージソースがあるかを変更する例を載せます。これはサ
       ブディレクトリにソースが存在するようなパッケージで使います。

               #!/usr/bin/make -f
               %:
                       dh $@ --sourcedirectory=src

       dh_auto_* にサブディレクトリでビルドするように指定する方法を以下に示します。こちらを指定す
       ると、clean 処理でこれらディレクトリが取り除かれるようになります:

               #!/usr/bin/make -f
               %:
                       dh $@ --builddirectory=build

       パッケージが並列ビルド可能であれば、互換性レベル 10 を使うか dh に --parallel を指定して下
       さい。すると dpkg-buildpackage -j が有効になります。

               #!/usr/bin/make -f
               %:
                       dh $@ --parallel

       パッケージが複数スレッドを使うと安定してビルド出来ない場合は、dh (あるいは関連する
       dh_auto_* コマンド)に --no-parallel を指定して下さい。

               #!/usr/bin/make -f
               %:
                       dh $@ --no-parallel

       ここでは、dh に、実行してほしくないコマンドを実行させないようにする方法を示します。その場
       合、それらのコマンドに対する override ターゲットを空にすることにより行います。

               #!/usr/bin/make -f
               %:
                       dh $@

               # 実行させたくないコマンド:
               override_dh_auto_test override_dh_compress override_dh_fixperms:

       ドキュメントパッケージを作成するのに時間がかかる場合があります。この場合、アーキテクチャ非
       依存用の override ターゲットを使ってビルドを分離することができます。こうすると、build-arch
       や binary-arch を実行するとき、ドキュメントパッケージのビルドが省略されます。

               #!/usr/bin/make -f
               %:
                       dh $@

               override_dh_auto_build-indep:
                       $(MAKE) -C docs

               # doc ターゲット実行時はテストは不要
               override_dh_auto_test-indep:

               override_dh_auto_install-indep:
                       $(MAKE) -C docs install

       上の例に加え、ファイルに chmod を実行しなければならないがそれはアーキテクチャ依存パッケー
       ジをビルドする際のみ必要で、ドキュメントのみをビルドする時には実行しないとしたらどうなるで
       しょうか。

               override_dh_fixperms-arch:
                       dh_fixperms
                       chmod 4755 debian/foo/usr/bin/foo

内部動作

       dh の内部動作に興味がある人向けに、以下に内部でどのように動作しているのかを記載します。

       In compat 10 (or later), dh creates a stamp file debian/debhelper-build-stamp after the
       build step(s) are complete to avoid re-running them.  It is possible to avoid the stamp
       file by passing --without=build-stamp to dh.  This makes "no clean" builds behave more
       like what some people expect at the expense of possibly running the build and test twice
       (the second time as root or under fakeroot(1)).

       Inside an override target, dh_* commands will create a log file
       debian/package.debhelper.log to keep track of which packages the command(s) have been run
       for.  These log files are then removed once the override target is complete.

       互換性レベル 9 とそれ以前では、各 debhelper コマンドは debian/package.debhelper.log に実行
       がうまく行ったものを記録します (これは dh_clean が消去します)。これにより、dh は既にどのコ
       マンドが実行されたか、あるいはどのパッケージに対して実行されたか、何のコマンドを再びスキッ
       プすればよいのかがわかります。

       Each time dh is run (in compat 9 or earlier), it examines the log, and finds the last
       logged command that is in the specified sequence. It then continues with the next command
       in the sequence.

       dh に処理の流れの名前を指定することにより、debian/rules に記載した依存関係にあるターゲット
       も実行されます。例えば、"binary" という処理の流れを指定すると、"install" ターゲットも実行
       されます。

       dh は、DH_INTERNAL_OPTIONS 環境変数をチェックし、override ターゲットの中で実行される
       debhelper コマンドに情報を渡します。この環境変数に記載されている内容は (実際には環境変数が
       存在していると) 、その環境変数の名前が示唆するとおり、どの時点でも debhelper コマンドの動
       作に影響を与えます。

       build-indep, install-indep, binary-indep の一連の処理に記載されているコマンドには、アーキ
       テクチャ非依存パッケージをビルドする時にだけ確実に作用するように -i オプションを使って情報
       が引き渡されます。build-arch, install-arch, binary-arch の一連の処理に対しては、-a にて引
       き渡され、アーキテクチャ依存パッケージにのみ確実に作用するように動作します。

参照

       debhelper(7)

       このプログラムは debhelper の一部です。

作者

       Joey Hess <joeyh@debian.org>