Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 28858 Details for
Bug 47149
Gentoo needs a clean way of asking "which package installed file X"
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Perl command to query the package that installed a file on the filesystem
whoowns (text/plain), 2.67 KB, created by
Tony Kay
on 2004-04-07 15:27:39 UTC
(
hide
)
Description:
Perl command to query the package that installed a file on the filesystem
Filename:
MIME Type:
Creator:
Tony Kay
Created:
2004-04-07 15:27:39 UTC
Size:
2.67 KB
patch
obsolete
>#!/usr/bin/perl -w > >use strict; >use Getopt::Long; >use Pod::Usage; > >our @contentfiles = `find /var/db/pkg -name CONTENTS`; >our $DEBUG = 0; >our $MAN = 0; > >GetOptions("debug" => \$DEBUG, > "man" => \$MAN) or pod2usage(2); >pod2usage(-exitstatus => 0, -verbose => 2) if $MAN; >pod2usage(1) if($#ARGV == -1); > >sub getMatches >{ > my $filename = shift; > my @matches = (); > my ($file, $line, $type); > > print STDERR "Looking for matches to '$filename'\n" if $DEBUG; > for $file (@contentfiles) { > print STDERR "Searching $file\n" if $DEBUG; > open DATA, "<$file" or die "Could not open $file"; > while($line = <DATA>) { > if($line =~ m/ \Q$filename\E /) { > print "Found one: '$line'\n" if $DEBUG; > $line =~ m/^(\S*)\s/; > $type = $1; > print STDERR "Extracting package name from '$file'" if $DEBUG; > $file =~ m!/var/db/pkg/([^/]*/[^/]*)/!; > push(@matches, "$1:$type"); > } > } > close DATA; > } > > return @matches; >} > >my ($file, $tmp, $match, $type); >my @matches; > >printf("%-50s %4s %s\n", "Source Package", "Type", "Filename"); >for $file (@ARGV) >{ > if($file !~ m!^/! && $file =~ m!/!) { > warn "Skipping $file. File names must be absolute paths or executable names\n"; > next; > } > if($file !~ m!^/!) { > $tmp = `which $file`; > if($tmp !~ m!^/!) { > warn "Skipping $file. It was not found on your PATH. Use an absolute path.\n"; > next; > } > chomp $tmp; > $file = $tmp; > } > @matches = getMatches($file); > for $match (@matches) { > printf("%-50s %4s %s\n", split(/:/, $match), $file); > } >} > >__END__ > >=head1 NAME > >whoowns - Find out which package owns a file. > >=head1 SYNOPSIS > >whoowns [--debug] [--man] files... > >=head1 OPTIONS > >=over 8 > >=item B<--man> > >Show the complete manual for the command. > >=item B<--debug, -d> > >Turn on debugging mode. > >=head1 DESCRIPTION > >B<whoowns> goes through the portage database of installed files and tries to >figure out which package a file belongs to. It will accept any number of file >names. If the file name is not an absolute path, then it uses PATH to try to >find it. > >=cut
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 47149
: 28858