Blob Blame History Raw
%define BothRequires() \
Requires:       %1 \
BuildRequires:  %1 \
%{nil}

%global		majorver	1.4
%define		mainver		1.4.2
%undefine		betaver		

%define		fedoraver	3

%if 0%{?fedora} >= 24
%global	python2_distutils_extra python2-distutils-extra
%else
%global	python2_distutils_extra python-distutils-extra
%endif

%global	description_common \
Catfish is a handy file searching tool. The interface is \
intentionally lightweight and simple, using only GTK+3.\
You can configure it to your needs by using several command line\
options.\
%{nil}

%if 0%{?fedora} >= 25
%global	support_python3		1
%else
%global	support_python3		0
%endif


Name:		catfish
Version:	%{mainver}
Release:	%{?betaver:0.}%{fedoraver}%{?betaver:.%betaver}%{?dist}
Summary:	A handy file search tool

License:	GPLv2+
URL:		https://launchpad.net/catfish-search
Source0:	https://launchpad.net/catfish-search/%{majorver}/%{mainver}/+download/%{name}-%{mainver}%{?betaver}.tar.bz2
BuildArch:	noarch

BuildRequires:	desktop-file-utils
BuildRequires:	gettext
BuildRequires:	intltool

%description
%description_common

%if 0%{?fedora} >= 28
%package -n python2-%{name}
Summary:        A handy file search tool using python 2
%endif

BuildRequires:	python2-devel
BuildRequires:	%python2_distutils_extra
BuildRequires:	python2-setuptools
BuildRequires:	%{_bindir}/appstream-util

%BothRequires	pygobject3
%BothRequires	python-pexpect

Requires:	%{name}-common = %{version}-%{release}
Requires:	xdg-utils
# search engine
Requires:	%{_bindir}/locate
# icon
# Requires:	redhat-artwork

# Upstream rename
Obsoletes:	search4files <= 0.2a
Provides:	search4files = %{version}-%{release}
# Obsolete old search engine subpackage
Obsoletes:	catfish-engines <= 0.6

%if 0%{?fedora} >= 28
%{?python_provide:%python_provide python2-%{name}}
Obsoletes:	%{name} < %{version}-%{release}
Provides:		%{name} = %{version}-%{release}

%description -n python2-%{name}
%description_common

This package uses python 2 for runtime executable.
%endif

%if %support_python3
%package	python3
Summary:	A handy file search tool using python3

BuildRequires:	python3-devel
BuildRequires:	python3-distutils-extra
BuildRequires:	python3-setuptools
BuildRequires:	%{_bindir}/appstream-util

%BothRequires	python3-gobject
%BothRequires	python3-pexpect

Requires:	%{name}-common = %{version}-%{release}
Requires:	xdg-utils
# search engine
Requires:	%{_bindir}/locate
# icon
# Requires:	redhat-artwork

%{?python_provide:%python_provide python3-%{name}}

%description	python3
%description_common

This package uses python 3 for runtime executable.
%endif

%package	common
Group:	Applications/File
Summary:	Common files for catfish

%description	common
This package contains common files for catfish rpm.


%prep
%setup -q -T -c -a 0 %{name}-%{mainver}%{?betaver}
pushd %{name}-%{mainver}*

# Fix up permissions...
find . -type f -print0 | xargs --null chmod 0644
chmod 0755 bin/%{name}

popd

%build
# Remove unneeded shebang
grep -rl "/usr/bin/env" . | \
	xargs sed -i -e "\@/usr/bin/env[ ][ ]*python@d"

TOPDIR=$(pwd)
rm -rf ./_TMPINSTDIR
mkdir -p ./_TMPINSTDIR/python2
mkdir -p ./_TMPINSTDIR/python3

pushd %{name}-%{mainver}*

%__python2 setup.py \
	install \
	--root ${TOPDIR}/_TMPINSTDIR/python2
%if %support_python3
%__python3 setup.py \
	install \
	--root ${TOPDIR}/_TMPINSTDIR/python3
%endif

popd

%if %support_python3
mv _TMPINSTDIR/python3/%{_bindir}/catfish{,-py3}
%endif

pushd _TMPINSTDIR

# Sanity check for file differenct
%if %support_python3
( cd python2 ; find . -type f ) | while read f
do
	test -f python3/$f || continue
	cmp -s python2/$f python3/$f
done

bash -c \
	"diff -u python2/%{_bindir}/catfish <(cat python3/%{_bindir}/catfish-py3 | sed -e 's|python3|python2|')"
%endif

ln -sf catfish ./python2/%{_bindir}/catfish-py2

desktop-file-validate \
	./python2/%{_datadir}/applications/%{name}.desktop
appstream-util validate-relax --nonet \
	./python2/%{_datadir}/appdata/%{name}.appdata.xml

%if %support_python3
pushd python3/%{_datadir}/applications/
mv %{name}{,-py3}.desktop
sed -i %{name}-py3.desktop \
	-e 's|/usr/bin/catfish$|/usr/bin/catfish-py3|' \
	-e 's|Catfish|Catfish(py3)|'\
	%{nil}
desktop-file-validate ./%{name}-py3.desktop
popd

pushd python3/%{_datadir}/appdata
mv catfish.appdata.xml catfish-py3.appdata.xml
sed -i catfish-py3.appdata.xml \
	-e 's|catfish\.desktop|catfish-py3.desktop|' \
	%{nil}
appstream-util validate-relax --nonet catfish-py3.appdata.xml
popd
%endif

%install
cp -a %{name}-%{mainver}*/[A-Z]* .

