diff options
author | fuzzyray <fuzzyray@gentoo.org> | 2008-08-27 21:19:40 +0000 |
---|---|---|
committer | fuzzyray <fuzzyray@gentoo.org> | 2008-08-27 21:19:40 +0000 |
commit | ba72586710a700ed76f35d365c645d5108bc5895 (patch) | |
tree | c16903693f2030c7b01b346b29b265dc1a473888 /src/old-scripts/pkg-size | |
parent | Fix has_key() deprecation message. (Bug #232797) (diff) | |
download | gentoolkit-ba72586710a700ed76f35d365c645d5108bc5895.tar.gz gentoolkit-ba72586710a700ed76f35d365c645d5108bc5895.tar.bz2 gentoolkit-ba72586710a700ed76f35d365c645d5108bc5895.zip |
Create the gentoolkit-0.2.4 branch to coincide with the release of gentoolkit-0.2.4
svn path=/branches/gentoolkit-0.2.4/; revision=510
Diffstat (limited to 'src/old-scripts/pkg-size')
-rw-r--r-- | src/old-scripts/pkg-size | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/old-scripts/pkg-size b/src/old-scripts/pkg-size new file mode 100644 index 0000000..8770db7 --- /dev/null +++ b/src/old-scripts/pkg-size @@ -0,0 +1,63 @@ +#!/bin/sh +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header$ +# Author: Karl Trygve Kalleberg <karltk@gentoo.org> + +echo +echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated." +echo -e "!!!\x1b[0;0m Refer to 'equery size' for a replacement." +echo + +spec=$1 + +if [ -z "$spec" ] ; then + echo "Usage: pkg-size package" + exit 1 +fi + +name=`echo $1 | sed "s/\([^/]*\)\///"` +category=`echo $1 | sed "s/\/.*//"` + +if [ "$category" == "$name" ] ; then + category= +fi + +function tryfile() { + local foo + foo=/var/db/pkg/$1/CONTENTS + bar=`ls $foo 2> /dev/null` + for i in $bar ; do + if [ -f "$i" ] ; then + echo $i + break + fi + done +} + +file=`tryfile "${category}/${name}"` +if [ -z $file ] ; then + file=`tryfile "${category}/${name}*"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}"` + if [ -z $file ] ; then + file=`tryfile "${category}*/${name}*"` + if [ -z $file ] ; then + echo "!!! Package resembling ${category}/${name} not found" + exit 1 + fi + fi + fi +fi + +pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"` + +totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1` + +size=0 +for i in $totals ; do + size=$[size+i] +done + +echo "$pkgname $size ($[size/1024]KB)" + |