Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2 years ago
commit
15aceacc50
  1. 159
      SOURCES/add_apt_checking.patch
  2. 10
      SOURCES/fix_gdk_import.patch
  3. 22
      SOURCES/fix_signal_name.patch
  4. 110
      SOURCES/show_utf8_only.patch
  5. 194
      SPECS/mintlocale.spec

159
SOURCES/add_apt_checking.patch

@ -0,0 +1,159 @@ @@ -0,0 +1,159 @@
From 451de58797ef3e270314d07da7170065d787e3e1 Mon Sep 17 00:00:00 2001
From: Sam Burgos <sam.burgos1089@gmail.com>
Date: Tue, 15 May 2018 16:04:11 -0600
Subject: [PATCH] added checking of APT so application can show proper
configuration

---
usr/lib/linuxmint/mintlocale/install_remove.py | 53 ++++++++++++++++----------
usr/lib/linuxmint/mintlocale/mintlocale.py | 20 +++++-----
2 files changed, 43 insertions(+), 30 deletions(-)

diff --git a/usr/lib/linuxmint/mintlocale/install_remove.py b/usr/lib/linuxmint/mintlocale/install_remove.py
index 205bd5b..00e2e2d 100755
--- a/usr/lib/linuxmint/mintlocale/install_remove.py
+++ b/usr/lib/linuxmint/mintlocale/install_remove.py
@@ -2,12 +2,10 @@
import os
import gettext
-import apt_pkg
import subprocess
import tempfile
import locale
import codecs
-import mintcommon
import gi
gi.require_version('Gtk', '3.0')
@@ -15,6 +13,13 @@
from gi.repository import GdkX11
from gi.repository import Gtk, GdkPixbuf, XApp
+# Used to detect Debian derivatives (we don't want to show APT features in other distros)
+IS_DEBIAN = os.path.exists("/etc/debian_version")
+
+if IS_DEBIAN:
+ import apt_pkg
+ import mintcommon
+
# i18n
APP = 'mintlocale'
LOCALE_DIR = "/usr/share/linuxmint/locale"
@@ -98,7 +103,9 @@ def __init__(self):
self.build_lang_list()
- self.apt = mintcommon.APT(self.window)
+
+ if IS_DEBIAN:
+ self.apt = mintcommon.APT(self.window)
def split_locale(self, locale_code):
if "_" in locale_code:
@@ -244,22 +251,25 @@ def select_language(self, treeview, data=None):
def button_install_clicked(self, button):
if self.selected_language_packs is not None:
- if self.cache_updated:
- self.apt.set_finished_callback(self.on_install_finished)
- self.apt.set_cancelled_callback(self.on_install_finished)
- self.apt.install_packages(self.selected_language_packs)
- else:
- self.apt.set_finished_callback(self.on_update_finished)
- self.apt.update_cache()
-
- def on_update_finished(self, transaction=None, exit_state=None):
- self.cache_updated = True
- self.apt.set_finished_callback(self.on_install_finished)
- self.apt.set_cancelled_callback(self.on_install_finished)
- self.apt.install_packages(self.selected_language_packs)
-
- def on_install_finished(self, transaction=None, exit_state=None):
- self.build_lang_list()
+ if IS_DEBIAN:
+ if self.cache_updated:
+ self.apt.set_finished_callback(self.on_install_finished)
+ self.apt.set_cancelled_callback(self.on_install_finished)
+ self.apt.install_packages(self.selected_language_packs)
+ else:
+ self.apt.set_finished_callback(self.on_update_finished)
+ self.apt.update_cache()
+
+ if IS_DEBIAN:
+ def on_update_finished(self, transaction=None, exit_state=None):
+ self.cache_updated = True
+ self.apt.set_finished_callback(self.on_install_finished)
+ self.apt.set_cancelled_callback(self.on_install_finished)
+ self.apt.install_packages(self.selected_language_packs)
+
+ if IS_DEBIAN:
+ def on_install_finished(self, transaction=None, exit_state=None):
+ self.build_lang_list()
def button_add_clicked(self, button):
os.system("/usr/lib/linuxmint/mintlocale/add.py")
@@ -284,8 +294,9 @@ def button_remove_clicked(self, button):
print(pkgname)
if len(installed_packs) > 0:
- self.apt.set_finished_callback(self.on_install_finished)
- self.apt.remove_packages(installed_packs)
+ if IS_DEBIAN:
+ self.apt.set_finished_callback(self.on_install_finished)
+ self.apt.remove_packages(installed_packs)
self.build_lang_list()
diff --git a/usr/lib/linuxmint/mintlocale/mintlocale.py b/usr/lib/linuxmint/mintlocale/mintlocale.py
index cd75f75..87e0c47 100755
--- a/usr/lib/linuxmint/mintlocale/mintlocale.py
+++ b/usr/lib/linuxmint/mintlocale/mintlocale.py
@@ -8,7 +8,6 @@
import tempfile
import subprocess
import codecs
-import mintcommon
try:
import _thread as thread
@@ -33,6 +32,7 @@
if IS_DEBIAN:
import apt
+ import mintcommon
# i18n
APP = 'mintlocale'
@@ -64,7 +64,8 @@ def __init__(self, codename, name, methods, app):
self.app = app
self.packages = []
self.missing_packages = []
- self.apt = mintcommon.APT(self.app.window)
+ if IS_DEBIAN:
+ self.apt = mintcommon.APT(self.app.window)
self.label = Gtk.Label()
self.label.set_markup(name)
@@ -107,13 +108,14 @@ def __init__(self, codename, name, methods, app):
def install(self, widget):
if len(self.missing_packages) > 0:
self.app.lock_input_methods()
- if self.app.cache_updated:
- self.apt.set_finished_callback(self.on_install_finished)
- self.apt.set_cancelled_callback(self.on_install_finished)
- self.apt.install_packages(self.missing_packages)
- else:
- self.apt.set_finished_callback(self.on_update_finished)
- self.apt.update_cache()
+ if IS_DEBIAN:
+ if self.app.cache_updated:
+ self.apt.set_finished_callback(self.on_install_finished)
+ self.apt.set_cancelled_callback(self.on_install_finished)
+ self.apt.install_packages(self.missing_packages)
+ else:
+ self.apt.set_finished_callback(self.on_update_finished)
+ self.apt.update_cache()
def on_update_finished(self, transaction=None, exit_state=None):
self.app.cache_updated = True

