dpkg
と apt
をだまして、抜け殻に過ぎないいくつかのパッケージがインストールされていると信じこませることにあります。フェイクパッケージを使うことで、あるソフトウェアの依存関係を満足させるために必要なソフトウェアがパッケージシステムの管轄外にインストールされている場合に、そのソフトウェアの依存関係を満足させることが可能です。フェイクパッケージを使うことで、依存関係の問題は解決されますが、これはできる限り避けるべき方法です。なぜなら、手作業でインストールされたソフトウェアが対応するパッケージと全く同様に振る舞う保証はありませんし、手作業でインストールされたソフトウェアに依存する他のパッケージが適切に動く保証もないからです。
equivs-control
と equivs-build
コマンド (equivs パッケージに含まれます) を使って作成されます。equivs-control file
コマンドは Debian パッケージヘッダファイルを作成します。Debian パッケージヘッダファイルには、パッケージの名前、バージョン番号、メンテナ、依存関係、説明を含めるように編集します。デフォルト値を持たない他のフィールドは任意で、削除することも可能です。Copyright
、Changelog
、Readme
、Extra-Files
フィールドは Debian パッケージの標準的なフィールドではありません。さらに、これらのフィールドは equivs-build
を使う限りにおいて意味を持つものであり、生成されるパッケージのヘッダから削除されます。
例 15.2 libxml-libxml-perl フェイクパッケージのヘッダファイル
Section: perl Priority: optional Standards-Version: 3.9.6 Package: libxml-libxml-perl Version: 2.0116-1 Maintainer: Raphael Hertzog <hertzog@debian.org> Depends: libxml2 (>= 2.7.4) Architecture: all Description: Fake package - module manually installed in site_perl This is a fake package to let the packaging system believe that this Debian package is installed. . In fact, the package is not installed since a newer version of the module has been manually compiled & installed in the site_perl directory.
equivs-build file
コマンドを使って Debian パッケージを生成します。さぁこれでパッケージは現在のディレクトリに作成され、他の Debian パッケージと同様に取り扱うことが可能になります。
falcot-data-1.0
ディレクトリを作成します。こうしておけば、パッケージは必然的に falcot-data
と名付けられ、バージョン番号は 1.0
になります。その後、管理者は文書ファイルを data
サブディレクトリに置きます。その後、管理者は dh_make
コマンド (dh-make パッケージに含まれます) を実行し、パッケージ生成作業に必要なファイルを追加します。ここで追加されるファイルは debian
サブディレクトリに保存されます。
$
cd falcot-data-1.0
$
dh_make --native
Type of package: (single, indep, library, python) [s/i/l/p]?
i
Maintainer Name : Raphael Hertzog Email-Address : hertzog@debian.org Date : Fri, 04 Sep 2015 12:09:39 -0400 Package Name : falcot-data Version : 1.0 License : gpl3 Package Type : indep Are the details correct? [Y/n/q] Currently there is not top level Makefile. This may require additional tuning Done. Please edit the files in the debian/ subdirectory now. $
Architecture: all
). single acts as a counterpart, and leads to a single binary package that is dependent on the target architecture (Architecture: any
). In this case, the former choice is more relevant since the package only contains documents and no binary programs, so it can be used similarly on computers of all architectures.
dh_make
コマンドによって debian
サブディレクトリと各種ファイルが作成されました。特に rules
、control
、changelog
、copyright
などの一部のファイルは必須です。.ex
拡張子を持つファイルは例ファイルで、必要ならばこれらのファイルをひな形として (拡張子を削除して) 使うことが可能です。必要なければ例ファイルを削除することを推奨します。compat
ファイルはそのままにしておくべきです。なぜなら、compat
ファイルはパッケージビルド作業のさまざまな段階で使われる debhelper プログラムスイート (dh_
から始まるプログラム群) を適切に動作させるために必要だからです。
copyright
file must contain information about the authors of the documents included in the package, and the related license. In our case, these are internal documents and their use is restricted to within the Falcot Corp company. The default changelog
file is generally appropriate; replacing the “Initial release” with a more verbose explanation and changing the distribution from unstable
to internal
is enough. The control
file was also updated: the Section
field has been changed to misc and the Homepage
, Vcs-Git
and Vcs-Browser
fields were removed. The Depends
fields was completed with firefox-esr | www-browser
so as to ensure the availability of a web browser able to display the documents in the package.
例 15.3 control
ファイル
Source: falcot-data Section: misc Priority: optional Maintainer: Raphael Hertzog <hertzog@debian.org> Build-Depends: debhelper (>= 10) Standards-Version: 4.1.2 Package: falcot-data Architecture: all Depends: firefox-esr | www-browser, ${misc:Depends} Description: Internal Falcot Corp Documentation This package provides several documents describing the internal structure at Falcot Corp. This includes: - organization diagram - contacts for each department. . These documents MUST NOT leave the company. Their use is INTERNAL ONLY.
例 15.4 changelog
ファイル
falcot-data (1.0) internal; urgency=low * Initial Release. * Let's start with few documents: - internal company structure; - contacts for each department. -- Raphael Hertzog <hertzog@debian.org> Sat, 05 Sep 2015 01:09:39 +0900
例 15.5 copyright
ファイル
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: falcot-data Files: * Copyright: 2004-2015 Falcot Corp License: All rights reserved.
rules
ファイルには、(生成されるバイナリパッケージにちなんで名付けられた) 専用のサブディレクトリ内で対象のソフトウェアを設定、ビルド、インストールするために使われる一連の規則が定義されています。このサブディレクトリの内容はあたかもサブディレクトリがファイルシステムのルートであるかのように Debian パッケージの中に保存されます。今回の場合、ファイルは debian/falcot-data/usr/share/falcot-data/
サブディレクトリにインストールされます。こうすることで、生成されたパッケージをインストールするとファイルが /usr/share/falcot-data/
の下に配備されます。rules
ファイルはいくつかの標準的なターゲットが定義されている Makefile
として使われます (定義済みターゲットの clean
と binary
はそれぞれソースディレクトリを削除する場合とバイナリパッケージを生成する場合に使います)。
rules
ファイルはビルド作業の核心で、debhelper
ツールによって提供される標準的なコマンド群を実行するために必要な最低限の要素だけを含みます。rules
ファイルが面倒を見るのは dh_make
によって生成されたファイルだけです。自分のファイルをインストールするためには、以下の debian/falcot-data.install
ファイルを作成して、dh_install
コマンドの挙動を単純に設定します。
data/* usr/share/falcot-data/
falcot-data.desktop
file and get it installed in /usr/share/applications
by adding a second line to debian/falcot-data.install
.
例 15.6 falcot-data.desktop
ファイル
[Desktop Entry] Name=Internal Falcot Corp Documentation Comment=Starts a browser to read the documentation Exec=x-www-browser /usr/share/falcot-data/index.html Terminal=false Type=Application Categories=Documentation;
debian/falcot-data.install
は以下のようになります。
data/* usr/share/falcot-data/ falcot-data.desktop usr/share/applications/
falcot-data-1.0
ディレクトリの中で、dpkg-buildpackage -us -uc
コマンドを実行します。