pushd _TMPINSTDIR
cp -a python2/* $RPM_BUILD_ROOT
%if %support_python3
cp -a python3/* $RPM_BUILD_ROOT
%endif
popd

pushd %{name}-%{mainver}*

# Install man page manually
%{__mkdir_p} $RPM_BUILD_ROOT%{_mandir}/man1
%{__install} -cpm 0644 ./%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/
%if %support_python3
%{__install} -cpm 0644 ./%{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}-py3.1
%endif

popd

# Remove all unnecessary documentation
%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/doc/

%{find_lang} %{name}

%post		common
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

%postun	common
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi

%posttrans		common
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :

%files common -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS
%doc ChangeLog
%doc README
%license COPYING

%{_datadir}/%{name}/
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

%if 0%{?fedora} >= 28
%files -n python2-%{name}
%else
%files
%endif
%{_bindir}/%{name}
%{_bindir}/%{name}-py2
%{_mandir}/man1/%{name}.1*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/appdata/%{name}.appdata.xml
%{python2_sitelib}/%{name}/
%{python2_sitelib}/%{name}_lib/
%{python2_sitelib}/%{name}-%{version}-py2*.egg-info

%if %support_python3
%files	python3
%{_bindir}/%{name}-py3
%{_mandir}/man1/%{name}-py3.1*
%{_datadir}/applications/%{name}-py3.desktop
%{_datadir}/appdata/%{name}-py3.appdata.xml
%{python3_sitelib}/%{name}/
%{python3_sitelib}/%{name}_lib/
%{python3_sitelib}/%{name}-%{version}-py3*.egg-info
%endif

%changelog
* Sat Nov 18 2017 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.2-3
- Fix up python2 namespace script bug manually

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.2-2.3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.2-2.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 1.4.2-2.1
- Rebuild for Python 3.6

* Wed Aug 17 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.2-2
- Support python3 for F-25+ (only)

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.2-1.1
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Apr  4 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.2-1
- 1.4.2

* Sun Mar  6 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.4.1-1
- 1.4.1

* Mon Feb 15 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.3.4-2
- Bump release

* Sun Feb 14 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.3.4-1
- 1.3.4

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.3-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Oct 14 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.3.3-1
- 1.3.3

* Thu Oct  1 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.3.2-2
- Fix traceback on en_US locale with non-sudoer user
  (bug 1266785)

* Thu Sep 24 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.3.2-1
- 1.3.2

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Wed Oct  1 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.2.2-1
- 1.2.2

* Mon Sep  8 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.2.1-1
- 1.2.1

* Wed Aug 13 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0.3-1
- 1.0.3

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.2-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri Mar 14 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0.2-1
- 1.0.2

* Sun Mar 02 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0.1-1
- 1.0.1
- Fix insecure loading of script at startup (CVE-2014-2093 through 
  CVE-2014-2096, bug 1069398)

* Sat Feb 15 2014 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.0.0-1
- 1.0.0

* Thu Oct  3 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.8.2-1
- 0.8.2

* Fri Aug 16 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.6.4-1
- 0.6.4

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0.2-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Jul  1 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.4.0.2-3
- Fix GError module error on launch (bug 964356)
- Fix infinite loop when searching words with asterisk (bug 964356)

* Sat Feb 23 2013 Toshio Kuratomi <toshio@fedoraproject.org> - 0.4.0.2-2.1
- Update stock_info patch so that build completes

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.0.2-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Feb  9 2013 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.4.0.2-2
- F-19: kill vendorization of desktop file (fpc#247)

* Fri Oct 05 2012 Christoph Wickert <cwickert@fedoraproject.org> - 0.4.0.2-1
- Update to 0.4.02 (GTK3 port)
- Require pygobject3 instead of pygtk2-libglade

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-5.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Wed Apr  4 2012 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.3.2-5
- Remove pinot dependency, seems no longer available

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-4.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Dec 14 2011 Mamoru Tasaka <mtasaka@fedoraproject.org> - 0.3.2-4
- Don't use missing gtk.STOCK_INFO (bug 753512)

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.2-3.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jul 23 2010 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp>
- F-14: rebuild against python 2.7

* Sat Jul 25 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.3.2-3
- F-12: Mass rebuild

* Tue Feb 24 2009 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> - 0.3.2-2
- GTK icon cache updating script update

* Mon Dec 01 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com>
- Rebuild for Python 2.6

* Tue Oct 28 2008 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3.2-1
- 0.3.2

* Thu Oct 18 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-1
- 0.3

* Fri Oct  5 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-0.3.c
- Remove beagle dependency for now because beagle is not
  available on ppc64 (although catfish itself is noarch :( )

* Wed Oct  3 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-0.2.c
- License update
- Create sub-metapackage to install all supported search engines
- Remove redhat-artwork dependency

* Fri Aug  3 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-0.1.c
- 0.3c

* Tue May 15 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-0.1.b
- 0.3b

* Wed Apr  4 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.3-0.1.a
- 0.3a

* Wed Feb 28 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2.2-1
- 0.2.2

* Sun Feb 18 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2.1-1
- 0.2.1

* Wed Feb 14 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2stable-1
- 0.2

* Wed Jan 30 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2d-1
- 0.2d

* Mon Jan 22 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2c-1
- 0.2c

* Sun Jan 14 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2b-1
- Upstream rename: search4files -> catfish
- Remove the dependencies for beagle, nautilus,
  replace with redhat-artwork

* Mon Jan  1 2007 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.2a-1
- 0.2a

* Sat Dec 23 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp>
- Require pyxdg again (fc7)

* Wed Dec 20 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.1e-1
- 0.1e

* Thu Dec 14 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.1d-1
- 0.1d
- Disable pyxdg support on devel for now.

* Sat Dec  8 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.1c-2
- Fix type typo

* Fri Dec  8 2006 Mamoru Tasaka <mtasaka@ioa.s.u-tokyo.ac.jp> 0.1c-1
- Initial packaging to import to Fedora Extras.