![]() |
![]()
| ![]() |
![]()
NAMEpkgs_which - Quickly find packages where trees of files got installed SYNOPSISpkgs_which [-oqvsd] {dir|file} [...] pkgs_which {-h|-?|--help} pkgs_which --man OPTIONS--origins, -o print package origins instead of names --quiet, -q only print actual package names --verbose, -v also print unmatched files --sort, -s sort package and file lists --[no-]cacheall read and cache all package file lists first --[no-]find descend directories on the command line [default] --debug, -d emit additional debug information on stderr --help, -h, -? print a brief help message and quit --man show the full full documentation and quit Long options can be abbreviated to the shortest unambiguous string. Short options can be bundled (Example: pkgs_which -qo ...). DESCRIPTIONpkgs_which is a tool to efficiently look up which FreeBSD ports or packages installed the files on its command line, or the files in the directories on the command line. pkgs_which
It is most useful for quickly obtaining a list of site-packages that need to be reinstalled after upgrading a script language interpreter to a new version that uses new directories for its site-packages, for instance, after a Python 2.6 => 2.7 or Perl 5.10 => 5.12 upgrade, and is a good companion to portmaster(8). IMPLEMENTATION NOTESpkgs_which uses pkg_info -L to accelerate the process. It first obtains a list of all files, looks at a random one, looks up the corresponding package and records its name, and then purges all files belonging to it before looking up the next file. pkgs_which does not spawn subshells for pkg_info for security reasons, and makes sure to launder the pkg_info output. The --cacheall option (default on) makes pkgs_which read all package file lists upon start. This takes a few seconds on a GHz-class computer but voids the need to run pkg_info -W often later on. For looking up very few files, it is more efficient to use --no-cacheall. RELATED TOOLSpkgs_which performs a similar task to pkg_which(1) that is part of the ports-mgmt/portupgrade port, but unlike the latter, it does not require a database, and is optimized for bulk lookups of entire directory trees. portmaster(8) is a tool written by Doug Barton to upgrade installed ports and their dependencies that does not require port/package databases. EXAMPLESObtain the sorted list of all packages that installed at least one file under /usr/local/lib/python2.6/site-packages: pkgs_which --sort /usr/local/lib/python2.6/site-packages Upgrade all packages that installed at least one file under /usr/local/lib/python2.6/site-packages (this assumes a Bourne-shell such as sh, ash, ksh, bash): portmaster -d $(pkgs_which -qo /usr/local/lib/python2.6/site-packages) SEE ALSOpkg_info(8), portmaster(8), portupgrade(8), pkg_which(8) HISTORY0.4.1 2014-02-11
Workaround for previous versions: use --no-find if you intend to look up non-regular files. 0.4.0 2013-11-28
Note that pkgNG always uses --nocache implictly for speed: https://github.com/freebsd/pkg/issues/658 Known issue: the pkgNG detection is a hack. It just looks for the executable and the database in default locations, but does not attempt to run "pkg -N". 0.3.0 2013-03-11
0.2.0 2011-07-25
- added the --no-find option 0.1.0 2011-03-12
AUTHORSCopyright 2011, 2013 Matthias Andree <mandree@FreeBSD.org>. All rights reserved. This script is exclusively licensed under the GNU General Public License version 3, or any later version.
|