Bug 1950406

Summary: Keymaps missing in the CentOS Stream build of kbd-misc
Product: Red Hat Enterprise Linux 9 Reporter: Brian Stinson <bstinson>
Component: kbdAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED CURRENTRELEASE QA Contact: Jakub Haruda <jharuda>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, carl, jharuda, jwboyer, peter.hutterer, smitterl, vcrhonek, virt-qe-z
Target Milestone: betaKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kbd-2.4.0-4.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:52:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1951453, 1951459, 1951875    
Bug Blocks: 1953549    

Description Brian Stinson 2021-04-16 14:50:13 UTC
We have this build of kbd in CentOS Stream 9: https://kojihub.stream.rdu2.redhat.com/koji/buildinfo?buildID=4967

I would have expected kbd-misc.rpm to include a whole bunch of keymaps under /usr/lib/kbd/keymps but those seem to be missing.

The corresponding Brew build has these files in their proper places.

Any ideas about what's going on here?

Comment 1 Vitezslav Crhonek 2021-04-19 07:21:25 UTC
The problem happens when keymaps are generated from xkb layouts:
/usr/bin/ckbcomp: Can not find file "rules/xorg" in any known directory

This file is expected to be present in xkeyboard-config BuildRequire:

$ rpm -ql xkeyboard-config | grep rules/xorg
/usr/share/X11/xkb/rules/xorg

But this is not true with the package used during the build:
$ rpm -qlp xkeyboard-config-2.32-1.el9.noarch.rpm | grep rules/xorg
$

It seems that it has been deliberately dropped from the package (adding maintainer to CC):
- drop the xorg ruleset, no longer in use. Everything is hardcoded to evdev
  these days.

Comment 2 Peter Hutterer 2021-04-20 08:43:46 UTC
Thanks for the CC and apologies for the breakage. I guess 15 years wasn't enough for people to drop the legacy symlinks :)

xkeyboard-config is now fixed in rawhide + F34 (after updates are through) and that'll trickle into Centos Stream once I figure out the process.
For F35 and beyond we should fix console-setup, see Bug 1951453, and identify any other potential users.

Vitezslav, do we need rebuilds for kbd or console-setup after the xkeyboard-config change?

Comment 3 Vitezslav Crhonek 2021-04-20 09:06:03 UTC
(In reply to Peter Hutterer from comment #2)
> Thanks for the CC and apologies for the breakage. I guess 15 years wasn't
> enough for people to drop the legacy symlinks :)
> 
> xkeyboard-config is now fixed in rawhide + F34 (after updates are through)
> and that'll trickle into Centos Stream once I figure out the process.
> For F35 and beyond we should fix console-setup, see Bug 1951453, and
> identify any other potential users.

Thank you Peter for investigating the issue and opening #1951453.
I agree that it needs to be fixed in console-setup in the end.

> 
> Vitezslav, do we need rebuilds for kbd or console-setup after the
> xkeyboard-config change?

No need to rebuild console-setup, but we will need to rebuild kbd with
new xkeyboard-config once you update it in CentOS Stream.

Comment 4 Peter Hutterer 2021-04-20 23:50:21 UTC
Vitezlsav: I've had another look at kbd.spec and, ignoring the console-setup and xkeyboard-config changes we can fix kbd with this diff:

diff --git a/kbd.spec b/kbd.spec
index 3abd4e5..f94dfd2 100644
--- a/kbd.spec
+++ b/kbd.spec
@@ -146,13 +146,13 @@ while read line; do
   XKBLAYOUT=`echo "$line" | cut -d " " -f 1`
   echo "$XKBLAYOUT" >> layouts-list.lst
   XKBVARIANT=`echo "$line" | cut -d " " -f 2`
-  ckbcomp "$XKBLAYOUT" "$XKBVARIANT" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz
+  ckbcomp -rules base "$XKBLAYOUT" "$XKBVARIANT" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$XKBLAYOUT"-"$XKBVARIANT".map.gz
 done < layouts-variants.lst
 
 # Convert X keyboard layouts (plain, no variant)
 cat layouts-list.lst | sort -u >> layouts-list-uniq.lst
 while read line; do
-  ckbcomp "$line" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$line".map.gz
+  ckbcomp -rules base "$line" | gzip > $RPM_BUILD_ROOT%{kbd_datadir}/keymaps/xkb/"$line".map.gz
 done < layouts-list-uniq.lst
 
 # wipe converted layouts which cannot input ASCII (#1031848)
---

This makes the package independent of the other package changes and corrects its behaviour. The ckbcomp code for rules handling is just `$rules = 'base' if (! $rules);` (that's the fixed version, previously it was 'xorg') so simply supplying the rules ourselves means we can fix this here without depending on other package updates. Do you agree? AFAICT there is no other xorg dependency in this package.

I can push that change out if you don't beat me to it.

Comment 5 Vitezslav Crhonek 2021-04-21 08:08:34 UTC
(In reply to Peter Hutterer from comment #4)

> This makes the package independent of the other package changes and corrects
> its behaviour. The ckbcomp code for rules handling is just `$rules = 'base'
> if (! $rules);` (that's the fixed version, previously it was 'xorg') so
> simply supplying the rules ourselves means we can fix this here without
> depending on other package updates. Do you agree? AFAICT there is no other
> xorg dependency in this package.

Yes, I agree, it looks good. Right, there's no other xorg dependency. Thanks!

Comment 6 Peter Hutterer 2021-04-22 04:14:34 UTC
> I can push that change out if you don't beat me to it.

Actually, on second thought - I'm going to leave the Fedora (and RHEL) package updates to you, you know better how to test all this :)

Comment 7 Vitezslav Crhonek 2021-04-27 09:35:00 UTC
PR done, stuck on failing pipeline:
https://gitlab.com/redhat/centos-stream/rpms/kbd/-/merge_requests/1