Author image Michael De La Rue


DirTree - get metainfo from a directory in a the perl module


This is a (experimental) module designed to get meta information from a special directory which is kept inside the perl-module.


The main directory for meta data is PkgData. This name is chosen because within the CPAN collection distributed by RedHat none of the existing modules had any files matching /pck/i.

Within that directory all names starting with opt_ are reserved for subdirectories for use for meta information which overrides the default in special circumstances. E.g. opt_rpm is for data which should be different specifically for rpm.


The directory contains files which contain the meta information. The files each have their own format.


This should contain a one line summary of what the module is for.


This contains the description of the module. This should be a few lines of text which explain what the module does. At present this should be in plain text format (ASCII - no internationalisation !??!).

A typical maximum length would be about 20-30 lines.


This will contain a list of documentation file names, one per line. The names can refer to individual files or whole directories. They are relative to the top level directory of the perl module.


This file contains a perl script for building the meta information. This script will be run with the current directory the main directory of the distribution

Avoid using this script

override directory

In order to provide your own descriptions of certain RPMs, you can put a file with the name of the module into a specified directory. This will then be used in the description field exactly as it is. This file will override all other possibilities since we assume that the package builder could delete the override file if wanted. Where there turns out to be an pkg-data-XXX/description as well as a description we give a warning.

rpm specific build scripts

These give direct access to the various RPM scripts of (almost)the same names. The text included is copied verbatim into the spec file.

The prep and build scripts are run after makerpm's normal options. The clean script is run before hand (whilst the build directory is still there) install script is run after deleting the previous build root, but before running the normal install options. This means that you have to create your own directories.


The default search path is only the PkgData directory in the base directory of the perl module. Calling the <add_option> function will mean that the directory PkgData/opt_ARG directory will be checked where ARG is the argument to add_option. Option directories are checked before the main package directory.

Calling the add_data_dir function will cause the ARG/package_name directory to be searched.

Each directory on the path is checked in turn.


When creating a metainfo file, the general rule is to always create the file in the generic (top level) directory. The opt directories should only be used for special cases.


Given a filename this simply returns the contents.


this finds the correct configuration file for a given name by searching through the path of different directories where it could be then calling _read_file() to read the file and returns the contents of the file.


You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README.