head	1.27;
access;
symbols
	RELEASE-1_4:1.26.0.2
	GENTOO_1_4_SNAP_2003010800:1.18;
locks; strict;
comment	@# @;


1.27
date	2003.08.15.12.50.15;	author lanius;	state dead;
branches;
next	1.26;

1.26
date	2003.06.25.01.28.25;	author vapier;	state Exp;
branches;
next	1.25;

1.25
date	2003.06.22.20.09.48;	author agriffis;	state Exp;
branches;
next	1.24;

1.24
date	2003.06.13.07.15.27;	author rajiv;	state Exp;
branches;
next	1.23;

1.23
date	2003.06.12.19.47.14;	author mholzer;	state Exp;
branches;
next	1.22;

1.22
date	2003.06.08.20.27.12;	author lostlogic;	state Exp;
branches;
next	1.21;

1.21
date	2003.06.08.13.18.48;	author mholzer;	state Exp;
branches;
next	1.20;

1.20
date	2003.04.22.18.54.26;	author mholzer;	state Exp;
branches;
next	1.19;

1.19
date	2003.03.21.12.37.18;	author mholzer;	state Exp;
branches;
next	1.18;

1.18
date	2003.01.05.12.36.25;	author mholzer;	state Exp;
branches;
next	1.17;

1.17
date	2002.10.31.22.26.34;	author lostlogic;	state Exp;
branches;
next	1.16;

1.16
date	2002.09.28.14.54.07;	author karltk;	state Exp;
branches;
next	1.15;

1.15
date	2002.09.03.02.46.41;	author lostlogic;	state Exp;
branches;
next	1.14;

1.14
date	2002.07.26.06.07.42;	author lostlogic;	state Exp;
branches;
next	1.13;

1.13
date	2002.07.14.22.39.40;	author lostlogic;	state Exp;
branches;
next	1.12;

1.12
date	2002.06.26.22.14.37;	author lostlogic;	state Exp;
branches;
next	1.11;

1.11
date	2002.06.26.04.20.21;	author lostlogic;	state Exp;
branches;
next	1.10;

1.10
date	2002.06.11.21.13.26;	author lostlogic;	state Exp;
branches;
next	1.9;

1.9
date	2002.06.11.14.45.03;	author lostlogic;	state Exp;
branches;
next	1.8;

1.8
date	2002.06.08.13.52.14;	author lostlogic;	state Exp;
branches;
next	1.7;

1.7
date	2002.06.08.13.38.46;	author lostlogic;	state Exp;
branches;
next	1.6;

1.6
date	2002.06.07.21.13.29;	author lostlogic;	state Exp;
branches;
next	1.5;

1.5
date	2002.06.05.02.45.33;	author lostlogic;	state Exp;
branches;
next	1.4;

1.4
date	2002.06.05.01.13.36;	author lostlogic;	state Exp;
branches;
next	1.3;

1.3
date	2002.02.11.15.28.47;	author vitaly;	state Exp;
branches;
next	1.2;

1.2
date	2002.02.03.11.32.39;	author vitaly;	state Exp;
branches;
next	1.1;

1.1
date	2002.01.24.20.45.57;	author karltk;	state Exp;
branches;
next	;


desc
@@


1.27
log
@moved to app-portage
@
text
@#!/bin/bash
#
# qpkg - query portage package system for various information
#
# Copyright (c) Vitaly Kushneriuk <vitaly_kushneriuk@@yahoo.com>
# This program is distributed under the terms of GPL version 2.
#
# Maintainer: Brandon Low <lostlogic@@gentoo.org>
# Additional code thanks to:
#	      Josh Goebel <dreamer@@firesedge.org>
#
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.26 2003/06/25 01:28:25 vapier Exp $
ID='$Id: qpkg,v 1.26 2003/06/25 01:28:25 vapier Exp $'
VERSION=0.`echo ${ID} | cut -d\  -f3`

PROG=`basename ${0}`

# Parse args
verb=0
group="*"
params=${#}
while [ ${#} -gt 0 ]
do
	a=${1}
	shift
	case "${a}" in

	-h|--help)
		usage=y
		break
		;;

	-i|--info)
		info=y
		;;

	-d|--dups)
		dups=y
		inst=y
		;;

	-q|--query-deps)
		query=y
		;;

	-s|--slot)
		slot=y
		;;

	-f|--find-file)
		ffind=y
		inst=y
		;;

	-fp|--find-pattern)
		ffind=y
		fpat=y
		inst=y
		;;

	-I|--installed)
		inst=y
		;;

	-m|--masked)
		grepmask="-L"
		;;

	-n|--non-masked)
		grepmask="-l"
		;;

	-U|--uninstalled)
		uninst=y
		;;

	-g|--group)
		group=$1
		shift
		;;

	-l|--list)
		list=y
		inst=y
		;;

	-ct|--check-time|-tc|--time-check)
		tcheck=y
		inst=y
		;;

	-cm|--check-md5|-mc|--md5-check)
		mcheck=y
		inst=y
		;;

	-c|--check)
		mcheck=y
		tcheck=y
		inst=y
		;;

	-v|--verbose)
		let $((verb++))
		;;

	-vv)
		let $((verb++))
		let $((verb++))
		;;

	-nc|--no-color|--nocolor|--no-colors|--nocolors)
		nocolor=y
		;;

	-*)
		echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2
		usage=y
		break
		;;
	*)
		if [ -n "${arg}" ]; then
			echo -e ${CY}${PROG}: ${YL}Only one argument supported
			usage=y
			break
		fi
		arg=$a
		;;
		
	esac
done

#This is a dumb way to handle things, take it out next time
T="\t"

#Set up colors
if [ ! "${nocolor}" ]; then
	NO="\x1b[0;0m"
	BR="\x1b[0;01m"
	CY="\x1b[36;01m"
	RD="\x1b[31;01m"
	GR="\x1b[32;01m"
	YL="\x1b[33;01m"
	BL="\x1b[34;01m"
	STAR=" *"
elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then
	STAR=" *"
fi


# check for option conflicts
if [ "${inst}" -a "${uninst}" \
	-o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \
	-a "${uninst}"  ]; then
	echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO}
	usage=y
fi

if [ "${usage}" ]; then
	echo -e "${CY}${PROG} v. ${VERSION}${NO}

${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can
find packages owning files on your filesystem, check the integrity
of installed packages, and do other queries against installed or
uninstalled packages.

${BR}Usage:
${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} <file>${NO}|${BL}-fp${YL} <patern>${NO}]
${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}]
${T}${CY}${PROG}${NO} ${BL}--help${NO}

${BR}Duplicate Locating:
  ${BL}-d,  --dups${NO}${T}${T}print packages that have multiple versions installed
  ${BL}-s,  --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT

${BR}Package Selection:
  ${BL}-f,  --find-file${NO}${T}finds package that owns file <file>
  ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching *<pattern>*
  ${BL}-m,  --masked${NO}${T}Include${YL} only${NO} masked packages
  ${BL}-n,  --non-masked${NO}${T}Include${YL} only${NO} non-masked packages
  ${BL}-I,  --installed${NO}${T}Include${YL} only${NO} installed packages
  ${BL}-U,  --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages
  ${BL}-g,  --group${NO}${T}${T}Find by goup (can be combined with other searches)

${BR}Information Selection:
  ${BL}-l,  --list${NO}${T}${T}List package content
  ${BL}-i,  --info${NO}${T}${T}Get package description and home page.
  ${BL}-ct, --check-time${NO}
  ${BL}-tc, --time-check${NO}${T}Verify package files timestamps
  ${BL}-cm, --check-md5${NO}
  ${BL}-mc, --md5-check${NO}${T}Verify package files md5
  ${BL}-c,  --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5.
  ${BL}-q,  --query-deps${NO}${T}display all installed packages 
${T}${T}${T}depending on selected packages

${BR}Operation Modifiers:
  ${BL}-nc, --no-color${NO}${T}don't use colors
  ${BL}-v,  --verbose${NO}${T}Be more verbose [ can be repeated twise ]
  ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO}

${YL}Notes${NO}: 
${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages.
${YL}*${NO} Short options may not be combined on the command-line, yet.
${YL}*${NO} The operation of some flags has been changed by the
  stripping of version numbers from some output to see
  the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}.
${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only
  matching files will be displayed, unless ${BL}-v${NO} is doubled, 
  (yet more verbose) or ${BL}-vv${NO} is used.


${YL}Examples${NO}:
  ${PROG} --dups		print duplicates oldest first
  ${PROG} --dups -v	.. with versions
  ${PROG}			print list of installed packages
  ${PROG} porta -I		print versions of installed portage
  ${PROG} porta -i		.. + versions in portage tree + descriptions 
			and homepages
  ${PROG} gawk -c -v	check integrity all installed versions of gawk
			the older will have \"damaged\" files.
  ${PROG} -f /bin/ls	print package(s) that own /bin/ls
"
	exit
fi

#For the --dups switch only
if [ "${dups}" ]; then
if [ "${grepmask}" ]; then
	mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null`
	echo -e "Currently accepted keywords: ${BL}${mask}${NO}"
	echo -e
	mask=`echo ${mask} | perl -pe 's/\s+/|/'`
fi

	#First dig out the list of packages with duplicates
	find /var/db/pkg -iname "*${arg}*.ebuild" 2> /dev/null > /tmp/qpkg.lst
	dups=`cat /tmp/qpkg.lst | cut -f7 -d/ |
		sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' |
		sort | 
		uniq -d`

	#Next get all the exact versions
	duppak=`cat /tmp/qpkg.lst | fgrep "${dups}"`

	#Now cut that down to the directory name so we can be smart
	dirs=`sed -e 's:/[^/]*$::' /tmp/qpkg.lst`

	#Go through each package's DB and create a sortable file
	#to play with
	declare -i defcount=`cat /var/cache/edb/counter`
	for DIR in ${dirs}
	do	#Package COUNTER
		NUM=`cat "${DIR}/COUNTER" 2> /dev/null`
		[ -z "${NUM}" ] && NUM=defcount
		#Package slot if requested
		[ ${slot} ] && SLOT=`cat "${DIR}/SLOT"`
		#Package fullname
		PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"`
		#Package basename
		NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'`
		echo "${NUM} ${PKG} ${NAME}${SLOT}"
	#Finish loop, and sort that nice sortable file based on 
	#installation order, and then based on package basename
	#bash hates me so I decided to use a temp file
	done |sort -t" " -k3 -k1g,2|uniq -D -f2 > /tmp/qpkg.lst
	duppak=`cat /tmp/qpkg.lst`
	rm /tmp/qpkg.lst

	#If max verbosity is set output with full path to each ebuild
	if [ "${verb}" -gt 1 ]; then
		echo -n "${duppak}"|cut -f2 -d" "| \
				    sed -e "s:^:${BL}/var/db/pkg/${BR}:" \
					-e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:"

	#If normal verbosity output package group, package name and package version
	elif [ "${verb}" -gt 0 ]; then
		echo -n "${duppak}"|cut -f2 -d" "| \
				    sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:"

	#Otherwise just output package group and package name
	else
		echo -n "${duppak}"|cut -f2 -d" "| \
				    sed -e "s:-r[0-9]\+$::" \
					-e "s:-[0-9].*$::" \
					-e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq
	fi
	exit
fi

# get list of ebuilds to work on
if [ "${ffind}" ]; then
	# file find mode - list all ebuilds for 
	# package/CONTENTS containing <arg>
	if [ "${fpat}" ]; then
		dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
		| xargs grep -l "${arg}" \
		| xargs --no-run-if-empty -n 1 dirname`
	else
		# if the user didnt specify a full path assume they
		# want to check in the working dir #17331
		[ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}"

		dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
		| xargs grep -l " ${arg}\( .*\)*$" \
		| xargs --no-run-if-empty -n 1 dirname`
	fi
	ipak=`(
	for d in ${dirs} -;do
		[ "-" = "$d" ] && break
		ls ${d}/*.ebuild
	done)`
else
	# normal mode - list ebuilds for ebuild name containing <arg>

	# installed packages
	if [ ! "${uninst}" ]; then
		ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null`
		if [[ ${group} != "*" ]]; then
		    ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}`
		fi
		if [ ${arg} ]; then
			# avoid ${arg}="db" from pulling in every installed package
			temp="/var/db/pkg/.*${arg}"	
			ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${temp}`
		fi
		if [ -n "${mask}" ]; then
		    ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
		fi
	fi
	# not installed packages (yet:-)
	if [ ! "${inst}" ]; then
		upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"`
		if [[ ${group} != "*" ]]; then
		    upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}`
		fi
		if [ ${arg} ]; then
		    upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${arg}`
		fi
		if [ -n "${mask}" ]; then
		    upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
		fi
	fi
