searching for a particular file
Panu Matilainen
pmatilai at laiskiainen.org
Mon May 29 13:25:28 PDT 2006
On Sat, 2006-05-27 at 12:53 -0600, Vincent Danen wrote:
> * Panu Matilainen <pmatilai at laiskiainen.org> [2006-05-27 21:13:18 +0300]:
>
> > > With urpmi, you can use the tool urpmf to find what package contains a
> > > certain file. For instance:
> > >
> > > urpmf "/usr/share/locale/en$"
> > >
> > > will tell me what package contains this directory (or owns it), such as:
> > >
> > > [root at build installer]# urpmf "/usr/share/locale/en$"
> > > locales-en:/usr/share/locale/en
> > >
> > > Is there an equivalent in apt? I thought apt-cache would do it but:
> > >
> > > [root at build installer]# apt-cache search "/usr/share/locale/en$"
> > > [root at build installer]#
> > >
> > > Looks like it only does package names:
> > >
> > > [root at build installer]# apt-cache search locales-en
> > > locales-en - Base files for localization (English)
> > >
> > > Now, this is fine, except that when I'm asking a user for their locale
> > > during installation, I used urpmf to make sure it was valid. If it was
> > > strictly "en" or "ru", etc. I could use the above and just change it to
> > > something like "apt-cache search locales-${locale}" but that doesn't
> > > help for things like "en_US" (apt-cache will return nothing, but it is
> > > valid), and urpmf will find it:
> > >
> > > [root at build installer]# urpmf "/usr/share/locale/en_US$"
> > > locales-en:/usr/share/locale/en_US
> > >
> > > Is there something like that for apt? I looked at the other apt-cache
> > > options, but none of them seemed to fit.
> >
> > There's no direct equivalent at the moment I'm afraid.
> >
> > You can use eg 'apt-get install /usr/share/locale/en_US' to find out
> > what package something belongs to but it's cumbersome and doesn't really
> > work with repomd (it only looks at a subset of files with repomd, with
> > other types it's fully supported)
> >
> > Fixing these things is in the ever growing todo-list :)
>
> =) Fair enough. I've managed to work around it, to some degree, on the
> assumption that xx_YY will always belong to package locales-xx. Not
> quite what I would want, but good enough for now.
FYI, just committed initial implementation of searching files into svn.
The output format might change still, currently it's simply just
<filename> <package-version>
for matched entries.
> I'm also not using repmod here, but using the apt tools to generate a
> pure apt repository.
Ok, with pure apt repositories the above will even work fully, repomd
needs some special love wrt full filelist access, the filelists.xml
format is *hideous* for searching anything. Oh and btw, you'll want to
use --bloat option with genbasedir, otherwise the filenames wont be
stored in the metadata.
- Panu -
More information about the Apt-Rpm
mailing list