From Fedora Project Wiki
(Add libraries to the mix)
No edit summary
Line 6: Line 6:
* '''[http://drupal.org/project/modules Modules]''': Modules extend and customize Drupal functionality.
* '''[http://drupal.org/project/modules Modules]''': Modules extend and customize Drupal functionality.
* '''[http://drupal.org/project/themes Themes]''': Themes allow users to change the look and feel of their Drupal site.
* '''[http://drupal.org/project/themes Themes]''': Themes allow users to change the look and feel of their Drupal site.
* '''[http://drupal.org/project/distributions Distributions/Profiles]''': Distributions provide site features and functions for a specific type of site.
* '''[http://drupal.org/project/distributions Distributions/Profiles]''': Distributions/profiles provide site features and functions for a specific type of site.


== Naming Scheme ==
== Naming Scheme ==
Every package '''MUST''' be named <code>drupal8-''&lt;drupal_machine_name''&gt;</code>.  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 <code>''&lt;drupal_machine_name''&gt;</code> '''MUST''' match the drupal.org project name (i.e. drupal.org/project/<code>''&lt;drupal_machine_name''&gt;</code>).
Every package '''MUST''' be named <code>drupal8-''&lt;drupal_project''&gt;</code>.  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 <code>''&lt;drupal_project''&gt;</code> '''MUST''' match the drupal.org project name (i.e. drupal.org/project/<code>''&lt;drupal_project''&gt;</code>).


== File Placement ==
== File Placement ==
* '''Modules''': A module package '''MUST''' be placed in the <code>%drupal8_modules</code> directory (base "<code>modules/</code>" directory)
* '''Modules''': A module package '''MUST''' be placed in the <code>%drupal8_modules</code> directory
* '''Themes''': A theme package '''MUST''' be placed in the <code>%drupal8_themes</code> directory (base "<code>themes/</code>" directory)
* '''Themes''': A theme package '''MUST''' be placed in the <code>%drupal8_themes</code> directory
* '''Distributions/Profiles''': A distribution/profile package '''MUST''' be placed in the <code>%drupal8_profiles</code> directory (base "<code>profiles/</code>" directory)
* '''Distributions/Profiles''': A distribution/profile package '''MUST''' be placed in the <code>%drupal8_profiles</code> directory
* '''Libraries''': A library package '''MUST''' be placed in the <code>%drupal8_libraries</code> directory (base "<code>libraries/</code>" directory)
* '''Libraries''': A library package '''MUST''' be placed in the <code>%drupal8_libraries</code> directory


== Requires and Provides ==
== Requires and Provides ==
Line 23: Line 23:
<pre>BuildRequires: drupal8-rpmbuild</pre>
<pre>BuildRequires: drupal8-rpmbuild</pre>


The <code>drupal8-rpmbuild</code> package automatically scans files for provides [1] and requires [2] and automatically adds them to the package during build time as "<code>drupal8(<drupal_machine_name>)</code>" virtual resources. 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.
The <code>drupal8-rpmbuild</code> package automatically scans files for provides [1] and requires [2] and automatically adds them to the package during build time as "<code>drupal8(<drupal_project>)</code>" and "<code>php-composer(<vendor>/<project>)</code>" virtual resources. 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.


[1] From *.info filenames<br />
[1] From <code>*.info.yml<code> and <code>composer.json<code> filenames<br />
[2] From *.info file "dependencies[]" entries
[2] From <code>*.info<code> file "dependencies" entries


=== Other Packages ===
=== Other Packages ===
Line 58: Line 58:
|-
|-
| <code>%drupal8_libraries</code> || <code>%{drupal8}/libraries</code> || Drupal 8 library directory.
| <code>%drupal8_libraries</code> || <code>%{drupal8}/libraries</code> || Drupal 8 library directory.
|-
| <code>%drupal8_var</code> || <code>%{_localstatedir}/lib/drupal8</code> || Drupal 8 var directory.
|-
| <code>%drupal8_conf</code> || <code>%{_sysconfdir}/drupal8</code> || Drupal 8 conf directory.
|}
|}



Revision as of 14:44, 24 January 2016

This is only a DRAFT!

Guidelines for packaging Drupal 8 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.
  • 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>).

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 provides [1] and requires [2] and automatically adds them to the package during build time as "drupal8(<drupal_project>)" and "php-composer(<vendor>/<project>)" virtual resources. 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.

[1] From *.info.yml and composer.json filenames
[2] From *.info file "dependencies" entries

Other Packages

See PHP packaging guidelines.

PHP Extensions

See PHP packaging guidelines.

Requiring a Minimum PHP Version

See PHP packaging guidelines but note that this should not normally be required by most packages (see [1]).

This needs to be added to the drupal8-rpmbuild package so it is automatic.

Macros and Scriptlets

Macros provided by the drupal8-rpmbuild package:

Macro Value Description
%drupal8_version 8.0* Drupal 8 version.
* Numeric value is dynamically updated by the Drupal 8 core package.
%drupal8 %{_datadir}/drupal8 Drupal 8 base directory.
%drupal8_modules %{drupal8}/modules Drupal 8 modules directory.
%drupal8_profiles %{drupal8}/profiles Drupal 8 profiles directory.
%drupal8_themes %{drupal8}/themes Drupal 8 themes directory.
%drupal8_libraries %{drupal8}/libraries Drupal 8 library directory.
%drupal8_var %{_localstatedir}/lib/drupal8 Drupal 8 var directory.
%drupal8_conf %{_sysconfdir}/drupal8 Drupal 8 conf directory.

Additional Hints

Templates

Module

Theme

Distribution/Profile