Include xkb layouts from xkeyboard-config converted to console keymaps, Add version to vlock provides
This commit is contained in:
parent
0adac6327a
commit
4cc30104bc
21
kbd.spec
21
kbd.spec
@ -1,6 +1,6 @@
|
||||
Name: kbd
|
||||
Version: 1.15.5
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Tools for configuring the console (keyboard, virtual terminals, etc.)
|
||||
|
||||
Group: System Environment/Base
|
||||
@ -11,6 +11,7 @@ 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: xml2lst.pl
|
||||
# Patch0: puts additional information into man pages
|
||||
Patch0: kbd-1.15-keycodes-man.patch
|
||||
# Patch1: sparc modifications
|
||||
@ -23,9 +24,10 @@ Patch3: kbd-1.15.3-dumpkeys-man.patch
|
||||
Patch4: kbd-1.15.5-loadkeys-regression.patch
|
||||
|
||||
BuildRequires: bison, flex, gettext, pam-devel
|
||||
BuildRequires: console-setup, xkeyboard-config
|
||||
Requires: initscripts >= 5.86-1
|
||||
Requires: %{name}-misc = %{version}-%{release}
|
||||
Provides: vlock
|
||||
Provides: vlock = %{version}
|
||||
Conflicts: vlock <= 1.3
|
||||
|
||||
%description
|
||||
@ -43,6 +45,7 @@ keymaps etc. Please note that %{name}-misc 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
|
||||
@ -112,6 +115,15 @@ ln -s openvt $RPM_BUILD_ROOT%{_bindir}/open
|
||||
cp -r $RPM_BUILD_ROOT/lib/kbd/locale/ $RPM_BUILD_ROOT%{_datadir}/locale
|
||||
rm -rf $RPM_BUILD_ROOT/lib/kbd/locale
|
||||
|
||||
# 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`
|
||||
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
|
||||
|
||||
%find_lang %{name}
|
||||
|
||||
%files -f %{name}.lang
|
||||
@ -124,6 +136,11 @@ rm -rf $RPM_BUILD_ROOT/lib/kbd/locale
|
||||
/lib/kbd
|
||||
|
||||
%changelog
|
||||
* Tue Jan 22 2013 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.15.5-3
|
||||
- Include xkb layouts from xkeyboard-config converted to console keymaps
|
||||
- Add version to vlock provides
|
||||
Resolves: #902564
|
||||
|
||||
* Mon Jan 21 2013 Vitezslav Crhonek <vcrhonek@redhat.com> - 1.15.5-2
|
||||
- Fix loadkeys regression
|
||||
Resolves: #902259
|
||||
|
231
xml2lst.pl
Normal file
231
xml2lst.pl
Normal file
@ -0,0 +1,231 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# converts the <rules>.xml file to the old format <rules>.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};
|
||||
}
|
Loading…
Reference in New Issue
Block a user