[Ubuntu] パッケージの作成方法
Ubuntu 6.10でEthna 2.3.0のパッケージを作成したときの記録を以下に記します。
まず、ソースを展開したディレクトリでdh_makeコマンドを実行します。dh_makeコマンドのオプションは、以下の通りです。
- --createorig: カレントディレクトリをオリジナルとみなして.origを生成する。
- --email: メンテナのメールアドレス。
- --copyright: ライセンスの種類。Ethnaの場合はbsd.
- --single: 生成されるバイナリパッケージはひとつである。
Ethnaの場合、.tar.gzを展開したディレクトリで、
dh_make --createorig --email foo@exmaple.com --copyright bsd --single
とする。
$ dh_make --createorig --email foo@exmaple.com --copyright bsd --single Package name "Ethna" is not in a valid format. Debian policy manual states: "Package names must only consist of lower case letters, digits (0-9), plus (+) or minus (-) signs, and periods (.)" $ (cd ..; mv Ethna-2.3.0 ethna-2.3.0) $ cd ../ethna-2.3.0 $ dh_make --createorig --email foo@exmaple.com --copyright bsd --single Maintainer name : Sumi Tomohiko Email-Address : foo@example.com Date : Mon, 11 Dec 2006 03:02:56 +0900 Package Name : ethna Version : 2.3.0 License : bsd Type of Package : Single Hit to confirm: Currently there is no top level Makefile. This may require additional tuning. Done. Please edit the files in the debian/ subdirectory now. You should also check that the ethna Makefiles install into $DESTDIR and not in / . $ ls [~/projects/Ethna/ethna-2.3.0] CHANGES Ethna.php LICENSE README bin class debian misc skel test tpl $ ls debian [~/projects/Ethna/ethna-2.3.0] README.Debian dirs ethna.doc-base.EX postinst.ex changelog docs init.d.ex postrm.ex compat emacsen-install.ex manpage.1.ex preinst.ex control emacsen-remove.ex manpage.sgml.ex prerm.ex copyright emacsen-startup.ex manpage.xml.ex rules cron.d.ex ethna-default.ex menu.ex watch.ex $ mv LICENSE debian/copyright [~/projects/Ethna/ethna-2.3.0] $ rm -f README.Debian [~/projects/Ethna/ethna-2.3.0/debian] (中略。様々なものを削除する) $ ls [~/projects/Ethna/ethna-2.3.0/debian] changelog compat control copyright dirs docs rules $ ls [~/projects/Ethna] ethna-2.3.0 ethna-2.3.0.orig
changelogを編集する。結果は以下の通り。
$ cat debian/changelog [~/projects/Ethna/ethna-2.3.0] ethna (2.3.0) unstable; urgency=low * Initial release. -- Sumi Tomohiko Mon, 11 Dec 2006 06:07:00 +0900
controlファイルを編集する。最終結果は、以下の通り。
$ cat control [~/projects/Ethna/ethna-2.3.0/debian] Source: ethna Section: web Priority: optional Maintainer: Sumi Tomohiko Build-Depends: debhelper (>= 5) Build-Depends-Indep: nkf Standards-Version: 3.7.2 Package: ethna Architecture: any Depends: php-db, php-pear, smarty Description: ethna is one of web application frameworks. ethna is on Model-View-Controller architecture.
dirsファイルを編集する。
$ cat dirs [~/projects/Ethna-2.3.0/ethna-2.3.0/debian] usr/bin usr/share/man/man1 usr/share/php
docsファイルを編集する。
$ cat docs [~/projects/Ethna/ethna-2.3.0/debian]
rulesファイルを編集する。
$ cat rules [~/projects/Ethna-2.3.0/ethna-2.3.0/debian] #!/usr/bin/make -f # -*- makefile -*- ROOTDIR=$(CURDIR)/debian/ethna # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean install: dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ethna. cp bin/ethna.sh $(ROOTDIR)/usr/bin/ethna mkdir -p $(ROOTDIR)/usr/share/php/Ethna cp -r Ethna.php bin class misc skel test tpl $(ROOTDIR)/usr/share/php/Ethna build: binary-arch: binary-indep: install dh_installdocs dh_installchangelogs CHANGES dh_installman $(CURDIR)/debian/man/ethna.1 dh_compress dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: binary binary-indep binary-arch install build clean
class/Renderer/Ethna_Renderer_Smarty.phpの以下の行を修正する(下は修正後)。
require_once 'smarty/libs/Smarty.class.php';
bin/ethna.shを修正する(下は、修正後)。
ETHNA_HOME="/usr/share/php/Ethna"
ソースを含むテキストドキュメントを、UTF-8に変換する。方法は省略。
パッケージの生成には、devscriptsパッケージに含まれるdebuildコマンドを使用する。有用なオプションは、
- --uc: changesファイルに署名しない。
- --us: dscファイルに署名しない。ただし、これらはパッケージのテストをする場合に限り使用し、リリースする場合は外すこと。
- --lintian-opts: lintianに渡すパラメータを指定する。
$ debuild -uc -us --lintian-opts --info fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ethna. cp bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/bin/ethna mkdir -p /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/Ethna cp -r Ethna.php bin class misc skel test tpl /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/Ethna dh_installdocs dh_installchangelogs CHANGES dh_installman /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/man/ethna.1 dh_compress dh_gencontrol dh_md5sums dh_builddeb tar: -: file name read contains nul character dpkg-deb: ../ethna_2.3.0_i386.deb にパッケージ `ethna' を構築しています。 dpkg-genchanges dpkg-genchanges: not including original source code in upload dpkg-buildpackage (debuild emulation): binary and diff upload (original source NOT included) Now running lintian... Finished running lintian.
以上で成功である。
この過程で遭遇したエラーの例を以下に記す。
$ debuild -uc -sc [~/projects/Ethna/ethna-2.3.0] parsechangelog/debian: error: badly formatted heading line, at file debian/changelog line 1 debuild: fatal error at line 617: problem executing dpkg-parsechangelog | grep:
$ debuild -us -uc [~/projects/Ethna/ethna-2.3.0] dpkg-checkbuilddeps: error: source paragraph in control info file is missing Source line debuild: fatal error at line 983: You do not appear to have all build dependencies properly met, aborting. (Use -d flag to override.) If you have the pbuilder package installed you can run /usr/lib/pbuilder/pbuilder-satisfydepends as root to install the required packages, or you can do it manually using dpkg or apt using the error messages just above this message.
$ debuild -uc -us [~/projects/Ethna/ethna-2.3.0] fakeroot debian/rules clean debian/rules: 1: #!/usr/bin/make: not found debian/rules: 7: clean:: not found Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. debian/rules: 16: install:: not found Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_installdirs: Compatibility levels before 4 are deprecated. debian/rules: 23: CURDIR: not found mv: cannot move `bin/ethna.sh' to `/debian/ethna/usr/bin/ethna': No such file or directory debian/rules: 24: CURDIR: not found mkdir: ディレクトリ `/debian' を作成できません: Permission denied debian/rules: 25: CURDIR: not found cp: target `/debian/ethna/usr/share/php/Ethna' is not a directory debian/rules: 27: binary-indep:: not found debuild: fatal error at line 1224: fakeroot debian/rules clean failed
$ debuild -uc -us [~/projects/Ethna/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dpkg-source -b ethna-2.3.0 dpkg-source: building ethna in ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: *** ターゲット `build' を make するルールがありません. 中止. debuild: fatal error at line 1224: debian/rules build failed
$ debuild -uc -us [~/projects/Ethna/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary make: *** ターゲット `binary' を make するルールがありません. 中止. debuild: fatal error at line 1224: fakeroot debian/rules binary failed
$ debuild -uc -us [~/projects/Ethna/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary make: `binary' に対して行うべき事はありません. dpkg-genchanges dpkg-genchanges: failure: cannot read files list file: No such file or directory
$ debuild -us -uc [~/projects/Ethna-2.3.0/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian /Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dh_installdirs Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_installdirs: Compatibility levels before 4 are deprecated. # Add here commands to install the package into debian/ethna. mv bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/bin/ethna mv: cannot move `bin/ethna.sh' to `/home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/bin/ethna': No such file or directory make: *** [install] エラー 1 debuild: fatal error at line 1224: fakeroot debian/rules binary failed
$ debuild -uc -us [~/projects/Ethna-2.3.0/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian /Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian /Debhelper/Dh_Lib.pm line 274, line 1. dh_clean: Compatibility levels before 4 are deprecated. dh_installdirs Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_installdirs: Compatibility levels before 4 are deprecated. # Add here commands to install the package into debian/ethna. cp bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/tmp/usr/bin/ethna mkdir -p /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/tmp/usr/share/php/Ethna cp -r Ethna.php bin class misc skel test tpl /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/tmp/usr/share/php/Ethna dh_gencontrol Argument "M-oM-;M-?5" isn't numeric in numeric lt (<) at /usr/share/perl5/Debian/Debhelper/Dh_Lib.pm line 274, line 1. dh_gencontrol: Compatibility levels before 4 are deprecated. dpkg-genchanges dpkg-genchanges: not including original source code in upload dpkg-genchanges: failure: cannot open upload file ../ethna_2.3.0_i386.deb for reading: No such file or directory
$ debuild -uc -us [~/projects/Ethna-2.3.0/ethna-2.3.0] fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ethna. cp bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/tmp/usr/bin/ethna cp: cannot create regular file `/home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/tmp/usr/bin/ethna': No such file or directory make: *** [install] エラー 1 debuild: fatal error at line 1224: fakeroot debian/rules binary failed
$ debuild -uc -us --lintian-opts --info fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ethna. cp bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/bin/ ethna mkdir -p /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/Ethna cp -r Ethna.php bin class misc skel test tpl /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/Ethna dh_installdocs dh_gencontrol dh_md5sums dh_builddeb tar: -: file name read contains nul character dpkg-deb: ../ethna_2.3.0_i386.deb にパッケージ `ethna' を構築しています。 dpkg-genchanges dpkg-genchanges: not including original source code in upload dpkg-buildpackage (debuild emulation): binary and diff upload (original source NOT included) Now running lintian... W: ethna: binary-without-manpage ethna N: N: Each binary in /usr/bin, /usr/sbin, /bin, /sbin or /usr/games should N: have a manual page N: N: Note, that though the `man' program has the capability to check for N: several program names in the NAMES section, each of these programs N: should have its own manual page (a symbolic link to the appropriate N: manual page is sufficient) because other manual page viewers such as N: xman or tkman don't support this. N: N: Refer to Policy Manual, section 12.1 for details. N: E: ethna: description-starts-with-package-name N: N: The first line of the "Description:" should not start with the package N: name. For example, the package foo should not have a description like N: this: `foo is a program that...'. N: N: Refer to Policy Manual, section 3.4.1 for details. N: W: ethna: description-synopsis-might-not-be-phrased-properly N: N: The synopsis (first line in the package "Description:" field, the N: short description) ends with a full stop "." character. This is not N: necessary, as the synopsis doesn't need to be a full sentence. It is N: recommended that a descriptive phrase is used instead. N: N: Note also that the synopsis is not part of the rest of the N: "Description:" field. N: N: Refer to Policy Manual, section 3.4.1 for details. N: E: ethna: changelog-file-missing-in-native-package N: N: Each Debian package (which provides a /usr/share/doc/ directory) N: has to install a changelog file. Since this package seems to be a N: native Debian package (i.e., there is no upstream source), the file N: should usually be installed as /usr/share/doc//changelog.gz N: N: Refer to Policy Manual, section 12.7 for details. N: W: ethna: syntax-error-in-debian-changelog line 0 "found eof where expected first heading" N: N: While parsing the Debian changelog, an syntax error was found. N: N: Refer to Policy Manual, section 4.4 for details. N: Finished running lintian.
$ debuild --lintian-opts --info fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dpkg-source -b ethna-2.3.0 dpkg-source: building ethna using existing ethna_2.3.0.orig.tar.gz dpkg-source: building ethna in ethna_2.3.0.diff.gz dpkg-source: warning: ignoring deletion of file LICENSE dpkg-source: building ethna in ethna_2.3.0.dsc debian/rules build make: `build' に対して行うべき事はありません. fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/ethna. cp bin/ethna.sh /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/bin/ ethna mkdir -p /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/E thna cp -r Ethna.php bin class misc skel test tpl /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/ethna/usr/share/php/Ethna dh_installdocs dh_installchangelogs CHANGES dh_installman /home/tom/projects/Ethna-2.3.0/ethna-2.3.0/debian/man/ethna.1 dh_compress dh_gencontrol dh_md5sums dh_builddeb tar: -: file name read contains nul character dpkg-deb: ../ethna_2.3.0_i386.deb にパッケージ `ethna' を構築しています。 dpkg-genchanges dpkg-genchanges: not including original source code in upload dpkg-buildpackage (debuild emulation): binary and diff upload (original source NOT included) Now running lintian... Finished running lintian. Now signing changes and any dsc files... signfile ethna_2.3.0.dsc Sumi Tomohiko gpg: 鍵輪「/home/tom/.gnupg/secring.gpg」ができました gpg: “Sumi Tomohiko ”をとばします: 秘密鍵が得られません gpg: [stdin]: clearsign failed: 秘密鍵が得られません debsign: gpg error occurred! Aborting.... debuild: fatal error at line 1151: running debsign failed