From a67d56241478a6e1c02e7e5f960e05e9c9afdbb7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:27:56 +0000 Subject: import kbd-1.15.5-11.el7 --- diff --git a/SOURCES/kbd-1.15.5-loadkeys-search-path.patch b/SOURCES/kbd-1.15.5-loadkeys-search-path.patch new file mode 100644 index 0000000..f105d4e --- /dev/null +++ b/SOURCES/kbd-1.15.5-loadkeys-search-path.patch @@ -0,0 +1,24 @@ +diff -up kbd-1.15.5/src/loadkeys.c.orig kbd-1.15.5/src/loadkeys.c +--- kbd-1.15.5/src/loadkeys.c.orig 2013-11-19 10:03:28.544600690 +0100 ++++ kbd-1.15.5/src/loadkeys.c 2013-11-19 10:05:21.018542306 +0100 +@@ -168,7 +168,7 @@ static void attr_noreturn usage(void) + } + + char **dirpath; +-char *dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 }; ++char *dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", DATADIR "/" XKBKEYMAPDIR "/", DATADIR "/" LEGACYKEYMAPDIR "/**", KERNDIR "/", 0 }; + char *dirpath2[] = { 0, 0 }; + char *suffixes[] = { "", ".kmap", ".map", 0 }; + +diff -up kbd-1.15.5/src/paths.h.orig kbd-1.15.5/src/paths.h +--- kbd-1.15.5/src/paths.h.orig 2013-11-19 10:02:07.117206075 +0100 ++++ kbd-1.15.5/src/paths.h 2013-11-19 10:03:07.900722065 +0100 +@@ -5,6 +5,8 @@ + * The following five subdirectories are defined: + */ + #define KEYMAPDIR "keymaps" ++#define XKBKEYMAPDIR "keymaps/xkb" ++#define LEGACYKEYMAPDIR "keymaps/legacy" + #define UNIMAPDIR "unimaps" + #define TRANSDIR "consoletrans" + #define VIDEOMODEDIR "videomodes" diff --git a/SOURCES/xml2lst.pl b/SOURCES/xml2lst.pl new file mode 100644 index 0000000..96cf01e --- /dev/null +++ b/SOURCES/xml2lst.pl @@ -0,0 +1,231 @@ +#!/usr/bin/perl + +# converts the .xml file to the old format .lst file +# +# Usage: +# +# perl xml2lst.pl < filename.xml > filename.lst +# +# author Ivan Pascal +# modified by Vitezslav Crhonek + +$doc = new_document( 0, ''); +parse('', $doc); + +($reg) = node_by_name($doc, '/xkbConfigRegistry'); +@models = node_by_name($reg, 'modelList/model/configItem'); +@layouts = node_by_name($reg, 'layoutList/layout/configItem'); +@options = node_by_name($reg, 'optionList/group/configItem'); + +for $i (@layouts) { + ($name) = node_by_name($i, 'name'); + @variants = node_by_name($i, '../variantList/variant/configItem'); + for $v (@variants) { + ($variant) = node_by_name($v, 'name'); + printf("%s %s\n", text_child($name), text_child($variant)); + } +} + +sub with_attribute { + local ($nodelist, $attrexpr) = @_; + local ($attr, $value) = split (/=/, $attrexpr); + local ($node, $attrvalue); + if (defined $value && $value ne '') { + $value =~ s/"//g; + foreach $node (@{$nodelist}) { + $attrvalue = node_attribute($node, $attr); + if (defined $attrvalue && $attrvalue eq $value) { + return $node; + } + } + } else { + foreach $node (@{$nodelist}) { + if (! defined node_attribute($node, $attr)) { + return $node; + } + } + } + undef; +} + +# Subroutines + +sub parse { + local $intag = 0; + my (@node_stack, $parent); + $parent = @_[1]; + local ($tag, $text); + + while (<>) { + chomp; + @str = split /([<>])/; + shift @str if ($str[0] eq '' || $str[0] =~ /^[ \t]*$/); + + while (scalar @str) { + $token = shift @str; + if ($token eq '<') { + $intag = 1; + if (defined $text) { + add_text_node($parent, $text); + undef $text; + } + } elsif ($token eq '>') { + $intag = 0; + if ($tag =~ /^\/(.*)/) { # close tag + $parent = pop @node_stack; + } elsif ($tag =~ /^([^\/]*)\/$/) { + empty_tag($parent, $1); + } else { + if (defined ($node = open_tag($parent, $tag))) { + push @node_stack, $parent; + $parent = $node; + } + } + undef $tag; + } else { + if ($intag == 1) { + if (defined $tag) { + $tag .= ' '. $token; + } else { + $tag = $token; + } + } else { + if (defined $text) { + $text .= "\n" . $token; + } else { + $text = $token; + } + } + } + } + } +} + +sub new_document { + $doc = new_node( 0, '', 'DOCUMENT'); + $doc->{CHILDREN} = []; + return $doc; +} + +sub new_node { + local ($parent_node, $tag, $type) = @_; + + my %node; + $node{PARENT} = $parent_node; + $node{TYPE} = $type; + + if ($type eq 'COMMENT' || $type eq 'TEXT') { + $node{TEXT} = $tag; + $node{NAME} = $type; + return \%node; + } + + local ($tname, $attr) = split(' ', $tag, 2); + $node{NAME} = $tname; + + if (defined $attr && $attr ne '') { + my %attr_table; + local @attr_list = split ( /"/, $attr); + local ($name, $value); + while (scalar @attr_list) { + $name = shift @attr_list; + $name =~ s/[ =]//g; + next if ($name eq ''); + $value = shift @attr_list; + $attr_table{$name} =$value; + } + $node{ATTRIBUTES} = \%attr_table; + } + return \%node; +} + +sub add_node { + local ($parent_node, $node) = @_; + push @{$parent_node->{CHILDREN}}, $node; + + local $tname = $node->{NAME}; + if (defined $parent_node->{$tname}) { + push @{$parent_node->{$tname}}, $node + } else { + $parent_node->{$tname} = [ $node ]; + } +} + +sub empty_tag { + local ($parent_node, $tag) = @_; + local $node = new_node($parent_node, $tag, 'EMPTY'); + add_node($parent_node, $node); +} + +sub open_tag { + local ($parent_node, $tag) = @_; + local $node; + + if ($tag =~ /^\?.*/ || $tag =~ /^\!.*/) { + $node = new_node($parent_node, $tag, 'COMMENT'); + add_node($parent_node, $node); + undef; return; + } else { + $node = new_node($parent_node, $tag, 'NODE'); + $node->{CHILDREN} = []; + add_node($parent_node, $node); + return $node; + } +} + +sub add_text_node { + local ($parent_node, $text) = @_; + local $node = new_node($parent_node, $text, 'TEXT'); + add_node($parent_node, $node); +} + +sub node_by_name { + local ($node, $name) = @_; + local ($tagname, $path) = split(/\//, $name, 2); + + my @nodelist; + + if ($tagname eq '') { + while ($node->{PARENT} != 0) { + $node = $node->{PARENT}; + } + sublist_by_name($node, $path, \@nodelist); + } else { + sublist_by_name($node, $name, \@nodelist); + } + return @nodelist; +} + +sub sublist_by_name { + local ($node, $name, $res) = @_; + local ($tagname, $path) = split(/\//, $name, 2); + + if (! defined $path) { + push @{$res}, (@{$node->{$tagname}}); + return; + } + + if ($tagname eq '..' && $node->{PARENT} != 0) { + $node = $node->{PARENT}; + sublist_by_name($node, $path, $res); + } else { + local $n; + for $n (@{$node->{$tagname}}) { + sublist_by_name($n, $path, $res); + } + } +} + +sub node_attribute { + local $node = @_[0]; + if (defined $node->{ATTRIBUTES}) { + return $node->{ATTRIBUTES}{@_[1]}; + } + undef; +} + +sub text_child { + local ($node) = @_; + local ($child) = node_by_name($node, 'TEXT'); + return $child->{TEXT}; +} diff --git a/SPECS/kbd.spec b/SPECS/kbd.spec index 8c64d4c..f717b6e 100644 --- a/SPECS/kbd.spec +++ b/SPECS/kbd.spec @@ -1,6 +1,6 @@ Name: kbd Version: 1.15.5 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Tools for configuring the console (keyboard, virtual terminals, etc.) Group: System Environment/Base @@ -11,7 +11,8 @@ Source2: kbd-latsun-fonts.tar.bz2 Source3: kbd-latarcyrheb-16-fixed.tar.bz2 Source4: fr-dvorak.tar.bz2 Source5: kbd-latarcyrheb-32.tar.bz2 -Source6: vlock.pamd +Source6: xml2lst.pl +Source7: vlock.pamd # Patch0: puts additional information into man pages Patch0: kbd-1.15-keycodes-man.patch # Patch1: sparc modifications @@ -26,10 +27,14 @@ Patch4: kbd-1.15.5-loadkeys-regression.patch Patch5: kbd-1.15.5-sg-decimal-separator.patch # Patch6: implement PAM account and password management, backported from upstream Patch6: kbd-1.15.5-vlock-more-pam.patch +# Patch7: adds xkb and legacy keymaps subdirs to loadkyes search path, bz 1028207 +Patch7: kbd-1.15.5-loadkeys-search-path.patch BuildRequires: bison, flex, gettext, pam-devel +BuildRequires: console-setup, xkeyboard-config Requires: initscripts >= 5.86-1 Requires: %{name}-misc = %{version}-%{release} +Requires: %{name}-legacy = %{version}-%{release} Provides: vlock = %{version} Conflicts: vlock <= 1.3 Obsoletes: vlock @@ -47,8 +52,17 @@ BuildArch: noarch The %{name}-misc package contains data for kbd package - console fonts, keymaps etc. Please note that %{name}-misc is not helpful without kbd. +%package legacy +Summary: Legacy data for kbd package +BuildArch: noarch + +%description legacy +The %{name}-legacy package contains original keymaps for kbd package. +Please note that %{name}-legacy is not helpful without kbd. + %prep %setup -q -a 2 -a 3 -a 4 -a 5 +cp -fp %{SOURCE6} . %patch0 -p1 -b .keycodes-man %patch1 -p1 -b .sparc %patch2 -p1 -b .unicode_start @@ -56,6 +70,7 @@ keymaps etc. Please note that %{name}-misc is not helpful without kbd. %patch4 -p1 -b .loadkeys-regression %patch5 -p1 -b .sg-decimal-separator %patch6 -p1 -b .vlock-more-pam +%patch7 -p1 -b .loadkeys-search-path # 7-bit maps are obsolete; so are non-euro maps pushd data/keymaps/i386 @@ -122,7 +137,30 @@ rm -rf $RPM_BUILD_ROOT/lib/kbd/locale # Install PAM configuration for vlock mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/pam.d -install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vlock +install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vlock + +# Move original keymaps to legacy directory +mkdir -p $RPM_BUILD_ROOT/lib/kbd/keymaps/legacy +mv $RPM_BUILD_ROOT/lib/kbd/keymaps/{amiga,atari,i386,include,mac,ppc,sun} $RPM_BUILD_ROOT/lib/kbd/keymaps/legacy + +# Convert X keyboard layouts to console keymaps +mkdir -p $RPM_BUILD_ROOT/lib/kbd/keymaps/xkb +perl xml2lst.pl < /usr/share/X11/xkb/rules/base.xml > layouts-variants.lst +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/lib/kbd/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/lib/kbd/keymaps/xkb/"$line".map.gz +done < layouts-list-uniq.lst + +# wipe converted layouts which cannot input ASCII (#1031848) +zgrep -L "U+0041" $RPM_BUILD_ROOT/lib/kbd/keymaps/xkb/* | xargs rm -f %find_lang %{name} @@ -135,8 +173,16 @@ install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vlock %files misc /lib/kbd +%exclude /lib/kbd/keymaps/legacy + +%files legacy +/lib/kbd/keymaps/legacy %changelog +* Thu Sep 25 2014 Vitezslav Crhonek - 1.15.5-11 +- Include xkb layouts from xkeyboard-config converted to console keymaps + Resolves: #1122058 + * Fri Jan 24 2014 Daniel Mach - 1.15.5-10 - Mass rebuild 2014-01-24