Please criticize my spec file. I have got it to compile and run on the 3 distros. It is heavily ifdefed. It looks like a bloody battlefield the day after. - # # spec file for package openastro (Version 1.1.23) # # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # # norootforbuild %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %define srcname openastro.org %define insname openastromod Name: openastro Version: 1.1.23 Release: 1 Summary: Open Source Astrology License: GPLv3 Group: Productivity/Graphics/Other Source0: https://launchpad.net/~pellesimon/+archive/+files/%{srcname}_%{version}.orig.tar.gz #Source: %{srcname}_%{version}.orig.tar.bz2 #Source: http://www.openastro.org/download.php?file=source Patch0: desktop.patch URL: http://www.openastro.org BuildRequires: python-devel BuildRequires: patch BuildRequires: gettext BuildRequires: desktop-file-utils #suse requires desktop file update %if 0%{?suse_version} >= 1101 || 0%{?sles_version} #This is a horrible kludge that will remain only till #this bug is fixed: # https://bugzilla.novell.com/show_bug.cgi?id=430965 BuildRequires: update-desktop-files %endif #fedora requires python-setuptools-devel %if 0%{?fedora} >= 8 BuildRequires: python-setuptools-devel %else BuildRequires: python-setuptools %endif #suse version uses fdupes %if 0%{?suse_version} || 0%{?sles_version} BuildRequires: fdupes %endif #rh fed use gnome-python2-desktop %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} Requires: gnome-python2-desktop # handled by gnome_python*-desktop under suse mandriva Requires: gnome-python2-rsvg Requires: pygtk2 Requires: pycairo Requires: gnome-python2 %else Requires: gnome-python-desktop Requires: python-cairo %if 0%{?mandriva_version} # pygtk2 is equivelent of python-gtk Requires: pygtk2 # mandrivia has gnome-python, but this is # already required by gnome-python-desktop %else Requires: python-gtk Requires: python-gnome %endif %endif Requires: python-sqlite2 Requires: python-dateutil Requires: ImageMagick # only suse vars split into 2 packages. %if 0%{?suse_version} || 0%{?sles_version} Requires: %{name}-lang = %{version} %endif BuildRoot: %{_tmppath}/%{name}-%{version}-build AutoReqProv: on #only suse supports %%py_requires. %%lang_package %if 0%{?suse_version} || 0%{?sles_version} %py_requires %lang_package %endif %description OpenAstro.org is an open source initiative from the Astro Tiger Astrologer Consultancy to provide in the growing demand for free horoscopes. %prep %setup -q -n %{srcname}-%{version}.orig %patch0 find icons/ -type f -exec chmod a-x {} \; find swisseph18/*.cat -type f -exec chmod a-x {} \; find . *.xml -type f -exec chmod a-x {} \; %build %{__python} setup.py build %install %{__python} setup.py install --prefix=%{_prefix} --root=%{buildroot} %{__mkdir} -p %{buildroot}%{_datadir}/pixmaps %{__cp} icons/openastro.svg %{buildroot}%{_datadir}/pixmaps/ #update suse desktop file %if 0%{?suse_version} >= 1101 || 0%{?sles_version} #This is a horrible kludge that will remain only till #this bug is fixed: # https://bugzilla.novell.com/show_bug.cgi?id=430965 %suse_update_desktop_file -i "%{srcname}" %endif desktop-file-validate %{buildroot}/%{_datadir}/applications/%{srcname}.desktop %if 0%{?suse_version} || 0%{?sles_version} #only suse needs to to find_lang # because suse uses a lang package # bacause all lang files are in a directory # owned by openastro %%{_datadir}/%%{srcname}/locale/* # find lang is not needed. # if the lang file were in /usr/share/locale # then find_lang would be needed to find # the files but not the directory /usr/share/locale which we would not own. # fedora find_lang only finds lang files in /usr/share/locale %find_lang %{name} #if suse do fdupes to detect duplicates. %fdupes -s %{buildroot} %endif pushd %{buildroot}%{python_sitearch}/%{insname}/ %{__chmod} 0755 dignities.py geoname.py importfile.py swiss.py zonetab.py popd #mandriva creates geonames.sql with wrong privs! Who knows why #make it readable. %if 0%{?mandriva_version} %{__chmod} a+r %{buildroot}%{_datadir}/%{srcname}/geonames.sql %endif %files %defattr(-,root,root) %{_bindir}/openastro.py %dir %{python_sitearch}/%{insname} %{python_sitearch}/%{insname}/* %{python_sitearch}/OpenAstro.org-%{version}_-py*.egg-info %{python_sitearch}/swisseph.so %dir %{_datadir}/%{srcname} %{_datadir}/%{srcname}/* %if 0%{?suse_version} || 0%{?sles_version} #only suse moves lang files to other package. %exclude %{_datadir}/%{srcname}/locale/* %endif %dir %{_datadir}/swisseph %{_datadir}/swisseph/* %{_datadir}/applications/* %{_datadir}/pixmaps/* %if 0%{?suse_version} || 0%{?sles_version} %files lang -f %{name}.lang %endif %changelog * Sat Nov 27 2010 Paul Elliott <pelliott@blackpatchpanel.com> - mandriva creates geonames.sql with wrong privs! Who knows why - make it readable. * Fri Nov 26 2010 Paul Elliott <pelliott@blackpatchpanel.com> - python-sqlite2 requires - mandrivia has gnome-python, but this is - already required by gnome-python-desktop - pygtk2 is mandriva equiv of python-gtk * Sun Nov 21 2010 Paul Elliott <pelliott@blackpatchpanel.com> - gnome-python-desktop in suse splits into - gnome-python2-desktop and gnome-python2-rsvg in fedora * Sat Nov 20 2010 Paul Elliott <pelliott@blackpatchpanel.com> - gnome-python-desktop, python-gtk, python-gnome, python-cairo - becomes for fedora - gnome-python2-desktop, pygtk2, pycairo, gnome-python2 * Wed Nov 17 2010 Paul Elliott <pelliott@blackpatchpanel.com> - only suse needs to do lang-file because - all lang files are owned by a directory we own. - fedora does not define %{py_ver} just use * in files statement. * Sun Nov 14 2010 Paul Elliott <pelliott@blackpatchpanel.com> - grabbed spec file and patch file from - https://build.opensuse.org/package/files?package=openastro&project=home%%3Amalcolmlewis%%3APython - important source be pristine i.e. identical with that available at upstream - sources' web site. - changed to use origial .gz from web site of upstream source. - srcname is name for source in Source0: - only suse has fdups. - fedora requires python-setuptools-devel - rh fed use gnome-python2-desktop - suse requires desktop file update - only suse supports %%py_requires. - only suse supports %%lang_package - gettext is supposed to be needed for lang packages. - BuildRequires: desktop-file-utils used by desktop-file-validate - which is needed by fedora. - Only suse splits into seperate lang package. -- Paul Elliott 1(512)837-1096 pelliott@BlackPatchPanel.com PMB 181, 11900 Metric Blvd Suite J http://www.free.blackpatchpanel.com/pme/ Austin TX 78758-3117