10
SOURCES/fix_gdk_import.patch

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
--- a/usr/lib/linuxmint/mintlocale/mintlocale.py
+++ b/usr/lib/linuxmint/mintlocale/mintlocale.py
@@ -21,6 +21,7 @@ except ImportError as err:
import ConfigParser as configparser
import gi
+gi.require_version('GdkX11', '3.0')
gi.require_version('Gtk', '3.0')
gi.require_version('AccountsService', '1.0')
from gi.repository import GdkX11

22
SOURCES/fix_signal_name.patch

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
From 7041982b69fa9fea065098e7b33f306df1dcac91 Mon Sep 17 00:00:00 2001
From: Michael Webster <miketwebster@gmail.com>
Date: Tue, 14 Jan 2020 16:51:20 -0500
Subject: [PATCH] mintlocale.py: Fix signal name typo.

---
usr/lib/linuxmint/mintlocale/mintlocale.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/lib/linuxmint/mintlocale/mintlocale.py b/usr/lib/linuxmint/mintlocale/mintlocale.py
index e7db8e4..d145073 100755
--- a/usr/lib/linuxmint/mintlocale/mintlocale.py
+++ b/usr/lib/linuxmint/mintlocale/mintlocale.py
@@ -430,7 +430,7 @@ def __init__(self):
self.accountService = AccountsService.UserManager.get_default().get_user(current_user)
self.accountService.connect('notify::is-loaded', self.accountservice_ready)
- self.accountService.connect('changed::', self.accountservice_changed)
+ self.accountService.connect('changed', self.accountservice_changed)
groups = grp.getgrall()
for group in groups:

