public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] list-pkgs - perl script for listing packages
@ 2001-07-08 14:55 Collins Richey
  0 siblings, 0 replies; only message in thread
From: Collins Richey @ 2001-07-08 14:55 UTC (permalink / raw
  To: gentoo

This little perl script provides a sorted list of packages (installed or available to install).  I got tired of trying to remember which directory under /usr/portage or /var/db/pkg holds a given ebuild.

Now i just enter, for example,  'list-pkgs | grep cups' to see what's available or 'list-pkgs db | grep gtk' to see what's already installed.


#!/usr/bin/perl
# list-pkgs
# Collins Richey 08Mar2001
# usage:  list-pkgs db    (list installed packages in /va/db/pkg)
#         list-pkgs       (list packages in /usr/portage)
if ($ARGV[0] eq "db")
  { @list = `find \/var\/db\/pkg -print|grep '.ebuild'`; 
    print "Packages already installed\n\n";
  }
else
  { @list = `find \/usr\/portage -print|grep '.ebuild'`; 
    print "Packages available to be installed\n\n";
  }
while ($a = shift(@list))
  { chop($a);
    @list2 = split(/\//,$a);
    $pkg = pop(@list2);
    $trash = shift(@list2);
    $place = join('/',@list2);
    push(@list3,"$pkg       \/$place\n");
  }
@list3 = sort(@list3);
print @list3;


enjoy!
-- 
Collins Richey
Denver Area
Gentoo_rc5 XFCE



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-07-08 20:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-07-08 14:55 [gentoo-dev] list-pkgs - perl script for listing packages Collins Richey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox