A better cache policy for _port
This compares modification times of the main PortIndex for all ports and registry.db for installed ports.
This commit is contained in:
parent
04e2e85de8
commit
8daa84f28f
12
src/_port
12
src/_port
|
@ -225,8 +225,16 @@ _port_select() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_port_caching_policy() {
|
_port_caching_policy() {
|
||||||
local reg_time comp_time
|
local reg_time comp_time check_file
|
||||||
reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db)
|
case "${1##*/}" in
|
||||||
|
PORT_INSTALLED_PACKAGES)
|
||||||
|
check_file=$port_prefix/var/macports/registry/registry.db
|
||||||
|
;;
|
||||||
|
PORT_AVAILABLE_PACKAGES)
|
||||||
|
check_file=${$(port dir MacPorts)%/*/*}/PortIndex
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
reg_time=$(stat -c '%Z' $check_file)
|
||||||
comp_time=$(stat -c '%Z' $1)
|
comp_time=$(stat -c '%Z' $1)
|
||||||
return $(( reg_time < comp_time ))
|
return $(( reg_time < comp_time ))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue