Hello community,
here is the log from the commit of package libxkbcommon for openSUSE:Factory checked in at 2019-02-28 21:24:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libxkbcommon (Old)
and /work/SRC/openSUSE:Factory/.libxkbcommon.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libxkbcommon"
Thu Feb 28 21:24:54 2019 rev:26 rq:678388 version:0.8.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/libxkbcommon/libxkbcommon.changes 2019-02-11 21:16:25.491367865 +0100
+++ /work/SRC/openSUSE:Factory/.libxkbcommon.new.28833/libxkbcommon.changes 2019-02-28 21:24:56.593902205 +0100
@@ -1,0 +2,6 @@
+Fri Feb 22 21:58:27 UTC 2019 - Jan Engelhardt
+
+- Update to new upstream release 0.8.4
+ * Only changes to the build procedure.
+
+-------------------------------------------------------------------
Old:
----
libxkbcommon-0.8.3.tar.xz
New:
----
libxkbcommon-0.8.4.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libxkbcommon.spec ++++++
--- /var/tmp/diff_new_pack.JuO8Oc/_old 2019-02-28 21:24:57.133902024 +0100
+++ /var/tmp/diff_new_pack.JuO8Oc/_new 2019-02-28 21:24:57.137902023 +0100
@@ -23,7 +23,7 @@
%endif
Name: libxkbcommon
-Version: 0.8.3
+Version: 0.8.4
Release: 0
Summary: Library for handling xkb descriptions
License: MIT
++++++ libxkbcommon-0.8.3.tar.xz -> libxkbcommon-0.8.4.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/Makefile.am new/libxkbcommon-0.8.4/Makefile.am
--- old/libxkbcommon-0.8.3/Makefile.am 2018-08-24 08:19:28.000000000 +0200
+++ new/libxkbcommon-0.8.4/Makefile.am 2019-02-22 14:46:44.000000000 +0100
@@ -8,7 +8,9 @@
scripts/update-keywords \
scripts/doxygen-wrapper \
src/xkbcomp/keywords.gperf \
+ fuzz \
test/data \
+ test/xkeyboard-config-test.py.in \
README.md \
doc/quick-guide.md \
doc/compat.md \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/Makefile.in new/libxkbcommon-0.8.4/Makefile.in
--- old/libxkbcommon-0.8.3/Makefile.in 2019-02-08 11:40:45.000000000 +0100
+++ new/libxkbcommon-0.8.4/Makefile.in 2019-02-22 21:28:05.000000000 +0100
@@ -868,7 +868,9 @@
scripts/update-keywords \
scripts/doxygen-wrapper \
src/xkbcomp/keywords.gperf \
+ fuzz \
test/data \
+ test/xkeyboard-config-test.py.in \
README.md \
doc/quick-guide.md \
doc/compat.md \
@@ -2340,12 +2342,12 @@
-rm -f src/xkbcomp/parser.c
-rm -f src/xkbcomp/parser.h
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-@ENABLE_DOCS_FALSE@install-data-local:
-@HAVE_DOXYGEN_FALSE@install-data-local:
-@ENABLE_DOCS_FALSE@clean-local:
-@HAVE_DOXYGEN_FALSE@clean-local:
@ENABLE_DOCS_FALSE@uninstall-local:
@HAVE_DOXYGEN_FALSE@uninstall-local:
+@ENABLE_DOCS_FALSE@clean-local:
+@HAVE_DOXYGEN_FALSE@clean-local:
+@ENABLE_DOCS_FALSE@install-data-local:
+@HAVE_DOXYGEN_FALSE@install-data-local:
clean: clean-am
clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/NEWS new/libxkbcommon-0.8.4/NEWS
--- old/libxkbcommon-0.8.3/NEWS 2019-02-08 11:37:52.000000000 +0100
+++ new/libxkbcommon-0.8.4/NEWS 2019-02-22 21:26:05.000000000 +0100
@@ -1,7 +1,16 @@
+libxkbcommon 0.8.4 - 2019-02-22
+==================
+
+- Fix build of xkbcommon-x11 static library with meson.
+
+- Fix building using meson from the tarball generated by autotools.
+
+
libxkbcommon 0.8.3 - 2019-02-08
==================
- Fix build of static libraries with meson.
+ (Future note: xkbcommon-x11 was *not* fixed in this release.)
- New API:
XKB_KEY_XF86MonBrightnessCycle
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/configure new/libxkbcommon-0.8.4/configure
--- old/libxkbcommon-0.8.3/configure 2019-02-08 11:40:43.000000000 +0100
+++ new/libxkbcommon-0.8.4/configure 2019-02-22 21:28:03.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libxkbcommon 0.8.3.
+# Generated by GNU Autoconf 2.69 for libxkbcommon 0.8.4.
#
# Report bugs to https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon.
#
@@ -591,8 +591,8 @@
# Identity of this package.
PACKAGE_NAME='libxkbcommon'
PACKAGE_TARNAME='libxkbcommon'
-PACKAGE_VERSION='0.8.3'
-PACKAGE_STRING='libxkbcommon 0.8.3'
+PACKAGE_VERSION='0.8.4'
+PACKAGE_STRING='libxkbcommon 0.8.4'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon'
PACKAGE_URL='https://xkbcommon.org'
@@ -1396,7 +1396,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libxkbcommon 0.8.3 to adapt to many kinds of systems.
+\`configure' configures libxkbcommon 0.8.4 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1466,7 +1466,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libxkbcommon 0.8.3:";;
+ short | recursive ) echo "Configuration of libxkbcommon 0.8.4:";;
esac
cat <<\_ACEOF
@@ -1631,7 +1631,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libxkbcommon configure 0.8.3
+libxkbcommon configure 0.8.4
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2046,7 +2046,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libxkbcommon $as_me 0.8.3, which was
+It was created by libxkbcommon $as_me 0.8.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2915,7 +2915,7 @@
# Define the identity of the package.
PACKAGE='libxkbcommon'
- VERSION='0.8.3'
+ VERSION='0.8.4'
cat >>confdefs.h <<_ACEOF
@@ -20632,7 +20632,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libxkbcommon $as_me 0.8.3, which was
+This file was extended by libxkbcommon $as_me 0.8.4, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -20699,7 +20699,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libxkbcommon config.status 0.8.3
+libxkbcommon config.status 0.8.4
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/configure.ac new/libxkbcommon-0.8.4/configure.ac
--- old/libxkbcommon-0.8.3/configure.ac 2019-02-08 11:38:48.000000000 +0100
+++ new/libxkbcommon-0.8.4/configure.ac 2019-02-22 21:26:34.000000000 +0100
@@ -22,7 +22,7 @@
# Initialize Autoconf
AC_PREREQ([2.63])
-AC_INIT([libxkbcommon], [0.8.3],
+AC_INIT([libxkbcommon], [0.8.4],
[https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon],
[libxkbcommon], [https://xkbcommon.org])
AC_CONFIG_SRCDIR([Makefile.am])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/.gitignore new/libxkbcommon-0.8.4/fuzz/.gitignore
--- old/libxkbcommon-0.8.3/fuzz/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/.gitignore 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1 @@
+findings/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/compose/dict new/libxkbcommon-0.8.4/fuzz/compose/dict
--- old/libxkbcommon-0.8.3/fuzz/compose/dict 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/compose/dict 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,8 @@
+"Ctrl"
+"Lock"
+"Caps"
+"Shift"
+"Alt"
+"Meta"
+"None"
+"acute"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/compose/target.c new/libxkbcommon-0.8.4/fuzz/compose/target.c
--- old/libxkbcommon-0.8.3/fuzz/compose/target.c 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/compose/target.c 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,45 @@
+/*
+ * A target program for fuzzing the Compose text format.
+ *
+ * Currently, just parses an input file, and hopefully doesn't crash or hang.
+ */
+
+#include
+
+#include "xkbcommon/xkbcommon.h"
+#include "xkbcommon/xkbcommon-compose.h"
+
+int
+main(int argc, char *argv[])
+{
+ struct xkb_context *ctx;
+ FILE *file;
+ struct xkb_compose_table *table;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <file>\n", argv[0]);
+ return 1;
+ }
+
+ ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES | XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
+ assert(ctx);
+
+#ifdef __AFL_HAVE_MANUAL_CONTROL
+ __AFL_INIT();
+
+ while (__AFL_LOOP(1000))
+#endif
+ {
+ file = fopen(argv[1], "r");
+ assert(file);
+ table = xkb_compose_table_new_from_file(ctx, file,
+ "en_US.UTF-8",
+ XKB_COMPOSE_FORMAT_TEXT_V1,
+ XKB_COMPOSE_COMPILE_NO_FLAGS);
+ xkb_compose_table_unref(table);
+ fclose(file);
+ }
+
+ puts(table ? "OK" : "FAIL");
+ xkb_context_unref(ctx);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/compose/testcases/Compose new/libxkbcommon-0.8.4/fuzz/compose/testcases/Compose
--- old/libxkbcommon-0.8.3/fuzz/compose/testcases/Compose 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/compose/testcases/Compose 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,2 @@
+ <space> : "~" asciitilde # X
+Meta !Alt ~Shift <apostrophe> <apostrophe> : "\"\'\x43\123abc" acute # Y
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/fuzz.sh new/libxkbcommon-0.8.4/fuzz/fuzz.sh
--- old/libxkbcommon-0.8.3/fuzz/fuzz.sh 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/fuzz.sh 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+case "$1" in
+ keymap|compose)
+ ;;
+ *)
+ echo "usage: $0 keymap|compose" 1>&2
+ exit 1
+ ;;
+esac
+
+export CC=afl-clang-fast
+export AFL_HARDEN=1
+test -d fuzz/build || meson setup -Db_lto=true fuzz/build
+ninja -C fuzz/build
+afl-fuzz -i fuzz/$1/testcases -x fuzz/$1/dict -o fuzz/$1/findings -t 200 -m 10 -- ./fuzz/build/fuzz-$1 @@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/keymap/dict new/libxkbcommon-0.8.4/fuzz/keymap/dict
--- old/libxkbcommon-0.8.3/fuzz/keymap/dict 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/keymap/dict 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,120 @@
+"Control"
+"Group1"
+"Group5"
+"Lock"
+"Mod1"
+"Mod9"
+"Shift"
+"U1"
+"0x1"
+"Up"
+"accel"
+"action"
+"actions"
+"affect"
+"alias"
+"all"
+"allowexplicit"
+"allownone"
+"alphanumeric_keys"
+"alternate"
+"alternate_group"
+"any"
+"augment"
+"both"
+"button"
+"clearLocks"
+"clearmods"
+"controls"
+"count"
+"ctrls"
+"data"
+"default"
+"dev"
+"device"
+"dfltbtn"
+"driveskbd"
+"false"
+"foo"
+"function_keys"
+"genKeyEvent"
+"group"
+"groupname"
+"groups"
+"groupsclamp"
+"groupsredirect"
+"groupswrap"
+"hidden"
+"include"
+"increment"
+"index"
+"indicator"
+"indicatordriveskbd"
+"interpret"
+"kc"
+"key"
+"keycode"
+"keypad_keys"
+"keys"
+"latchToLock"
+"leddriveskbd"
+"levelname"
+"lock"
+"locking"
+"logo"
+"map"
+"mod_map"
+"modifier_keys"
+"modifier_map"
+"modifiers"
+"modmap"
+"modmapmods"
+"mods"
+"name"
+"neither"
+"no"
+"none"
+"nosymbol"
+"off"
+"on"
+"outline"
+"overlay"
+"override"
+"partial"
+"preserve"
+"radiogroup"
+"repeat"
+"replace"
+"report"
+"row"
+"same"
+"sameServer"
+"screen"
+"section"
+"shape"
+"solid"
+"symbols"
+"text"
+"true"
+"type"
+"unlock"
+"usemodmap"
+"value"
+"virtual"
+"virtual_modifiers"
+"virtualmod"
+"vmods"
+"voidsymbol"
+"whichgroupstate"
+"whichmodstate"
+"x"
+"xkb_compat"
+"xkb_geometry"
+"xkb_keycodes"
+"xkb_keymap"
+"xkb_layout"
+"xkb_semantics"
+"xkb_symbols"
+"xkb_types"
+"y"
+"yes"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/keymap/target.c new/libxkbcommon-0.8.4/fuzz/keymap/target.c
--- old/libxkbcommon-0.8.3/fuzz/keymap/target.c 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/keymap/target.c 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,43 @@
+/*
+ * A target program for fuzzing the XKB keymap text format.
+ *
+ * Currently, just parses an input file, and hopefully doesn't crash or hang.
+ */
+
+#include
+
+#include "xkbcommon/xkbcommon.h"
+
+int
+main(int argc, char *argv[])
+{
+ struct xkb_context *ctx;
+ FILE *file;
+ struct xkb_keymap *keymap;
+
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <file>\n", argv[0]);
+ return 1;
+ }
+
+ ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES | XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
+ assert(ctx);
+
+#ifdef __AFL_HAVE_MANUAL_CONTROL
+ __AFL_INIT();
+
+ while (__AFL_LOOP(1000))
+#endif
+ {
+ file = fopen(argv[1], "r");
+ assert(file);
+ keymap = xkb_keymap_new_from_file(ctx, file,
+ XKB_KEYMAP_FORMAT_TEXT_V1,
+ XKB_KEYMAP_COMPILE_NO_FLAGS);
+ xkb_keymap_unref(keymap);
+ fclose(file);
+ }
+
+ puts(keymap ? "OK" : "FAIL");
+ xkb_context_unref(ctx);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/fuzz/keymap/testcases/input.xkb new/libxkbcommon-0.8.4/fuzz/keymap/testcases/input.xkb
--- old/libxkbcommon-0.8.3/fuzz/keymap/testcases/input.xkb 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/fuzz/keymap/testcases/input.xkb 2018-07-30 09:35:10.000000000 +0200
@@ -0,0 +1,59 @@
+xkb_keymap{
+xkb_keycodes"0"{
+minimum=0;
+maximum=500;
+<a>=0;
+indicator 1="X";
+alias<X>=<Y>;
+};
+xkb_types"X"{
+virtual_modifiers NumLock;
+type"X"{
+modifiers=Shift;
+map[Shift]=Level2;
+level_name[Level1]="X";
+preserve[Shift]=Shift;
+};
+};
+partial xkb_compat{
+virtual_modifiers Alt;
+interpret.useModMapMods=AnyLevel;
+interpret.repeat=False;
+interpret.locking=False;
+interpret ISO_Level2_Latch+Exactly(Shift){
+repeat=True;
+virtualModifier=NumLock;
+useModMapMods=level1;
+action=LatchMods(modifiers=Shift,clearLocks,latchToLock);
+action=MovePtr(x=+0,y=-0);
+action=SwitchScreen(screen=00,!same);
+action=Private(type=0x80,data[0]=0x00);
+};
+indicator"X"{whichModState=locked;modifiers=Lock;};
+};
+xkb_symbols{
+name[group1]="X";
+key<Y>{type[group2]="X",symbols[Group1]=[0,exclam],symbols[Group2]=[0xff,U00],symbols[Group3]=[z]};
+modifier_map Control{<a>};
+};
+default xkb_geometry"X"{
+description="X";
+width=470;
+shape.cornerRadius=1;
+shape"NORM"{cornerRadius=0,{[0.0,0]},{[0,0],[0,0.0]}};
+solid"X"{shape="X";top=00;left=00;color="X";};
+indicator.onColor="X";
+indicator.top=00.0;
+indicator.shape="X";
+indicator"X"{left=0;};
+text.top=00;
+text.color="X";
+text"X"{left=0;text="X";};
+section.left=00;
+row.left=0;
+key.shape="X";
+key.gap=1;
+section"X"{top=22;row{top=1;keys{{<X>,color="X"},{<X>,00.0},<X>,<X>,<X>};};};
+alias<AC00>=<CAPS>;
+};
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/meson.build new/libxkbcommon-0.8.4/meson.build
--- old/libxkbcommon-0.8.3/meson.build 2019-02-08 11:38:55.000000000 +0100
+++ new/libxkbcommon-0.8.4/meson.build 2019-02-22 21:26:43.000000000 +0100
@@ -1,7 +1,7 @@
project(
'libxkbcommon',
'c',
- version: '0.8.3',
+ version: '0.8.4',
default_options: [
'c_std=c99',
'warning_level=2',
@@ -217,8 +217,7 @@
You can disable X11 support with -Denable-x11=false.''')
endif
- libxkbcommon_x11_internal = static_library(
- 'xkbcommon-x11-internal',
+ libxkbcommon_x11_sources = [
'src/x11/keymap.c',
'src/x11/state.c',
'src/x11/util.c',
@@ -229,6 +228,10 @@
'src/keymap-priv.c',
'src/atom.h',
'src/atom.c',
+ ]
+ libxkbcommon_x11_internal = static_library(
+ 'xkbcommon-x11-internal',
+ libxkbcommon_x11_sources,
include_directories: include_directories('src'),
link_with: libxkbcommon,
dependencies: [
@@ -243,11 +246,17 @@
libxkbcommon_x11 = library(
'xkbcommon-x11',
'xkbcommon/xkbcommon-x11.h',
- link_whole: libxkbcommon_x11_internal,
+ libxkbcommon_x11_sources,
link_args: libxkbcommon_x11_link_args,
link_depends: 'xkbcommon-x11.map',
version: '0.0.0',
install: true,
+ include_directories: include_directories('src'),
+ link_with: libxkbcommon,
+ dependencies: [
+ xcb_dep,
+ xcb_xkb_dep,
+ ],
)
install_headers(
'xkbcommon/xkbcommon-x11.h',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libxkbcommon-0.8.3/test/xkeyboard-config-test.py.in new/libxkbcommon-0.8.4/test/xkeyboard-config-test.py.in
--- old/libxkbcommon-0.8.3/test/xkeyboard-config-test.py.in 1970-01-01 01:00:00.000000000 +0100
+++ new/libxkbcommon-0.8.4/test/xkeyboard-config-test.py.in 2018-08-24 08:19:28.000000000 +0200
@@ -0,0 +1,129 @@
+#!/usr/bin/env python
+import sys
+import subprocess
+import os
+import xml.etree.ElementTree as ET
+
+
+verbose = True
+
+DEFAULT_RULES_XML = '@XKB_CONFIG_ROOT@/rules/evdev.xml'
+
+# Meson needs to fill this in so we can call the tool in the buildir.
+EXTRA_PATH='@MESON_BUILD_ROOT@'
+os.environ['PATH'] = ':'.join([EXTRA_PATH, os.getenv('PATH')])
+
+
+# The function generating the progress bar (if any).
+progress_bar = lambda x, desc: x
+if os.isatty(sys.stdout.fileno()):
+ try:
+ from tqdm import tqdm
+ progress_bar = tqdm
+
+ verbose = False
+ except ImportError:
+ pass
+
+
+def xkbcommontool(r='evdev', m='pc105', l='us', v=None, o=None):
+ args = [
+ 'rmlvo-to-keymap',
+ '--rules', r,
+ '--model', m,
+ '--layout', l,
+ ]
+ if v is not None:
+ args += ['--variant', v]
+ if o is not None:
+ args += ['--options', o]
+
+ if verbose:
+ print(':: {}'.format(' '.join(args)))
+
+ try:
+ output = subprocess.check_output(args, stderr=subprocess.STDOUT)
+ if verbose:
+ print(output.decode('utf-8'))
+ except subprocess.CalledProcessError as err:
+ print('ERROR: Failed to compile: {}'.format(' '.join(args)))
+ print(err.output.decode('utf-8'))
+ sys.exit(1)
+
+
+def xkbcomp(r='evdev', m='pc105', l='us', v='', o=''):
+ args = ['setxkbmap', '-print']
+ if r is not None:
+ args.append('-rules')
+ args.append('{}'.format(r))
+ if m is not None:
+ args.append('-model')
+ args.append('{}'.format(m))
+ if l is not None:
+ args.append('-layout')
+ args.append('{}'.format(l))
+ if o is not None:
+ args.append('-option')
+ args.append('{}'.format(o))
+
+ if verbose:
+ print(':: {}'.format(' '.join(args)))
+
+ try:
+ xkbcomp_args = ['xkbcomp', '-xkb', '-', '-']
+
+ setxkbmap = subprocess.Popen(args, stdout=subprocess.PIPE)
+ xkbcomp = subprocess.Popen(xkbcomp_args, stdin=setxkbmap.stdout,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ setxkbmap.stdout.close()
+ stdout, stderr = xkbcomp.communicate()
+ if xkbcomp.returncode != 0:
+ print('ERROR: Failed to compile: {}'.format(' '.join(args)))
+ if xkbcomp.returncode != 0 or verbose:
+ print(stdout.decode('utf-8'))
+ print(stderr.decode('utf-8'))
+
+ # This catches setxkbmap errors.
+ except subprocess.CalledProcessError as err:
+ print('ERROR: Failed to compile: {}'.format(' '.join(args)))
+ print(err.output.decode('utf-8'))
+
+
+def parse(root):
+ layouts = root.findall('layoutList/layout')
+
+ options = [
+ e.text
+ for e in root.findall('optionList/group/option/configItem/name')
+ ]
+
+ # Switch this to xkbcomp if needed.
+ tool = xkbcommontool
+ # tool = xkbcomp
+
+ for l in progress_bar(layouts, 'layout '):
+ layout = l.find('configItem/name').text
+ tool(l=layout)
+
+ variants = l.findall('variantList/variant')
+ for v in progress_bar(variants, 'variant'):
+ variant = v.find('configItem/name').text
+ tool(l=layout, v=variant)
+
+ for option in progress_bar(options, 'option '):
+ tool(l=layout, v=variant, o=option)
+
+
+def main(args):
+ try:
+ path = args[1]
+ except IndexError:
+ path = DEFAULT_RULES_XML
+
+ with open(path) as f:
+ root = ET.fromstring(f.read())
+ parse(root)
+
+
+if __name__ == '__main__':
+ main(sys.argv)