File mintmenu.spec of Package mintmenu

%global _internal_version 9e8c4d9

Name:           mintmenu
Version:        5.6.5
Release:        3%{?dist}
#Release:        0.1.git%{_internal_version}1%{?dist}
Summary:        Advanced Menu for the MATE Desktop

Group:          System Environment/Shells
# MIT is needed for keybinding.py
License:        GPLv2+ and MIT
URL:            http://packages.linuxmint.com

# To generate tarball
# wget wget https://github.com/linuxmint/%%{name}/archive/master.tar.gz \
# -O %%{name}-%%{version}.git%%{_internal_version}.tar.gz \
# && tar -xf %%{name}-%%{version}.git%%{_internal_version}.tar.gz \
# && mv %%{name}-master %%{name}-%%{version}.git%%{_internal_version} \
# && tar -czf %%{name}-%%{version}.git%%{_internal_version}.tar.gz \
# %%{name}-%%{version}.git%%{_internal_version}

#Source0:        http://raveit65.fedorapeople.org/Mate/git-upstream/%{name}-%{version}.git%{_internal_version}.tar.gz

Source0:        http://packages.linuxmint.com/pool/main/m/mintmenu/%{name}_%{version}.tar.gz
Source1:        http://packages.linuxmint.com/pool/main/m/mint-translations/mint-translations_2015.11.06.tar.gz
Source2:        mintmenu-mate.png
Source3:        mintmenu-icon.png
Source4:        mintmenu-icon.svg

BuildArch:      noarch

# Apt makes no since in an RPM based system, causes ABRT on fedora
Patch1:         mintmenu_remove-import-apt.patch
# Apt makes no since in an RPM based system, causes ABRT on fedora
Patch2:         mintmenu_remove-apt-cache.patch
# add yumex as package manager
Patch3:         mintmenu_synaptics-to-yumex.patch
# change /usr/lib to /usr/share
Patch4:         mintmenu_datadir.patch
# fix run as superuser
Patch5:         mintmenu_run-as-superuser.patch
# update paths for executable
Patch6:         mintmenu_executables.patch
# Change locale directory
Patch7:         mintmenu_change-locale-directory.patch
# update search path to valid values
Patch8:         mintmenu_change-search-path-for-fedora.patch
# fedora specific, add more defaults to favorite menu
Patch9:         mintmenu_default-apps.patch
# change nautilus to caja desktop files
Patch10:        mintmenu_special-location.patch
# mate-folder.png icon doesn't exits in icon themes, use folder.png
Patch11:        mintmenu_recent-icon.patch
# fix output of about for rpm based distro
Patch12:        mintmenu_about.patch
# fix intends in mintmenu execute.py
Patch13:        mintmenu_execute-fix.patch
# usage of beesu instead of gksu
Patch14:        mintmenu_gksu-to-beesu.patch
# remove uninstall entry in context menu
Patch15:        mintmenu_remove_uninstall-entry.patch
# use mate icon for panel
Patch16:        mintmenu_adjust-panel-icon.patch
# fix rhbz (#1293105), credits to Sorokin Alexei (XRevan86) from opensuse
Patch17:        mintmenu_crash-in-mintMenuConfig.patch

BuildRequires:  python2-devel
# for creating mint-translations
BuildRequires:  gettext

Requires:       python
Requires:       python-configobj
Requires:       pygtk2
Requires:       pyxdg
Requires:       python-xlib
Requires:       system-logos
Requires:       pygtk2-libglade
Requires:       yumex
Requires:       beesu
Requires:       mate-panel
Requires:       mozo


%description
An advanced "slab" style menu for Linux. MintMenu supports filtering,
favorites, auto-session, and many other features.  MintMenu can either be
added to your mate-panel or launched in its own window.

%prep
#%setup -q -n %{name}-%{version}.git%{_internal_version}
%setup -q -n %{name}
mv debian/changelog changelog
mv debian/copyright copyright
tar -xf %{SOURCE1}

