MacPortsでdeactiveなportを削除するスクリプト
追記: port uninstall inactiveでできます。
追記2: port uninstall -uでもできます。
30分プログラム、その704。MacPortsでdeactiveなportを削除するスクリプト。
MacPortsを長い間使っていると、古いportがたまってきます。
# (active)以外が古いport $ port installed The following ports are currently installed: a2ps @4.13b_3 a2ps @4.14_0 (active) a52dec @0.7.4_0 (active) apg @2.2.3_0 (active) apr @1.3.2_0+darwin_9 apr @1.3.3_0 apr @1.3.3_1 apr @1.3.8_0 (active)
古いportは無効化(deactivate)されているので邪魔じゃないんですが、気分的にちょっと嫌です。
というわけで、古いportを削除するスクリプトを書いてみました。シェルスクリプトでも十分な気がしますが、拡張のしやすさとかを考えてPerlで書いておきました。
使い方
$ ./port-uninstall ....
ソースコード
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
foreach(`port installed`) {
next if /active/;
next unless /@/;
system "port -d uninstall $_";
}