[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Quel fichiers dans quel package?



J'utilise une Hamm.

Quand je lance une compilation, il m'arrive d'avoir un message d'erreur
du genre:
toto.h: file not found.

Et la, point d'aide subtile et delicate pour me signaler dans quel
package se trouve ce foutu fichier.

Mais on est debrouillard sous Linux.

J'ai donc une petite methode qui met en place une (miserable ;-) base de
donnees des fichiers contenus dans chaque package.

Je vous la livre dans le HOWTO que j'ai ecrit.

-- 
Olivier
This is the first release of the Packages-Contents-HOWTO.
Its main aim is to allow people using Red Hat and Debian distributions to know
which file is included in which package.

I present here a rather ugly method, but it works very well.



For DEBIAN users:
-------------------------------------------------------------------------------
*********
1) How to determine which files are included in one known package (Debian
version)

Suppose you want to know which files are included in (let's say) the package
toto.deb of the current directory.
You just have to type the following command:
dpkg -l ./toto.deb

That will list each file of the package, one per line.

*********
2) List the files for each package of my distribution (Debian version).

The most interesting thing is to make a kind of database (in fact, a simple
text file) that list for each package:its name and the files in it.
For example:

-------------
--- Package name
-------------

File1
File2

-------------
--- Another package name
-------------

File3
File4

...

It is not that difficult.
The most interesting is to do the following thing:

2-1) List the files for one package of my distribution.

Do a script called /tmp/toto
This script should include these lines:

--- cut here ---
#!/bin/sh

echo "--------"    >> /tmp/full_list
echo "--- $1"      >> /tmp/full_list
echo "--------"    >> /tmp/full_list
echo ''            >> /tmp/full_list
dpkg --contents $1 >> /tmp/full_list
echo ''            >> /tmp/full_list
--- cut here ---

This script accepts the name of a .deb archive (full name, with absolute path) as argument and add an entry at the end of /tmp/full_list.
The entry is as follows:

--- cut here ---
--------
--- /DEB/adjtimex_1.5-1.deb
--------

drwxr-xr-x root/root         0 1998-04-21 01:58 ./
drwxr-xr-x root/root         0 1998-04-21 01:58 usr/
drwxr-xr-x root/root         0 1998-04-21 01:58 usr/bin/
drwxr-xr-x root/root         0 1998-04-21 01:59 usr/sbin/
-rwxr-xr-x root/root     30176 1998-04-21 01:59 usr/sbin/adjtimex
-rwxr-xr-x root/root       857 1998-04-21 01:58 usr/sbin/adjtimexconfig
drwxr-xr-x root/root         0 1998-04-21 01:58 usr/man/
drwxr-xr-x root/root         0 1998-04-21 01:59 usr/man/man8/
-rw-r--r-- root/root      3706 1997-12-14 19:28 usr/man/man8/adjtimex.8.gz
-rw-r--r-- root/root       628 1998-04-21 01:38 usr/man/man8/adjtimexconfig.8.gz
drwxr-xr-x root/root         0 1998-04-21 01:58 usr/doc/
drwxr-xr-x root/root         0 1998-04-21 01:59 usr/doc/adjtimex/
-rw-r--r-- root/root       374 1998-04-21 01:58 usr/doc/adjtimex/copyright
-rw-r--r-- root/root       569 1998-04-21 01:39 usr/doc/adjtimex/README.debian
-rw-r--r-- root/root       210 1998-04-21 01:58 usr/doc/adjtimex/buildinfo.Debian
-rw-r--r-- root/root      3060 1997-12-12 02:10 usr/doc/adjtimex/README.gz
-rw-r--r-- root/root      1265 1998-04-21 01:58 usr/doc/adjtimex/changelog.Debian.gz
drwxr-xr-x root/root         0 1998-04-21 01:58 etc/
drwxr-xr-x root/root         0 1998-04-21 01:58 etc/rc.boot/
-rwxr-xr-x root/root       168 1998-04-21 01:58 etc/rc.boot/adjtimex

--- cut here ---

Pretty nice, isn't it?




If you do not want to have the 'permissions owner/group size date' field, you shoud use this script
instead:

--- cut here ---
#!/bin/sh

echo "--------"                        >> /tmp/full_list
echo "--- $1"                          >> /tmp/full_list
echo "--------"                        >> /tmp/full_list
echo ''                                >> /tmp/full_list
dpkg --contents $1 |sed 's/^.\{48\}//' >> /tmp/full_list
echo ''                                >> /tmp/full_list
--- cut here ---


