unixのwhich(1) のようなものを作ってみるテスト
2009年5月アーカイブ
Bazaar 関連の覚書
いわゆる"リポジトリ"の概念は、
[repository/]branch/files...
な感じ。repositoryはoptionalなので、standalone-branchなんてのも可能。
- repositoryを作る
bzr init-repo [--no-trees] <repository>- repositoryはremote uri (sftp:// とか) 可
- --no-trees を指定しておくと、このrepository下に作成されるbranchはworking-treeを持たない(よくわからない...
- branch を作る
bzr init <repository>/<branch>- windows版のbzr 1.14では repositoryがremoteだと失敗する?
- → ローカルでリポジトリ作ってuploadするのはokらしい
<repository>/が無ければstandalone-branchになる。
- branchからcheck-out
bzr co <repository>/<branch> [dir]
メモメモ
co/update/ci と pull/push の違いがいまいちよくわからない。
standalone-branch を repositoryに追加する方法?
元ネタ: http://twitter.com/melponn/statuses/1565586704 とか http://twitter.com/melponn/statuses/1565590431
カッとなって作ってみた。(RSSフィードを取ってきてはてダの下書きに追記していくだけです 自動と言ってしまっていいのか微妙なところですが、まぁいいや
は、いいけど私はHatenaのアカウントを持ってないのでテストすらできないのでありました。(チャンチャン
でもまぁ、一応コードは晒しておきます。
使ってみてバグがあったら教えてくださいw
ちょっと間が空きすぎですが、
過日行われた JPAセミナー#02 に参加してきました。
今更ながら、
firefox 3が遅くなった→ SQLite reindexで解決&高速化
ということを知ったので、
.sqliteファイルをreindexしてまわるスクリプトを書いた。
use strict;
use warnings;
use DBI;
use File::Find;
if ( !@ARGV ) {
print "$0 <base dir>";
exit;
}
my $basedir = shift;
die "$basedir not found" if !-d $basedir;
find(\&reindex_dbfile, $basedir);
sub reindex_dbfile
{
my $dbfile = $File::Find::name;
return if $dbfile !~ m{\.sqlite$};
print "reindexing $dbfile...\n";
my $dbi = DBI->connect("dbi:SQLite:dbname=$dbfile", "", "");
if (!$dbi) {
print STDERR "cannot open $dbfile\n";
next;
}
reindex($dbi, $_) for get_tables($dbi);
print "done\n";
}
sub get_tables
{
my $stm = shift->prepare(<<EOS);
SELECT name FROM sqlite_master WHERE type IN ('table', 'index') UNION ALL
SELECT name FROM sqlite_temp_master WHERE type IN ('table', 'index')
EOS
$stm->execute;
map { $_->[0] } @{$stm->fetchall_arrayref};
}
sub reindex
{
my($dbi, $table) = @_;
print "-> $table\n";
$dbi->do("REINDEX $table");
}
.. 確かに起動が早くなった気がする!
ちなみにSQLiteでtable一覧を取得する方法は ここ 経由 この辺 を参照しました。多謝多謝。
2009-05-12 15:50 追記: tableだけじゃなくてindexもreindexするように変えてみました。意味があるかどうかは知らない(ぉ
http://floralcompany.jp/archives/2007/10/libxml2mingw32.html の続き。
libxml2 を --disable-shared 付きで ./configure したら(?) リンク時に
undefined reference to '_imp__xmlFree' が出るようになった。
ぐぐって見たら以下の解決(?)策が見つかりました。
http://mail.gnome.org/archives/xml/2004-February/msg00004.html
libxml/xmlexports.h の
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if defined(IN_LIBXML) && !defined(LIBXML_STATIC)
の部分を
/* Windows platform with GNU compiler (Mingw) */
#if defined(_WIN32) && defined(__MINGW32__)
#undef XMLPUBFUN
#undef XMLPUBVAR
#undef XMLCALL
#undef XMLCDECL
#if !defined(LIBXML_STATIC)
に変えるだけらしい。(defined(IN_LIBXML) が無くなってる。)
Encode::Detect 1.01 のインストールも一筋縄でいかんかったのでメモ。
普通にビルドしようとすると Detector.dll のビルド時に undefined reference to 'boot_Encode__Detect' って言われるのですよ。
- Encode::Detect のtarballを展開
- Detector.pm を書き換え
-
Encode::Detect::Detector->bootstrap($VERSION);となっている箇所をbootstrap Encode::Detect::Detector;に書き換える。($VERSION引数削るだけでいいのかな?どうなんだろ..
-
- Build.PL を書き換え
module_nameを"Encode::Detect::Detector"にしてpm_filesから Detect.pm の定義をコメントアウト
perl Build.PL&&dmake test install- Build.PLを再度書き換え
module_nameを"Encode::Detect"に戻し、pm_filesから Detect.pm の定義を戻して Detector.pm の定義をコメントアウト。またc_sourcesやxs_filesなども削っておく。
- 再度
perl Build.PL&&dmake test install - めでたしめでたし で あってくれ
libdbの準備
- Oracle Berkeley DB Downloads からtarballを持ってくる
- msys上 で
tar xvzf db-***.tar.gz cd build_unix/して../dist/configure- configure のオプションは
--prefix=/usr/local(お好みで--disable-shared(これもお好みで--enable-mingw(超重要 これ付けないとMinGWでビルドできない。
- configure のオプションは
- 後は普通に
make install
DB_Fileのインストール
- Windowsプロンプトに戻って
- DB_Fileのtarballを一旦展開
- config.in を編集して、INCLUDE と LIB を書き換える
- (環境変数 DB_FILE_INCLUDE と DB_FILE_LIB を設定するのでもいいのかな。まぁお好みで
perl Makefile.PLとdmake test install- めでたしめでたし




