Blob Blame Raw
# This package depends on automagic byte compilation
# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
%global _python_bytecompile_extra 1

%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
%global debug_package %{nil}

Name:           bibus
Version:        1.5.2
Release:        9%{?dist}
Summary:        Bibliographic and reference management software

License:        GPLv2+
URL:            http://bibus-biblio.sourceforge.net/
Source0:        http://downloads.sourceforge.net/bibus-biblio/%{name}_%{version}.orig.tar.gz

Patch0:         %{name}-build-1.5.1.patch
Patch1:         wxpy30-changes.patch

## temporarily removing noarch to workaround this bug:
##  https://bugzilla.redhat.com/show_bug.cgi?id=438527
## also filed with bibus upstream: 
##  http://sourceforge.net/tracker/index.php?func=detail&aid=1989580&group_id=110943&atid=657832
##BuildArch:      noarch

BuildRequires:  python2-devel python-unversioned-command
BuildRequires:  desktop-file-utils
BuildRequires:  gettext
Requires:       python2-wxpython > 2.6
Requires:       python2-mysql
Requires:       libreoffice-writer
Requires:       libreoffice-pyuno


%description
Bibus is a bibliographic database. It uses a MySQL or SQLite database
to store references. It can directly insert references in
LibreOffice and MS Word and generate the bibliographic index.


%prep
%setup -q -n %{name}-%{version}
%patch0 -p0
%patch1 -p1

## make files UTF-8 
for i in bibMSW.htm eTBlast\ Interface\ to\ Bibus.htm
do
  /usr/bin/iconv -f iso8859-1 -t utf-8 "Docs/html/en/${i}" > "Docs/html/en/${i}.conv" && /bin/mv -f "Docs/html/en/${i}.conv" "Docs/html/en/${i}"
done

## remove all CVS version control files
find . -type d -name CVS -print0 | xargs --null rm -rf

##  fix line endings
##find Docs -type f -exec sed -i 's/\r//' {} 2>/dev/null ';'
find Docs -type f -name '*ml' -exec sed -i 's/\r//' {} 2>/dev/null ';'

## remove she-bang lines in .py files to keep rpmlint happy
find . -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/.*$/ d' {} 2>/dev/null ';'

## restore she-bang line for bibusStart.py
sed -i '1i #!/usr/bin/env python2' bibusStart.py

## remove non-standard zh_cn locale directory
rm -r locale/zh_cn

%build

%install
make DESTDIR=$RPM_BUILD_ROOT/%{_prefix} sysconfdir=$RPM_BUILD_ROOT/etc \
 oopath=%{_libdir}/libreoffice/program/ ooure=%{_libdir}/libreoffice/ure/lib \
 oobasis=%{_libdir}/libreoffice/basis-link/program  install

## fix symlink
rm $RPM_BUILD_ROOT%{_bindir}/bibus
ln -s %{_datadir}/%{name}/bibusStart.py $RPM_BUILD_ROOT%{_bindir}/bibus

## also install ScreenShots subdirectory, missed by Makefile
install -d $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/html/ScreenShots/
install -m644 Docs/html/ScreenShots/*.png $RPM_BUILD_ROOT%{_datadir}/doc/%{name}/html/ScreenShots/

if [ "%{_datadir}/doc/%{name}" != "%{_pkgdocdir}" ]; then
    ## fix location of doc directory to include version
    mv $RPM_BUILD_ROOT%{_datadir}/doc/%{name} $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}

    ## fix bibus.cfg to fix documentation location
    sed -i "s:doc/bibus:doc/bibus-%{version}:" $RPM_BUILD_ROOT%{_datadir}/%{name}/bibus.cfg
fi

## fix bibus.cfg to remove $RPM_BUILD_ROOT
sed -i "s:$RPM_BUILD_ROOT::" $RPM_BUILD_ROOT%{_datadir}/%{name}/bibus.cfg

## remove uninstall program, not necessary for RPM package
rm $RPM_BUILD_ROOT%{_datadir}/%{name}/Setup/uninstall.sh

desktop-file-install \
     --dir=${RPM_BUILD_ROOT}%{_datadir}/applications \
     --remove-category="Application"                 \
     ${RPM_BUILD_ROOT}%{_datadir}/applications/%{name}.desktop

%{find_lang} %{name}

%files -f %{name}.lang
%doc %{_pkgdocdir}
%{_bindir}/bibus
%{_datadir}/%{name}
%{_datadir}/applications/*
%{_datadir}/icons/hicolor/48x48/apps/*
%{_mandir}/man1/*
%config(noreplace) %{_sysconfdir}/*

%changelog
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Jul 19 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.5.2-8
- Update for https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.5.2-6
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

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

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

* Sat Dec 03 2016 Filipe Rosset <rosset.filipe@gmail.com> - 1.5.2-1
- Rebuilt for new upstream release 1.5.2, fixes rhbz #757675
- Added patch to fixes rhbz #1190916 (thanks to Scott Talbert)

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

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

* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

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

* Sat Jan 18 2014 Ville Skyttä <ville.skytta@iki.fi> - 1.5.1-11
- Adapt to unversioned docdirs where applicable (#993684).
- Fix bogus date in %%changelog.

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

* Mon Feb 11 2013 Rahul Sundaram <sundaram@fedoraproject.org> - 1.5.1-9
- remove vendor tag from desktop file. https://fedorahosted.org/fpc/ticket/247
- clean up spec to follow current guidelines

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

* Wed Feb  8 2012 Toshio Kuratomi <toshio@fedoraproject.org> - 1.5.1-7
- Remove python-sqlite2 dep as bibus can use the sqlite3 module from the stdlib

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

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Oct 30 2010 Caolán McNamara <caolanm@redhat.com> - 1.5.1-4
- rebuild against LibreOffice

* Wed Aug 11 2010 David Malcolm <dmalcolm@redhat.com> - 1.5.1-3
- recompiling .py files against Python 2.7 (rhbz#623278)

* Mon Mar  8 2010 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.5.1-2
- Disable debuginfo package (#547493)

* Wed Dec  9 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.5.1-1
- Update to latest upstream (1.5.1)
- Should fix connection problem with newer OpenOffice.org (#545809)

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.3.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Jan 12 2009 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.3.1-2
- Fix paths to openoffice (#479099)

* Mon Dec  1 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.3.1-1
- Updating to new upstream (1.4.3.1)
- Adds support for OpenOffice 3.x
- Add patch to fix broken Makefile and desktop file
- Cleanup .spec

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

* Tue Jun 10 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.3-1
- Update to latest upstream (1.4.3)
- Make package arch-specific to allow package to find appropriate location
  for x86_64 (#438527)
- Fix PNG corruption introduced by fixing line-feeds, patch thanks to 
  Nicolas Thierry-Mieg (#448483)
- Add missing images to doc

* Thu Mar 13 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.1-4
- Require python-sqlite2, not sqlite

* Thu Mar 13 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.1-3
- Fix desktop-file-install as per review (#436619)

* Tue Mar 11 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.1-2
- Require sqlite for sqlite backend

* Sat Mar  8 2008 Alex Lancaster <alexlan[AT]fedoraproject org> - 1.4.1-1
- Initial Fedora package