New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate all tools behind one subtool #160
Conversation
a5cde78
to
e4e99c7
Compare
Updated, builds on Win/Macos now as well. Renamed to |
e4e99c7
to
6e36c6e
Compare
Rebased on top of #164 |
uhm, I don't know what I have to do to start the CI, it's not running for some reason. I've rebased this on top of #164 and did a bit more cleanup, I'd rather have any nontrivial stuff as follow-up patches, this is getting a bit painful to rebase. Notably: I've ditched the separate Other than that I think this is ready, or at least I've stared at it long enough now to not see the bugs. |
6e36c6e
to
7dec5f1
Compare
Fixes tag added for #161 and the force-push caused the test suite to run, so that's a win. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work.
I left some comments on the code.
Some larger comments:
-
Not sure about using
ronn
for the man pages (left a code comment). -
I'm a bit concerned about installing these tools when they are statically linked instead of linking to the system xkbcommon. I think it's not appropriate to install like this... The issue is that some tools use private APIs. I propose we remove the
install: true
temporarily in this PR (in a revertible commit) and merge it, and handle this issue separately as it would require some changes probably.
7dec5f1
to
1091ac3
Compare
Windows test case failure is the same as in #165 (comment) |
meson complains because this requires 0.50.0 and we don't require that. But since it defaults to false anyway, let's just omit it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We cannot add to configh_data after this command so let's generate this last. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Windows doesn't have getopt.h. This would prevent building the tools but they are behind other checks that cause them to be disabled. The only tools that don't need getopt.h are interactive-wayland and interactive-x11 but neither is particularly useful on Windows. Just hide all tools behind the getopt check in preparation for the upcoming tool consolidation work. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This is the base tool, no subtools are currently connected so you only get help and version for now. The goal here is to have a git-like infrastructure where /usr/bin/xkbcli is the main tool, anything else will hide in libexec. The infrastructure for this is copied from libinput. Tools themselves will will be installed in $prefix/libexec/xkbcommon and the xkbcli tool forks off whatever argv[1] is after modifying the PATH to include the libexec dir. libinput has additional code for checking whether we're running this from the builddir but it's a bit iffy and it's usefulness is limited - if you're in the builddir anyway you can just run ./builddir/xkbcli-<toolname> directly. So for this code here, running ./builddir/xkbcli <toolname> will execute the one in the prefix/libexecdir. Since we want that tool available everywhere even where some of the subtools aren't present, we need to ifdef the getopt handling. man page generation is handled via ronn which is a ruby program but allows markdown for the sources. It's hidden behind a meson option to disable where downloading ronn isn't an option. The setup is generic enough that we can add other man-pages by just appending to the array. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
1091ac3
to
132fc1c
Compare
The xkbcli tool usage help is ifdef'd out where the tool isn't built but the man page always includes all tools. Easier that way. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Requiring long options for this tool means it's immediately obvious what an invocation does, compare e.g. xkbcli interactive-evdev -gcd to the equivalent: xkbcli interactive-evdev --consumed-mode=gtk --enalbe-compose --report-state-changes This drops the evdev offset argument - that offset should never be anything other than 8, having this as argument here is more likely to confuse or produce misleading debugging logs. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This provides consistency with the other tools that now all take long options. Plus, it's more obvious to have the arguments spelled out. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
On all platforms we build on where getopt.h is available, getopt_long is also available. Only Windows doesn't have either but that's no reason for us to differentiate between the two. If we need to special-case getopt vs getopt_long, it's probably better to implement our own cross-platform version of it and use that. Fixes xkbcommon#161 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
A pytest wrapper around our xkbcli tool - copied from libinput. This calls our various xkbcli tools with varying options and check that they either succeed or return the right error code. The coverage is limited, it does not (and cannot) test for all possible combinations but it should provide a good red flag if we have inconsistent behavior or accidentally break some combination of flags. Meanwhile, we can at least assume that all our commandline arguments are parsed without segfaulting or worse. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
132fc1c
to
32bf408
Compare
@whot Please let me know when it's ready again. (And also mark comments as "Resolved" so it's easier to see if anything remains). |
Drop the ronn source files, check in the generated files instead. This gets rid of the ruby+gem+ronn toolchain requirement at the cost of having to edit raw man pages. ronn files are as-generated but with the preamble and generation date removed. The latter isn't important enough to keep, it'll just go stale for manually maintained files and it's not worth setting up a configure_file() just for that date. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
20feda2
to
41ec5b1
Compare
Sorry, only just saw this: I'm not 100% sure on static linking rules in distros but given the binaries come from the same repo as the shared library, I'm not sure it classifies. Rather hard to update |
This is merely to fill in some NULL pointers anyway, we can just use the #defines we have available at build time. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The tools previously linked against a static version (by simply recompiling everythiong). This isn't necessary, we can link them against libxkbcommon.so. Only exception: The xbkcli-compile-keymap tool needs a private API for the --kccgst flag. Avoid this by disabling this flag in the installed tool and building the same tool, statically linked but not-installed. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Ok, done. I removed the static linkage but this means we lose the tbh, I don't think we gain much here and the |
(and some more commits after that) |
Fixes #151
This PR adds a new tool
xkbcommon
which is thegit
-style parent tool to start the various other tools. Already included are:The infrastructure is copied from libinput which does the same thing with its tools. Having the forking approach makes code management easier, each subtool is still its own program and there's no requirement on programming language.
Man pages are generated via
ronn
which is a ruby program.scdoc
looked interesting but can only handle stdin as input and I don't know how well forking a shell during meson'scustom_target()
works on macos and windows. Ruby at works on all three platforms.This is still a draft, missing are:
how-to-type
getopt_long()
is conditional, so, urgh. See Why is getopt_long() optional? #161Anyway, I'd appreciate a quick peek and some heads-up about anything that'd be a blocker here. Thanks.