Date: Thu, 20 Jul 2000 12:02:48 -0400 (EDT) From: abeaupre@chemcomp.com To: FreeBSD-gnats-submit@freebsd.org Subject: bin/20062: New (?) package management utilities Message-ID: <20000720160248.C0AF3A7@sky.chemcomp.com>
next in thread | raw e-mail | index | archive | help
>Number:         20062
>Category:       bin
>Synopsis:       New (?) package management utilities
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 20 09:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Antoine Beaupre
>Release:        FreeBSD 4.0-RELEASE i386
>Organization:
Chemical Computing Group, Inc.
>Environment:
	FreeBSD sky.chemcomp.com 4.0-RELEASE FreeBSD 4.0-RELEASE #7:
	Tue Jun 27 16:42:57 EDT 2000
	root@sky.chemcomp.com:/usr/src/sys/compile/SKY  i386
>Description:
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.
>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..
>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
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000720160248.C0AF3A7>
