cli: remove babeltrace2-log
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 29 Jul 2019 15:42:58 +0000 (11:42 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 2 Aug 2019 15:46:54 +0000 (11:46 -0400)
babeltrace-log (now renamed to babeltrace2-log) is a legacy tool
provided by Babeltrace 1 used to transform `dmesg` output to CTF.  The
version currently provided by Babeltrace 2 simply runs babeltrace2 with
a pre-defined graph topology.  It does nothing that a user couldn't do
on the command line.

The equivalent now would be:

    dmesg | babeltrace2 -c src.text.dmesg -o ctf -w /path/to/trace

It was therefore decided that it was no longer necessary to provide that
utility, and to remove it.

Change-Id: Id547bced56a8b9913cb152e1309919a15b6fbdd0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1796
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
configure.ac
doc/man/Makefile.am
doc/man/babeltrace2-log.1.txt [deleted file]
src/cli/Makefile.am
src/cli/babeltrace2-log.c [deleted file]
tests/utils/utils.sh

index cf89a9d50369004579793699d7b68e26b3c5e143..e4a0c86dcc8229119cfdd627617f7ca40eb17509 100644 (file)
@@ -679,7 +679,7 @@ CFLAGS=${save_CFLAGS}
 
 # Abuse autoconf's AC_ARG_PROGRAM output variable 'program_transform_name'
 # to rename babeltrace2.bin to babeltrace2 at install time.
-program_transform_name="s&babeltrace2\.bin&babeltrace2&;s&babeltrace2-log\.bin&babeltrace2-log&;$program_transform_name"
+program_transform_name="s&babeltrace2\.bin&babeltrace2&;$program_transform_name"
 AC_SUBST(program_transform_name)
 
 AC_CONFIG_FILES([
index 8cc9d4f34967bd51205fc447310be41ce51d45a6..850fdf04618e8b67a24c3149ae4ccd167d138092 100644 (file)
@@ -11,7 +11,6 @@ MAN1_NAMES = \
        babeltrace2-convert \
        babeltrace2-help \
        babeltrace2-list-plugins \
-       babeltrace2-log \
        babeltrace2-query \
        babeltrace2-run
 MAN7_NAMES = babeltrace2-filter.utils.muxer \
diff --git a/doc/man/babeltrace2-log.1.txt b/doc/man/babeltrace2-log.1.txt
deleted file mode 100644 (file)
index c88056c..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-babeltrace2-log(1)
-=================
-:manpagetype: program
-:revdate: 5 October 2017
-
-
-NAME
-----
-babeltrace2-log - Convert a Linux kernel ring buffer to a CTF trace
-
-
-SYNOPSIS
---------
-[verse]
-*babeltrace2-log* [opt:--with-timestamps] 'OUTPUT-PATH'
-
-
-DESCRIPTION
------------
-The `babeltrace2-log` tool reads the lines of a Linux kernel ring buffer,
-as printed by the man:dmesg(1) tool, from the standard input stream and
-converts them to a http://diamon.org/ctf/[CTF] trace written to the
-'OUTPUT-PATH' directory.
-
-Usage example:
-
-[role="term"]
-----
-$ dmesg | babeltrace2-log --with-timestamps my-trace
-----
-
-The events of the generated CTF trace are named `string` and contain a
-single payload string field named `str` which contains the corresponding
-ring buffer line.
-
-By default, `babeltrace2-log` does not try to extract the timestamps of
-the kernel ring buffer lines to use them as the created events's
-timestamps. A typical man:dmesg(1) line looks like this:
-
-----
-[87166.510937] PM: Finishing wakeup.
-----
-
-In the last example, the `[87166.510937]` part is a timestamp which
-could be extracted. You can make `babeltrace2-log` extract timestamps
-from lines with the opt:--with-timestamps option.
-
-
-OPTIONS
--------
-opt:-t, opt:--with-timestamps::
-    Extract timestamps from the kernel ring buffer lines: set
-    the created event's payload's `str` field to the rest of the line,
-    excluding any timestamp prefix.
-
-
-ENVIRONMENT VARIABLES
----------------------
-See the environment variables of man:babeltrace2-source.text.dmesg(7),
-man:babeltrace2-filter.utils.muxer(7), and
-man:babeltrace2-sink.ctf.fs(7).
-
-include::common-lib-env.txt[]
-
-include::common-cli-files.txt[]
-
-include::common-cmd-footer.txt[]
-
-
-SEE ALSO
---------
-man:babeltrace2-intro(7),
-man:babeltrace2-source.text.dmesg(7),
-man:babeltrace2-filter.utils.muxer(7),
-man:babeltrace2-sink.ctf.fs(7)
index d8946e448245f61a0bb04c1c1272bcc5ce5445d9..338a85faa8c1060425fbe8d54dba98e01c79974c 100644 (file)
@@ -17,8 +17,8 @@ if ENABLE_PYTHON_PLUGINS
 AM_CPPFLAGS += '-DCONFIG_IN_TREE_PROVIDER_DIR="$(abs_top_builddir)/src/python-plugin-provider/.libs"'
 endif
 
-bin_PROGRAMS = babeltrace2.bin babeltrace2-log.bin
-noinst_PROGRAMS = babeltrace2 babeltrace2-log
+bin_PROGRAMS = babeltrace2.bin
+noinst_PROGRAMS = babeltrace2
 
 babeltrace2_bin_SOURCES = \
        babeltrace2.c \
@@ -99,17 +99,3 @@ babeltrace2_SOURCES = $(babeltrace2_bin_SOURCES)
 babeltrace2_LDFLAGS = $(babeltrace2_bin_LDFLAGS)
 babeltrace2_LDADD = $(babeltrace2_bin_LDADD)
 babeltrace2_CFLAGS = $(AM_CFLAGS) -DBT_SET_DEFAULT_IN_TREE_CONFIGURATION
-
-# babeltrace2-log rules and config below
-babeltrace2_log_bin_SOURCES = babeltrace2-log.c
-babeltrace2_log_bin_LDADD = \
-       $(top_builddir)/src/compat/libcompat.la \
-       $(top_builddir)/src/common/libbabeltrace2-common.la \
-       $(top_builddir)/src/logging/libbabeltrace2-logging.la \
-       $(POPT_LIBS)
-babeltrace2_log_bin_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(abs_top_builddir)/src/cli/babeltrace2$(EXEEXT)"'
-
-# Only used for in-tree execution and tests
-babeltrace2_log_SOURCES = $(babeltrace2_log_bin_SOURCES)
-babeltrace2_log_LDADD = $(babeltrace2_log_bin_LDADD)
-babeltrace2_log_CFLAGS = $(AM_CFLAGS) '-DBT_CLI_PATH="$(bindir)/babeltrace2$(EXEEXT)"'
diff --git a/src/cli/babeltrace2-log.c b/src/cli/babeltrace2-log.c
deleted file mode 100644 (file)
index 59f34e5..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include "common/assert.h"
-#include <babeltrace2/babeltrace.h>
-#include <popt.h>
-#include <glib.h>
-
-static
-void print_usage(FILE *fp)
-{
-       fprintf(stderr, "Usage: babeltrace2-log [OPTIONS] OUTPUT-PATH\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "Options:\n");
-       fprintf(stderr, "\n");
-       fprintf(stderr, "  -t, --with-timestamps  Extract timestamps from lines and map them to\n");
-       fprintf(stderr, "                         a CTF clock class\n");
-}
-
-static
-int parse_params(int argc, char *argv[], char **output_path,
-               bool *no_extract_ts)
-{
-       enum {
-               OPT_WITH_TIMESTAMPS = 1,
-               OPT_HELP = 2,
-       };
-       static struct poptOption opts[] = {
-               { "with-timestamps", 't', POPT_ARG_NONE, NULL, OPT_WITH_TIMESTAMPS, NULL, NULL },
-               { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL },
-               { NULL, '\0', 0, NULL, 0, NULL, NULL },
-       };
-       poptContext pc = NULL;
-       int opt;
-       int ret = 0;
-       const char *leftover;
-
-       *no_extract_ts = true;
-       pc = poptGetContext(NULL, argc, (const char **) argv, opts, 0);
-       if (!pc) {
-               fprintf(stderr, "Cannot get popt context\n");
-               goto error;
-       }
-
-       poptReadDefaultConfig(pc, 0);
-
-       while ((opt = poptGetNextOpt(pc)) > 0) {
-               switch (opt) {
-               case OPT_HELP:
-                       print_usage(stdout);
-                       goto end;
-               case OPT_WITH_TIMESTAMPS:
-                       *no_extract_ts = false;
-                       break;
-               default:
-                       fprintf(stderr, "Unknown command-line option specified (option code %d)\n",
-                               opt);
-                       goto error;
-               }
-       }
-
-       if (opt < -1) {
-               fprintf(stderr, "While parsing command-line options, at option %s: %s\n",
-                       poptBadOption(pc, 0), poptStrerror(opt));
-               goto error;
-       }
-
-       leftover = poptGetArg(pc);
-       if (!leftover) {
-               fprintf(stderr, "Command line error: Missing output path\n");
-               print_usage(stderr);
-               goto error;
-       }
-
-       *output_path = strdup(leftover);
-       BT_ASSERT(*output_path);
-       goto end;
-
-error:
-       ret = 1;
-
-end:
-       if (pc) {
-               poptFreeContext(pc);
-       }
-
-       return ret;
-}
-
-int main(int argc, char *argv[])
-{
-       char *output_path = NULL;
-       bool no_extract_ts;
-       int retcode;
-       GError *error = NULL;
-       gchar *bt_argv[] = {
-               BT_CLI_PATH,
-               "run",
-               "--component",
-               "dmesg:src.text.dmesg",
-               "--params",
-               NULL, /* no-extract-timestamp=? placeholder */
-               "--component",
-               "ctf:sink.ctf.fs",
-               "--key",
-               "path",
-               "--value",
-               NULL, /* output path placeholder */
-               "--params",
-               "single-trace=yes",
-               "--connect",
-               "dmesg:ctf",
-               NULL, /* sentinel */
-       };
-
-       retcode = parse_params(argc, argv, &output_path, &no_extract_ts);
-       if (retcode) {
-               goto end;
-       }
-
-       if (no_extract_ts) {
-               bt_argv[5] = "no-extract-timestamp=yes";
-       } else {
-               bt_argv[5] = "no-extract-timestamp=no";
-       }
-
-       bt_argv[11] = output_path;
-       (void) g_spawn_sync(NULL, bt_argv, NULL,
-               G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL,
-               NULL, NULL, &retcode, &error);
-
-       if (error) {
-               fprintf(stderr, "Failed to execute \"%s\": %s (%d)\n",
-                       bt_argv[0], error->message, error->code);
-       }
-
-end:
-       free(output_path);
-
-       if (error) {
-               g_error_free(error);
-       }
-
-       return retcode;
-}
index a2a5c1dd966787ceadd232e4aa340f75f6c0899f..97de1c735fe498a8fadcf0c8d79212e7ba821c04 100644 (file)
@@ -85,14 +85,6 @@ if [ "x${BT_TESTS_BT2_BIN:-}" = "x" ]; then
 fi
 export BT_TESTS_BT2_BIN
 
-if [ "x${BT_TESTS_BT2LOG_BIN:-}" = "x" ]; then
-       BT_TESTS_BT2LOG_BIN="$BT_TESTS_BUILDDIR/../src/cli/babeltrace2-log"
-       if [ "$BT_OS_TYPE" = "mingw" ]; then
-               BT_TESTS_BT2LOG_BIN="${BT_TESTS_BT2LOG_BIN}.exe"
-       fi
-fi
-export BT_TESTS_BT2LOG_BIN
-
 # TODO: Remove when bindings/python/bt2/test_plugin.py is fixed
 BT_PLUGINS_PATH="${BT_TESTS_BUILDDIR}/../src/plugins"
 
This page took 0.031005 seconds and 4 git commands to generate.