# ---------------------------------------------------------------------- copyright and license --- # # file: rpm/locale-en_ru.spec.in # # Copyright 🄯 2013, 2014, 2016—2021, 2025 Van de Bugger. # # This file is a part of Locale en_RU. # # Locale en_RU is free software: you can redistribute it and/or modify it under the terms of the # GNU General Public License as published by the Free Software Foundation, either version 3 of # the License, or (at your option) any later version. # # Locale en_RU is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; # without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See # the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with Locale en_RU. If # not, see . # # SPDX-License-Identifier: GPL-3.0-or-later # # ---------------------------------------------------------------------- copyright and license --- %bcond_with debug # In OpenSuse documentation files are expected to be in `/usr/share/doc/packages/${name}`, while # `make` by default installs documents to `/usr/share/doc/${name}`. `rpmbuild` fails because it # can't find files it expected location. # # I would expect OpenSuse's `$configure` macro passes `--docdir` option to `configure` command, # bit it does not. Let's fix it: # %if 0%{?suse_version} %global configure %{configure} --docdir=%{_docdir}/%{name} %endif %global rem() %{nil} # Directories: %global _localedef %{_bindir}/localedef %global _make %{_bindir}/make %global _perl %{_bindir}/perl %global _i18ndir %{_datadir}/i18n %global _charmapsdir %{_i18ndir}/charmaps %global _localesdir %{_i18ndir}/locales # Files: %global locale_archive %{_prefix}/lib/locale/locale-archive %if 0%{?mageia:1} %global locale_archive %{_datadir}/locale/locale-archive %endif %global need_to_add_locale %{_localstatedir}/lib/rpm-state/%{name}.need_to_add_locale %global locale_added %{_localstatedir}/lib/rpm-state/%{name}.locale_added %global locale_transaction %{_localstatedir}/lib/rpm-state/%{name}.locale_transaction # Packages: %global glibc_locale_source glibc-locale-source %{rem: Package containing charmaps/UTF-8.gz.} %global glibc_all_langpacks glibc-all-langpacks %{rem: Package containing locale-archive.} %if 0%{?mageia:1} %global glibc_locale_source glibc-i18ndata %endif %if 0%{?suse_version:1} %global glibc_locale_source glibc-i18ndata %endif # Commands: %global add_locale %{_localedef} --quiet --replace -c -i %{_localesdir}/en_RU -f UTF-8 en_RU.utf8 %global del_locale %{_localedef} --quiet --delete-from-archive en_RU.utf8 Name: locale-en_ru Version: 0.5.5 Release: 0.vdb.5 Summary: English language for Russia Group: System Environment/Base License: GPLv3+ URL: https://en-ru.sourceforge.io/ Source0: https://sourceforge.net/projects/en-ru/files/0.5.5/%{name}-%{version}.tar.gz BuildArch: noarch # Build requires Perl 5.14: %global perl_version 5.14.0 %if 0%{?fedora} || 0%{?rhel} # Fedora and RHEL use epoch 4: %global perl_version 4:%{perl_version} %endif %if 0%{?suse_version} # OpenSuse does not use epoch in Perl version. %endif BuildRequires: gcc-c++ # There is one test written in C++. BuildRequires: make BuildRequires: %{_make} # BuildRequires: perl >= {perl_version} BuildRequires: %{_perl} BuildRequires: perl(utf8) BuildRequires: perl(open) BuildRequires: %{_localedef} %if 0 BuildRequires: %{_charmapsdir}/UTF-8.gz # F24 moves charmaps from glibc-common to glibc-locale-source. Let us require specific file # instead of package so the requirement can be fulfilled by any version of Fedora. %else BuildRequires: %{glibc_locale_source} # In F41 and some other OSes (e. g. RHEL 10) file dependency doesn't work, since the package # manager does not download file lists by default. %endif Requires: %{_localedef} %if 0 Requires: %{_charmapsdir}/UTF-8.gz # F24 moves charmaps from glibc-common to glibc-locale-source. Let us require specific file # instead of package so the requirement can be fulfilled by any version of Fedora. %else Requires: %{glibc_locale_source} %endif Conflicts: glibc-locale-en_RU = 0.001 Provides: locale-en_RU = %{version}-%{release} Obsoletes: locale-en_RU < %{version}-%{release} %description This is a glibc locale, namely, English language locale for Russia. It consistently sticks to English language, but makes other parameters more suitable for Russians, e. g.: * Ridiculous 12-hour clock is replaced with 24-hour clock. * Long date format is changed from confusing mm/dd/yyyy to unambiguous ISO yyyy-mm-dd. * Weeks start on Monday, not Sunday. * Thousand separator set to narrow non-breaking space. Decimal mark is dot, not comma -- it is an English variant of SI style. * Imperial units replaced with metric units. * Default paper sheet size is A4. * Territory is changed to Russia: country name, country phone code, currency name, etc. %global debug %{?with_debug:%{nil}}%{!?with_debug:#} %global debug %{nil} %prep %setup -q %{__mkdir} _build cd _build %{__ln_s} ../con'fig'ure . # rpmlint thinks it is a configure call and warns "lib dir is not specified". %build cd _build export PERL=%{_perl} export LOCALEDEF=%{_localedef} %{configure} --disable-rpm --disable-html --srcdir=.. %{make_build} %install cd _build %{make_install} %check cd _build VERBOSE=1 %{_make} check # # The sriptlets are listed in order of execution. # # After installing the package. %post %{debug} set -x; : "--- post-in ---" # I cannot add a new locale now, because the preun scriplet of the obsoleted package locale-en_RU # will run later and remove the added locale. Instead, let's create a flag that the posttrans # scriptlet (which runs later) of this package need to build the locale. echo > %{need_to_add_locale} # Before uninstalling the package. %preun %{debug} set -x; : "--- pre-un ---" # Remove locale only if we are deleting the last package. In other cases deleting is not required, # since the old locale will be rewritten by a new package. if [[ "$1" -eq 0 ]]; then # Deleting non-existent locale does not cause error. %{del_locale} fi # A third-party package (glibc-all-langpacks) installed the locale archive file. %filetriggerin -- %{locale_archive} %{debug} set -x; : "--- file-trigger-in ---" # If glibc-all-langpacks is updated, locale en_RU disappears because glibc-all-langpacks # replaces entire locale archive. I need to re-add the locale, but only if the transaction does not # include locale-en_ru, otherwise the locale will be added twice. It doesn't hurt, but there's no # point in doing the extra work. if [[ ! -e %{need_to_add_locale} ]]; then %{add_locale} touch --reference=%{locale_archive} %{locale_added} fi %triggerin -- %{glibc_all_langpacks} %{debug} set -x; : "--- trigger-in ---" if [[ ! -e %{need_to_add_locale} ]]; then if [[ %{locale_archive} -nt %{locale_added} ]]; then %{add_locale} %{__rm} %{locale_added} fi fi # One or more third-party packags installed the locale archive file. %transfiletriggerin -- %{locale_archive} # In theory, the filetriggerin scriplet will be called for each third-party package installing the # locale archive file, while this scriptlet will be called only once. However, I have never seen # this scriptled executed. Also, the locale archive file is installed only by one package, # glibc-all-langpacks, so in practice there is no difference between the filetriggerin and # transfiletriggerin scriplets. %{debug} set -x; : "--- trans-file-trigger-in ---" %transtriggerin -- %{glibc_all_langpacks} %{debug} set -x; : "--- trans-trigger-in ---" # At the end of the rpm transaction. %posttrans %{debug} set -x; : "--- post-trans ---" # Post-trans is executed only if the transaction includes installing or uninstalling this package. # In case of updating glibc, post-trans will *not* be called! if [[ -e %{need_to_add_locale} ]]; then %{add_locale} %{__rm} -f %{need_to_add_locale} fi %files %defattr( -, root, root, - ) %{_localesdir}/en_RU %dir %{_docdir}/%{name} %doc %{_docdir}/%{name}/* %changelog * Sun Apr 13 2025 Van de Bugger - 0.5.5-0.vdb.5 - Code for unsupported Fedora releases dropped. - Locale en_RU didn't survive glibc update, fixed. - Rebuilt for F41. * Mon Aug 9 2021 Van de Bugger - 0.5.5-0.vdb.4 - Rebuilt for F34. * Wed Oct 28 2020 Van de Bugger - 0.5.5-0.vdb.3 - Rebuilt for F33. * Wed May 06 2020 Van de Bugger - 0.5.5-0.vdb.2 - Rebuilt for F32. * Sun Feb 02 2020 Van de Bugger - 0.5.5-0.vdb.1 - Updated to v0.5.5. - Locale din't survive glibc update in F31. Fixed again. * Tue Nov 26 2019 Van de Bugger - 0.5.4-0.vdb.3 - Locale din't survive glibc update in F31. Fixed. * Sat Nov 02 2019 Van de Bugger - 0.5.4-0.vdb.2 - Spec fixed to enable OpenSuse and Mageia builds. - Rebuild for F31. * Wed Mar 27 2019 Van de Bugger - 0.5.4-0.1 - Updated to v0.5.4. * Thu Nov 01 2018 Van de Bugger - 0.5.3-2 - locale-en_RU survives updating the glic-all-langpacks. * Wed Oct 31 2018 Van de Bugger - 0.5.3-1 - Updated to v0.5.3. - make_build and make_install macros used. * Mon Apr 10 2017 Van de Bugger - 0.5.2-1 - Updated to v0.5.2. - Source0 tag specified properly. * Wed Aug 03 2016 Van de Bugger - 0.5.1-3 - BuildRequires tag was accidentally used instead of Requires tag. Fixed. * Mon Jun 27 2016 Van de Bugger - 0.5.1-2 - F24 moves charmaps from glibc-common to glibc-locale-source. Fix to work in F24. - _bindir macro used few times. * Fri Feb 19 2016 Van de Bugger - 0.5.1-1 - Build requires make and /usr/bin/make. - Build requires perl modules: perl(open), perl(utf8), not perl-open package. - Build requires glibc-common and /usr/bin/localedef. - Since we explicitly require /usr/bin/perl and /usr/bin/localedef, they are passed to configure. * Sun Feb 14 2016 Van de Bugger - 0.5-1 - Locale updated to v0.5. - perl-open was a missed build requirement, added now. - Test result is not ignored now. * Wed Nov 12 2014 Van de Bugger - 0.4.3-1 - HTML documentation bug fixing and improvements. - Many changes in build and test infrastructure, not visible to end users. * Tue Nov 4 2014 Van de Bugger - 0.4-1 - Locale updated to v0.4. - Documentation is installed to unversioned directory, like other Fedora 20 packages. * Sun Oct 27 2013 Van de Bugger - 0.3-1 - Locale updated to v0.3. - Fixed bug in spec file which prevents upgrade. - This package conflicts with glibc-locale-en_RU-0.001 to avoid the bug described above. - Documentation added. * Sat Oct 5 2013 Van de Bugger - 0.2-1 - Project renamed from "glibc-locale-en_RU" to "locale-en_RU". * Thu Mar 14 2013 Van de Bugger - 0.1-1 - Initial release. # end of file #