Edgewall Software
Modify

Ticket #1141 (closed enhancement: fixed)

Opened 7 years ago

Last modified 6 years ago

setup.py does not produce valid rpm on Fedora core 3

Reported by: nigel.metheringham@… Owned by: daniel
Priority: normal Milestone: 0.9
Component: project Version: 0.8
Severity: normal Keywords:
Cc:
Release Notes:
API Changes:

Description

setup.py bdist_rpm

when run on Fedora (FC3 - looks like this will apply to other versions too) does not produce an rpm due to problems in the generated spec file.

Man Page Filenames

The specific problem is that Fedora (and RH distributions in general) compress man pages as part of an automatically run rpm script (this could be turned off but would make the generated rpm rather out of step with others on the system).

I currently fix this up in a hack by changing the %install and %files section to this:-

%install
rm -rf %{buildroot}
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
# fix up file list slightly...
# basically man page fixup
sed -e 's/\.[0-9]$/&\*/' <INSTALLED_FILES >INSTALLED_FILES2

%files -f INSTALLED_FILES2
%defattr(-,root,root)

The references to INSTALLED_FILES2 are the changes - which wildcard the lines refering to the man pages ie /usr/share/man/man1/tracd.1/usr/share/man/man1/tracd.1*

Dependancies

The following dependancies should be added:-

BuildRequires: python >= 2.1
BuildRequires: python-devel
BuildRequires: PyXML
BuildRequires: python-sqlite
BuildRequires: python-clearsilver
BuildRequires: subversion
Requires: PyXML
Requires: python-sqlite
Requires: python-clearsilver
Requires: subversion

This full set should allow the package to be built within a specific build environment - for example mach.

Contrib

The contrib scripts should be packaged within the rpm - I would suggest they should be bundled into /usr/share/trac/contrib

This would allow nice neat handling of subversion hook scripts without having to go round these manually.

NB This applies to the Suse rpm stuff as well.

Attachments

bdist_rpm.diff (1.7 KB) - added by moschny at ipd dot uka dot de 7 years ago.
diff against 0.8.2

Download all attachments as: .zip

Change History

comment:1 Changed 7 years ago by moschny@…

Here's a patch to fix the problem with compressed manpages (tested on SuSE 9.0):

diff -Naur trac-0.8.1/install-rpm.sh trac-0.8.1-mine/install-rpm.sh
--- trac-0.8.1/install-rpm.sh   1970-01-01 01:00:00.000000000 +0100
+++ trac-0.8.1-mine/install-rpm.sh      2005-03-03 21:28:50.000000000 +0100
@@ -0,0 +1,3 @@
+python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
+#  'brp-compress' gzips the man pages without distutils knowing, so fix the filelist
+sed -i -e 's@man/man\([[:digit:]]\)/\(.\+\.[[:digit:]]\)$@man/man\1/\2.gz@g' INSTALLED_FILES
diff -Naur trac-0.8.1/setup.py trac-0.8.1-mine/setup.py
--- trac-0.8.1/setup.py 2004-11-18 13:46:31.000000000 +0100
+++ trac-0.8.1-mine/setup.py    2005-03-03 21:16:26.000000000 +0100
@@ -156,6 +156,7 @@
         bdist_rpm.initialize_options(self)
         self.title = "Trac %s" % VERSION
         self.packager = "Edgewall Software <info@edgewall.com>"
+        self.install_script = "install-rpm.sh"
         for x in rpm_distros[self.distro].keys():
             setattr(self, x, rpm_distros[self.distro][x])

The basic idea is grabbed from a comment to Python bug 644744.

comment:2 Changed 7 years ago by moschny@…

Here's a new patch for trunk. I've tested it on fc3, suse90 and suse91.

Index: setup.py
===================================================================
--- setup.py    (Revision 1342)
+++ setup.py    (Arbeitskopie)
@@ -158,6 +158,7 @@
         self.packager = "Edgewall Software <info@edgewall.com>"
         for x in rpm_distros[self.distro].keys():
             setattr(self, x, rpm_distros[self.distro][x])
+        self.install_script = "rpm-install.sh"

     def run(self):
         bdist_rpm.run(self)
Index: MANIFEST.in
===================================================================
--- MANIFEST.in (Revision 1342)
+++ MANIFEST.in (Arbeitskopie)
@@ -1,4 +1,4 @@
-include AUTHORS ChangeLog COPYING INSTALL MANIFEST.in README README.tracd RELEASE setup.cfg THANKS UPGRADE
+include AUTHORS ChangeLog COPYING INSTALL MANIFEST.in README README.tracd RELEASE setup.cfg THANKS UPGRADE rpm-install.sh
 include scripts/trac-admin
 include scripts/tracd
 include scripts/tracdb2env
Index: rpm-install.sh
===================================================================
--- rpm-install.sh      (Revision 0)
+++ rpm-install.sh      (Revision 0)
@@ -0,0 +1,16 @@
+#! /bin/sh
+#
+# this file is *inserted* into the %install section of the generated
+# spec file
+#
+
+# this is, what dist.py normally does
+./setup.py install --root=${RPM_BUILD_ROOT} --record="INSTALLED_FILES"
+
+# catch compressed man pages
+sed -i -e 's@\(.\+/man/man[[:digit:]]/.\+\.[[:digit:]]\)$@\1*@' "INSTALLED_FILES"
+
+# catch any compiled python files (.pyc, .pyo), but don't list them twice
+sed -i -e 's@\(.\+\)\.py$@\1.py*@' \
+       -e '/.\+\.pyc$/d' \
+       "INSTALLED_FILES"

Changed 7 years ago by moschny at ipd dot uka dot de

diff against 0.8.2

comment:3 Changed 7 years ago by moschny at ipd dot uka dot de

  • Milestone set to 0.9

Setting Milestone from none to 0.9.

The patch above is almost identical to the earlier ones, but additionally adds scripts/trac-postinstall.py to MANIFEST.in. The postinstall script is needed for Windows only, but when it's missing in the manifest, bdist_rpm fails early.

comment:4 Changed 7 years ago by jonas

  • Resolution set to fixed
  • Status changed from new to closed

Applied in [2067].

comment:5 Changed 7 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

python setup.py bdist_rpm dies with:

building RPMs
error: line 37: second %install
error: query of specfile build/bdist.linux-i686/rpm/SPECS/trac.spec failed, can't parse
error: Failed to execute: "rpm -q --qf '%{name}-%{version}-%{release}.src.rpm %{arch}/%{name}-%{version}-%{release}.%{arch}.rpm\\n' --specfile 'build/bdist.linux-i686/rpm/SPECS/trac.spec'"

on FC3 and FC4 here (but works on FC2).

The following allows the rpms to be built:

--- scripts/rpm-install.sh      (revision 2100)
+++ scripts/rpm-install.sh      (working copy)
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# this file is *inserted* into the %install section of the generated
+# this file is *inserted* into the install section of the generated
 # spec file
 #

It looks like the problem lies with rpm itself, it shouldn't be trying to parse %install inside a comment.

comment:6 Changed 7 years ago by jonas

  • Resolution set to fixed
  • Status changed from reopened to closed

I've removed the "%install" occurance from rpm-install.sh. I'm unable to test this myself so please reopen if it's still broken.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from daniel. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.