[PATCH] installer: Restore LatGrkCyr-8x16 console font depending on language.

  • Done
  • quality assurance status badge
Details
3 participants
  • Josselin Poiret
  • pelzflorian (Florian Pelz)
  • Denys Nykula
Owner
unassigned
Submitted by
Denys Nykula
Severity
normal

Debbugs page

Denys Nykula wrote 2 years ago
(address . guix-patches@gnu.org)(name . Denys Nykula)(address . vegan@libre.net.ua)
34ca88bad83d40c14346f18ddbc34e8d2884f88f.1688217377.git.vegan@libre.net.ua

* gnu/installer/services.scm (system-services->configuration): When the
LANGUAGE environment variable matches a known native console font, wrap the
%desktop-services or %base-services with modify-services, configuring
console-font-service-type to set the native console font on every tty instead
of the default console font.
---
This makes console messages, such as errors and help texts, readable (like they
were in Guix System 1.4.0) if the user chooses the Belarusian, Bulgarian,
Greek, Esperanto, Kazakh, Kyrgyz, Macedonian, Mongolian, Russian, Serbian,
Tajik or Ukrainian language at the beginning of a new installation. For other
languages, this keeps the default font, which is Unifont-APL8x16 in the latest
development snapshots. Thanks to Florian Pelz and Josselin Poiret for tips
about editing the installer and testing it using a virtual machine.

gnu/installer/services.scm | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

