Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #6047 pear makerpm fails to handle docs in root directory
Submitted: 2005-11-23 12:26 UTC
From: bugs at timj dot co dot uk Assigned: cellog
Status: Closed Package: PEAR
PHP Version: 5.0.4 OS:
Roadmaps: (Not assigned)    

 [2005-11-23 12:26 UTC] bugs at timj dot co dot uk
Description: ------------ "pear makerpm" does not always produce spec files that build. Specifically, the %doc section sometimes contains docs that remain in %{buildroot}/docs/[package]/ rather than getting moved to %{_builddir}. Thus, the package build fails. $ pear -V PEAR Version: 1.4.5 PHP Version: 5.0.4 Bug also confirmed on PEAR 1.3.5. This is similar to bug #1163 which is closed, though this report is probably substantial enough to warrant being opened as a new bug anyway. Test script: --------------- Download Auth-1.2.3.tgz (this is not the only package with the problem, but is a simple example) and do "pear makerpm" on it. Spec file produced includes: %doc README.Auth This is correct, and is consistent with the package.xml file from Auth. However, the logic in the spec file only does this: (PEAR 1.4.5) if [ -d "%{buildroot}/docs/@package@/doc" ]; then [move "doc" into %{_builddir}] fi (PEAR 1.3.5) for DOCDIR in docs doc examples; do [move $DOCDIR into %{_builddir}] done which ignores documents (e.g. README.Auth) which may be in the "top level" directory, and also any docs which may be in unusual directories. So, a "rpmbuild -ba PEAR::Auth-1.2.3.spec" fails. There is a side issue which is independent of this (but has a related fix) which is that the spec files generated are "messy" and splatter the root of %{_builddir} with files (package.xml and the documentation) rather than having them in a subdirectory named according to the package being built, as is conventional. The below simple patch fixes both these issues. A subdirectory will be created in %{_builddir}, named appropriately (e.g. "/path/to/rpmtree/BUILD/PEAR::Auth-1.2.3"). *All* documentation that is installed into /docs in the buildroot will end up in this new directory, and as a bonus the package.xml file will too. Thus, the doc problem is fixed and the build directory is kept clean. patch for PEAR 1.4.5: --- template.spec +++ template.spec @@ -8,7 +8,6 @@ BuildRoot: %{_tmppath}/%{name}-root URL: http://@master_server@/package/@package@ Prefix: %{_prefix} -#Docdir: @doc_dir@/@package@ BuildArchitectures: @arch@ @extra_headers@ @@ -17,6 +16,7 @@ %prep rm -rf %{buildroot}/* +%setup -c -T # XXX Source files location is missing here in pear cmd pear -v -c %{buildroot}/pearrc \ -d php_dir=%{_libdir}/php/pear \ @@ -53,11 +53,12 @@ rm %{buildroot}/%{_libdir}/php/pear/.filemap rm %{buildroot}/%{_libdir}/php/pear/.lock rm -rf %{buildroot}/%{_libdir}/php/pear/.registry -if [ -d "%{buildroot}/docs/@package@/doc" ]; then - rm -rf $RPM_BUILD_DIR/doc - mv %{buildroot}/docs/@package@/doc $RPM_BUILD_DIR + +if [ "@doc_files@" != ""]; then + mv %{buildroot}/docs/@package@/* . rm -rf %{buildroot}/docs fi + mkdir -p %{buildroot}@rpm_xml_dir@ tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package@package2xml@.xml cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml patch for PEAR 1.3.5: --- template.spec +++ template.spec @@ -8,7 +8,6 @@ BuildRoot: %{_tmppath}/%{name}-root URL: http://@master_server@/ Prefix: %{_prefix} -#Docdir: @doc_dir@/@package@ BuildArchitectures: @arch@ @extra_headers@ @@ -17,6 +16,7 @@ %prep rm -rf %{buildroot}/* +%setup -c -T # XXX Source files location is missing here in pear cmd pear -v -c %{buildroot}/pearrc \ -d php_dir=%{_libdir}/php/pear \ @@ -46,13 +46,12 @@ rm %{buildroot}/%{_libdir}/php/pear/.filemap rm %{buildroot}/%{_libdir}/php/pear/.lock rm -rf %{buildroot}/%{_libdir}/php/pear/.registry -for DOCDIR in docs doc examples; do - if [ -d "%{buildroot}/docs/@package@/$DOCDIR" ]; then - rm -rf $RPM_BUILD_DIR/$DOCDIR - mv %{buildroot}/docs/@package@/$DOCDIR $RPM_BUILD_DIR - rm -rf %{buildroot}/docs - fi -done + +if [ "@doc_files@" != ""]; then + mv %{buildroot}/docs/@package@/* . + rm -rf %{buildroot}/docs +fi + mkdir -p %{buildroot}@rpm_xml_dir@ tar -xzf $RPM_SOURCE_DIR/@package@-%{version}.tgz package.xml cp -p package.xml %{buildroot}@rpm_xml_dir@/@package@.xml Expected result: ---------------- RPM package builds correctly. Actual result: -------------- End of output from "rpmbuild -ba PEAR::Auth-1.2.3.spec": ... Processing files: PEAR::Auth-1.2.3-1 Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.57482 + umask 022 + cd /path/to/rpmtree/BUILD + DOCDIR=/var/tmp/PEAR::Auth-root/usr/share/doc/PEAR::Auth-1.2.3 + export DOCDIR + rm -rf /var/tmp/PEAR::Auth-root/usr/share/doc/PEAR::Auth-1.2.3 + /bin/mkdir -p /var/tmp/PEAR::Auth-root/usr/share/doc/PEAR::Auth-1.2.3 + cp -pr README.Auth /var/tmp/PEAR::Auth-root/usr/share/doc/PEAR::Auth-1.2.3 cp: cannot stat `README.Auth': No such file or directory error: Bad exit status from /var/tmp/rpm-tmp.57482 (%doc)


 [2005-11-23 13:14 UTC] bugs at timj dot co dot uk
Sorry, 1 char typo in the above patches. Replace: if [ "@doc_files@" != ""]; then with if [ "@doc_files@" != "" ]; then
 [2005-11-27 02:52 UTC] cellog
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.