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.
- Distributions/Profiles: Distributions/profiles provide site features and functions for a specific type of site.
Naming Scheme
Every package MUST be named drupal8-<drupal_project>
. Drupal itself enforces unique project names for each of its' projects and there is a single namespace for all modules, themes, and distributions/profiles. The <drupal_project>
MUST match the drupal.org project name (i.e. drupal.org/project/<drupal_project>
).
Required Spec Macro Definitions
Every package:
- MUST define "
%global drupal8_project <drupal_project>
"<drupal_project>
MUST match the drupal.org project name (i.e. drupal.org/project/<drupal_project>
)
- MUST define "
%global drupal8_type module/profile/theme
" - MUST define "
%global drupal8_pre_release PRE_RELEASE
" if package is a pre-release - MUST define "
%global drupal8_commit COMMIT
" if package is a dev release - SHOULD define "
%global drupal8_commit_date YYYYMMDD
" if package is a dev release
File Placement
- Modules: A module package MUST be placed in the
%drupal8_modules
directory - Themes: A theme package MUST be placed in the
%drupal8_themes
directory - Distributions/Profiles: A distribution/profile package MUST be placed in the
%drupal8_profiles
directory - Libraries: A library package MUST be placed in the
%drupal8_libraries
directory
Requires and Provides
Every package MUST include the following in its' spec:
BuildRequires: drupal8-rpmbuild
The drupal8-rpmbuild
package automatically scans files for requires and provides and automatically adds them to the package during build time. The use of virtual provides and requires helps alleviate the confusion of sub-projects and which projects actually provide those sub-modules. They also help simplify spec files.
Automatic Requires
drupal8(core)
is always a requirementdrupal8(*)
requires are only determined from the project's main<drupal_project>.info.yml
file- "
dependencies
" property
- "
composer.json
files are not used for automatic requires because of dependency version formats and minimum Fedora/EPEL version for autoloaders- Also see Requiring a Minimum PHP Version section
Automatic Provides
drupal8(*)
virtual provides are determined from all project's*.info.yml
file namesphp-composer(*)
virtual provides are determined from all project'scomposer.json
filesname
propertyreplace
property where version =self.version
Drupal Projects
Every package MUST use drupal8(*)
dependencies for Drupal project dependencies.
Other Packages
See PHP packaging guidelines: Other Packages.
PHP Extensions
See PHP packaging guidelines: Extensions Requires.
Requiring a Minimum PHP Version
Since all packages require drupal8(core)
which requires Drupal 8's minimum PHP version, most packages do not need to require a minimum PHP version. If packages require a minimum PHP version greater than Drupal 8's minimum version, the project maintainers should have the minimum version provided in the project's main *.info.yml
file and drupal8-rpmbuild
will automatically find and require the minimum PHP version.
Macros and Scriptlets
Macros provided by the drupal8-rpmbuild
package:
Macro | Value | Description |
---|---|---|
%drupal8_core_version |
8.*.* * |
Drupal 8 core version. |
%drupal8_php_min_ver |
5.5.9 * |
Drupal 8 core minimum PHP version requirement. |
%drupal8 |
%{_datadir}/drupal8 |
Drupal 8 base install directory. |
%drupal8_modules |
%{drupal8}/modules/rpm ** |
Drupal 8 modules install directory. |
%drupal8_profiles |
%{drupal8}/profiles/rpm ** |
Drupal 8 profiles install directory. |
%drupal8_themes |
%{drupal8}/themes/rpm ** |
Drupal 8 themes install directory. |
%drupal8_libraries |
%{drupal8}/libraries |
Drupal 8 libraries install directory. |
%drupal8_var |
%{_localstatedir}/lib/drupal8 |
Drupal 8 var directory. |
%drupal8_conf |
%{_sysconfdir}/drupal8 |
Drupal 8 conf directory. |
%drupal8_name |
drupal8-%{drupal8_project} |
Spec name. |
%drupal8_release |
%{?drupal8_pre_release:.%{drupal8_pre_release}}%{?drupal8_commit:.%{?drupal8_commit_date}git%(c=%{drupal8_commit}; echo ${c:0:7})}%{?dist} |
Spec release. |
%drupal8_url |
https://www.drupal.org/project/%{drupal8_project} |
Spec URL. |
%drupal8_source |
%{!?drupal8_commit:https://ftp.drupal.org/files/projects/%{drupal8_project}-8.x-%{?version}%{?drupal8_pre_release:-%{drupal8_pre_release}}.tar.gz}%{?drupal8_commit:%{drupal8_project}-8.x-%{?version}-%{drupal8_commit}.tar.gz}
|
Spec source.
|
%drupal8_files |
.rpm/files.txt |
Package files list.
|
%drupal8_prep |
%setup -qn %{drupal8_project} \
|
Prep scriptlet used in %prep .
|
%drupal8_install |
%define drupal8_type_dir %{expand:%%{drupal8_%{drupal8_type}s}} \
|
Install scriptlet used in %install .
|
* Value is dynamically updated by the Drupal 8 core package.
** rpm
sub-directory so RPM-installed Drupal projects are separated from manually installed Drupal projects.
Template
%global drupal8_project __DRUPAL8_PROJECT__ %global drupal8_type module/profile/theme #%%global drupal8_pre_release #%%global drupal8_commit #%%global drupal8_commit_date Name: %{drupal8_name} Version: __VERSION__ Release: 1%{drupal8_release} Summary: __SUMMARY__ License: GPLv2+ URL: %{drupal8_url} Source0: %{drupal8_source} BuildArch: noarch BuildRequires: drupal8-rpmbuild %description __DESCRIPTION__ %prep %{drupal8_prep} %build # Empty build section, nothing to build %install %{drupal8_install} %files -f %{drupal8_files} %changelog * ddd MMM DD YYYY __NAME__ <__EMAIL__> __VERSION__-1 - Initial package