Toggle diff (50 lines)
diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm
index d08bab47fd..fb66f2248c 100644
--- a/gnu/installer/services.scm
+++ b/gnu/installer/services.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2023 Denys Nykula <vegan@libre.net.ua>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,6 +24,7 @@
(define-module (gnu installer services)
#:use-module (guix records)
#:use-module (guix read-print)
+ #:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (system-service?
system-service-name
@@ -156,9 +158,22 @@ (define (system-services->configuration services)
(let* ((snippets (append-map system-service-snippet services))
(packages (append-map system-service-packages services))
(desktop? (find desktop-system-service? services))
- (base (if desktop?
- '%desktop-services
- '%base-services))
+ (base-with-default-console-font (if desktop?
+ '%desktop-services
+ '%base-services))
+ (native-console-font (match (getenv "LANGUAGE")
+ ((or "be" "bg" "el" "eo" "kk" "ky"
+ "mk" "mn" "ru" "sr" "tg" "uk")
+ "LatGrkCyr-8x16.psfu.gz")
+ (_ #f)))
+ (base (if native-console-font
+ `(modify-services
+ ,base-with-default-console-font
+ (console-font-service-type
+ config => (map (lambda (tty)
+ (cons (car tty) ,native-console-font))
+ config)))
+ base-with-default-console-font))
(service-heading (list (vertical-space 1)
(comment (G_ "\
;; Below is the list of system services. To search for available

base-commit: b24a05830d11e3011eee4bc5f60a41e26188cde1
--
2.40.1
pelzflorian (Florian Pelz) wrote 2 years ago
(name . Denys Nykula)(address . vegan@libre.net.ua)
87zg4fpns3.fsf@pelzflorian.de
Hello Denys,

this patch looks good mostly good to me, except in my opinion,
`base-with-default-console-font' should be called `base' and
what is called `base' in your patch should be called `services'.
Consequently within the `let' body, the services field then could be set
as (services ,services) instead of (services ,base).

The one who commits the patch can fix it, but perhaps you could also
indent properly and untabify your change and then resend a v2 of the
patch? In the manual’s Contributing section, the recommended way is to
use Emacs for automatic formatting, where you can press the tab key for
automatic indentation.

I have not tested yet.

I put the installer team in Cc. If noone disagrees, I will make the
above changes, test, and commit this patch next weekend.

Regards,
Florian
Denys Nykula wrote 2 years ago
[PATCH v2] installer: Restore LatGrkCyr-8x16 console font depending on language.
(address . 64399@debbugs.gnu.org)(name . Denys Nykula)(address . vegan@libre.net.ua)
48d9788a3a2dceab15c5432bd439d8f33492d4a5.1688233529.git.vegan@libre.net.ua

* gnu/installer/services.scm (system-services->configuration): When the
LANGUAGE environment variable matches a known native console font, wrap the
base services with modify-services, configuring console-font-service-type to
set the native console font on every tty instead of the default console font.
---
Untabified version 2 with suggested naming changes. Version 1 was in fact
written in Emacs and formatted using the tab key, but I was editing remotely
and hadn't customized enable-remote-dir-locals, so .dir-locals.el
wasn't applied.

gnu/installer/services.scm | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

Toggle diff (59 lines)
diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm
index d08bab47fd..a0ac2f35d3 100644
--- a/gnu/installer/services.scm
+++ b/gnu/installer/services.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2023 Denys Nykula <vegan@libre.net.ua>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -23,6 +24,7 @@
(define-module (gnu installer services)
#:use-module (guix records)
#:use-module (guix read-print)
+ #:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (system-service?
system-service-name
@@ -159,6 +161,19 @@ (define (system-services->configuration services)
(base (if desktop?
'%desktop-services
'%base-services))
+ (native-console-font (match (getenv "LANGUAGE")
+ ((or "be" "bg" "el" "eo" "kk" "ky"
+ "mk" "mn" "ru" "sr" "tg" "uk")
+ "LatGrkCyr-8x16.psfu.gz")
+ (_ #f)))
+ (services (if native-console-font
+ `(modify-services ,base
+ (console-font-service-type
+ config => (map (lambda (tty)
+ (cons (car tty)
+ ,native-console-font))
+ config)))
+ base))
(service-heading (list (vertical-space 1)
(comment (G_ "\
;; Below is the list of system services. To search for available
@@ -177,7 +192,7 @@ (define (system-services->configuration services)
%base-packages))))
,@service-heading
- (services ,base))
+ (services ,services))
`(,@(if (null? packages)
'()
`(,@package-heading
@@ -199,4 +214,4 @@ (define (system-services->configuration services)
,(comment (G_ "\
;; This is the default list of services we
;; are appending to.\n"))
- ,base))))))
+ ,services))))))

base-commit: b24a05830d11e3011eee4bc5f60a41e26188cde1
--
2.40.1
pelzflorian (Florian Pelz) wrote 2 years ago
(name . Denys Nykula)(address . vegan@libre.net.ua)(address . 64399@debbugs.gnu.org)
874jmidtg1.fsf@pelzflorian.de
Pryvit Denys,

Denys Nykula <vegan@libre.net.ua> writes:
Toggle quote (5 lines)
> + (native-console-font (match (getenv "LANGUAGE")
> + ((or "be" "bg" "el" "eo" "kk" "ky"
> + "mk" "mn" "ru" "sr" "tg" "uk")
> + "LatGrkCyr-8x16.psfu.gz")

Works very well. I prefer however to change this to just
"LatGrkCyr-8x16" which works too and is what’s used in the Guix manual’s
example for configuring console-font-service-type.

Will push on Friday.

Regards,
Florian
Josselin Poiret wrote 2 years ago
(address . 64399@debbugs.gnu.org)
87left76zz.fsf@jpoiret.xyz
Hi Florian,

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> writes:

Toggle quote (12 lines)
> Pryvit Denys,
>
> Denys Nykula <vegan@libre.net.ua> writes:
>> + (native-console-font (match (getenv "LANGUAGE")
>> + ((or "be" "bg" "el" "eo" "kk" "ky"
>> + "mk" "mn" "ru" "sr" "tg" "uk")
>> + "LatGrkCyr-8x16.psfu.gz")
>
> Works very well. I prefer however to change this to just
> "LatGrkCyr-8x16" which works too and is what’s used in the Guix manual’s
> example for configuring console-font-service-type.

Tested this as well, works quite nice! Please go ahead :)

Best,
--
Josselin Poiret
-----BEGIN PGP SIGNATURE-----

iQHEBAEBCgAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmSmgdAQHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5FhcaivtmC/90mnnjk/N+65RlVe+kJZlpwjvH9lmywXvw
DjfT/fJcuCR6colQtIHOPtNOo02cXN5t/cnCRHiPXsT7Tmuh0msH7/Qeu9CPScTp
q1CM9O+hj6yqU6yqvOzal5Za+V5FvQmCl3MJYC93976R0ql0yYXojqAJkPWj8DX3
gtLbQhgduvY1qQP3sZwjSNFRHXYGc4GDqcWfrjf+xy+Man9f+BktluZSThgnl/D3
0BahocXd5LSOILyRjfSjJsRdFnpx2XO88q8l4hVY4URESWdmN0WdqFA0RBKa9DP8
vpUenCHe++5Rx88wG58rznDF8vHfgXE4+n7HNRDlB9yHv7PISgxJCROBQ+OiJCSq
qbb/XZDC7FhkU4qHoRfNW5p0RwyYnzmclxTsQmpFdreQ6kO5AYLbyI2ptlgRo1ub
bATWe+cbUULlptRjLJLshwMHYfeNKb0vbDWQ4Q61mXPNSK7hy2QSdWlNtu2VPiKT
07c0etdEXbpAKUN8UhMmbSbZfCdGGD0=
=PBzM
-----END PGP SIGNATURE-----

pelzflorian (Florian Pelz) wrote 2 years ago
(name . Denys Nykula)(address . vegan@libre.net.ua)
877crdm7xa.fsf@pelzflorian.de
Pushed as 961ffca1c75141cbb351d143b22b673638e9659d.

Great work. :)

Regards,
Florian
pelzflorian (Florian Pelz) wrote 2 years ago
close 64399
(address . control@debbugs.gnu.org)
873521m7r5.fsf@pelzflorian.de
close 64399
thanks
?
Your comment

This issue is archived.

To comment on this conversation send an email to 64399@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 64399
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help