Guidelines for packaging Drupal 7 modules, themes, and profiles
Different Kinds of Packages
- Modules: Modules extend and customize Drupal functionality.
- Themes: Themes allow users to change the look and feel of their Drupal site.
Naming Scheme
Every package MUST be named drupal7-<drupal_machine_name>
. Drupal itself enforces unique machine names for each of its' projects and there is a single namespace for all modules, themes, and distributions/profiles. The <drupal_machine_name>
MUST match the drupal.org project name (i.e. drupal.org/project/<drupal_machine_name>
).
File Placement
- Modules: A module package MUST be placed in the
%drupal7_modules
directory (base "modules/
" directory) - Themes: A theme package MUST be placed in the
%drupal7_themes
directory (base "themes/
" directory) - Libraries: A library package MUST be placed in the
%drupal7_libraries
directory (base "libraries/
" directory)
Requires and Provides
- Every package SHOULD require "
drupal7(<drupal_machine_name>)
" virtual resources instead of "drupal7-<drupal_machine_name>
" packages. - Every package MUST include the following in its' spec:
%{?drupal7_find_provides_and_requires}
This is for compatibility with RPM < 4.9 (i.e. EPEL 5/6).
BuildRequires: drupal7-rpmbuild >= 7.22-5
The drupal7-rpmbuild
package automatically requires drupal7(core)
and scans files for provides (from *.info files) and automatically adds them to the package during build time as "drupal7(<drupal_machine_name>)
" virtual resources. Hidden projects are ignored. The use of virtual provides and requires helps alleviate the confusion of sub-modules and which modules actually provide those sub-modules. They also help simplify spec files.
- Every package MUST NOT:
- explicitly require "
drupal7
" or "drupal7(core)
" (unless a specific core version is required) becausedrupal7-rpmbuild
auro-requires "drupal7(core)
" - explicitly provide "
drupal7(<drupal_machine_name>)
" virtual resources becausedrupal7-rpmbuild
auto-provides these
- explicitly require "
Other Packages
PHP Extensions
Requiring a Minimum PHP Version
See PHP packaging guidelines but note that this should not normally be required by most packages (see [1]).
Macros and Scriptlets
Macros provided by the drupal7-rpmbuild
package:
Macro | Value | Description |
---|---|---|
%drupal7 |
%{_datadir}/drupal7 |
Drupal 7 base directory |
%drupal7_modules |
%{drupal7}/modules |
Drupal 7 modules directory |
%drupal7_themes |
%{drupal7}/themes |
Drupal 7 themes directory |
%drupal7_libraries |
%{_sysconfdir}/drupal7/all/libraries |
Drupal 7 libraries directory |