%patch1 -p1 -b .remove_import_apt
%patch2 -p1 -b .remove_apt
%patch3 -p1 -b .yumex
%patch4 -p1 -b .datadir
%patch5 -p1 -b .superuser
%patch6 -p1 -b .executables
%patch7 -p1 -b .locale
%patch8 -p1 -b .search_path
%patch9 -p1 -b .default_apps
%patch10 -p1 -b .special_location
%patch11 -p1 -b .recent_icon
%patch12 -p1 -b .about
%patch13 -p1 -b .execute
%patch14 -p1 -b .gksu
%patch15 -p1 -b .uninstall-entry
%patch16 -p1 -b .adjust-panel-icon
# https://github.com/linuxmint/mintmenu/commit/4b876e7
%patch17 -p1 -b .crash-in-mintMenuConfig


%build
#pure python
# build mint-translations
cd mint-translations
make %{?_smp_mflags} V=1
cd ..

%install
find mint-translations/ -not -name 'mintmenu.mo' -type f -exec rm -f {} ';'

install -d -p %{buildroot}%{_bindir}/
install -m 755 -p usr/bin/mintmenu %{buildroot}%{_bindir}/mintmenu
install -d -p %{buildroot}%{_datadir}/linuxmint
install -d -p %{buildroot}%{_datadir}/linuxmint/mintMenu
install -d -p %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins
install -d -p %{buildroot}%{_datadir}/linuxmint/mintMenu/search_engines
install -d -p %{buildroot}%{_datadir}/dbus-1
install -d -p %{buildroot}%{_datadir}/dbus-1/services
install -d -p %{buildroot}%{_datadir}/glib-2.0
install -d -p %{buildroot}%{_datadir}/glib-2.0/schemas
install -d -p %{buildroot}%{_datadir}/mate-panel
install -d -p %{buildroot}%{_datadir}/mate-panel/applets
install -m 644 -p usr/lib/linuxmint/mintMenu/*.* %{buildroot}%{_datadir}/linuxmint/mintMenu/
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/*.py
install -m 755 -p usr/lib/linuxmint/mintMenu/*.py %{buildroot}%{_datadir}/linuxmint/mintMenu/
install -m 644 -p usr/lib/linuxmint/mintMenu/plugins/* %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/
install -m 644 -p usr/lib/linuxmint/mintMenu/search_engines/* %{buildroot}%{_datadir}/linuxmint/mintMenu/search_engines/
install -m 755 -p usr/lib/linuxmint/mintMenu/plugins/*.py %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/
install -m 644 -p usr/share/dbus-1/services/* %{buildroot}%{_datadir}/dbus-1/services/
install -m 644 -p usr/share/glib-2.0/schemas/* %{buildroot}%{_datadir}/glib-2.0/schemas/
install -m 644 -p usr/share/mate-panel/applets/* %{buildroot}%{_datadir}/mate-panel/applets/

#clean build
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/applications.list.default_apps
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenu.glade.gtk_widget_hide
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenu.py.about
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenu.py.datadir
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenu.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenu.ui.gtk_widget_hide
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.glade.remove_apt
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.glade.yumex
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.py.datadir
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.py.remove_apt
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintMenuConfig.py.yumex
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/mintRemove.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.datadir
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.remove_apt
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.search_path
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.special_location
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/applications.py.uninstall-entry
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/easybuttons.py.datadir
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/easybuttons.py.gksu
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/easybuttons.py.uninstall-entry
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/execute.py.execute
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/execute.py.superuser
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/get_apt_cache.py.remove_import_apt
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/places.py.datadir
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/places.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/recent.py.recent_icon
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/system_management.py.locale
rm -rf %{buildroot}%{_datadir}/linuxmint/mintMenu/plugins/system_management.py.yumex
rm -rf %{buildroot}%{_datadir}/dbus-1/services/org.mate.panel.applet.MintMenuAppletFactory.service.datadir
rm -rf %{buildroot}%{_datadir}/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml.yumex
rm -rf %{buildroot}%{_datadir}/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml.datadir
rm -rf %{buildroot}%{_datadir}/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml.remove_apt
rm -rf %{buildroot}%{_datadir}/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml.adjust-panel-icon
rm -rf %{buildroot}%{_datadir}/mate-panel/applets/org.mate.panel.MintMenuApplet.mate-panel-applet.datadir

# install mint translations and MATE icons
cp -r mint-translations/usr/share/linuxmint/* %{buildroot}%{_datadir}/
cp -f %{SOURCE2}  %{buildroot}%{_datadir}/linuxmint/mintMenu/visualisation-logo.png
cp -f %{SOURCE3}  %{buildroot}%{_datadir}/linuxmint/mintMenu/icon.png
cp -f %{SOURCE4}  %{buildroot}%{_datadir}/linuxmint/mintMenu/icon.svg

# fix rpmlint warning invalid-lc-messages-dir
rm -rf %{buildroot}%{_datadir}/locale/ber/

chmod -R u+rw,g-w,g+r,o+r,o-w %{buildroot}%{_datadir}/locale/*

%find_lang %{name}

%post
/bin/touch --no-create %{_datadir}/linuxmint/mintMenu &>/dev/null || :
/bin/touch --no-create %{_datadir}/linuxmint/mintMenu/search_engines &>/dev/null || :

%postun
if [ $1 -eq 0 ] ; then
    /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
    /bin/touch --no-create %{_datadir}/linuxmint/mintMenu &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/linuxmint/mintMenu &>/dev/null || :
    /bin/touch --no-create %{_datadir}/linuxmint/mintMenu/search_engines &>/dev/null
    /usr/bin/gtk-update-icon-cache %{_datadir}/linuxmint/mintMenu/search_engines &>/dev/null || :
fi

%posttrans
/usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/linuxmint/mintMenu &>/dev/null || :
/usr/bin/gtk-update-icon-cache %{_datadir}/linuxmint/mintMenu/search_engines &>/dev/null || :


%files -f %{name}.lang
%doc COPYING copyright changelog
%{_bindir}/mintmenu
%dir %{_datadir}/linuxmint/
%dir %{_datadir}/linuxmint/mintMenu/
%{_datadir}/linuxmint/mintMenu/*.*
%{_datadir}/linuxmint/mintMenu/plugins/
%{_datadir}/linuxmint/mintMenu/search_engines/
%{_datadir}/dbus-1/services/org.mate.panel.applet.MintMenuAppletFactory.service
%{_datadir}/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml
%{_datadir}/mate-panel/applets/org.mate.panel.MintMenuApplet.mate-panel-applet


%changelog
* Sun Feb 07 2016 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.5-3
- fix rhbz (#1302737), credits to Sorokin Alexei (XRevan86) from opensuse

* Thu Jan 14 2016 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.5-2
- fix rhbz (#1293105), credits to Sorokin Alexei (XRevan86) from opensuse

* Sun Nov 08 2015 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.5-1
- update to 5.6.5 release

* Sun Aug 02 2015 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.4-1
- update to 5.6.4 release
- adjust mintmenu_datadir.patch
- adjust mintmenu_run-as-superuser.patch
- install %%{_datadir}/linuxmint/mintMenu/search_engines
- adjust icon cache scriptlets
- adjust panel icon

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

* Tue Mar 31 2015 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.2-1
- update to 5.6.2 release

* Sun Nov 09 2014 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.6.0-1
- update to 5.6.0

* Mon Sep 15 2014 Wolfgang Ulbrich <chat-to-me@raveit.de> 5.5.8-2
- build for epel7
- clean spec file

* Sat Jun 21 2014 Wolfgang Ulbrich <chat-to-me@raveit.de> 5.5.8-1
- update to 5.5.8 release
- update mint-translations to 2014-05.25
- remove uninstall entry in context menu

* Sun Apr 27 2014 Wolfgang Ulbrich <chat-to-me@raveit.de> 5.5.3-1
- update to 5.5.3 release
- removed upstreamed shebang patch
- re-worked patches for 5.5.3 release and renanamed the rest of them

* Mon Jan 20 2014 Wolfgang Ulbrich <chat-to-me@raveit.de> 5.5.1-0.1.git9e8c4d9
- use latest snapshot from 2014.01.20
- fix rhbz (#1054781)
- edit superuser (5)patch
- edit execute (13) patch

* Sat Nov 30 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.5.0-1
- update to 5.5.0 release
- rework of some patches for 5.5.0 release

* Mon Jun 03 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-6
- add a comment to COPYING file

* Sat Jun 01 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-5
- add runtime require python-xlib
- add valid license file

* Tue May 28 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-4
- add runtime require mate-menu-editor
- remove require -lang subpackage
- remove virtual provides -lang subpackage
- simplify rpm scriptlets
- add comment to license line
 
* Mon May 27 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-3
- update mintmenu-new_recent_icon.patch
- remove mintmenu_terminal-icon.patch
- remove mintmenu_desktop-icon.patch

* Mon May 27 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-2
- initial build for fedora
- remove -lang subpackage and move locale to main package

* Tue May 21 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.9-1
- update to 5.4.9
- fix license information
- add doc directory
- remove requires python-xlib to avoid rpmlint error
- rework add shebang patch
- fix permissions
- fix invalid-lc-messages-dir in locale
- fix rpmlint non-standard-group warning for -lang subpackage
- add noarch tag

* Tue May 21 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.8-1
- update to 5.4.8
- update translations
- remove upstreamed mintmenu_remove_gtk_widget_hide.patch

* Mon Mar 18 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.7-1
- update to 5.4.7

* Mon Mar 18 2013 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.4.6-1
- update to 5.4.6
- update mint-translations

* Sat Oct 06 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.7-0101
- improve and review spec file
- fix url and %%prep
- fix descriptions

* Mon Aug 27 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.7-0100
- build for f18

* Sat Jun 30 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.7-2
- fix mintmenu about
- change gnome icons to mate icons

* Sat Jun 30 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.7-1
- update to 5.3.7

* Mon May 14 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.3-4
- fix packagekit entries
- add mintmenu_recent_icon.patch
- add mintmenu_places_caja-nautilus.patch
- cleanup build

* Mon May 14 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.3-3
- add mintmenu_fix_logo_path.patch
- add mintmenu_special_location.patch

* Thu May 10 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.3-2
- switch to fuduntu spec
- fix reboot/restart/logout error
- add language package

* Tue May 01 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.3-1
- update to 5.3.3
- remove mintmenu_lock-button_use_mate-screensaver.patch, it's upstreamed

* Tue May 01 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.1-3
- fix mate config dir in home

* Sat Apr 14 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.1-2
- disable apt

* Thu Apr 12 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.3.1-1
- update to 5.3.1

- rebuild for python-mate and python-mate-desktop

* Tue Apr 10 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.9-3
- switch to python-corba instead of pymatecorba

* Mon Mar 26 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.9-2
- add fedora search path patch

* Fri Mar 23 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.9-1
- update to 5.2.9

* Fri Mar 23 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-6
- fix lock screen
- use mate-screensaver instead xdg-screensaver command

* Mon Mar 05 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-5
- add one more fedora patch

* Sat Mar 03 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-4
- fix icons

* Sat Mar 03 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-3
* fix default apps and insert packagekit instead of synaptics

* Wed Jan 04 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-2
- test build

* Wed Jan 04 2012 Wolfgang Ulbrich <chat-to-me@raveit.de> - 5.2.8-1
- Initial package
openSUSE Build Service is sponsored by