#30-03 [Ubuntu,perl,hack]CPANモジュールをdebパッケージにするcpan2deb(車輪の再発明)
自分の気にいるものがなかったので自作。
使い方実行例はこんな感じ。
cpan2deb モジュール名 または cpan2deb tarball URIex)
$ cpan2deb JSON::XSCPAN モジュールを取得して Ubuntu 用にパッケージングする準備をします。
- 雛型作るところまでは自動で、debuild は手動で行います (debian/control や debian/copyright を手動で修正する場合があるため)
- root 権限は必要なく、一般ユーザ権限で deb まで作成できます(sudoの必要なし)
- パッケージの依存関係もある程度自動取得します (モジュールのバージョンがあやしいときは警告を出します)
$ cpan2deb JSON::XS
CPAN: Storable loaded ok
Going to read /home/sharl/.cpan/Metadata
Database was generated on Tue, 30 Nov 2010 01:53:34 GMT
Running get for module JSON::XS
CPAN: Digest::MD5 loaded ok
Checksum for /home/sharl/.cpan/sources/authors/id/M/ML/MLEHMANN/JSON-XS-2.3.tar.gz ok
(snip)
Maintainer name : Sharl Morlaroll
Email-Address : sharl@hauN.org
Date : Tue, 30 Nov 2010 17:30:00 +0900
Package Name : libjson-xs-perl
Version : 2.3
License : artistic
Type of Package : Single
Hit <enter> to confirm: Skipping creating ../libjson-xs-perl_2.3.orig.tar.gz because it already exists
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 libjson-xs-perl Makefiles install into $DESTDIR and not in / .
Build-Depends: libextutils-makemaker-perl
Depends: libcommon-sense-perl
$ ls
libjson-xs-perl-2.3/ libjson-xs-perl_2.3.orig.tar.gz
$ cd libjson-xs-perl-2.3/
$ debuild -uc -us
(snip)
dpkg-deb: building package `libjson-xs-perl' in `../libjson-xs-perl_2.3-1_i386.deb'.
dpkg-genchanges
dpkg-genchanges: including full source code in upload
dpkg-buildpackage (debuild emulation): full upload (original source is included)
$ tree debian/libjson-xs-perl
debian/libjson-xs-perl
|-- DEBIAN
| |-- control
| `-- md5sums
`-- usr
|-- bin
| `-- json_xs
|-- lib
| `-- perl5
| |-- JSON
| | |-- XS
| | | `-- Boolean.pm
| | `-- XS.pm
| `-- auto
| `-- JSON
| `-- XS
| |-- XS.bs
| `-- XS.so
`-- share
|-- doc
| `-- libjson-xs-perl
| |-- changelog.Debian.gz
| `-- copyright
`-- man
|-- man1
| `-- json_xs.1p.gz
`-- man3
|-- JSON::XS.3pm.gz
`-- JSON::XS::Boolean.3pm.gz
16 directories, 12 files
$ cd ..
$ ls
libjson-xs-perl-2.3/ libjson-xs-perl_2.3-1_i386.build libjson-xs-perl_2.3.orig.tar.gz
libjson-xs-perl_2.3-1.diff.gz libjson-xs-perl_2.3-1_i386.changes
libjson-xs-perl_2.3-1.dsc libjson-xs-perl_2.3-1_i386.deb
この辺までは自動でできるようになったので、ひとまず満足。
恥ずかしいけど置いておきます。
修正点:
追記:
GitHubにも登録してみた。cpan2deb