110
SOURCES/show_utf8_only.patch

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
--- a/usr/lib/linuxmint/mintlocale/mintlocale.py
+++ b/usr/lib/linuxmint/mintlocale/mintlocale.py
@@ -279,7 +279,7 @@
vbox = Gtk.VBox()
vbox.pack_start(image, False, False, 2)
label = Gtk.Label()
- label.set_markup(title)
+ label.set_text(title)
vbox.pack_start(label, False, False, 2)
menuitem.add(vbox)
else:
@@ -720,7 +720,10 @@
vars[var_name] = value
if "LANG" in vars:
locale = vars['LANG'].replace('"', '').replace("'", "")
- locale = locale.split(".")[0].strip()
+ locale = locale.replace("utf8", "UTF-8")
+ locale = locale.replace("UTF-8", "")
+ locale = locale.replace(".", "")
+ locale = locale.strip()
if "_" in locale:
split = locale.split("_")
if len(split) == 2:
@@ -745,7 +748,10 @@
if "LC_NUMERIC" in vars:
locale = vars['LC_NUMERIC'].replace('"', '').replace("'", "")
- locale = locale.split(".")[0].strip()
+ locale = locale.replace("utf8", "UTF-8")
+ locale = locale.replace("UTF-8", "")
+ locale = locale.replace(".", "")
+ locale = locale.strip()
if "_" in locale:
split = locale.split("_")
if len(split) == 2:
@@ -773,7 +779,7 @@
self.system_label.set_markup("<b>%s</b>\n<small>%s <i>%s</i>\n%s <i>%s</i></small>" % (_("System locale"), language_prefix, language_str, region_prefix, region_str))
def set_num_installed(self):
- num_installed = int(subprocess.check_output("localedef --list-archive | wc -l", shell=True))
+ num_installed = int(subprocess.check_output("localedef --list-archive | grep utf8 | wc -l", shell=True))
self.install_label.set_markup("<b>%s</b>\n<small>%s</small>" % (_("Language support"), gettext.ngettext("%d language installed", "%d languages installed", num_installed) % num_installed))
def accountservice_ready(self, user, param):
@@ -827,11 +833,12 @@
built_locales = {}
for line in locales.rstrip().split("\n"):
line = line.replace("utf8", "UTF-8")
- cur_index += 1
- locale_code = line.split(".")[0].strip()
- charmap = None
- if len(line.split(".")) > 1:
- charmap = line.split(".")[1].strip()
+ if "UTF-8" not in line:
+ continue
+ cur_index += 1
+ locale_code = line.replace("UTF-8", "")
+ locale_code = locale_code.replace(".", "")
+ locale_code = locale_code.strip()
if "_" in locale_code:
split = locale_code.split("_")
@@ -843,16 +850,13 @@
else:
language = language_code
- country_code = split[1].lower().split('@')[0].strip()
+ country_code = split[1].lower()
if country_code in self.countries:
country = self.countries[country_code]
else:
country = country_code
- if '@' in split[1]:
- language_label = u"%s (@%s), %s" % (language, split[1].split('@')[1].strip(), country)
- else:
- language_label = u"%s, %s" % (language, country)
+ language_label = u"%s, %s" % (language, country)
flag_path = FLAG_PATH % country_code
else:
@@ -864,9 +868,6 @@
flag_path = self.set_minority_language_flag_path(locale_code, flag_path)
- if charmap is not None and not all_locales_are_utf8:
- language_label = u"%s <small><span foreground='#3c3c3c'>%s</span></small>" % (language_label, charmap)
-
if os.path.exists(flag_path):
flag = flag_path
else:
@@ -892,7 +893,7 @@
def set_user_locale(self, path, locale):
self.locale_button.set_button_label(locale.name)
- print(u"Setting language to %s" % locale.id)
+ print(u"Setting language to '%s' '%s'" % (locale.name, locale.id))
# Set it in Accounts Service
try:
self.accountService.set_language(locale.id)
@@ -916,7 +917,7 @@
def set_user_region(self, path, locale):
self.region_button.set_button_label(locale.name)
- print("Setting region to %s" % locale.id)
+ print("Setting region to '%s' '%s'" % (locale.name, locale.id))
# We don't call self.accountService.set_formats_locale(locale.id) here...
# First, we don't really use AccountsService, we're only doing this to be nice to LightDM and all..

194
SPECS/mintlocale.spec

@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
%global _mintlibdir %{_prefix}/lib/linuxmint/

Name: mintlocale
Version: 1.4.7
Release: 11%{?dist}
Summary: Language selection tool

License: GPLv2+
URL: https://github.com/linuxmint/%{name}
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz

# Revert https://github.com/linuxmint/mintlocale/commit/0206bbf7c12058999e701bb11f9012be54da2cbb
# Using non utf8 breaks gnome apps
Patch0: show_utf8_only.patch
Patch1: %{url}/pull/56.patch#/add_apt_checking.patch
Patch2: %{url}/commit/7041982b69fa9fea065098e7b33f306df1dcac91.patch#/fix_signal_name.patch
Patch3: fix_gdk_import.patch

