# To create svn tarball use:
# svn co https://comix.svn.sourceforge.net/svnroot/comix/trunk
# mv trunk comix-%%mainver
# tar czf comix-%%mainver-%%alphatag.tar.gz comix-%%mainver
%define mainver 4.0
%define alphatag svn199_trunk
%define comix4 1
%define ifalpha 1
%define fedorarel 1
Name: comix
Version: %{mainver}
Release: %{?ifalpha:0.}%{fedorarel}%{?ifalpha:.%alphatag}%{?dist}
Summary: A user-friendly, customizable image viewer
Group: Amusements/Graphics
URL: http://comix.sourceforge.net/
License: GPLv2+
%if 0%{?ifalpha}
Source0: %{name}-%{mainver}-%{alphatag}.tar.gz
%else
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: pygtk2
BuildRequires: python-imaging
BuildRequires: desktop-file-utils
BuildRequires: %{_bindir}/jpegtran
Requires: pygtk2
Requires: python-imaging
Requires: %{_bindir}/jpegtran
Requires(pre): GConf2
Requires(preun): GConf2
Requires(post): GConf2
%description
Comix is a user-friendly, customizable image viewer.
It is specifically designed to handle comic books, but
also serves as a generic viewer. It reads images in ZIP,
RAR or tar archives (also gzip or bzip2 compressed) as
well as plain image files. It is written in Python and
uses GTK+ through the PyGTK bindings.
%prep
%setup -q
%{__mkdir_p} TMPBIN
cd TMPBIN
%{__ln_s} -f /bin/true update-mime-database
%{__ln_s} -f /bin/true gconftool-2
cd ..
%build
%{__sed} -i -e 's|shutil.copy|shutil.copy2|' install.py
%{__sed} -e 's|\r||g' COPYING > COPYING.tmp && \
( touch -r COPYING COPYING.tmp ; %{__mv} -f COPYING.tmp COPYING )
%{__rm} -f COPYING.tmp
%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__mkdir_p} $RPM_BUILD_ROOT%{_prefix}
export PATH=$(pwd)/TMPBIN:${PATH}
%{__python} install.py \
%if %{comix4}
--dir \
%else
--installdir \
%endif
$RPM_BUILD_ROOT%{_prefix} \
install
desktop-file-install \
--vendor fedora \
--delete-original \
--remove-category Application \
--dir $RPM_BUILD_ROOT%{_datadir}/applications/ \
$RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/mime/
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/mime/packages
%{__install} -c -p -m644 mime/comix.xml \
$RPM_BUILD_ROOT%{_datadir}/mime/packages/%{name}.xml
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas
%{__install} -c -p -m644 mime/comicbook.schemas \
$RPM_BUILD_ROOT%{_sysconfdir}/gconf/schemas/%{name}.schemas
%find_lang %{name}
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
[ "$1" -gt 1 ] || exit 0
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
%{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null
# If the schema file has ever been renamed::
# gconftool-2 --makefile-uninstall-rule \
# %{_sysconfdir}/gconf/schemas/[OLDNAME].schemas > /dev/null
exit 0
%post
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule \
%{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null
touch --no-create %{_datadir}/icons/hicolor
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null
exit 0
%preun
[ "$1" -eq 0 ] || exit 0
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-uninstall-rule \
%{_sysconfdir}/gconf/schemas/%{name}.schemas > /dev/null
exit 0
%postun
touch --no-create %{_datadir}/icons/hicolor
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor
update-desktop-database &> /dev/null
update-mime-database %{_datadir}/mime &> /dev/null
exit 0
%files -f %{name}.lang
%defattr(-,root,root,-)
%doc COPYING ChangeLog README
%{_sysconfdir}/gconf/schemas/%{name}.schemas
%{_bindir}/*
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_mandir}/man1/*
%{_datadir}/icons/hicolor/*/apps/%{name}*
%if %{comix4}
%{_datadir}/icons/hicolor/*/mimetypes/application-x-*.png
%endif
%if ! %{comix4}
%{_datadir}/pixmaps/%{name}.png
%dir %{_datadir}/pixmaps/%{name}
%{_datadir}/pixmaps/%{name}/*.png
%else
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/images/
%{_datadir}/%{name}/src/
%endif
%changelog
* Fri Oct 3 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp>
- 4.0 branch, rev 199
* Thu Jul 10 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.5-1
- 3.6.5 (2 patches applied upstream)
* Thu Apr 3 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-6
- Second patch for bug 430635
Use tempfile.mkdtemp() for multiple user race condition
(tagged as CVE-2008-1796)
* Wed Apr 2 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-4
- First patch for bug 430635
Replace os.popen() with subprocess.Popen() to handle hostile filename
properly (CVE-2008-1568)
* Wed Dec 5 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-3
- Fix icon path in desktop file for desktop-file-utils 0.14+
* Mon Aug 20 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-2
- Now %%_sysconfdir/gconf{,/schemas} are owned by GConf2 (#233756)
* Fri Aug 3 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-1.dist.1
- License update
* Mon May 28 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.4-1
- 3.6.4
* Sat Mar 17 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.3-1
- 3.6.3
* Wed Jan 31 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.2-2
- Surely remove ja.po, upstream included it.
* Wed Jan 31 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.2-1
- 3.6.2
* Wed Jan 31 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.1-2
- Add Japanese translation
* Thu Oct 19 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6.1-1
- 3.6.1
* Fri Oct 06 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6-2
- Specify URL.
* Fri Oct 06 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 3.6-1
- Initial packaging, importing to Fedora extras.