Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts

Aug 18, 2011

OSX に、Mercurial のリポジトリを構築

macports を使って、mercurial をインストール
sudo port install mercurial


リポジトリの作成
※ パーミッション等、Apacheのユーザが書き込めるようにしておく
mkdir -p /path/to/hg/repo

cd /path/to/hg/repo
hg init someproject


hgrc の設置
vi /path/to/hg/repo/someproject/.hg/hgrc


# こんな感じ
[web]
contact = me@me.com
description = Some Project

allow_push = *
allow_archive = zip
push_ssl = true

# 詳しくは
man hgrc


hgweb.config の設置
vi /path/to/hg/hgweb.config


# こんな感じ
[paths]
/ = /path/to/hg/repo/*


hgweb.cgi の設置
cp /opt/local/share/mercurial/hgweb.cgi /path/to/hg/

vi /path/to/hg/hgweb.cgi

# 設定ファイルのパスを修正
config = "/path/to/hg/hgweb.config"

# 文字化けする場合は以下を追加
import os
os.environ["HGENCODING"] = "UTF-8"

# 以下必要に応じて書き換え
import sys; sys.path.insert(0, "/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages")


Apacheの設定
sudo vi /etc/apache2/other/hg.config


# こんな感じ
Alias /hg /path/to/hg

<Directory "/path/to/hg">
Options ExecCGI FollowSymLinks
DirectoryIndex hgweb.cgi
AddHandler cgi-script .cgi

AuthType Basic
AuthName "Repository"
AuthUserFile /private/etc/apache2/.htpasswd
AuthGroupFile /dev/null

Order deny,allow
Deny from all
Allow from xxx.xxx.xxx.xxx/24

Require valid-user
</Directory>

# Apache再起動
sudo /usr/sbin/apachectl restart


参考サイト

http://www.neutralworks.com/blog/osx/mecurial-on-mac.html
http://blog.bluegold.me/2010/02/setup-mercurial-hgwebdir-fcgi-on-nginx/
http://d.hatena.ne.jp/eldesh/20110125/1295938971
http://www.proton.jp/main/programming/mercurial.html

Feb 21, 2011

MacPortsのメンテナンス

MacPorts自体をアップデートする。

$ sudo port selfupdate

MacPorts にたまったキャッシュをクリアする。

$ sudo port clean --dist outdated
$ sudo port upgrade outdated
$ sudo port -u uninstall

clean のオプションは、man port で clean のセクションに詳細が書いてあります。

ちなみに、私の環境では約1年半メンテナンスしていなくて、約2.4G溜まっていたものが、
約1.2Gまで、スペースが空きました。


参考サイト

http://kunishi.blogspot.com/2009/04/macportstips-distfiles.html

Feb 16, 2011

lipo - OSXのユニバーサルバイナリをダイエット

lipo を使えば、PowerPC用など使わないバイナリを削除できます。

まず、情報をチェック。
$ cd /Applications/CotEditor.app/Contents/MacOS/
$ lipo -detailed_info CotEditor Fat header in: CotEditor
fat_magic 0xcafebabe
nfat_arch 2
architecture ppc
    cputype CPU_TYPE_POWERPC
    cpusubtype CPU_SUBTYPE_POWERPC_ALL
    offset 4096
    size 451032
    align 2^12 (4096)
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 458752
    size 457544
    align 2^12 (4096)

削除してよければ、例えば以下のように。
$ lipo -remove ppc -output CotEditor2 CotEditor

$ ll -h
total 2696
-rwxr-xr-x  1 user  admin   895K  4 26  2009 CotEditor
-rwxr-xr-x  1 user  admin   451K  2 16 23:14 CotEditor2

$ lipo -detailed_info CotEditor2
Fat header in: CotEditor3
fat_magic 0xcafebabe
nfat_arch 1
architecture i386
    cputype CPU_TYPE_I386
    cpusubtype CPU_SUBTYPE_I386_ALL
    offset 4096
    size 457544
    align 2^12 (4096)

起動してみて問題がなければ元のものと入れ替えます。


参考サイト

http://journal.mycom.co.jp/column/osx/282/index.html