BuildArch: noarch

BuildRequires: desktop-file-utils

Requires: accountsservice
Requires: %{name}-set-default-locale = %{version}-%{release}
Requires: xapps

%description
Language selection tool for Cinnamon.

%package set-default-locale
Summary: Language selection tool

%description set-default-locale
Language selection tool for Cinnamon.


%prep
%autosetup -p1


%build
echo 'nothing to build'


%install
%{__cp} -pr .%{_prefix} %{buildroot}
%{__rm} %{buildroot}%{_bindir}/add-remove-locales \
%{buildroot}%{_datadir}/applications/%{name}-im.desktop \
%{buildroot}%{_mintlibdir}/mintlocale/add.py \
%{buildroot}%{_mintlibdir}/mintlocale/install_remove.py
%{__chmod} -c 0755 %{buildroot}%{_mintlibdir}/mintlocale/mintlocale.py

echo 'LANG=$locale' > %{buildroot}%{_datadir}/linuxmint/mintlocale/templates/default_locale.template

%{_bindir}/desktop-file-install \
--add-only-show-in=X-Cinnamon \
--delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/%{name}.desktop


%files
%doc debian/changelog
%license COPYING debian/copyright
%{_bindir}/%{name}
%{_mintlibdir}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/linuxmint
%{_datadir}/polkit-1/actions/com.linuxmint.mintlocale.policy

%files set-default-locale
%{_bindir}/set-default-locale


%changelog
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Sat Jun 12 2021 Leigh Scott <leigh123linux@gmail.com> - 1.4.7-9
- Fix (rhbz#1971037)

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Thu Apr 02 2020 leigh123linux <leigh123linux@googlemail.com> - 1.4.7-6
- Fix rhbz#1819715

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sun Oct 07 2018 Leigh Scott <leigh123linux@googlemail.com> - 1.4.7-2
- Drop EPEL/RHEL support

* Thu Aug 16 2018 Leigh Scott <leigh123linux@googlemail.com> - 1.4.7-1
- New upstream release

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu May 17 2018 Leigh Scott <leigh123linux@googlemail.com> - 1.4.5-1
- New upstream release

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Oct 27 2017 Leigh Scott <leigh123linux@googlemail.com> - 1.4.4-1
- New upstream release

* Mon Sep 11 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-11
- Require xapps for iso-flag-png

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-10
- Preserve mode of files when changing hashbang

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-9
- Fix regex for EPEL

* Thu Aug 31 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-8
- Fix hashbang in regex

* Tue Aug 29 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-7
- Use Python2 on EPEL <= 7

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

* Tue May 09 2017 Leigh Scott <leigh123linux@googlemail.com> - 1.4.2-5
- Remove the add and remove bits

* Tue May 09 2017 Leigh Scott <leigh123linux@googlemail.com> - 1.4.2-4
- Split package (bz 1449122)
- Remove python3-devel build requires

* Tue May 09 2017 Leigh Scott <leigh123linux@googlemail.com> - 1.4.2-3
- Show UTF8 Lang only

* Sun May 07 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-2
- Fix template for system locale

* Sun May 07 2017 Björn Esser <besser82@fedoraproject.org> - 1.4.2-1
- New upstream release

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

* Thu Apr 28 2016 Leigh Scott <leigh123linux@googlemail.com> - 1.1.6-0.8.gitfb4118d
- rebuilt for bz 1292296

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-0.7.gitfb4118d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Sep 09 2015 Leigh Scott <leigh123linux@googlemail.com> - 1.1.6-0.6.gitfb4118d
- fix some deprecation warnings

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

* Sat Nov 08 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1.6-0.4.gitfb4118d
- fix locale path

* Fri Jun 27 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1.6-0.3.gitfb4118d
- only show in cinnamon menu

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

* Tue May 27 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1.6-0.1.gitfb4118d
- update to the latest git snapshot

* Sat May 10 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1-4
- fix system wide settings

* Sat May 03 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1-3
- more fixes

* Sat May 03 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1-2
- fix ui so it looks better
- add pkexec support for setting system
locale (needs group adm,sudo,wheel to show)

* Mon Apr 14 2014 Leigh Scott <leigh123linux@googlemail.com> - 1.1-1
- Inital build
Loading…
Cancel
Save