Bug 1035901 - don't assume that buildrpm will generate .pyo files rpm-2.16-2
authorRyan Kelly <rfkelly@mozilla.com>
Tue, 15 Jul 2014 14:50:42 +1000
changeset 1072 d771339e6bc90319b49428b3d8a0197441960671
parent 1071 8187776ee424078372ee875e44ab16c447d717f8
child 1073 e2552387f34e99c8c6db7ec1bf39a77516f685ea
push id501
push userrkelly@mozilla.com
push dateTue, 15 Jul 2014 04:54:30 +0000
bugs1035901
Bug 1035901 - don't assume that buildrpm will generate .pyo files
Services.spec
--- a/Services.spec
+++ b/Services.spec
@@ -1,13 +1,13 @@
 %define name python26-services
 %define pythonname Services
 %define version 2.16
 %define unmangled_version %{version}
-%define release 1
+%define release 2
 
 Summary: Services core tools
 Name: %{name}
 Version: %{version}
 Release: %{release}
 Source0: %{pythonname}-%{unmangled_version}.tar.gz
 License: MPL
 Group: Development/Libraries
@@ -39,18 +39,22 @@ Core library that provides these feature
 %prep
 %setup -n %{pythonname}-%{unmangled_version} -n %{pythonname}-%{unmangled_version}
 
 %build
 python2.6 setup.py build
 
 %install
 python2.6 setup.py install --single-version-externally-managed --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
-# This works around a problem with rpmbuild, where it pre-gnerates .pyo
+# This works around a problem with rpmbuild, where it pre-generates .pyo
 # files that aren't included in the INSTALLED_FILES list by bdist_rpm.
-cat INSTALLED_FILES | grep '.pyc$' | sed 's/.pyc$/.pyo/' >> INSTALLED_FILES
+for PYO_FILE in `cat INSTALLED_FILES | grep '.pyc$' | sed 's/.pyc$/.pyo/'`; do
+  if [ -f $PYO_FILE ]; then
+    echo $PYO_FILE >> INSTALLED_FILES
+  fi;
+done;
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files -f INSTALLED_FILES
 
 %defattr(-,root,root)