From Fedora Project Wiki

No edit summary
(Fix module template to use newest bits)
Line 13: Line 13:


<pre>
<pre>
%global drupal_base        %{_datadir}/drupal
%global drupalver 6
%global drupal_moddir      %{drupal_base}/modules
# e.g. "drupal6"
%global drupal_modname      <<<YOUR_MODULE_NAME>>>
%global drupal drupal%{drupalver}
# Use 5 for Drupal 5.x modules, 6 for Drupal 6.x modules, etc.
# e.g. "/usr/share/drupal6"
%global drupal_release      6
%global drupaldir %{_datadir}/drupal%{drupalver}
 
# Use upstream name as expressed in URL and tarball
Name:          drupal-module-%{drupal_modname}-%{drupal_release}x
%global modname <<<MODULE_NAME>>>
Version:        2.6
Release:        1%{?dist}
Summary:        # Use short description from Drupal site for module
 
Group:          Applications/Publishing
License:        GPLv2
# Use top-level URL from Drupal site for the module
URL:            http://drupal.org/
Source0:        http://ftp.drupal.org/files/projects/%{drupal_modname}-%{drupal_release}.x-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
#  
Requires:      drupal >= %{drupal_release}


Name:    %{drupal}-%{modname}
Version: <<<MODULE_VERSION>>>
Release: 1%{?dist}
Summary: <<<MODULE_SUMMARY>>>
Group:  Applications/Publishing
License: GPLv2+
URL:    http://drupal.org/project/%{modname}
Source0: http://ftp.drupal.org/files/projects/%{modname}-%{drupalver}.x-%{version}.tar.gz
Source1: %{name}-fedora-README.txt
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires:  %{drupal} >= 6.0


%description
%description
# Use full description from Drupal site for module
<<<MODULE_DESCRIPTION - use upstream text wherever possible>>>
 


%prep
%prep
%setup -qn %{drupal_modname}
%setup -qn %{modname}
# Remove empty index.html and others
find -size 0 | xargs rm -f
 


%build
%build
 
cp %{SOURCE1} .


%install
%install
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%{__mkdir} -p $RPM_BUILD_ROOT/%{drupal_moddir}/%{drupal_modname}  
install -d %{buildroot}%{drupaldir}/modules/%{modname}
cp -pr . $RPM_BUILD_ROOT/%{drupal_moddir}/%{drupal_modname}
cp -pr * %{buildroot}%{drupaldir}/modules/%{modname}
rm -rf $RPM_BUILD_ROOT/%{drupal_moddir}/%{drupal_modname}/pndocs
 


%clean
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
 


%files
%files
%defattr(-,root,root,-)
%defattr(-,root,root,-)
%doc CHANGELOG.txt LICENSE.txt README.txt DEVELOPER.txt UPGRADE.txt
%doc LICENSE.txt %{name}-fedora-README.txt
%{drupal_moddir}/%{drupal_modname}
%exclude %{drupaldir}/modules/%{modname}/LICENSE.txt
 
%exclude %{drupaldir}/modules/%{modname}/%{name}-fedora-README.txt
%{drupaldir}/modules/%{modname}


%changelog
%changelog
</pre>
</pre>


== Theme template ==
== Theme template ==

Revision as of 00:52, 2 March 2011


Cog.png
This page needs some love
This page should be revised or reconstructed to be more helpful. Problems may include being out of step with current team or project status or process.


Warning.png
This page is a draft only
It is still under construction and content may change. Do not rely on the information on this page. Don't rely on this page for now, as the Drupal packages in Fedora have changed subtly from what these templates expected.

The following templates can be used to create new Drupal module and theme packages. Substitute the name for the Drupal module or theme, in the correct case as used throughout the Drupal web site.

Warning.png
Look for dependencies
Before you submit a package, you must go through the source and ensure that all dependency libraries are separately packaged in Fedora, and eliminated from the Drupal module package. Also, be sure to check the .info file for dependency information!

Module template

%global drupalver 6
# e.g. "drupal6"
%global drupal drupal%{drupalver}
# e.g. "/usr/share/drupal6"
%global drupaldir %{_datadir}/drupal%{drupalver}
# Use upstream name as expressed in URL and tarball
%global modname <<<MODULE_NAME>>>

Name:    %{drupal}-%{modname}
Version: <<<MODULE_VERSION>>>
Release: 1%{?dist}
Summary: <<<MODULE_SUMMARY>>>
Group:   Applications/Publishing
License: GPLv2+
URL:     http://drupal.org/project/%{modname}
Source0: http://ftp.drupal.org/files/projects/%{modname}-%{drupalver}.x-%{version}.tar.gz
Source1: %{name}-fedora-README.txt
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires:  %{drupal} >= 6.0

%description
<<<MODULE_DESCRIPTION - use upstream text wherever possible>>>

%prep
%setup -qn %{modname}

%build
cp %{SOURCE1} .

%install
rm -rf %{buildroot}
install -d %{buildroot}%{drupaldir}/modules/%{modname}
cp -pr * %{buildroot}%{drupaldir}/modules/%{modname}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc LICENSE.txt %{name}-fedora-README.txt
%exclude %{drupaldir}/modules/%{modname}/LICENSE.txt
%exclude %{drupaldir}/modules/%{modname}/%{name}-fedora-README.txt
%{drupaldir}/modules/%{modname}

%changelog

Theme template

%global drupal_base         %{_datadir}/drupal
%global drupal_themedir     %{drupal_base}/themes
%global drupal_themename    <<<YOUR_THEME_NAME>>>
# Use 5 for Drupal 5.x themes, 6 for Drupal 6.x themes, etc.
%global drupal_release      6

Name:           drupal-theme-%{drupal_themename}-%{drupal_release}x
Version:        2.6
Release:        1%{?dist}
Summary:        # Use short description from Drupal site for theme

Group:          Applications/Publishing
License:        GPLv2
# Use top-level URL from Drupal site for the theme
URL:            http://drupal.org/
Source0:        http://ftp.drupal.org/files/projects/%{drupal_themename}-%{drupal_release}.x-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
# 
Requires:       drupal >= %{drupal_release}


%description
# Use full description from Drupal site for theme


%prep
%setup -qn %{drupal_themename}
# Remove empty index.html and others
find -size 0 | xargs rm -f


%build


%install
rm -rf $RPM_BUILD_ROOT
%{__mkdir} -p $RPM_BUILD_ROOT/%{drupal_themedir}/%{drupal_themename} 
cp -pr . $RPM_BUILD_ROOT/%{drupal_themedir}/%{drupal_themename}
rm -rf $RPM_BUILD_ROOT/%{drupal_themedir}/%{drupal_themename}/pndocs


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc CHANGELOG.txt LICENSE.txt README.txt DEVELOPER.txt UPGRADE.txt
%{drupal_themedir}/%{drupal_themename}


%changelog