Collect Distribution Information
From ISP_RAS
Contents |
Prerequisites
The following components should be installed in the system in order to run any of scripts described here:
- perl >= 5.8.8
- python >= 2.4.2
- 'readelf' comamnd from either binutils or elfutils
- file
- coreutils (actually, 'uname' command may be required in order to guess architecture)
- in order to collect data using rpm files, 'rpm', 'rpm2cpio' and 'cpio' commands are required
- in order to collect data using deb files, 'dpkg-deb', 'lzma', 'tar', 'gzip' and 'bzip2' commands are required
Download
All scripts described here are available in the unofficial bazaar repository.
distrtodb.pl
Usage: distrtodb.pl [options] distr_name distr_version comp_file
distr_name Name of the distribution
distr_version Version of the distribution
comp_file The file with the list of components to be processed
-a|--arch Specify architecture. Possible values are IA32, IA64, PPC32,
PPC64, S390, S390X and x86-64. By default the output of `uname -m`
is analyzied.
-h|--help Display this help message
-f|--file filename Filename where the data for upload will be situated
By default, "<distr_name>_<distr_ver>_<arch>_upload_data" is used
-q|--quiet Be relly quiet - do not produce any messages except critcal errors
--verbose Be verbose
-u|--url URL Distribution homepage URL
-r|--rpm Indicates that rpms with components should be processed.
In this case, <comp_file> should contain rpm names instead of
component names used by system package manager
-d|--deb Indicates that 'deb' packages with components should be processed.
In this case, <comp_file> should contain 'deb' file names instead of
component names used by system package manager
-m|--packagemanager pkg_name Package manager used in the distribution. Supported values
are 'rpm', 'dpkg' and 'emerge'. If none is specified, the script
will try to guess it.
-c|--comment Comment for the distribution (will be inserted into the database)
--dump_python Dump python built-in modules. For every distribution going to the database
this operation should be performed once on installed system (rpm/deb files
are not suitable here)
Collects information about distribution components. More precisly, the script collects information about upstream components that are presented in distribution and commands, shared objects, binary interfaces and perl/python modules provided by them. There are two ways of collecting information about distribution:
- use installed distribution and collect information about installed components
- use distribution installation files (currently only rpm files are supported) and obtain information from them, without distribution installation.
Collect Information Using Installed Distribution
In this case distrtodb.pl should be provided with file containing list of components for which information should be collected. This should be a simple text file, each line containing component name and package name that provides that component, space separated. Information about components is obtained using system package manager (currently rpm, dpkg and emerge are supported), and package name should be one that package manager will understand (for example, in Ubuntu glibc is provided by libc6 package, so in file one should write string 'glibc libc6'). If package name and component name are the same then package name can be omitted.
In case when a component consists of several packages, the question arises which version should be assigned to this component. By default, version of the first package will be used, but it is possible to set version directly after component name (but before package name, if any). This version should present in all lines for the given component; otherwise one will possibly obtain two components with the same name but with different versions.
Actually, for each component componnettodb.pl is called and then the data obtained is joined into resulting file. The resulting file has the same format as file produced by apptodb.pl, but instead of first string ('!Application ...') the following string is printed:
!Distribution '<name>' '<version>' '<arch>' '<comment>'
Note: information about different components from the same distribution can be collected and uploaded to the database separately.
Note: in order to get full information about python for a distribution, one should call distrtodb.pl with '--dump_python' option on installed system. When this option is specified, distrtodb will dump python built-in modules for the current distribution.
Examples
Let's collect some information about Ubuntu 6.06 distribution and let's include 'glibc', 'libjpeg', 'pango' and 'zlib' components. In Ubuntu 6.06 these components are provided by 'libc6', 'libjpeg62', 'libpango1.0-0' and 'zlib1g' packages respectively. Let's also add component 'xorg-x11-libs' consisting of packages 'libice6', 'libxt6', 'libxi6', 'libsm6', 'libx11-6' and 'libxext6'. Packages that form xorg-x11-libs can have different versions, but it is desirable to set one version to component itself. Let it be '7.0'. In order to collect such information, we should create file 'Ubuntu_components' with the following lines:
glibc libc6 libjpeg libjpeg62 pango libpango1.0-0 zlib zlib1g xorg-x11-libs 7.0 libice6 xorg-x11-libs 7.0 libxt6 xorg-x11-libs 7.0 libxi6 xorg-x11-libs 7.0 libsm6 xorg-x11-libs 7.0 libx11-6 xorg-x11-libs 7.0 libxext6
and then call distrtodb.pl:
distrtodb.pl Ubuntu 6.06 Ubuntu_components
Collect Information Using Distribution Packages
To run script in this mode, please call it with '-r' (or '--rpm') or '-d' (or '--deb') option. In this case you don't have to install distribution; the only thing you need is a set of files from which distribution is installed. (NOTE: Only rpm and deb files are supported at the moment). The script should be provided with the same file as one described in the previous section, but rpm (or deb) file names should be specified instead of package names. Note that in this case it is desirable to specify component names, since by default they will be set to rpm (or deb) file names, and this doesn't seem to look nice.
Examples
Let's collect information about come openSUSE X libraries on x86-64 architecture and join them into one component, xorg-x11-libs with '7.2' version. Suppose that we have openSUSE x86-64 installation media mounted at /mnt/cdrom with rpms located in /mnt/cdrom/suse/x86_64/. In order to collect the information, we should create file 'SUSE_components' with the following lines:
xorg-x11-libs 7.2 /mnt/cdrom/suse/x86_64/xorg-x11-libICE-7.2-13.x86_64.rpm xorg-x11-libs 7.2 /mnt/cdrom/suse/x86_64/xorg-x11-libXt-7.2-13.x86_64.rpm xorg-x11-libs 7.2 /mnt/cdrom/suse/x86_64/xorg-x11-libSM-7.2-12.x86_64.rpm xorg-x11-libs 7.2 /mnt/cdrom/suse/x86_64/xorg-x11-libXext-7.2-12.x86_64.rpm xorg-x11-libs 7.2 /mnt/cdrom/suse/x86_64/xorg-x11-libX11-7.2-13.x86_64.rpm
and then call distrtodb.pl:
distrtodb.pl -r openSUSE 10.2 SUSE_components
componenttodb.pl
Usage: componenttodb.pl [options] component_name
component_name Name of the component to process as it should be
given to the package manager
-c|--comp-dbname Name of the component that should be placed into the database
(by default <component_name> is used)
-h|--help Display this help message
-f|--file filename Filename where the data for upload will be situated
By default, "<component_name>_upload_data" is used
-l|--filelist filename File containing list of file names that are installed by the application.
(Directory names are also allowed; all files from given directories will be processed)
-v|--version version Component version. By default, the script will try to obtain version using
package manager, but that version might be not that one you'd like to see if
the component is provided by several packages, since each package may have
its own version
-a|--arch Architecture name where the component is processed
(if it is not set, the output of 'uname' will be used)
-m|--packagemanager pkg_name Package manager used in the distribution. Supported values
are 'rpm', 'dpkg' and 'emerge'. If none is specified, the script
will try to guess it.
-q|--quiet Be relly quiet - do not produce any messages except critcal errors
--verbose Be verbose
Collects information about component. Used by apptodb.pl and distrtodb.pl scripts, but can be also used separately in order to collect data about component without assigning it to any distribution or application. Produces the file of the same format as apptodb.pl does except initial string ("!Application ...") and containing only one component section. Options meaning is the same as for apptodb.pl.
Examples
Collect data about 'glibc' component. Try to guess system package manager and architecture
componenttodb.pl glibc
Collect data about 'libc6' component, but insert it into the database as 'glibc'. Print data collected in 'glibc_upload' file
componenttodb.pl -c glibc -f glibc_upload libc6