The entry in /tmp/full_list will then be:

--- cut here ---
--------
--- /DEB/adjtimex_1.5-1.deb
--------

./
usr/
usr/bin/
usr/sbin/
usr/sbin/adjtimex
usr/sbin/adjtimexconfig
usr/man/
usr/man/man8/
usr/man/man8/adjtimex.8.gz
usr/man/man8/adjtimexconfig.8.gz
usr/doc/
usr/doc/adjtimex/
usr/doc/adjtimex/copyright
usr/doc/adjtimex/README.debian
usr/doc/adjtimex/buildinfo.Debian
usr/doc/adjtimex/README.gz
usr/doc/adjtimex/changelog.Debian.gz
etc/
etc/rc.boot/
etc/rc.boot/adjtimex

--- cut here ---

Interesting, too...





If you do not want directories to be listed in entries, then use this script:

--- cut here ---
#!/bin/sh

echo "--------"                                     >> /tmp/full_list
echo "--- $1"                                       >> /tmp/full_list
echo "--------"                                     >> /tmp/full_list
echo ''                                             >> /tmp/full_list
dpkg --contents $1 |sed 's/^.\{48\}//'|grep -v '/$' >> /tmp/full_list
echo ''                                             >> /tmp/full_list
--- cut here ---

The entry in /tmp/full_list will then be:

--- cut here ---
--------
--- /DEB/adjtimex_1.5-1.deb
--------

usr/sbin/adjtimex
usr/sbin/adjtimexconfig
usr/man/man8/adjtimex.8.gz
usr/man/man8/adjtimexconfig.8.gz
usr/doc/adjtimex/copyright
usr/doc/adjtimex/README.debian
usr/doc/adjtimex/buildinfo.Debian
usr/doc/adjtimex/README.gz
usr/doc/adjtimex/changelog.Debian.gz
etc/rc.boot/adjtimex

--- cut here ---


Finally good.





A nice option is to have the name of the archive in front of each file.
If you like the idea, use this script:

--- cut here ---
#!/bin/sh

echo "--------"                                                      >> /tmp/full_list
dpkg --contents $1 |sed 's/^.\{48\}//'|grep -v '/$'|sed "s+^+$1:  +" >> /tmp/full_list
echo ''                                                              >> /tmp/full_list
--- cut here ---


The entry in /tmp/full_list will then be:

--- cut here --- 
--------
/DEB/adjtimex_1.5-1.deb:  usr/sbin/adjtimex
/DEB/adjtimex_1.5-1.deb:  usr/sbin/adjtimexconfig
/DEB/adjtimex_1.5-1.deb:  usr/man/man8/adjtimex.8.gz
/DEB/adjtimex_1.5-1.deb:  usr/man/man8/adjtimexconfig.8.gz
/DEB/adjtimex_1.5-1.deb:  usr/doc/adjtimex/copyright
/DEB/adjtimex_1.5-1.deb:  usr/doc/adjtimex/README.debian
/DEB/adjtimex_1.5-1.deb:  usr/doc/adjtimex/buildinfo.Debian
/DEB/adjtimex_1.5-1.deb:  usr/doc/adjtimex/README.gz
/DEB/adjtimex_1.5-1.deb:  usr/doc/adjtimex/changelog.Debian.gz
/DEB/adjtimex_1.5-1.deb:  etc/rc.boot/adjtimex

--- cut here --- 

This is, for the moment, my favourite option.

2-2) Using the script to scan all the packages of my distribution.

This is very easy.
The idea is to use the instruction find this way:

            find /mnt/cdrom -name '*.deb' -exec /tmp/toto {} \;


This instruction will scan all the cdrom (change the '/mnt/cdrom' directory if you wish to scan
something else) to find each .deb package then will execute /tmp/toto on it.

I prefer to do this command line to create my database:

            rm /tmp/full_list; find /mnt/cdrom -name '*.deb' -exec /tmp/toto {} \;


This way, I am sure my /tmp/full_list is empty at the beginning of the operation.

Do not forget to move this database when it is ready. Because /tmp is emptied each time you reboot
your Linux.


3) How to use the database

Now to find which package "owns" which file, just do a search of the filename
in the database then find the package name by searching the preceeding '--- ' string.
(not needed if you use the last solution of 2-1).

Pretty huge, isn't it ;-)






APOLOGIZES
-------------------------------------------------------------------------------
This is my first attempt as an HOWTO writer. So do not hesitate to tell me
what is wrong in it.
-------------------------------------------------------------------------------







Reply to: