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

Request #7129 A better template.spec
Submitted: 2006-03-15 18:07 UTC
From: Fedora at FamilleCollet dot com Assigned: timj
Status: Closed Package: PEAR_Command_Packaging (version 0.1.0)
PHP Version: 5.1.2 OS: FC4
Roadmaps: (Not assigned)    
Subscription  


 [2006-03-15 18:07 UTC] Fedora at FamilleCollet dot com (Remi Collet)
Description: ------------ See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185321 I think the template.spec use by "makerpm" could be improve in somme ways. I know PEAR_Command_Packaging is on the road but "makerpm" still usefull, at least to make the rpm of PEAR_Command_Packaging ;) I see a lot of bugs with the comment "fixed in CVS" but i don't see any change in pear-1.4.8. Some improvement : 1. don't remove the .xml (it's owned by the RPM) 2. use "pear config-get php_dir" 3. use "--nodeps --soft --force --register-only" on install / upgrade (because upgrading a RPM could keep the same package version) 4. use "-ignore-errors --register-only" on uninstall 5. remove .channels, .depdb, .depdblock during %install 6. don't own / but %{peardir}/* and @rpm_xml_dir@/@package@.xml instead. Next is the patch I use on FC4 to build the RPM of php-pear-1.4.8 (some changes are already include in the official RPM in Fedora "rawhide"). I think it can apply on all distro and could be include upstream. Hope that help a little. Test script: --------------- --- data/PEAR/template.spec.orig 2006-03-13 17:57:44.000000000 +0100 +++ data/PEAR/template.spec 2006-03-13 18:27:51.000000000 +0100 @@ -1,7 +1,9 @@ +%define peardir %(pear config-get php_dir 2> /dev/null || echo %{_datadir}/pear) + Summary: PEAR: @summary@ Name: @rpm_package@ Version: @version@ -Release: 1 +Release: @release@ License: @release_license@ Group: Development/Libraries Source: http://@master_server@/get/@package@-%{version}.tgz @@ -19,11 +21,11 @@ %setup -c -T # XXX Source files location is missing here in pear cmd pear -v -c %{buildroot}/pearrc \ - -d php_dir=%{_libdir}/php/pear \ + -d php_dir=%{peardir} \ -d doc_dir=/docs \ -d bin_dir=%{_bindir} \ - -d data_dir=%{_libdir}/php/pear/data \ - -d test_dir=%{_libdir}/php/pear/tests \ + -d data_dir=%{peardir}/data \ + -d test_dir=%{peardir}/tests \ -d ext_dir=%{_libdir} \@extra_config@ -s @@ -33,40 +35,41 @@ %postun # if refcount = 0 then package has been removed (not upgraded) if [ "$1" -eq "0" ]; then - pear uninstall --nodeps -r @possible_channel@@package@ - rm @rpm_xml_dir@/@package@.xml + pear uninstall --nodeps --ignore-errors --register-only @possible_channel@@package@ fi %post # if refcount = 2 then package has been upgraded if [ "$1" -ge "2" ]; then - pear upgrade --nodeps -r @rpm_xml_dir@/@package@.xml + pear upgrade --nodeps --soft --force --register-only @rpm_xml_dir@/@package@.xml else - pear install --nodeps -r @rpm_xml_dir@/@package@.xml + pear install --nodeps --soft --force --register-only @rpm_xml_dir@/@package@.xml fi %install pear -c %{buildroot}/pearrc install --nodeps -R %{buildroot} \ $RPM_SOURCE_DIR/@package@-%{version}.tgz + rm %{buildroot}/pearrc -rm %{buildroot}/%{_libdir}/php/pear/.filemap -rm %{buildroot}/%{_libdir}/php/pear/.lock -rm -rf %{buildroot}/%{_libdir}/php/pear/.registry +rm %{buildroot}/%{peardir}/.filemap +rm %{buildroot}/%{peardir}/.lock +rm -rf %{buildroot}/%{peardir}/.registry +rm -rf %{buildroot}/%{peardir}/.channels +rm %{buildroot}/%{peardir}/.depdb +rm %{buildroot}/%{peardir}/.depdblock + 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 -#rm -rf %{buildroot}/* -#pear -q install -R %{buildroot} -n package@package2xml@.xml -#mkdir -p %{buildroot}@rpm_xml_dir@ -#cp -p package@package2xml@.xml %{buildroot}@rpm_xml_dir@/@package@.xml - %files %defattr(-,root,root) %doc @doc_files@ - / + %{peardir}/* + @rpm_xml_dir@/@package@.xml

Comments

 [2006-03-15 18:12 UTC] cellog
please make your patch against pear/PEAR_Command_Packaging/template.spec the make-rpm-spec command is the official maintained way of RPMing in PEAR now.
 [2006-03-15 19:40 UTC] Fedora at FamilleCollet dot com
Mini patch (as most improvement already in) --- data/PEAR_Command_Packaging/template.spec.orig 2006-03-15 20:35:12.000000000 +0100 +++ data/PEAR_Command_Packaging/template.spec 2006-03-15 20:36:39.000000000 +0100 @@ -67,4 +67,5 @@ %files %defattr(-,root,root) %doc @doc_files@ -/ +%{peardir}/* +@rpm_xml_dir@/@package@.xml However, the previous still needed (i think) while PEAR_Command_Packaging is an "alpha" version.
 [2006-03-15 23:36 UTC] timj at php dot net
We are not going to make any more fixes to the old "makerpm" code in PEAR. Although PEAR_Command_Packaging is marked as alpha, it is a direct fork of the "makerpm" code and is therefore no less stable than it. Please use PEAR_Command_Packaging. If there are any bugs in that please file as appropriate. The specific bug with ownership of / has been fixed in CVS (for PEAR_Command_Packaging) just now, so thanks for that fix. (It may be fixed more comprehensively at some point by fulling enumerating all the expected owned files)