[drupal7] Allow use of auto-provides <EL-6.

Jon Ciesla limb at fedoraproject.org
Tue May 21 20:02:26 UTC 2013


commit 4515a5c422c3ca7d9a66540522c28450d8980784
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Tue May 21 14:57:53 2013 -0500

    Allow use of auto-provides <EL-6.

 drupal7-rpm-no-fileattrs.patch   |   39 ++++++++++++++++++++++++++++++++++++++
 drupal7.spec                     |   24 ++++++++++++++++++----
 macros.drupal7                   |    3 ++
 macros.drupal7.rpm-lt-4-9-compat |   10 +++++++++
 4 files changed, 71 insertions(+), 5 deletions(-)
---
diff --git a/drupal7-rpm-no-fileattrs.patch b/drupal7-rpm-no-fileattrs.patch
new file mode 100644
index 0000000..3bff829
--- /dev/null
+++ b/drupal7-rpm-no-fileattrs.patch
@@ -0,0 +1,39 @@
+diff --git drupal7.prov drupal7.prov
+index 5495296..c11cafb 100644
+--- drupal7.prov
++++ drupal7.prov
+@@ -26,6 +26,7 @@ Parsed from *.info files.
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ # IN THE SOFTWARE.
+ 
++import subprocess
+ import sys
+ import os
+ 
+@@ -37,6 +38,10 @@ def main():
+         if path.endswith('.info'):
+             print 'drupal7(' + os.path.basename(path)[:-len('.info')] + ')'
+ 
++    # Invoke the regular RPM provides generator to allow compatibility with RPM < 4.9 (no fileattrs)
++    p = subprocess.Popen(['/usr/lib/rpm/find-provides'], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
++    print p.communicate(input='\n'.join(paths))[0]
++
+ 
+ if __name__ == '__main__':
+     main()
+diff --git macros.drupal7 macros.drupal7
+index 920d2c0..9641013 100644
+--- macros.drupal7
++++ macros.drupal7
+@@ -3,5 +3,9 @@
+ %drupal7_themes   %{drupal7}/themes
+ %drupal7_libraries  %{_sysconfdir}/drupal7/all/libraries
+ 
+-# No-op macro to allow spec compatibility with RPM < 4.9 (no fileattrs)
+-%drupal7_find_provides_and_requires %{nil}
++# Macro to allow spec compatibility with RPM < 4.9 (no fileattrs)
++%drupal7_find_provides_and_requires %{expand: \
++%global _use_internal_dependency_generator 0
++%global __find_provides %{_rpmconfigdir}/drupal7.prov
++%global __find_requires %{_rpmconfigdir}/drupal7.req
++}
diff --git a/drupal7.spec b/drupal7.spec
index 2b0d544..c8fe524 100644
--- a/drupal7.spec
+++ b/drupal7.spec
@@ -4,7 +4,7 @@ AutoReqProv: no
 %define drupaldir %{_datadir}/drupal7
 Name: drupal7
 Version:  7.22
-Release:  3%{?dist}
+Release:  4%{?dist}
 Summary: An open-source content-management platform
 
 Group: Applications/Publishing
@@ -18,6 +18,8 @@ Source4: %{name}-files-migrator.sh
 Source5: macros.%{name}
 Source6: %{name}.attr
 Source7: %{name}.prov
+Source8: macros.%{name}.rpm-lt-4-9-compat
+Source9: %{name}.prov.rpm-lt-4-9-compat
 Patch0:  %{name}-7.4-scripts-noshebang.patch
 Patch1:  drupal-7.14-CVE-2012-2922.patch
 
@@ -76,11 +78,20 @@ ln -s ../../../%{_sysconfdir}/httpd/conf.d/drupal7-site.htaccess %{buildroot}%{d
 mv %{buildroot}%{_sysconfdir}/%{name}/example.sites.php .
 
 # rpmbuild
+# RPM >= 4.9
+%if 0%{?_fileattrsdir:1}
 mkdir -p %{buildroot}%{_sysconfdir}/rpm/
-install -pm0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/rpm/macros.drupal7
+install -pm0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/rpm/macros.%{name}
 mkdir -p %{buildroot}%{_prefix}/lib/rpm/fileattrs
-install -pm0644 %{SOURCE6} %{buildroot}%{_prefix}/lib/rpm/fileattrs/
-install -pm0755 %{SOURCE7} %{buildroot}%{_prefix}/lib/rpm/
+install -pm0644 %{SOURCE6} %{buildroot}%{_prefix}/lib/rpm/fileattrs/%{name}.attr
+install -pm0755 %{SOURCE7} %{buildroot}%{_prefix}/lib/rpm/%{name}.prov
+# RPM < 4.9
+%else
+mkdir -p %{buildroot}%{_sysconfdir}/rpm/
+install -pm0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/rpm/macros.%{name}
+mkdir -p %{buildroot}%{_prefix}/lib/rpm/
+install -pm0755 %{SOURCE9} %{buildroot}%{_prefix}/lib/rpm/%{name}.prov
+%endif
 
 %clean
 rm -rf %{buildroot}
@@ -112,10 +123,13 @@ rm -rf %{buildroot}
 %files rpmbuild
 %defattr(-,root,root,-)
 %{_sysconfdir}/rpm/macros.drupal7
-%{_prefix}/lib/rpm/fileattrs/%{name}.attr
+%{?_fileattrsdir:%{_prefix}/lib/rpm/fileattrs/%{name}.attr}
 %{_prefix}/lib/rpm/%{name}.prov
 
 %changelog
+* Tue May 21 2013 Jon Ciesla <limburgher at gmail.com> - 7.22-4
+- Allow use of auto-provides <EL-6.
+
 * Thu May 09 2013 Jon Ciesla <limburgher at gmail.com> - 7.22-3
 - Change rpmconfigdir to %{_prefix}/lib/rpm to support EL-5.
 
diff --git a/macros.drupal7 b/macros.drupal7
index 51d86bc..920d2c0 100644
--- a/macros.drupal7
+++ b/macros.drupal7
@@ -2,3 +2,6 @@
 %drupal7_modules  %{drupal7}/modules
 %drupal7_themes   %{drupal7}/themes
 %drupal7_libraries  %{_sysconfdir}/drupal7/all/libraries
+
+# No-op macro to allow spec compatibility with RPM < 4.9 (no fileattrs)
+%drupal7_find_provides_and_requires %{nil}
diff --git a/macros.drupal7.rpm-lt-4-9-compat b/macros.drupal7.rpm-lt-4-9-compat
new file mode 100644
index 0000000..9d66394
--- /dev/null
+++ b/macros.drupal7.rpm-lt-4-9-compat
@@ -0,0 +1,10 @@
+%drupal7          %{_datadir}/drupal7
+%drupal7_modules  %{drupal7}/modules
+%drupal7_themes   %{drupal7}/themes
+%drupal7_libraries  %{_sysconfdir}/drupal7/all/libraries
+
+# Macro to allow spec compatibility with RPM < 4.9 (no fileattrs)
+%drupal7_find_provides_and_requires %{expand: \
+%global _use_internal_dependency_generator 0
+%global __find_provides %{_rpmconfigdir}/drupal7.prov
+}


More information about the scm-commits mailing list