ebuildでmercurial_fetchを使う場合のソースリビジョン指定
先日、 recpt1 用の ebuild スクリプトを作ったんですけど、今日 recpt1 ドライバを再コンパイルするにあたりそのときと同じリビジョンのものを入れたかったので、ソースのリビジョンを指定してダウンロードさせる方法を調べてみました。
※ その時 ↑ は特にリビジョン指定しないで常に最新版を使うように書いていました。
とりあえずバージョンの確認
今のバージョンが何であるかわからないと話にならないので、バージョン確認。
$ recpt1 --version
recpt1 r116:38a793ac3d9d (2010-03-25)
recorder command for PT1/2 digital tuner.
リビジョン 116 らしいです。
現在公開されているバージョンも実は 116 っぽいので最新版をいれれば同じなのですが…w
普通にコマンドラインから hg clone する場合
普通にコマンドラインからソース全部とってくる場合はきっとこうですね。
$ hg clone -r 116 http://hg.honeyplanet.jp/pt1/
ebuild スクリプトで mercurial_fetch のリビジョンを指定する
今日の本題です。従来はこんな感じに書いていました。
src_unpack() { mercurial_fetch http://hg.honeyplanet.jp/pt1/ #unpack ${A} }
ここでリビジョンを指定してやるように書きたいのですが、どうすればいいのか。
こんな変数を ebuild スクリプトに書いてやればいいようです。
EHG_REVISION="116"
詳しくは /usr/portage/eclass/mercurial.eclass に書いてあります。
てことでちょっとだけ ebuild スクリプトを更新。 recpt1-116.ebuild として作ってローカルオーバーレイに保存しておきました。これで最新版をおっかけても簡単に元に戻せるかな? その前に DVB ドライバにしてそうな気もしますけどね。
# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="2" inherit eutils mercurial autotools linux-mod #inherit eutils autotools linux-mod DESCRIPTION="Earthsoft PT1/PT2 Char-Driver & Recording Tool" HOMEPAGE="http://hg.honeyplanet.jp/pt1/" SRC_URI="" #SRC_URI="http://hg.honeyplanet.jp/pt1/archive/tip.tar.bz2" RESTRICT="nomirror" LICENSE="as-is" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="b25 +modules" RDEPEND="b25? ( media-tv/arib25 ) " DEPEND="${RDEPEND} sys-libs/ncurses dev-util/pkgconfig" S=${WORKDIR}/pt1 EHG_REVISION="116" pkg_setup() { linux-mod_pkg_setup BUILD_PARAMS="KERN_DIR=${KV_DIR} KERNOUT=${KV_OUT_DIR}" MODULE_NAMES="pt1_drv(video:${S}/driver:${S}/driver)" BUILD_TARGETS="all" } src_prepare() { epatch ${FILESDIR}/recpt1_Makefile.in.patch epatch ${FILESDIR}/recpt1_configure.ac.patch cd ${S}/recpt1 eautoreconf } src_configure() { cd ${S}/recpt1 econf $(use_enable b25) } src_compile() { if use modules; then # KERNEL DRIVER to BUILD linux-mod_src_compile || die "driver compile failed" fi # RECPT1 to BUILD if use b25 ; then einfo elog "Now \"b25\" USE flag enabled" elog " recpt1 will compile with b25 support." einfo fi emake -C "${S}/recpt1" || die "recpt1 compile failed" } src_install() { if use modules; then # INSTALL KERNEL MODULE(S) linux-mod_src_install || die "driver install failed" insinto /etc/udev/rules.d || die "udev/rules install failed" doins ${S}/driver/etc/99-pt1.rules || die "udev/rules install failed" fi # INSTALL RECPT1 BINARIES cd ${S}/recpt1 dobin recpt1 recpt1ctl checksignal || die "recpt1 install failed" # INSTALL CHANNEL LIST SAMPLES insinto /usr/share/recpt1/channels doins ${S}/recpt1/channels/* || die "recpt1 install failed" } pkg_postinst() { linux-mod_pkg_postinst einfo elog "" elog "New kernel modules were added. When you update" elog "kernel, you have to run \"emerge recpt1\" again." elog " (or \"emerge module-rebuild\"" elog " and run \"module-rebuild rebuild\")" elog "" einfo } pkg_preinst() { linux-mod_pkg_preinst }