On Mon, Mar 24, 2008 at 09:05:36PM +0200, Igor Vlasenko wrote: > Больше всего в repocop 0.06 меня напрягала необходимость 2 часа прогонять > через тест весь репозиторий, если в тесте хоть что-то меняется. Я для этого в свое время в пакете qa-robot сделал cmdcache(1). Но никакой инвалидации кеша там нет, так что это можно использовать только для очень стабильно работающих команд -- например, для file(1) в сочетании c nm(1). $ man cmdcache |cat -s CMDCACHE(1) User Contributed Perl Documentation CMDCACHE(1) NAME cmdcache - simple cache for command output SYNOPSIS cmdcache [-h] command FILE DESCRIPTION cmdcache wraps command and caches its output. command must take exactly one argument, an existent FILE (or possibly a directory). Pre- vious command output is reused when "st_ino", "st_size", and "st_mtime" of the FILE match. cmdcache can be sourced by specifying null argument for the command. Shell function with the same name is provided, and command can be a shell function, too. Suggested usage is as follows: # implement custom command with a shell function my_command() { local f="$1"; study "$f"; } # grab cmdcache shell function . cmdcache "" # process arguments and cache the results for f; do cmdcache my_command "$f"; done Upon successful command completion, cache file is stored under "$HOME/.cmdcache/command" directory. The directory has up to 97 subdi- rectories, due to "mod 97" hash function. That is, the designed cache cacpacity is about 10k (100 files * 100 subdirs), and the capacity does not impose any performance hit. When command return code is non-zero, cache file is not created, and the return code of cmdcache is that of the command. The return code is 2 if an error occurred (e.g. if FILE does not exist). If FILE has changed upon command completion, the return code is 2. This means that FILE must not be modified by the command. AUTHOR Written by Alexey Tourbin . COPYING Copyright (c) 2005 Alexey Tourbin, ALT Linux Team. This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. SEE ALSO stat(2), ccache(1) perl v5.8.8 2007-11-27 CMDCACHE(1)