diff options
| author | Shohei YOSHIDA <syohex@gmail.com> | 2023-09-04 17:12:07 +0900 |
|---|---|---|
| committer | Shohei YOSHIDA <syohex@gmail.com> | 2023-09-04 17:12:07 +0900 |
| commit | ae3a2e440005fd04a88ce49d405a37326fba45bc (patch) | |
| tree | b0591bb95922703ec7e29e0483ebc00644a598ee /src/_port | |
| parent | Merge pull request #1033 from zsh-users/add-supervisord (diff) | |
| download | zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar.gz zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar.bz2 zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar.lz zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar.xz zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.tar.zst zsh-completions-ae3a2e440005fd04a88ce49d405a37326fba45bc.zip | |
Fix port's cache policy function
The option of stat on macOS/BSD is wrong. So cache is always purged and
cache is always recreated so it is really slow.
Use 'zstat' module instead stat command for portability.
Diffstat (limited to 'src/_port')
| -rw-r--r-- | src/_port | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -253,15 +253,10 @@ _port_select() { fi } -stat -f%m . > /dev/null 2>&1 -if [ "$?" = 0 ]; then - stat_cmd=(stat -f%Z) -else - stat_cmd=(stat --format=%Z) -fi - _port_caching_policy() { local reg_time comp_time check_file + + zmodload -F zsh/stat b:zstat 2> /dev/null case "${1##*/}" in PORT_INSTALLED_PACKAGES) check_file=$port_prefix/var/macports/registry/registry.db @@ -270,9 +265,17 @@ _port_caching_policy() { check_file=${$(port dir MacPorts)%/*/*}/PortIndex ;; esac - reg_time=$($stat_cmd $check_file) - comp_time=$($stat_cmd $1) + reg_time=$(zstat +mtime $check_file) + comp_time=$(zstat +mtime $1) return $(( reg_time < comp_time )) } _port "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et |
