| Summary: | New (?) package management utilities | ||
|---|---|---|---|
| Product: | Base System | Reporter: | abeaupre <abeaupre> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.0-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed What's really needed is for the _existing_ package management tools to be extended as required. Providing a pantheon of management utilities, each of which duplicates in some way the functionality of at least one other, is not the way to go. However, if you're not up to that task but still think your suite of scripts is useful, you should probably submit them as a port. Please see: http://www.freebsd.org/porters-handbook/ |
I have "coded" a few shell scripts to help me in the titanic task of managing packages under FreeBSD, and I think there would be place in the base system for this. These are basic shell scripts that make a heavy use of grep and ls and that are much faster than pkg_info(1) and that (you guessed it!) support regular expressions (yay!). Description of utilities: pkg_find [regexp] [displays names of matching packages] pkg_findBin [regexp] [displays names of packages which +CONTENTS file matches regexp] pkg_desc [regexp] [gives +DESC files of matching packages, uses pkg_find] pkg_plist [regexp] [idem with +CONTENTS file] One could add one called pkg_comment or something like that to give the short description of the package and/or merge the last 2 together since the code is the same. Only the displayed file is different. Fix: Source code (!): pkg_find (that's a hard one... :) ---- Cut Here ---- #! /bin/sh ls /var/db/pkg | grep $@ ---- Cut Here ---- pkg_findBin: ---- Cut Here ---- #! /bin/sh pkgDir="/var/db/pkg" echo "Matching packages:" for package in `ls $pkgDir` { grep -q $@ $pkgDir/$package/+CONTENTS && \ echo $package } ---- Cut Here ---- pkg_desc: ---- Cut Here ---- #! /bin/sh hits=`pkg_find $@` if [ ! -z "$hits" ] then echo "Matches:" echo echo $hits echo echo "To display package(s) description, press ENTER. Ctrl-C to cancel." read botch for hit in $hits do $PAGER /var/db/pkg/$hit/+DESC read -p "Press ENTER to continue" done else echo No match. fi ---- Cut Here ---- pkg_plist (could probably be merged with pkg_desc): ---- Cut Here ---- #! /bin/sh hits=`pkg_find $@` if [ ! -z "$hits" ] then echo "Matches:" echo echo $hits echo echo "To display package(s) description, press ENTER. Ctrl-C to cancel." read botch for hit in $hits do $PAGER /var/db/pkg/$hit/+CONTENTS read -p "Press ENTER to continue: " botch done else echo No match. fi ---- Cut Here ---- TODO: - Compatibility with pkg_info commandline and environnement. - Full pkg_info replacement?? - Merge pkg_desc pkg_plist and potential pkg_comment together How-To-Repeat: $ pkg_find em movemail-1.0 xemacs-mule-21.1.9 xemacs-mule-common-21.1.9 xemacs-mule-packages-1.1 xemacs-packages-1.1 $ pkg_findBin '\(apache\)\|\(xemacs\)' File found in: apache-1.3.12 xemacs-mule-21.1.9 xemacs-mule-common-21.1.9 xemacs-mule-packages-1.1 xemacs-packages-1.1 $ pkg_desc xemacs ... You get the picture..