1. Debian メンテナツールの概要

この章には、メンテナが利用できるツールについて大まかな概要が含まれています。以下は完全なものでも決定版的なものでもありませんが、よく使われているツールについての説明です。

Debian メンテナツールは、開発者を手助けし、重要な作業のために時間を作れるようにしてくれるものです。Larry Wall が言うように、やり方は一つではありません (there's more than one way to do it)。

Some people prefer to use high-level package maintenance tools and some do not. Debian is officially agnostic on this issue; any tool that gets the job done is fine. Therefore, this section is not meant to stipulate to anyone which tools they should use or how they should go about their duties of maintainership. Nor is it meant to endorse any particular tool to the exclusion of a competing tool.

パッケージの説明文のほとんどは実際のパッケージの説明から取ったものです。より詳細な情報はパッケージ内のドキュメントで確認できます。apt-cache showパッケージ名 コマンドでも情報を得られます。

1.1. 主要なツール

以下のツールはどのメンテナであっても、必ず必要とするものです。

1.1.1. dpkg-dev

dpkg-dev は、パッケージを展開、ビルド、Debian ソースパッケージをアップロードするのに必要なツールを含んでいます (dpkg-source を含む) 。これらのユーティリティはパッケージを作成・操作するのに必要な基礎的で、低レイヤの機能を含んでいます。そのため、これらはあらゆる Debian メンテナにとって必要不可欠なものです。

1.1.2. debconf

debconf は、パッケージを対話形式で設定できる一貫したインターフェイスを提供します。これはユーザインターフェイスに依存せず、エンドユーザがテキストのみのインターフェイス、HTML インターフェイス、ダイアログ形式のインターフェイスでパッケージを設定できます。新たなインターフェイスはモジュールとして追加できます。

このパッケージに関するドキュメントは debconf-doc パッケージ中で確認できます。

Many feel that this system should be used for all packages that require interactive configuration; see debconf による設定管理. debconf is not currently required by Debian Policy, but that may change in the future.

1.1.3. fakeroot

fakeroot は root 特権をシミュレートします。これは root になること無しにパッケージをビルドできるようにしてくれます (パッケージは通常 root の所有権でファイルをインストールしようとします)。fakeroot をインストールしていれば、dpkg-buildpackage で自動的に利用します。

1.2. パッケージチェック (lint) 用ツール

According to the Free On-line Dictionary of Computing (FOLDOC), lint is: "A Unix C language processor which carries out more thorough checks on the code than is usual with C compilers." Package lint tools help package maintainers by automatically finding common problems and policy violations in their packages.

1.2.1. lintian

lintian は Debian パッケージを解剖してバグやポリシー違反の情報を出力します。一般的なエラーへのチェック同様にDebian ポリシーの多くの部分を自動チェックする機能を含んでいます。

定期的に最新の lintianunstable から取得し、パッケージを全てチェックするべきです。-i オプションは、各エラーや警告が何を意味しているのか、ポリシーを元に、詳細な説明を提供してくれ、一般的に問題をどのように修正するべきかを説明してくれることに留意してください。

何時、どのようにして Lintian を使うのか、詳細については パッケージをテストする を参照してください。

あなたのパッケージに対して Lintian によって報告されたの問題の要約はすべて https://lintian.debian.org/から確認することもできます。このレポートは、最新の lintian による開発版ディストリビューション (unstable) 全体についての出力を含んでいます。

1.2.2. lintian-brush

lintian-brush contains a set of scripts that can automatically fix more than 80 common lintian issues in Debian packages.

It comes with a wrapper script that invokes the scripts, updates the changelog (if desired) and commits each change to version control.

1.2.3. piuparts

piuparts is the .deb package installation, upgrading, and removal testing tool.

piuparts tests that .deb packages handle installation, upgrading, and removal correctly. It does this by creating a minimal Debian installation in a chroot, and installing, upgrading, and removing packages in that environment, and comparing the state of the directory tree before and after. piuparts reports any files that have been added, removed, or modified during this process.

piuparts is meant as a quality assurance tool for people who create .deb packages to test them before they upload them to the Debian archive.

1.2.4. debdiff

(devscripts パッケージ、devscripts より) debdiff は二つのパッケージのファイルのリストと control ファイルを比較します。前回のアップロードからバイナリパッケージ数が変わったことや、control ファイル内で何が変わったのかなどに気付く手助けをしてくれるなど、簡単なリグレッションテストとなります。もちろん、報告される変更の多くは問題ありませんが、様々なアクシデントを防止するのに役立ってくれるでしょう。

バイナリパッケージのペアに対して実行することができます:

debdiff package_1-1_arch.deb package_2-1_arch.deb

changes ファイルのペアに対してさえも実行できます:

debdiff package_1-1_arch.changes package_2-1_arch.changes

より詳細については、debdiff 1を参照してください。

1.2.5. diffoscope

diffoscope provides in-depth comparison of files, archives, and directories.

diffoscope will try to get to the bottom of what makes files or directories different. It will recursively unpack archives of many kinds and transform various binary formats into more human readable form to compare them.

Originally developed to compare two .deb files or two changes files nowadays it can compare two tarballs, ISO images, or PDF just as easily and supports a huge variety of filetypes.

The differences can be shown in a text or HTML report or as JSON output.

1.2.6. duck

duck, the Debian Url ChecKer, processes several fields in the debian/control, debian/upstream, debian/copyright, debian/patches/* and systemd.unit files and checks if URLs, VCS links and email address domains found therein are valid.

1.2.7. adequate

adequate checks packages installed on the system and reports bugs and policy violations.

The following checks are currently implemented:

  • broken symlinks

  • missing copyright file

  • obsolete conffiles

  • Python modules not byte-compiled

  • /bin and /sbin binaries requiring /usr/lib libraries

  • missing libraries, undefined symbols, symbol size mismatches

  • license conflicts

  • program name collisions

  • missing alternatives

  • missing binfmt interpreters and detectors

  • missing pkg-config dependencies

1.2.8. i18nspector

i18nspector is a tool for checking translation templates (POT), message catalogues (PO) and compiled message catalogues (MO) files for common problems.

1.2.9. cme

cme is a tool from the libconfig-model-dpkg-perl package is an editor for dpkg source files with validation. Check the package description to see what it can do.

1.2.10. licensecheck

licensecheck attempts to determine the license that applies to each file passed to it, by searching the start of the file for text belonging to various licenses.

1.2.11. blhc

blhc is a tool which checks build logs for missing hardening flags.

1.3. debian/rules の補助ツール

パッケージ構築ツールは debian/rules ファイルを書く作業を楽にしてくれます。これらが望ましい、あるいは望ましくない理由の詳細については ヘルパースクリプト を参照してください。

1.3.1. debhelper

debhelper is a collection of programs that can be used in debian/rules to automate common tasks related to building binary Debian packages. debhelper includes programs to install various files into your package, compress files, fix file permissions, and integrate your package with the Debian menu system.

Unlike some approaches, debhelper is broken into several small, simple commands, which act in a consistent manner. As such, it allows more fine-grained control than some of the other debian/rules tools.

ここに記すには一時的な、大量の小さな debhelper のアドオンパッケージがあります。apt-cache search ^dh- と実行することで一覧の多くを参照できます。

When choosing a debhelper compatibility level for your package, you should choose the highest compatibility level that is supported in the most recent stable release. Only use a higher compatibility level if you need specific features that are provided by that compatibility level that are not available in earlier levels.

In the past the compatibility level was defined in debian/compat, however nowadays it is much better to not use that but rather to use a versioned build-dependency like debhelper-compat (=12).

1.3.2. dh-make

The dh-make package contains dh_make, a program that creates a skeleton of files necessary to build a Debian package out of a source tree. As the name suggests, dh_make is a rewrite of debmake, and its template files use dh_* programs from debhelper.

dh_make によって生成された rules ファイルは、大抵の場合作業するパッケージに対して十分な基礎にはなりますが、まだこれは下地でしかありません。メンテナに残っている責務は、生成されたファイルをきれいに整理して、完全に動作してポリシーに準拠したパッケージにすることです。

1.3.3. equivs

equivs はパッケージ作成用のもう一つのパッケージです。単純に依存関係を満たしたいだけのパッケージを作成する必要がある場合に、しばしばローカルでの使用を勧められます。時折、他のパッケージに依存することだけが目的のパッケージ、「メタパッケージ (meta-packages)」を作る際にも使われます。

1.4. パッケージ作成ツール

The following packages help with the package building process, general driving of dpkg-buildpackage, as well as handling supporting tasks.

1.4.1. git-buildpackage

git-buildpackage は、Debian ソースパッケージを Git リポジトリに挿入あるいはインポートし、Debian パッケージを Git リポジトリから生成、そして開発元での変更をリポジトリに統合するのに役立つ機能を提供します。

これらのユーティリティは、Debian メンテナによる Git の利用を促進するインフラストラクチャを提供します。これは、バージョンコントロールシステムの他の利点と同様に、stableunstable、おそらく experimental ディストリビューション用にパッケージに個々の Git ブランチを持つことができます。

1.4.2. debootstrap

debootstrap パッケージとスクリプトは、システムのどこででも Debian ベースシステムをブートストラップできるようにしてくれます。ベースシステムとは、操作するのに必要となる素の最小限パッケージ群を意味し、それに加えてシステムの残りの部分をインストールします。

この様なシステムを持つことは、様々な面で役に立つでしょう。例えば、ビルドの依存関係をテストしたい場合に chroot でそのシステムの中に入ることができます。あるいは素のベースシステムにインストールした際にパッケージがどのように振る舞うかをテストできます。chroot 作成ツールはこのパッケージを使います。以下を参照ください。

1.4.3. pbuilder

pbuilder constructs a chrooted system, and builds a package inside the chroot. It is very useful to check that a package's build dependencies are correct, and to be sure that unnecessary and wrong build dependencies will not exist in the resulting package.

A related package is cowbuilder, which speeds up the build process using a COW filesystem on any standard Linux filesystem.

1.4.4. sbuild

sbuild はもう一つの自動ビルドシステムです。同様に chroot された環境を使うことが出来ます。単独で使うことも、分散ビルド環境のネットワークの一部として使うこともできます。文字通り、移植者たちによって利用可能な全アーキテクチャのバイナリパッケージをビルドするのに使われているシステムの一部です。詳細についてはwanna-build を参照してください。それからシステムの動作については https://buildd.debian.org/ を参照してください。

1.5. パッケージのアップロード用ツール

以下のパッケージはパッケージを公式アーカイブにアップロードする作業を自動化、あるいは単純化してくれるのに役立ちます。

1.5.1. dupload

dupload is a package and a script to automatically upload Debian packages to the Debian archive, to log the upload, and to optionally send mail about the upload of a package. It supports various kinds of hooks to extend its functionality, and can be configured for new upload locations or methods, although by default it provides various hooks performing checks and comes configured with all Debian upload locations.

1.5.2. dput

The dput package and script do much the same thing as dupload, but in a different way. Out of the box it supports to run dinstall in dry-run mode after the upload.

1.5.3. dcut

dcut スクリプト (dput パッケージの一部、dput 参照)は、ftp アップロードディレクトリからファイルを削除するのに役立ちます。

1.6. メンテナンスの自動化

以下のツールは changelog のエントリや署名行の追加、Emacs 内でのバグの参照から最新かつ公式の config.sub を使うようにするまで、様々なメンテナンス作業を自動化するのに役立ちます。

1.6.1. devscripts

devscripts is a package containing wrappers and tools that are very helpful for maintaining your Debian packages. Example scripts include debchange (or its alias, dch), which manipulates your debian/changelog file from the command-line, and debuild, which is a wrapper around dpkg-buildpackage. The bts utility is also very helpful to update the state of bug reports on the command line. uscan can be used to watch for new upstream versions of your packages (see https://wiki.debian.org/debian/watch for more info on that). suspicious-source outputs a list of files which are not common source files.

利用可能なスクリプトの全リストについては devscripts 1 マニュアルページを参照してください。

1.6.2. reportbug

reportbug is a tool designed to make the reporting of bugs in Debian and derived distributions relatively painless. Its features include:

  • Integration with mutt and mh/nmh mail readers.

  • Access to outstanding bug reports to make it easier to identify whether problems have already been reported.

  • Automatic checking for newer versions of packages.

reportbug is designed to be used on systems with an installed mail transport agent; however, you can edit the configuration file and send reports using any available mail server.

This package also includes the querybts script for browsing the Debian bug tracking system.

1.6.3. autotools-dev

autotools-dev contains best practices for people who maintain packages that use autoconf and/or automake. Also contains canonical config.sub and config.guess files, which are known to work on all Debian ports.

1.6.4. dpkg-repack

dpkg-repack creates a Debian package file out of a package that has already been installed. If any changes have been made to the package while it was unpacked (e.g., files in /etc were modified), the new package will inherit the changes.

This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system but no longer available elsewhere, or to save the current state of a package before you upgrade it.

1.6.5. alien

alien は、Debian、RPM (RedHat)、LSB (Linux Standard Base)、Solaris、Slackware などの各種バイナリパッケージのパッケージ形式を変換します。

1.6.6. dpkg-dev-el

dpkg-dev-el is an Emacs lisp package that provides assistance when editing some of the files in the debian directory of your package. For instance, there are handy functions for listing a package's current bugs, and for finalizing the latest entry in a debian/changelog file.

1.6.7. dpkg-depcheck

(devscripts パッケージ、devscripts より) dpkg-depcheck は、指定されたコマンドによって使われた全てのパッケージを確認するため、コマンドを strace の下で実行します。

Debian パッケージについていうと、これは新しいパッケージの Build-Depends 行を構成するのが必要になった際に役立ちます。dpkg-depcheck を通してビルド作業を実行すると、最初の大まかなビルドの依存関係を良い形で得られます。例えば以下の様にします:

dpkg-depcheck -b debian/rules build

dpkg-depcheck は、特にパッケージが他のプログラムを実行するのに exec 2 を使っている場合に実行時の依存性を確認するのにも使えます。

より詳細については、dpkg-depcheck 1 を参照してください。

1.7. 移植用ツール

以下のツールが、移植作業者やクロスコンパイル作業に役立ちます。

1.7.1. dpkg-cross

dpkg-cross は、dpkg に似た方法でクロスコンパイルするためのライブラリとヘッダをインストールするツールです。さらに、dpkg-buildpackage および dpkg-shlibdeps の機能がクロスコンパイルをサポートするように拡張されます。

1.8. ドキュメントと情報について

以下のパッケージが、メンテナへの情報提供やドキュメントの作成に役立ちます。

1.8.1. debian-policy

The debian-policy package contains the Debian Policy Manual and related documents, which are:

  • Debian Policy Manual

  • Filesystem Hierarchy Standard (FHS)

  • Debian Menu sub-policy

  • Debian Perl sub-policy

  • Debian configuration management specification

  • Machine-readable debian/copyright specification

  • Autopkgtest - automatic as-installed package testing

  • Authoritative list of virtual package names

  • Policy checklist for upgrading your packages

The Debian Policy Manual the policy relating to packages and details of the packaging mechanism. It covers everything from required gcc options to the way the maintainer scripts (postinst etc.) work, package sections and priorities, etc.

Also useful is the file /usr/share/doc/debian-policy/upgrading-checklist.txt.gz, which lists changes between versions of policy.

1.8.2. doc-debian

doc-debian contains lots of useful Debian-specific documentation:

  • Debian Linux Manifesto

  • Constitution for the Debian Project

  • Debian Social Contract

  • Debian Free Software Guidelines

  • Debian Bug Tracking System documentation

  • Introduction to the Debian mailing lists

1.8.3. developers-reference

The developers-reference package contains the document you are reading right now, the Debian Developer's Reference, a set of guidelines and best practices which has been established by and for the community of Debian developers.

1.8.4. maint-guide

The maint-guide package contains the Debian New Maintainers' Guide.

This document tries to describe the building of a Debian package to ordinary Debian users and prospective developers. It uses fairly non-technical language, and it's well covered with working examples.

1.8.5. packaging-tutorial

This tutorial is an introduction to Debian packaging. It teaches prospective developers how to modify existing packages, how to create their own packages, and how to interact with the Debian community.

In addition to the main tutorial, it includes three practical sessions on modifying the grep package, and packaging the gnujump game and a Java library.

1.8.6. how-can-i-help

how-can-i-help shows opportunities for contributing to Debian. how-can-i-help hooks into APT to list opportunities for contributions to Debian (orphaned packages, bugs tagged 'newcomer') for packages installed locally, after each APT invocation. It can also be invoked directly, and then lists all opportunities for contribution (not just the new ones).

1.8.7. docbook-xml

docbook-xml は Debian のドキュメントで一般的に使われている DocBook XML DTD を提供します (古いものは debiandoc SGML DTD を使っています) 。例えば、このマニュアルは DocBook XML で書かれています。

docbook-xsl パッケージは、ソースをビルドして様々な出力フォーマットに整形する XSL ファイルを提供します。XSL スタイルシートを使うには xsltproc のような XSLT プロセッサが必要になります。スタイルシートのドキュメントは各種 docbook-xsl-doc-* パッケージで確認できます。

FO から PDF を生成するには、xmlrofffop のような FO プロセッサが必要です。他に DocBook XML から PDF を生成するツールとしては dblatex があります。

1.8.8. debiandoc-sgml

debiandoc-sgml は Debian のドキュメントで一般的に使われている DebianDoc SGML DTD を提供します。しかし、現在は非推奨 (deprecated) となっています (代わりに docbook-xmlpython3-sphinx を使うようにしてください)。これも、ソースをビルドして様々な出力フォーマットに整形するスクリプトを提供します。

1.8.9. debian-keyring

Debian 開発者および Debian メンテナの公開 GPG 鍵を含んでいます。詳細については 公開鍵をメンテナンスする とパッケージ内のドキュメントを参照してください。

1.8.10. debian-el

debian-el は、Debian バイナリパッケージを参照する Emacs モードを提供します。これを使うと、パッケージを展開しなくても実行できるようになります。