fi

X="\([^/]*\)"

for p in ${ipak} ${upak} -;do
	[ "${p}" = "-" ] && break

	# cut common prefix from ebuild name and mark installed/uninstalled packages
	# Note: iii/uuu will be replaced by the pipe at the end
	n=${p%.ebuild}
	var_db_pkg="/var/db/pkg/"
	n=${n/${var_db_pkg}/iii }
	usr_portage="/usr/portage/"
	n=${n/${usr_portage}/uuu }
	n=${n/\/*\//\/}

	d=${p%\/*.ebuild} # faster d=`dirname ${p}`
	echo ${n}
	
	# if we have no passed parameters then 
	# we can skip the extra conditional checks
	[[ ${params} == 0 ]] && continue;

	if [ "${mask}" ]; then
		keywords=`grep KEYWORDS ${p}| cut -d\" -f2`
		echo -e "${T}Keywords: ${BL}${keywords}${NO}"
	fi
	
	if [ ${verb} -gt 1 ];then
		echo "vvv    ${p}"
	fi
	
	if [ "${info}" ]; then
		home=`grep HOMEPAGE ${p}| cut -d\" -f2`
		desc=`grep DESCRIPTION ${p}| cut -d\" -f2`
		echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]"
	fi
	
	if [ "${query}" ]; then
		echo -e "${BL}DEPENDED ON BY:${NO}"
		package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \
					-e 's:-[0-9].*$::' \
					-e 's:^iii ::' \
					-e 's:^uuu ::'`"
		place="`echo ${n}|cut -f1 -d' '`"
		[[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}"
		grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \
		cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort | uniq
#		gawk -F "/" '{printf("${place}\n\t%s/%s${NO}",$5,$6)}' | sort | uniq
	fi

	# cat package content, remove obj/sym/dir, md5 and mtime when not verbose
	# display only match in file-find mode unless extra verbose
	if [ "${list}" ]; then
		echo -e ${BL}CONTENTS:${NO}

		if [ ${verb} -gt 1 ]; then
			cat ${d}/CONTENTS
		else
			if [ "${ffind}" ]; then
				if [ "${fpat}" ]; then
					grep "${arg}" $d/CONTENTS
				else
					grep " ${arg}\( .*\)*$" $d/CONTENTS
				fi
			else
				cat $d/CONTENTS
			fi |
			if [ ${verb} -gt 0 ]; then
				cat
			else
				sed -e "s:\(^obj \)\([^ ]*\)\(.*$\):\1${BR}\2${NO}:;
				        s:\(^sym \)\([^ ]*\)\( -> \)\([^ ]*\)\(.*$\):\1${CY}\2${NO}\3\4:;
				        s:\(^dir \)\([^ ]*\)\(.*$\):\1${YL}\2${NO}:"
			fi
		fi

		echo
		
	# check files mtime and md5, display summary at the end
	elif [ "${tcheck}" -o "${mcheck}" ]; then
		# counters
		fe=0
		fs=0
		# read the CONTENTS file and check md5 and mtime if needed
		# process only matching files in find-file mode unless extra verbose
		cat ${d}/CONTENTS | 
			if [ "${ffind}" -a ${verb} -lt 2 ];then 
				if [ "${fpat}" ]; then
					grep "${arg}"
				else
					grep " ${arg} "
				fi
			else
				cat
			fi |
		(
		while read -a line
		do
			fs=$((fs + 1))
			
			unset md5
			unset _md5
			unset mtime
			unset _mtime
			unset err

			name=${line[1]}
			
			missing=
			[ ! -e ${name} ] && missing=1
			
			# colorize name and compute mtime/md5
			if [ "obj" = ${line[0]} ]; then
				[ -e ${name} ] && {
					[ "${tcheck}" ] && mtime=${line[3]}
					[ "${tcheck}" ] && _mtime=`date -r ${name} +%s`

					[ "${mcheck}" ] && md5=${line[2]}
					[ "${mcheck}" ] && _md5=`md5sum ${name}|cut -f1 -d" "`
				}

				name=${BR}${name}${NO}

			elif [ "sym" = ${line[0]} ]; then
				name=${CY}${name}${NO}

			elif [ "dir" = ${line[0]} ]; then
				name=${YL}${name}${NO}
			fi
			
			# compare
			if [ "$missing" ]; then
				err=1
				name="${name} ${RD}!not exist!${NO}"
			fi
			if [ "${md5}" != "${_md5}" ]; then
				#If the md5 fails the first time check it with
				#everything changed to lowercase :-D
				md5=`echo "${md5}"|tr A-Z a-z`
				if [ "${md5}" != "${_md5}" ]; then
					err=1
					name="${name} ${RD}!md5!${NO}"
				fi
			fi
			if [ "${mtime}" != "${_mtime}" ]; then
				err=1
				name="${name} ${RD}!mtime!${NO}"
			fi

			[ ${verb} -gt 1 ] && echo -e ${name}
			[[ ${verb} -eq 1 ]] && [[ $err -eq 1 ]] && echo -e ${name}

			fe=$((fe + err))
		done
		if [ "$fe" = "0" ]; then
			echo -e ${YL}$fe${CY}/$fs${NO}
		else
			echo -e ${RD}$fe${CY}/$fs${NO}
		fi
		echo
		)
	fi
	
done | (
	if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then
		sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1
	elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then
		sort -k2|uniq -f1
	else
		cat
	fi | sed \
		-e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \
		-e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \
		-e "s:^vvv \(.*\)$:${BL}\1${NO}:" \
		-e "s:^obj ::;s:^sym ::;s:^dir ::"

)
@


1.26
log
@fix for #17331
@
text
@d12 2
a13 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.25 2003/06/22 20:09:48 agriffis Exp $
ID='$Id: qpkg,v 1.25 2003/06/22 20:09:48 agriffis Exp $'
@


1.25
log
@fix bug 22528
@
text
@d12 2
a13 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.24 2003/06/13 07:15:27 rajiv Exp $
ID='$Id: qpkg,v 1.24 2003/06/13 07:15:27 rajiv Exp $'
d299 4
@


1.24
log
@fixed mis-paste. fixes bug #22694.
@
text
@d12 2
a13 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.23 2003/06/12 19:47:14 mholzer Exp $
ID='$Id: qpkg,v 1.23 2003/06/12 19:47:14 mholzer Exp $'
d505 1
a505 1
		sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -1
d507 1
a507 1
		sort -k2|uniq -1
@


1.23
log
@readded back patch from #22432.
@
text
@d12 2
a13 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.22 2003/06/08 20:27:12 lostlogic Exp $
ID='$Id: qpkg,v 1.22 2003/06/08 20:27:12 lostlogic Exp $'
d62 3
a70 3
		;;

		inst=y
@


1.22
log
@qpkg fixage
@
text
@d1 1
a1 1
#!/bin/sh
d12 2
a13 2
# $Header: /home/cvsroot/gentoolkit/src/qpkg/qpkg,v 1.2 2003/06/08 20:24:23 lostlogic Exp $
ID='$Id: qpkg,v 1.2 2003/06/08 20:24:23 lostlogic Exp $'
d62 8
d179 2
d228 7
d322 3
d335 3
d361 5
d504 1
a504 1
	if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o ${verb} -gt 0 \) ]; then
d506 1
a506 1
	elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o ${verb} -lt 2 \) ]; then
@


1.21
log
@New qpkg flags added
@
text
@d1 1
a1 1
#!/bin/bash
d9 2
d12 2
a13 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.20 2003/04/22 18:54:26 mholzer Exp $
ID='$Id: qpkg,v 1.20 2003/04/22 18:54:26 mholzer Exp $'
d21 1
a64 8
	-m|--masked)
		grepmask="-L"
		;;

	-n|--non-masked)
		grepmask="-l"
		;;

d119 1
a119 2
		# Kill a trailing slash
		arg=${a%/}
d173 1
a173 3
  ${BL}-m,  --masked${NO}${T}Include${YL} only${NO} masked packages
  ${BL}-n,  --non-masked${NO}${T}Include${YL} only${NO} non-masked packages
  ${BL}-g,  --group${NO}${T}${T}Find by group (can be combined with other searches)
d188 1
a188 1
  ${BL}-v,  --verbose${NO}${T}Be more verbose [ can be repeated twice ]
d200 1
a200 5
${YL}*${NO} When using${BL} -q${NO}, it is important to note that the querying of deps is NOT
  a complete check, because qpkg is not advanced enough (nor can it reasonably
  made so) to check complete deps with versions.  Please use ${GR}depclean${NO} or
  ${GR}emerge --dep-clean${NO} to more completely check the dependency sanity of your
  system.
d205 1
a205 1
  ${PROG}			print list of all packages
a215 7
if [ "${grepmask}" ]; then
	mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null`
	echo -e "Currently accepted keywords: ${BL}${mask}${NO}"
	echo -e
	mask=`echo ${mask} | perl -pe 's/\s+/|/'`
fi

d301 3
a303 4
		    ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${arg}`
		fi
		if [ -n "${mask}" ]; then
		    ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
a314 3
		if [ -n "${mask}" ]; then
		    upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
		fi
d325 8
a332 3
	n=`echo $p | sed -e "s:^/var/db/pkg/${X}/${X}/${X}.ebuild:iii \1/\3:" \
		-e "s:^/usr/portage/${X}/${X}/${X}\.ebuild:uuu \1/\3:"`
	d=`dirname ${p}`
d334 5
a347 5

	if [ "${mask}" ]; then
		keywords=`grep KEYWORDS ${p}| cut -d\" -f2`
		echo -e "${T}Keywords: ${BL}${keywords}${NO}"
	fi
d476 1
a476 1
	if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then
d478 1
a478 1
	elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then
@


1.20
log
@Chaning qpkg to use /bin/bash. Closes #18915.
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.19 2003/03/21 12:37:18 mholzer Exp $
ID='$Id: qpkg,v 1.19 2003/03/21 12:37:18 mholzer Exp $'
d62 8
d179 2
d228 7
d322 3
d335 3
d361 5
d494 1
a494 1
	if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o ${verb} -gt 0 \) ]; then
d496 1
a496 1
	elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o ${verb} -lt 2 \) ]; then
@


1.19
log
@Fixed type in qpkg. Closes #17851.
@
text
@d1 1
a1 1
#!/bin/sh
d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.18 2003/01/05 12:36:25 mholzer Exp $
ID='$Id: qpkg,v 1.18 2003/01/05 12:36:25 mholzer Exp $'
@


1.18
log
@Corrected qpkg help. Closes #5194.
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.17 2002/10/31 22:26:34 lostlogic Exp $
ID='$Id: qpkg,v 1.17 2002/10/31 22:26:34 lostlogic Exp $'
d171 1
a171 1
  ${BL}-g,  --group${NO}${T}${T}Find by goup (can be combined with other searches)
@


1.17
log
@add a note about qpkg -q
@
text
@d10 2
a11 2
# $Header: /space/home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.16 2002/09/28 14:54:07 karltk Exp $
ID='$Id: qpkg,v 1.16 2002/09/28 14:54:07 karltk Exp $'
d207 1
a207 1
  ${PROG}			print list of installed packages
@


1.16
log
@Fixed two minor typos.
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.15 2002/09/03 02:46:41 lostlogic Exp $
ID='$Id: qpkg,v 1.15 2002/09/03 02:46:41 lostlogic Exp $'
d198 5
a202 1

@


1.15
log
@parse off trailing /
@
text
@d10 2
a11 2
# $Header: /space/home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.14 2002/07/26 06:07:42 lostlogic Exp $
ID='$Id: qpkg,v 1.14 2002/07/26 06:07:42 lostlogic Exp $'
d186 1
a186 1
  ${BL}-v,  --verbose${NO}${T}Be more verbose [ can be repeated twise ]
@


1.14
log
@fix for cardoe
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.13 2002/07/14 22:39:40 lostlogic Exp $
ID='$Id: qpkg,v 1.13 2002/07/14 22:39:40 lostlogic Exp $'
d116 2
a117 1
		arg=$a
@


1.13
log
@New gentoolkit revision fixes fairly critical bug in etc-update
etc-update didn't keep perms on merged files.  Other etc-update bugfixes
Add feature to qpkg.
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.12 2002/06/26 22:14:37 lostlogic Exp $
ID='$Id: qpkg,v 1.12 2002/06/26 22:14:37 lostlogic Exp $'
d216 3
a218 2
	dups=`/usr/lib/portage/bin/pkglist | 
		sed -e 's:-r[0-9]*::' -e 's:-[^-]*$::' | 
d223 1
a223 1
	duppak=`ls /var/db/pkg/*/*/*${arg}*.ebuild 2>/dev/null | fgrep "${dups}"`
d226 1
a226 1
	dirs=`echo ${duppak}|sed -e "s:\ :\n:g"|sed -e "s:/[^/]*$::"`
d230 1
d233 2
a234 1
		NUM=`cat "${DIR}/COUNTER"`
d238 1
a238 1
		PKG=`ls ${DIR}/*.ebuild|cut -f5,7 -d"/"`
d240 1
a240 3
		NAME=`echo "${PKG}"|sed -e "s:\.ebuild$::" \
					-e "s:-r[0-9]\+$::" \
					-e "s:-[0-9].*$::"`
@


1.12
log
@minor bug in --dups sorting
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.10 2002/06/11 21:13:26 lostlogic Exp $
ID='$Id: qpkg,v 1.10 2002/06/11 21:13:26 lostlogic Exp $'
d39 4
d131 1
d162 2
a163 2
  ${BL}-d,  --dups${NO}${T}${T} print packages that have multiple versions installed
  ${BL}-s,  --slot${NO}${T}${T} make ${BL}-d${NO} SLOT only print dups of the same SLOT
d166 5
a170 5
  ${BL}-f,  --find-file${NO}${T} finds package that owns file <file>
  ${BL}-fp, --find-pattern${NO}${T} finds to package that owns file matching *<pattern>*
  ${BL}-I,  --installed${NO}${T} Include${YL} only${NO} installed packages
  ${BL}-U,  --uninstalled${NO}${T} Include${YL} only${NO} uninstalled packages
  ${BL}-g,  --group${NO}${T}${T} Find by goup (can be combined with other searches)
d173 2
a174 2
  ${BL}-l,  --list${NO}${T}${T} List package content
  ${BL}-i,  --info${NO}${T}${T} Get package description and home page.
d176 1
a176 1
  ${BL}-tc, --time-check${NO}${T} Verify package files timestamps
d178 4
a181 2
  ${BL}-mc, --md5-check${NO}${T} Verify package files md5
  ${BL}-c,  --check${NO}${T}${T} Verify mtimes${YL} and${NO} md5.
d184 3
a186 3
  ${BL}-nc, --no-color${NO}${T} don't use colors
  ${BL}-v,  --verbose${NO}${T} Be more verbose [ can be repeated twise ]
  ${BL}-vv${NO}${T}${T}${T} Same as ${BL}-v -v${NO}
a212 1

d263 1
a263 1
					-e "s:-[0-9][^-]*$::" \
d333 13
d460 1
a460 1
	if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o ${verb} -gt 0 \) ]; then
d462 1
a462 1
	elif [ ${verb} -lt 2 ]; then
@


1.11
log
@etc-update rewrite and qpkg bugfix in one pretty new gentoolkit
@
text
@d233 1
a233 1
					-e "s:-[0-9][^-]*$::"`
d238 1
a238 1
	done |sort -t " " -k1g,2 |sort -t " " -k3|uniq -D -2> /tmp/qpkg.lst
@


1.10
log
@another minor qpkg update
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.8 2002/06/08 13:52:14 lostlogic Exp $
ID='$Id: qpkg,v 1.8 2002/06/08 13:52:14 lostlogic Exp $'
d347 3
a349 3
				sed -e "s:obj \([^ ]*\).*:${BR}\1${NO}:" \
				    -e "s:sym \([^ ]*\) -> \([^ ]*\).*:${CY}\1 ${NO}-> \2:" \
				    -e "s:dir \([^ ]*\).*:${YL}\1${NO}:"
d450 2
a451 1
		-e "s:^vvv \(.*\)$:${BL}\1${NO}:"
@


1.9
log
@minor qpkg improvement
@
text
@d444 1
a444 1
		sed -e "s:-[0-9][^-]*$::"|sort -k2|uniq -1
@


1.8
log
@Grr I dumb
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.7 2002/06/08 13:38:46 lostlogic Exp $
ID='$Id: qpkg,v 1.7 2002/06/08 13:38:46 lostlogic Exp $'
d442 3
a444 1
		sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort|uniq
@


1.7
log
@More qpkg updates, removed old versions
@
text
@d10 2
a11 2
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.5 2002/06/05 02:45:33 lostlogic Exp $
ID='$Id: qpkg,v 1.5 2002/06/05 02:45:33 lostlogic Exp $'
d238 1
a238 1
	done |sort -t " " -k1g,2 |sort -t " " -k3|uniq -d -2> /tmp/qpkg.lst
@


1.6
log
@Fix display of installed vs. uninstalled versions in -nc mode, code cleanups
@
text
@d18 1
a18 1
group='*'
d39 4
d97 1
a97 1
	-nc|--no-colors)
d102 1
a102 1
		echo -e ${CY}${PROG}${NO}:${YL} Invalid option $RD$a 1>&2
d145 6
d152 7
a158 3
${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} <file>${NO}]
${T}${CY}${PROG}${NO} ${BL}-d${NO}|${BL}--dups${NO}
${T}${CY}${PROG}${NO} ${BL}-h${NO}|${BL}--help${NO}
d162 1
a162 1
  ${BL}-fp, --find-pattern${NO}${T} finds to package that owns file matching *<file>*
a165 1
  ${BL}-d,  --dups${NO}${T}${T} print packages that have multiple versions installed
d167 1
a167 1
${BR}Information selection:
d176 2
a177 2
${BR}Operation modifiers:
  ${BL}-nc,  --no-color${NO}${T} don't use colors
d184 3
d226 2
d234 1
a234 1
		echo "${NUM} ${PKG} ${NAME}"
d238 1
a238 1
	done |sort -t " " -k1g,2 |sort -t " " -k3> /tmp/qpkg.lst
d244 3
a246 3
		echo "${duppak}"|cut -f2 -d" "| \
			       sed -e "s:^:${BL}/var/db/pkg/${BR}:" \
				   -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:"
d250 2
a251 2
		echo "${duppak}"|cut -f2 -d" "| \
			       sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:"
d255 4
a258 1
		echo "${dups}"|sed -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"
d285 9
a293 2
	[ ! "${uninst}" ] && 
	    ipak=`ls /var/db/pkg/*${group}*/*/*${arg}*.ebuild 2>/dev/null`
d295 9
a303 2
	[ ! "${inst}" ] && 
	    upak=`ls /usr/portage/*${group}*/*/*${arg}*.ebuild 2>/dev/null`
d317 1
a317 1
	if [ ${verb} -gt 0 ];then
d348 2
a349 2
					-e "s:sym \([^ ]*\) -> \([^ ]*\).*:${CY}\1 ${NO}-> \2:" \
					-e "s:dir \([^ ]*\).*:${YL}\1${NO}:"
d410 1
a410 1
				name="${name} $RD!not exist!${NO}"
d418 1
a418 1
					name="${name} $RD!md5!${NO}"
d423 1
a423 1
				name="${name} $RD!mtime!${NO}"
d434 1
a434 1
			echo -e $RD$fe${CY}/$fs${NO}
d442 1
a442 1
		sort -k 2 | uniq -1
@


1.5
log
@More qpkg fixage, see ChangeLog
@
text
@d5 1
a5 1
# Copiright (c) Vitaly Kushneriuk <vitaly_kushneriuk@@yahoo.com>
d8 5
a12 3
# $Header: /home/cvsroot/gentoo-x86/app-admin/gentoolkit/files/scripts/qpkg,v 1.4 2002/06/05 01:13:36 lostlogic Exp $
ID='$Id: qpkg,v 1.4 2002/06/05 01:13:36 lostlogic Exp $'
VERSION=0.`echo $ID | cut -d\  -f3`
d14 1
a14 1
PROG=`basename $0`
d19 1
a19 1
while [ $# -gt 0 ]
d21 1
a21 1
	a=$1
d23 1
a23 1
	case "$a" in
d34 1
a34 1
	--dups)
d36 1
d98 1
a98 1
		echo -e $CY$PROG$NO:$YL Invalid option $RD$a 1>&2
d103 2
a104 2
		if [ -n "$arg" ]; then
			echo -e $CY$PROG: ${YL}Only one argument supported
d118 1
a118 1
if [ ! "$nocolor" ]; then
d126 2
d132 4
a135 4
if [ "$inst" -a "$uninst" \
	-o \( "$ffind" -o "$list" -o "$tcheck" -o "$mcheck" \) \
	-a "$uninst"  ]; then
	echo -e $CY$PROG$NO:$YL conflicting options/modes$NO
d139 2
a140 2
if [ "$usage" ]; then
	echo -e "$CY$PROG v. $VERSION$NO
d142 3
a144 3
$T$CY$PROG$NO [$BR options$NO ] [$YL pkgname $NO|$BL-g$YL group$NO|$BL-f$YL <file>$NO ]
$T$CY$PROG$NO $BL--dups$NO
$T$CY$PROG$NO  $BL-h$NO|$BL--help$NO
d147 6
a152 6
  $BL-f,  --find-file$NO$T finds package that owns file <file>
  $BL-fp, --find-pattern$NO$T finds to package that owns file matching *<file>*
  $BL-I,  --installed$NO$T Include$YL only$NO installed packages
  $BL-U,  --uninstalled$NO$T Include$YL only$NO uninstalled packages
  $BL-g,  --group$NO$T$T Find by goup (can be combined with other searches)
  $BL--dups$NO$T$T print packages that have multiple versions installed
d155 7
a161 7
  $BL-l,  --list$NO$T$T List package content
  $BL-i,  --info$NO$T$T Get package description and home page.
  $BL-ct, --check-time$NO
  $BL-tc, --time-check$NO$T Verify package files timestamps
  $BL-cm, --check-md5$NO
  $BL-mc, --md5-check$NO$T Verify package files md5
  $BL-c,  --check$NO$T$T Verify mtimes$YL and$NO md5.
d164 18
a181 17
  $BL-nc,  --no-color$NO$T don't use colors
  $BL-v,  --verbose$NO$T Be more verbose [ can be repeated twise ]
  $BL-vv$NO$T$T$T Same as $BL-v -v$NO

${YL}Notes$NO: 
$YL*$NO $BL-l$NO, $BL-ct$NO, and $BL-cm$NO apply only to installed packages
$YL*$NO When using$BL -f$NO with $BL-l$NO or $BL--check.. -v$NO options,
  only matching files will be displayed, unless $BL-v$NO is doubled, 
  (yet more verbose) or $BL-vv$NO is used.


${YL}Examples$NO:
  $PROG --dups		print duplicates oldest first
  $PROG --dups -v	.. with versions
  $PROG			print list of installed packages
  $PROG porta -I		print versions of installed portage
  $PROG porta -i		.. + versions in portage tree + descriptions 
d183 3
a185 3
  $PROG gawk -c -v	check integrity all installed versions of gawk
			the older will have \"demaged\" files.
  $PROG -f /bin/ls	print package(s) that own /bin/ls
d192 1
a192 1
if [ "$dups" ]; then
d198 1
d200 2
a201 1
	duppak=`ls /var/db/pkg/*/*/*$arg*.ebuild 2>/dev/null | fgrep "$dups"`
d203 2
a204 1
	dirs=`echo $duppak|sed -e "s:\ :\n:g"|sed -e "s:/[^/]*$::"`
d207 1
a207 1
	for DIR in $dirs
d209 1
a209 1
		NUM=`cat "$DIR/COUNTER"`
d211 1
a211 1
		PKG=`ls $DIR/*.ebuild|cut -f5,7 -d"/"`
d213 4
a216 4
		NAME=`echo "$PKG"|sed -e "s:\.ebuild$::" \
				      -e "s:-r[0-9]\+$::" \
				      -e "s:-[0-9][^-]*$::"`
		echo "$NUM $PKG $NAME"
d223 1
d225 2
a226 2
	if [ "$verb" -gt 1 ]; then
		echo "$duppak"|cut -f2 -d" "| \
d229 1
d231 2
a232 2
	elif [ "$verb" -gt 0 ]; then
		echo "$duppak"|cut -f2 -d" "| \
d234 1
d237 1
a237 1
		echo "$dups"|sed -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"
d243 1
a243 1
if [ "$ffind" ]; then
d246 3
a248 3
	if [ "$fpat" ]; then
		dirs=`ls /var/db/pkg/$group/*/CONTENTS \
		| xargs grep -l "$arg" \
d251 2
a252 2
		dirs=`ls /var/db/pkg/$group/*/CONTENTS \
		| xargs grep -l " $arg\( .*\)*$" \
d256 1
a256 1
	for d in $dirs -;do
d258 1
a258 1
		ls $d/*.ebuild
d264 2
a265 2
	[ ! "$uninst" ] && 
	    ipak=`ls /var/db/pkg/*$group*/*/*$arg*.ebuild 2>/dev/null`
d267 2
a268 2
	[ ! "$inst" ] && 
	    upak=`ls /usr/portage/*$group*/*/*$arg*.ebuild 2>/dev/null`
d273 2
a274 2
for p in $ipak $upak -;do
	[ "$p" = "-" ] && break
d278 6
a283 6
	n=`echo $p | sed -e "s:^/var/db/pkg/$X/$X/$X.ebuild:iii \1/\3:" \
		-e "s:^/usr/portage/$X/$X/$X\.ebuild:uuu \1/\3:"`
	d=`dirname $p`
	echo $n
	if [ $verb -gt 0 ];then
		echo "vvv    $p"
d286 4
a289 4
	if [ "$info" ]; then
		home=`grep HOMEPAGE $p| cut -d\" -f2`
		desc=`grep DESCRIPTION $p| cut -d\" -f2`
		echo -e "$T$BL$desc$NO [ $YL$home$NO ]"
d294 2
a295 2
	if [ "$list" ]; then
		echo -e ${BL}CONTENTS:$NO
d297 2
a298 2
		if [ $verb -gt 1 ]; then
			cat $d/CONTENTS
d300 3
a302 3
			if [ "$ffind" ]; then
				if [ "$fpat" ]; then
					grep "$arg" $d/CONTENTS
d304 1
a304 1
					grep " $arg\( .*\)*$" $d/CONTENTS
d309 1
a309 1
			if [ $verb -gt 0 ]; then
d312 3
a314 3
				sed -e "s:obj \([^ ]*\).*:$BR\1$NO:" \
					-e "s:sym \([^ ]*\) -> \([^ ]*\).*:$CY\1 $NO-> \2:" \
					-e "s:dir \([^ ]*\).*:$YL\1$NO:"
d321 1
a321 1
	elif [ "$tcheck" -o "$mcheck" ]; then
d327 4
a330 4
		cat $d/CONTENTS | 
			if [ "$ffind" -a $verb -lt 2 ];then 
				if [ "$fpat" ]; then
					grep "$arg"
d332 1
a332 1
					grep " $arg "
d351 1
a351 1
			[ ! -e $name ] && missing=1
d355 3
a357 3
				[ -e $name ] && {
					[ "$tcheck" ] && mtime=${line[3]}
					[ "$tcheck" ] && _mtime=`date -r $name +%s`
d359 2
a360 2
					[ "$mcheck" ] && md5=${line[2]}
					[ "$mcheck" ] && _md5=`md5sum $name|cut -f1 -d" "`
d363 1
a363 1
				name=$BR$name$NO
d366 1
a366 1
				name=$CY$name$NO
d369 1
a369 1
				name=$YL$name$NO
d375 1
a375 1
				name="$name $RD!not exist!$NO"
d377 1
a377 1
			if [ "$md5" != "$_md5" ]; then
d380 2
a381 2
				md5=`echo "$md5"|tr A-Z a-z`
				if [ "$md5" != "$_md5" ]; then
d383 1
a383 1
					name="$name $RD!md5!$NO"
d386 1
a386 1
			if [ "$mtime" != "$_mtime" ]; then
d388 1
a388 1
				name="$name $RD!mtime!$NO"
d391 2
a392 2
			[ $verb -gt 1 ] && echo -e $name
			[[ $verb -eq 1 ]] && [[ $err -eq 1 ]] && echo -e $name
d397 1
a397 1
			echo -e $YL$fe$CY/$fs$NO
d399 1
a399 1
			echo -e $RD$fe$CY/$fs$NO
d406 1
a406 1
	if [ ! \( "$tcheck" -o "$mcheck" -o "$info" -o "$list" -o $verb -gt 0 \) ]; then
d411 3
a413 3
		-e "s:^iii $X/$X:$BR\1/$CY\2$STAR$NO:" \
		-e "s:^uuu $X/$X:$BR\1/$YL\2$NO:" \
		-e "s:^vvv \(.*\)$:$BL\1$NO:"
a415 1

@


1.4
log
@qpkg updates see ChangeLog
@
text
@d8 2
a9 2
# $Header: $
ID='$Id: qpkg,v 1.3 2002/02/11 15:28:47 vitaly Exp $'
d348 1
a348 1
					[ "$mcheck" ] && md5=${line[2]}
d366 7
a372 8
				#I was going to put the awking toupper here but it didn't
				#save any time... I'm taking it out, kill me later.
				#md5=`echo "$md5"| awk '{print toupper($1)}'`
				#_md5=`echo "$_md5"|awk '{print toupper($1)}'`
				#if [ "$md5" != "$_md5" ]; then
				err=1
				name="$name $RD!md5!$NO"
				#fi
d380 1
@


1.3
log
@few qpkg fixes:
  '-f' mode now works for directories
  properly handle and parse installed ebuild path for latest portage quirks
@
text
@d8 2
a9 1
ID='$Id: qpkg,v 1.19 2002/02/11 15:17:39 root Exp root $'
d111 1
d113 2
d122 1
d171 1
a171 1
  $PROG --dups		print duplicates
d185 1
d187 1
d192 23
d216 4
a219 1
		ls /var/db/pkg/*/*/*$arg*.ebuild 2>/dev/null | fgrep "$dups"
d221 3
a223 1
		/usr/lib/portage/bin/pkglist | fgrep "$dups"
d225 1
a225 1
		echo "$dups"
d348 1
a348 2
					[ "$mcheck" ] && _md5=`md5sum $name \
						| cut -d\  -f1| awk '{print toupper($1)}'`
d366 5
d373 1
d399 1
a399 1
		-e "s:^iii $X/$X:$BR\1/$CY\2 *$NO:" \
@


1.2
log
@update to the current version of qpkg.
Added -g option to select group (category) and reworked usage
@
text
@d8 1
a8 1
ID='$Id: qpkg,v 1.17 2002/02/03 11:13:35 root Exp root $'
d205 1
a205 1
		| xargs grep -l " $arg " \
d231 1
a231 1
	n=`echo $p | sed -e "s:^/var/db/pkg/$X/$X.*:iii \1/\2:" \
d257 1
a257 1
					grep " $arg " $d/CONTENTS
@


1.1
log
@Initial import of Gentoolkit
@
text
@d8 1
a8 1
ID='$Id: qpkg,v 1.14 2002/01/06 11:10:42 root Exp root $'
d15 1
d46 13
a88 8
	-I|--installed)
		inst=y
		;;

	-U|--uninstalled)
		uninst=y
		;;

d132 1
a132 1
$T$CY$PROG$NO [$BR options$NO ] [$YL pkgname $NO|$BL-f$YL file$NO ]
d134 1
a134 1
$T$CY$PROG$NO $BL--conlicts$NO
d136 6
a141 2
${BR}Operation Modes:
  $BL-h,  --help$NO$T$T This usage help
d143 3
a146 1
  $BL-l,  --list$NO$T$T List package content
a154 4
  $BL-f,  --find-file$NO$T apply to package that owns file
  $BL-fp, --find-pattern$NO$T apply to package that owns file that looks 'like' ...
  $BL-I,  --installed$NO$T Include$YL only$NO installed packages
  $BL-U,  --uninstalled$NO$T Include$YL only$NO uninstalled packages
d160 1
a160 1
$YL*$NO When using$BL -f$NO with$BL-l$NO or $BL--check.. -v$NO options,
d169 3
a171 2
  $PROG porta		print versions of installed portage
  $PROG -a porta -i	.. + versions in portage tree + descriptions and homepages
d197 2
a198 1
	# file find mode - list all ebuilds for package/CONTENTS containing <arg>
d200 2
a201 1
		dirs=`ls /var/db/pkg/*/*/CONTENTS | xargs grep -l "$arg" \
d204 2
a205 1
		dirs=`ls /var/db/pkg/*/*/CONTENTS | xargs grep -l " $arg " \
d217 2
a218 1
	[ ! "$uninst" ] && ipak=`ls /var/db/pkg/*/*/*$arg*.ebuild 2>/dev/null`
d220 2
a221 1
	[ ! "$inst" ] && upak=`ls /usr/portage/*/*/*$arg*.ebuild 2>/dev/null`
@

