Last active
November 1, 2024 06:18
-
-
Save noqisofon/a9cc044df5adc06a7e62e1adc785da5d to your computer and use it in GitHub Desktop.
( ノ╹◡◡╹)ノ いんすとろーるされてるパッケージの依存関係をグラフで見たい気もする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `pkg-config.list-all.txt` を作成します。 | |
pkg-config --list-all | sort -u > ./pkg-config.list-all.txt | |
# おまけで `./digraph` ディレクトリを作るかもしれない。 | |
mkdir ./digraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `pkg-config.list-all.txt` を 1 行ずつ読み取り、`pkg-config --digraph $package_name` を実行するシェルスクリプトを出力するスクリプト。 | |
for './pkg-config.list-all.txt'.IO.lines -> $line { | |
my @parts = $line.split(/' '+/); | |
my $package-name = @parts[0]; | |
say "pkg-config --digraph $package-name > ./digraph/$package-name.dot"; | |
} | |
# 以下のように実行すると良いかも。 | |
# ``` | |
# raku ./1_list-all-to-digraph.raku > ./1_list-all-to-digraph.bash | |
# bash ./1_list-all-to-digraph.bash | |
# ``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `.dot` から `.png` に変換するまけふぁいるを `./digraph/makefile` に生成するよ。 | |
my $digraph-dir = './digraph/'.IO; | |
my @dot-files = $digraph-dir.dir(test => /:i '.dot' $/ ); | |
my @sources = @dot-files.map: { .resolve.basename }; | |
my @targets = @sources.map: { .subst('.dot', '.png') }; | |
my $makefile = $digraph-dir.add('makefile'); | |
my $fh = $makefile.open(:w); | |
$fh.put("targets := {@targets.join(' ')}"); | |
$fh.print-nl; | |
$fh.put("all: \$(targets)"); | |
$fh.print-nl; | |
$fh.put("\%.png: \%.dot"); | |
$fh.put("\t/ucrt64/bin/dot -v -Kdot \$^ -Tpng -o\$@"); | |
$fh.print-nl; | |
LEAVE $fh.close; | |
# 以下のように実行すると、多分生成されるよ! 楽しんでね! | |
# ``` | |
# raku ./2_generate_makefile.raku | |
# make -C ./digraph | |
# ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment