■squeezeでnwdiagを導入する。
以下のようにGraphizでも出来なくはないのですが、NWの線を引きたい。。。
debtreeとdotコマンドでvmnetのイメージ図を作る
http://labunix.hateblo.jp/entry/2012/05/04/155322
※結論から言うと、「easy_install」手順は地雷。「pypi-install」を使う。
debian wheezyではパッケージ管理されるらしい。
■「easy_install」手順、PIL (Python Imaging Library) の導入。
以下を参考に、前提条件を満たしておく。
※「build-dep」したのは、python関連のパッケージの導入の為。
「python-setuptools」には「easy_install」コマンドがある。
Sphinx連携は導入しない。trac関連でPythonには若干懲りているので、様子見が必要。
参考:(2日目) blockdiag のインストール〜使い方 (Debian 編)
http://d.hatena.ne.jp/tk0miya/20111202
$ sudo apt-get install -y python-imaging
$ sudo apt-get build-dep -y python-imaging
$ sudo apt-get install -y python-setuptools
■「easy_install」手順、blockdiagの導入。
$ sudo easy_install blockdiag
$ sudo easy_install seqdiag
$ sudo easy_install actdiag
$ sudo easy_install nwdiag
■「easy_install」手順、確認。
※dpkgに反映されないだけでなく、
「easy_install」はアンインストールコマンドを提供していない。
「/usr/local/bin」等、debianのポリシーと異なる場所にインストールされる。
よって、これは地雷手順。
$ whereis blockdiag
blockdiag: /usr/local/bin/blockdiag
$ whereis seqdiag
seqdiag: /usr/local/bin/seqdiag
$ whereis actdiag
actdiag: /usr/local/bin/actdiag
$ whereis nwdiag
nwdiag: /usr/local/bin/nwdiag
$ dpkg -l | grep "diag" | wc -l
0
■「easy_install」手順、アップデート時に再度確認できる。
$ echo "blockdiag seqdiag actdiag nwdiag" | for list in `xargs`;do sudo easy_install -U "$list";done | grep ".egg"
Processing blockdiag-1.2.2-py2.6.egg
Using /usr/local/lib/python2.6/dist-packages/blockdiag-1.2.2-py2.6.egg
Processing seqdiag-0.8.0-py2.6.egg
Using /usr/local/lib/python2.6/dist-packages/seqdiag-0.8.0-py2.6.egg
Processing actdiag-0.4.1-py2.6.egg
Using /usr/local/lib/python2.6/dist-packages/actdiag-0.4.1-py2.6.egg
Processing nwdiag-0.9.1-py2.6.egg
Using /usr/local/lib/python2.6/dist-packages/nwdiag-0.9.1-py2.6.egg
■「easy_install」手順、以下を参考にアンインストール。
参考:pythonモジュールのアンインストール
http://d.hatena.ne.jp/kokiya/20080920/1221931695
※メインのコマンドは「-m」だが、エラーが出るので、「-x」、「-N」も組み合わせる。
$ sudo easy_install --help 2>&1 | grep -A 1 "(\-m)"
--multi-version (-m) make apps have to require() a
version
$ sudo easy_install --help 2>&1 | grep "(\-[xN])"
--exclude-scripts (-x) Don't install scripts
--no-deps (-N) don't install dependencies
$ ls /usr/local/bin/*diag | sed s%/usr/local/bin/%%g | for list in `xargs`;do sudo easy_install -mxN "$list";done
■「easy_install」手順、実行ファイルとeggの削除。
$ sudo rm -f /usr/local/bin/*diag
$ find /usr/local/lib/python2.6/dist-packages/ -type d -name "*diag*.egg" -print
/usr/local/lib/python2.6/dist-packages/blockdiag-1.2.2-py2.6.egg
/usr/local/lib/python2.6/dist-packages/actdiag-0.4.1-py2.6.egg
/usr/local/lib/python2.6/dist-packages/nwdiag-0.9.1-py2.6.egg
/usr/local/lib/python2.6/dist-packages/seqdiag-0.8.0-py2.6.egg
$ find /usr/local/lib/python2.6/dist-packages/ -type d -name "*diag*.egg" -print | sudo rm -fr `xargs`
$ ls /usr/local/lib/python2.6/dist-packages
easy-install.pth ordereddict-1.1-py2.6.egg
funcparserlib-0.3.5-py2.6.egg webcolors-1.4-py2.6.egg
■「easy_install」手順、残り3つも削除。
$ ls /usr/local/lib/python2.6/dist-packages | \
grep -v easy | \
sed s/"\-.*"//g | \
for list in `xargs`;do \
sudo easy_install -mxN "$list"; \
done
$ ls /usr/local/lib/python2.6/dist-packages/
funcparserlib-0.3.5-py2.6.egg webcolors-1.4-py2.6.egg
ordereddict-1.1-py2.6.egg
$ find /usr/local/lib/python2.6/dist-packages/ -type d -name "*.egg" -print | rm -fr `xargs`
$ ls /usr/local/bin/ | wc -l
0
$ ls /usr/local/lib/python2.6/dist-packages/ | wc -l
0
■「pypi-install」手順、正しく、簡単な方法
参考:blockdiag の概要
http://blockdiag.com/ja/blockdiag/introduction.html#debian-6-0-squeeze
□上記の「easy_install」で汚れている可能性のあるパッケージを念のため再インストールする場合のみ。
$ sudo apt-get install --reinstall -y python-imaging
$ sudo apt-get install -y ttf-ipafont
$ sudo apt-get purge python-setuptools
$ sudo apt-get autoremove -y
$ sudo apt-get install -y python-stdeb
$ sudo apt-get build-dep -y python-stdeb
■「pypi-install」手順、クリーンインストール時には、以下の手順で行う。
というよりこちらの方がはるかに楽。
$ sudo apt-get install -y python-imaging ttf-ipafont python-stdeb
$ sudo apt-get build-dep -y python-imaging ttf-ipafont python-stdeb
$ sudo apt-get build-dep -y python
$ echo "funcparserlib webcolors blockdiag" | \
for list in `xargs`;do \
sudo pypi-install "$list"; \
done
$ whereis blockdiag
blockdiag: /usr/bin/blockdiag
$ dpkg -l | grep "funcparserlib\|webcolors\|blockdiag" | grep ^ii | awk '{print $2}'
python-blockdiag
python-funcparserlib
python-webcolors
$ echo "seqdiag actdiag nwdiag" | for list in `xargs`;do sudo pypi-install "$list";done
■「pypi-install」手順、導入確認。
以下のように、「dpkg」「apt-cache」で管理できる。
残念ながら「apt-file」では見つからない。
$ echo "seqdiag actdiag nwdiag" | for list in `xargs`;do dpkg -l | grep "$list" | grep ^ii | awk '{print $2}';done
python-seqdiag
python-actdiag
python-nwdiag
$ echo "seqdiag actdiag nwdiag" | for list in `xargs`;do apt-cache search "$list";done
python-seqdiag - seqdiag generate sequence-diagram image file from spec-text
python-actdiag - actdiag generate activity-diagram image file from spec-text
python-nwdiag - nwdiag generate network-diagram image file from spec-text fi
$ echo "seqdiag actdiag nwdiag" | for list in `xargs`;do apt-file search "$list";done | wc -l
0
■但し、「dpkg」で管理されているので、以下にファイル構成がある。
$ sudo find /var/lib/dpkg/info -type f -name "python-*.list" -print
/var/lib/dpkg/info/python-reportbug.list
/var/lib/dpkg/info/python-tk.list
/var/lib/dpkg/info/python-actdiag.list
/var/lib/dpkg/info/python-apt-common.list
/var/lib/dpkg/info/python-dbg.list
/var/lib/dpkg/info/python-minimal.list
/var/lib/dpkg/info/python-stdeb.list
/var/lib/dpkg/info/python-webcolors.list
/var/lib/dpkg/info/python-imaging.list
/var/lib/dpkg/info/python-support.list
/var/lib/dpkg/info/python-nwdiag.list
/var/lib/dpkg/info/python-dev.list
/var/lib/dpkg/info/python-funcparserlib.list
/var/lib/dpkg/info/python-apt.list
/var/lib/dpkg/info/python-blockdiag.list
/var/lib/dpkg/info/python-tk-dbg.list
/var/lib/dpkg/info/python-central.list
/var/lib/dpkg/info/python-seqdiag.list
/var/lib/dpkg/info/python-all-dev.list
/var/lib/dpkg/info/python-pkg-resources.list
/var/lib/dpkg/info/python-all.list
/var/lib/dpkg/info/python-setuptools.list
/var/lib/dpkg/info/python-all-dbg.list
■例えば以下のようにファイル構成を確認できる。
$ cat /var/lib/dpkg/info/python-nwdiag.list
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python-nwdiag
/usr/share/doc/python-nwdiag/changelog.Debian.gz
/usr/share/python-support
/usr/share/python-support/python-nwdiag.public
/usr/share/pyshared
/usr/share/pyshared/nwdiag_sphinxhelper.py
/usr/share/pyshared/rackdiag_sphinxhelper.py
/usr/share/pyshared/packetdiag_sphinxhelper.py
/usr/share/pyshared/rackdiag
/usr/share/pyshared/rackdiag/utils
/usr/share/pyshared/rackdiag/utils/__init__.py
/usr/share/pyshared/rackdiag/utils/rst
/usr/share/pyshared/rackdiag/utils/rst/__init__.py
/usr/share/pyshared/rackdiag/utils/rst/directives.py
/usr/share/pyshared/rackdiag/utils/math.py
/usr/share/pyshared/rackdiag/command.py
/usr/share/pyshared/rackdiag/__init__.py
/usr/share/pyshared/rackdiag/metrics.py
/usr/share/pyshared/rackdiag/elements.py
/usr/share/pyshared/rackdiag/builder.py
/usr/share/pyshared/rackdiag/tests
/usr/share/pyshared/rackdiag/tests/test_rst_directives.py
/usr/share/pyshared/rackdiag/tests/test_pep8.py
/usr/share/pyshared/rackdiag/parser.py
/usr/share/pyshared/rackdiag/drawer.py
/usr/share/pyshared/nwdiag-0.9.1.egg-info
/usr/share/pyshared/nwdiag-0.9.1.egg-info/entry_points.txt
/usr/share/pyshared/nwdiag-0.9.1.egg-info/PKG-INFO
/usr/share/pyshared/nwdiag-0.9.1.egg-info/SOURCES.txt
/usr/share/pyshared/nwdiag-0.9.1.egg-info/top_level.txt
/usr/share/pyshared/nwdiag-0.9.1.egg-info/requires.txt
/usr/share/pyshared/nwdiag-0.9.1.egg-info/dependency_links.txt
/usr/share/pyshared/nwdiag
/usr/share/pyshared/nwdiag/utils
/usr/share/pyshared/nwdiag/utils/__init__.py
/usr/share/pyshared/nwdiag/utils/rst
/usr/share/pyshared/nwdiag/utils/rst/__init__.py
/usr/share/pyshared/nwdiag/utils/rst/directives.py
/usr/share/pyshared/nwdiag/command.py
/usr/share/pyshared/nwdiag/__init__.py
/usr/share/pyshared/nwdiag/metrics.py
/usr/share/pyshared/nwdiag/elements.py
/usr/share/pyshared/nwdiag/builder.py
/usr/share/pyshared/nwdiag/tests
/usr/share/pyshared/nwdiag/tests/test_builder_errors.py
/usr/share/pyshared/nwdiag/tests/test_rst_directives.py
/usr/share/pyshared/nwdiag/tests/test_pep8.py
/usr/share/pyshared/nwdiag/tests/test_generate_diagram.py
/usr/share/pyshared/nwdiag/tests/test_builder.py
/usr/share/pyshared/nwdiag/parser.py
/usr/share/pyshared/nwdiag/drawer.py
/usr/share/pyshared/packetdiag
/usr/share/pyshared/packetdiag/noderenderers.py
/usr/share/pyshared/packetdiag/utils
/usr/share/pyshared/packetdiag/utils/__init__.py
/usr/share/pyshared/packetdiag/utils/rst
/usr/share/pyshared/packetdiag/utils/rst/__init__.py
/usr/share/pyshared/packetdiag/utils/rst/directives.py
/usr/share/pyshared/packetdiag/command.py
/usr/share/pyshared/packetdiag/__init__.py
/usr/share/pyshared/packetdiag/metrics.py
/usr/share/pyshared/packetdiag/elements.py
/usr/share/pyshared/packetdiag/builder.py
/usr/share/pyshared/packetdiag/tests
/usr/share/pyshared/packetdiag/tests/test_rst_directives.py
/usr/share/pyshared/packetdiag/tests/test_pep8.py
/usr/share/pyshared/packetdiag/parser.py
/usr/share/pyshared/packetdiag/drawer.py
/usr/bin
/usr/bin/rackdiag
/usr/bin/nwdiag
/usr/bin/packetdiag
□追記
※後で解析しようと思うが、easy_installしないと以下のようなエラーを吐いて出力できなかった。
「pypi-install」単独では、どこかの依存関係を満たせていない様子。
また、「ttf-ipafont」はインストールできていなかったので、もう一度やり直しかな。。。。
File "/usr/bin/nwdiag", line 5, in <module>
...
■「easy_install」手順、blockdiagの導入。
$ sudo easy_install blockdiag
$ sudo easy_install seqdiag
$ sudo easy_install actdiag
$ sudo easy_install nwdiag