diff options
author | Kir Kolyshkin <kir@openvz.org> | 2016-12-17 14:22:15 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@virtuozzo.com> | 2017-03-15 00:09:57 +0300 |
commit | 7ad7ee4d6cd8fa3b5fc8057f85f0e3983cf6e97e (patch) | |
tree | 5cdc2186f4e737236e38fe89f50ec08ec198b856 /compel/src | |
parent | 616c6d172a0062bc9ef679e7c09a8025cb5f1410 (diff) |
compel cli: add plugins cmd, use it
A compel user should not be aware of compel internals, including
the paths to various files. This commit introduces a command to
get the plugin files (well, currently just one plugin, "std").
Example for uninstalled compel:
$ cd compel/test/infect/
$ ../../../compel/compel-host plugins
../../../compel/plugins/std.built-in
Example for installed compel:
$ compel plugins
/usr/libexec/compel/std.built-in.o
The commit also makes use of this command by compel/test/infect
and criu/pie.
travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'compel/src')
-rw-r--r-- | compel/src/main.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/compel/src/main.c b/compel/src/main.c index cd4753c1c..2d2351753 100644 --- a/compel/src/main.c +++ b/compel/src/main.c @@ -120,7 +120,7 @@ static int usage(int rc) { fprintf(out, "Usage:\n" -" compel [--compat] includes | cflags | ldflags\n" +" compel [--compat] includes | cflags | ldflags | plugins\n" " compel -f FILE -o FILE -p NAME [-l N] hgen\n" " -f, --file FILE input (parasite object) file name\n" " -o, --output FILE output (header) file name\n" @@ -182,12 +182,25 @@ static void print_ldflags(bool compat) } } +static void print_plugins(const char *list[]) +{ + while (*list != NULL) { + if (uninst_root) + printf("%s/plugins/%s.built-in.o\n", + uninst_root, *list); + else + printf("%s/compel/%s.built-in.o\n", LIBEXECDIR, *list); + list++; + } +} + int main(int argc, char *argv[]) { int log_level = DEFAULT_LOGLEVEL; bool compat = false; int opt, idx; char *action; + const char *plugins_list[] = { "std", NULL }; static const char short_opts[] = "cf:o:p:hVl:"; static struct option long_opts[] = { @@ -260,6 +273,13 @@ int main(int argc, char *argv[]) return 0; } + if (!strcmp(action, "plugins")) { + /* TODO: add option to specify additional plugins + * if/when we'll have any */ + print_plugins(plugins_list); + return 0; + } + if (!strcmp(action, "hgen")) { if (!opts.input_filename) { fprintf(stderr, "Error: option --file required\n"); |