diff options
| author | Aljaž "g5pw" Srebrnič <a2piratesoft@gmail.com> | 2014-02-19 15:28:30 +0100 |
|---|---|---|
| committer | Aljaž "g5pw" Srebrnič <a2piratesoft@gmail.com> | 2014-06-26 17:58:00 +0200 |
| commit | 8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1 (patch) | |
| tree | 8413c6f2b66b92336b58e2c098756a28b2e9a3ac /src/_port | |
| parent | Use the -q flag when calling port (diff) | |
| download | zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar.gz zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar.bz2 zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar.lz zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar.xz zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.tar.zst zsh-completions-8daa84f28ffc8b1f955a1a5e83b8cb55f47111e1.zip | |
A better cache policy for _port
This compares modification times of the main PortIndex for all ports and
registry.db for installed ports.
Diffstat (limited to 'src/_port')
| -rw-r--r-- | src/_port | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -225,8 +225,16 @@ _port_select() { } _port_caching_policy() { - local reg_time comp_time - reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db) + local reg_time comp_time check_file + 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) return $(( reg_time < comp_time )) } |
