linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] perf tools: Basic bash completion support v3
@ 2012-08-09 14:31 Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 14:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, David Ahern, Ingo Molnar, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian

Changes since v2:

- Fix /etc config installation from Namhyung.

Frederic Weisbecker (2):
  perf tools: Initial bash completion support
  perf tools: Support for events bash completion

Namhyung Kim (1):
  perf tools: Fix /etc config related installation

 tools/perf/Makefile            |    3 ++
 tools/perf/bash_completion     |   26 +++++++++++++++
 tools/perf/builtin-list.c      |   14 ++++---
 tools/perf/perf.c              |   69 ++++++++++++++++++++++-----------------
 tools/perf/util/parse-events.c |   70 +++++++++++++++++++++++++---------------
 tools/perf/util/parse-events.h |    7 ++--
 6 files changed, 124 insertions(+), 65 deletions(-)
 create mode 100644 tools/perf/bash_completion

-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 14:31 [PATCH 0/3] perf tools: Basic bash completion support v3 Frederic Weisbecker
@ 2012-08-09 14:31 ` Frederic Weisbecker
  2012-08-09 16:35   ` Arnaldo Carvalho de Melo
  2012-08-21 15:38   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 2/3] perf tools: Support for events bash completion Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 3/3] perf tools: Fix /etc config related installation Frederic Weisbecker
  2 siblings, 2 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 14:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, David Ahern, Ingo Molnar, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian

This implements bash completion for perf subcommands such
as record, report, script, probe, etc...

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile        |    1 +
 tools/perf/bash_completion |   22 ++++++++++++++
 tools/perf/perf.c          |   69 +++++++++++++++++++++++++-------------------
 3 files changed, 62 insertions(+), 30 deletions(-)
 create mode 100644 tools/perf/bash_completion

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2d4bf6e..84b4227 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -951,6 +951,7 @@ install: all
 	$(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
 	$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
 	$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+	$(INSTALL) -m 755 bash_completion $(DESTDIR_SQ)/etc/bash_completion.d/perf
 
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
new file mode 100644
index 0000000..9a31fa5
--- /dev/null
+++ b/tools/perf/bash_completion
@@ -0,0 +1,22 @@
+# perf completion
+
+have perf &&
+_perf()
+{
+	local cur cmd
+
+	COMPREPLY=()
+	_get_comp_words_by_ref cur
+
+	cmd=${COMP_WORDS[0]}
+
+	# List perf subcommands
+	if [ $COMP_CWORD -eq 1 ]; then
+		cmds=$($cmd --list-cmds)
+		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+	# Fall down to list regular files
+	else
+		_filedir
+	fi
+} &&
+complete -F _perf perf
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 2b2e225..db37ee3 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -24,6 +24,37 @@ const char perf_more_info_string[] =
 int use_browser = -1;
 static int use_pager = -1;
 
+struct cmd_struct {
+	const char *cmd;
+	int (*fn)(int, const char **, const char *);
+	int option;
+};
+
+static struct cmd_struct commands[] = {
+	{ "buildid-cache", cmd_buildid_cache, 0 },
+	{ "buildid-list", cmd_buildid_list, 0 },
+	{ "diff",	cmd_diff,	0 },
+	{ "evlist",	cmd_evlist,	0 },
+	{ "help",	cmd_help,	0 },
+	{ "list",	cmd_list,	0 },
+	{ "record",	cmd_record,	0 },
+	{ "report",	cmd_report,	0 },
+	{ "bench",	cmd_bench,	0 },
+	{ "stat",	cmd_stat,	0 },
+	{ "timechart",	cmd_timechart,	0 },
+	{ "top",	cmd_top,	0 },
+	{ "annotate",	cmd_annotate,	0 },
+	{ "version",	cmd_version,	0 },
+	{ "script",	cmd_script,	0 },
+	{ "sched",	cmd_sched,	0 },
+	{ "probe",	cmd_probe,	0 },
+	{ "kmem",	cmd_kmem,	0 },
+	{ "lock",	cmd_lock,	0 },
+	{ "kvm",	cmd_kvm,	0 },
+	{ "test",	cmd_test,	0 },
+	{ "inject",	cmd_inject,	0 },
+};
+
 struct pager_config {
 	const char *cmd;
 	int val;
@@ -160,6 +191,14 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			fprintf(stderr, "dir: %s\n", debugfs_mountpoint);
 			if (envchanged)
 				*envchanged = 1;
+		} else if (!strcmp(cmd, "--list-cmds")) {
+			unsigned int i;
+
+			for (i = 0; i < ARRAY_SIZE(commands); i++) {
+				struct cmd_struct *p = commands+i;
+				printf("%s ", p->cmd);
+			}
+			exit(0);
 		} else {
 			fprintf(stderr, "Unknown option: %s\n", cmd);
 			usage(perf_usage_string);
@@ -245,12 +284,6 @@ const char perf_version_string[] = PERF_VERSION;
  */
 #define NEED_WORK_TREE	(1<<2)
 
-struct cmd_struct {
-	const char *cmd;
-	int (*fn)(int, const char **, const char *);
-	int option;
-};
-
 static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 {
 	int status;
@@ -296,30 +329,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 static void handle_internal_command(int argc, const char **argv)
 {
 	const char *cmd = argv[0];
-	static struct cmd_struct commands[] = {
-		{ "buildid-cache", cmd_buildid_cache, 0 },
-		{ "buildid-list", cmd_buildid_list, 0 },
-		{ "diff",	cmd_diff,	0 },
-		{ "evlist",	cmd_evlist,	0 },
-		{ "help",	cmd_help,	0 },
-		{ "list",	cmd_list,	0 },
-		{ "record",	cmd_record,	0 },
-		{ "report",	cmd_report,	0 },
-		{ "bench",	cmd_bench,	0 },
-		{ "stat",	cmd_stat,	0 },
-		{ "timechart",	cmd_timechart,	0 },
-		{ "top",	cmd_top,	0 },
-		{ "annotate",	cmd_annotate,	0 },
-		{ "version",	cmd_version,	0 },
-		{ "script",	cmd_script,	0 },
-		{ "sched",	cmd_sched,	0 },
-		{ "probe",	cmd_probe,	0 },
-		{ "kmem",	cmd_kmem,	0 },
-		{ "lock",	cmd_lock,	0 },
-		{ "kvm",	cmd_kvm,	0 },
-		{ "test",	cmd_test,	0 },
-		{ "inject",	cmd_inject,	0 },
-	};
 	unsigned int i;
 	static const char ext[] = STRIP_EXTENSION;
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] perf tools: Support for events bash completion
  2012-08-09 14:31 [PATCH 0/3] perf tools: Basic bash completion support v3 Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
@ 2012-08-09 14:31 ` Frederic Weisbecker
  2012-08-21 15:39   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 3/3] perf tools: Fix /etc config related installation Frederic Weisbecker
  2 siblings, 1 reply; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 14:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, David Ahern, Ingo Molnar, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian

Add basic bash completion for the -e option in record, top
and stat subcommands. Only hardware, software and tracepoint
events are supported.

Breakpoints, raw events and events grouping completion
need more thinking.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/bash_completion     |    6 +++-
 tools/perf/builtin-list.c      |   14 ++++---
 tools/perf/util/parse-events.c |   70 +++++++++++++++++++++++++---------------
 tools/perf/util/parse-events.h |    7 ++--
 4 files changed, 61 insertions(+), 36 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 9a31fa5..1958fa5 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -6,7 +6,7 @@ _perf()
 	local cur cmd
 
 	COMPREPLY=()
-	_get_comp_words_by_ref cur
+	_get_comp_words_by_ref cur prev
 
 	cmd=${COMP_WORDS[0]}
 
@@ -14,6 +14,10 @@ _perf()
 	if [ $COMP_CWORD -eq 1 ]; then
 		cmds=$($cmd --list-cmds)
 		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+	# List possible events for -e option
+	elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
+		cmds=$($cmd list --raw-dump)
+		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
 	# Fall down to list regular files
 	else
 		_filedir
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 6313b6e..bdcff81 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -19,15 +19,15 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 	setup_pager();
 
 	if (argc == 1)
-		print_events(NULL);
+		print_events(NULL, false);
 	else {
 		int i;
 
 		for (i = 1; i < argc; ++i) {
-			if (i > 1)
+			if (i > 2)
 				putchar('\n');
 			if (strncmp(argv[i], "tracepoint", 10) == 0)
-				print_tracepoint_events(NULL, NULL);
+				print_tracepoint_events(NULL, NULL, false);
 			else if (strcmp(argv[i], "hw") == 0 ||
 				 strcmp(argv[i], "hardware") == 0)
 				print_events_type(PERF_TYPE_HARDWARE);
@@ -36,13 +36,15 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 				print_events_type(PERF_TYPE_SOFTWARE);
 			else if (strcmp(argv[i], "cache") == 0 ||
 				 strcmp(argv[i], "hwcache") == 0)
-				print_hwcache_events(NULL);
+				print_hwcache_events(NULL, false);
+			else if (strcmp(argv[i], "--raw-dump") == 0)
+				print_events(NULL, true);
 			else {
 				char *sep = strchr(argv[i], ':'), *s;
 				int sep_idx;
 
 				if (sep == NULL) {
-					print_events(argv[i]);
+					print_events(argv[i], false);
 					continue;
 				}
 				sep_idx = sep - argv[i];
@@ -51,7 +53,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 					return -1;
 
 				s[sep_idx] = '\0';
-				print_tracepoint_events(s, s + sep_idx + 1);
+				print_tracepoint_events(s, s + sep_idx + 1, false);
 				free(s);
 			}
 		}
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 8bdfa3e..3ec4bfc 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -799,7 +799,8 @@ static const char * const event_type_descriptors[] = {
  * Print the events from <debugfs_mount_point>/tracing/events
  */
 
-void print_tracepoint_events(const char *subsys_glob, const char *event_glob)
+void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
+			     bool name_only)
 {
 	DIR *sys_dir, *evt_dir;
 	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
@@ -829,6 +830,11 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob)
 			    !strglobmatch(evt_dirent.d_name, event_glob))
 				continue;
 
+			if (name_only) {
+				printf("%s:%s ", sys_dirent.d_name, evt_dirent.d_name);
+				continue;
+			}
+
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
 				 sys_dirent.d_name, evt_dirent.d_name);
 			printf("  %-50s [%s]\n", evt_path,
@@ -906,7 +912,7 @@ void print_events_type(u8 type)
 		__print_events_type(type, event_symbols_hw, PERF_COUNT_HW_MAX);
 }
 
-int print_hwcache_events(const char *event_glob)
+int print_hwcache_events(const char *event_glob, bool name_only)
 {
 	unsigned int type, op, i, printed = 0;
 	char name[64];
@@ -923,8 +929,11 @@ int print_hwcache_events(const char *event_glob)
 				if (event_glob != NULL && !strglobmatch(name, event_glob))
 					continue;
 
-				printf("  %-50s [%s]\n", name,
-					event_type_descriptors[PERF_TYPE_HW_CACHE]);
+				if (name_only)
+					printf("%s ", name);
+				else
+					printf("  %-50s [%s]\n", name,
+					       event_type_descriptors[PERF_TYPE_HW_CACHE]);
 				++printed;
 			}
 		}
@@ -934,7 +943,8 @@ int print_hwcache_events(const char *event_glob)
 }
 
 static void print_symbol_events(const char *event_glob, unsigned type,
-				struct event_symbol *syms, unsigned max)
+				struct event_symbol *syms, unsigned max,
+				bool name_only)
 {
 	unsigned i, printed = 0;
 	char name[MAX_NAME_LEN];
@@ -946,6 +956,11 @@ static void print_symbol_events(const char *event_glob, unsigned type,
 		      (syms->alias && strglobmatch(syms->alias, event_glob))))
 			continue;
 
+		if (name_only) {
+			printf("%s ", syms->symbol);
+			continue;
+		}
+
 		if (strlen(syms->alias))
 			snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
 		else
@@ -963,39 +978,42 @@ static void print_symbol_events(const char *event_glob, unsigned type,
 /*
  * Print the help text for the event symbols:
  */
-void print_events(const char *event_glob)
+void print_events(const char *event_glob, bool name_only)
 {
-
-	printf("\n");
-	printf("List of pre-defined events (to be used in -e):\n");
+	if (!name_only) {
+		printf("\n");
+		printf("List of pre-defined events (to be used in -e):\n");
+	}
 
 	print_symbol_events(event_glob, PERF_TYPE_HARDWARE,
-			    event_symbols_hw, PERF_COUNT_HW_MAX);
+			    event_symbols_hw, PERF_COUNT_HW_MAX, name_only);
 
 	print_symbol_events(event_glob, PERF_TYPE_SOFTWARE,
-			    event_symbols_sw, PERF_COUNT_SW_MAX);
+			    event_symbols_sw, PERF_COUNT_SW_MAX, name_only);
 
-	print_hwcache_events(event_glob);
+	print_hwcache_events(event_glob, name_only);
 
 	if (event_glob != NULL)
 		return;
 
-	printf("\n");
-	printf("  %-50s [%s]\n",
-	       "rNNN",
-	       event_type_descriptors[PERF_TYPE_RAW]);
-	printf("  %-50s [%s]\n",
-	       "cpu/t1=v1[,t2=v2,t3 ...]/modifier",
-	       event_type_descriptors[PERF_TYPE_RAW]);
-	printf("   (see 'perf list --help' on how to encode it)\n");
-	printf("\n");
-
-	printf("  %-50s [%s]\n",
-			"mem:<addr>[:access]",
+	if (!name_only) {
+		printf("\n");
+		printf("  %-50s [%s]\n",
+		       "rNNN",
+		       event_type_descriptors[PERF_TYPE_RAW]);
+		printf("  %-50s [%s]\n",
+		       "cpu/t1=v1[,t2=v2,t3 ...]/modifier",
+		       event_type_descriptors[PERF_TYPE_RAW]);
+		printf("   (see 'perf list --help' on how to encode it)\n");
+		printf("\n");
+
+		printf("  %-50s [%s]\n",
+		       "mem:<addr>[:access]",
 			event_type_descriptors[PERF_TYPE_BREAKPOINT]);
-	printf("\n");
+		printf("\n");
+	}
 
-	print_tracepoint_events(NULL, NULL);
+	print_tracepoint_events(NULL, NULL, name_only);
 }
 
 int parse_events__is_hardcoded_term(struct parse_events__term *term)
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 163aad4..00416d7f 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -96,10 +96,11 @@ void parse_events_update_lists(struct list_head *list_event,
 void parse_events_error(void *data, void *scanner, char const *msg);
 int parse_events__test(void);
 
-void print_events(const char *event_glob);
+void print_events(const char *event_glob, bool name_only);
 void print_events_type(u8 type);
-void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
-int print_hwcache_events(const char *event_glob);
+void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
+			     bool name_only);
+int print_hwcache_events(const char *event_glob, bool name_only);
 extern int is_valid_tracepoint(const char *event_string);
 
 extern int valid_debugfs_mount(const char *debugfs);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] perf tools: Fix /etc config related installation
  2012-08-09 14:31 [PATCH 0/3] perf tools: Basic bash completion support v3 Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
  2012-08-09 14:31 ` [PATCH 2/3] perf tools: Support for events bash completion Frederic Weisbecker
@ 2012-08-09 14:31 ` Frederic Weisbecker
  2012-08-21 15:40   ` [tip:perf/core] " tip-bot for Namhyung Kim
  2 siblings, 1 reply; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 14:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Namhyung Kim, David Ahern, Ingo Molnar, Jiri Olsa,
	Peter Zijlstra, Stephane Eranian, Frederic Weisbecker

From: Namhyung Kim <namhyung@gmail.com>

Fix missing /etc/bash_completion.d directory creation, otherwise
the installation fails miserably on systems that don't have bash
completion installed yet or on specific target:

	   $ make DESTDIR=/tmp/junk-perf O=/tmp/pbuild -C tools/perf/ install
	   ...
	   install -m 755 bash_completion /tmp/junk-perf/etc/bash_completion.d/perf
	   install: cannot create regular file
	   `/tmp/junk-perf/etc/bash_completion.d/perf': No such file or directory
	   make: *** [install] Error 1
	   make: Leaving directory `/opt/sw/ahern/perf.git/tools/perf'

Also use sysconfdir variable instead of the hardcoded /etc to handle
overriden conf directory.

Reported-by: David Ahern <dsahern@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 tools/perf/Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 84b4227..a9458b9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -700,6 +700,7 @@ perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
 template_dir_SQ = $(subst ','\'',$(template_dir))
 htmldir_SQ = $(subst ','\'',$(htmldir))
 prefix_SQ = $(subst ','\'',$(prefix))
+sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
 
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 
@@ -951,7 +952,8 @@ install: all
 	$(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
 	$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
 	$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
-	$(INSTALL) -m 755 bash_completion $(DESTDIR_SQ)/etc/bash_completion.d/perf
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+	$(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
 
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
@ 2012-08-09 16:35   ` Arnaldo Carvalho de Melo
  2012-08-09 16:40     ` David Ahern
  2012-08-09 17:00     ` Frederic Weisbecker
  2012-08-21 15:38   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
  1 sibling, 2 replies; 18+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-09 16:35 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, David Ahern, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> This implements bash completion for perf subcommands such
> as record, report, script, probe, etc...

Humm, I get this when doing my usual workflow:

[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
make: Entering directory `/home/git/linux/tools/perf'
PERF_VERSION = 3.6.rc1.152.g5758f7
<SNIP>
install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
install -m 755 bash_completion /etc/bash_completion.d/perf
install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
make: *** [install] Error 1
make: Leaving directory `/home/git/linux/tools/perf'
[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install

	Shouldn't it install on ~/etc/bash_completion.d/perf ?

	Is there a way to have per user bash completion files like that?

- Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 16:35   ` Arnaldo Carvalho de Melo
@ 2012-08-09 16:40     ` David Ahern
  2012-08-09 17:14       ` Arnaldo Carvalho de Melo
  2012-08-09 17:00     ` Frederic Weisbecker
  1 sibling, 1 reply; 18+ messages in thread
From: David Ahern @ 2012-08-09 16:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Frederic Weisbecker, LKML, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On 8/9/12 10:35 AM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
>> This implements bash completion for perf subcommands such
>> as record, report, script, probe, etc...
>
> Humm, I get this when doing my usual workflow:
>
> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> make: Entering directory `/home/git/linux/tools/perf'
> PERF_VERSION = 3.6.rc1.152.g5758f7
> <SNIP>
> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> install -m 755 bash_completion /etc/bash_completion.d/perf
> install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> make: *** [install] Error 1
> make: Leaving directory `/home/git/linux/tools/perf'
> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
>
> 	Shouldn't it install on ~/etc/bash_completion.d/perf ?
>
> 	Is there a way to have per user bash completion files like that?

3rd patch should fix this.

David

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 16:35   ` Arnaldo Carvalho de Melo
  2012-08-09 16:40     ` David Ahern
@ 2012-08-09 17:00     ` Frederic Weisbecker
  2012-08-09 17:11       ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 17:00 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, David Ahern, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On Thu, Aug 09, 2012 at 01:35:15PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> > This implements bash completion for perf subcommands such
> > as record, report, script, probe, etc...
> 
> Humm, I get this when doing my usual workflow:
> 
> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> make: Entering directory `/home/git/linux/tools/perf'
> PERF_VERSION = 3.6.rc1.152.g5758f7
> <SNIP>
> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> install -m 755 bash_completion /etc/bash_completion.d/perf
> install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> make: *** [install] Error 1
> make: Leaving directory `/home/git/linux/tools/perf'
> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> 
> 	Shouldn't it install on ~/etc/bash_completion.d/perf ?

Are you sure you have the third patch?

> 
> 	Is there a way to have per user bash completion files like that?

It seems that some manual tweaking is needed :(

http://www.simplicidade.org/notes/archives/2008/02/bash_completion.html


> 
> - Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 17:00     ` Frederic Weisbecker
@ 2012-08-09 17:11       ` Arnaldo Carvalho de Melo
  2012-08-09 17:13         ` Frederic Weisbecker
  0 siblings, 1 reply; 18+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-09 17:11 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: LKML, David Ahern, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

Em Thu, Aug 09, 2012 at 07:00:10PM +0200, Frederic Weisbecker escreveu:
> On Thu, Aug 09, 2012 at 01:35:15PM -0300, Arnaldo Carvalho de Melo wrote:
> > Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> > > This implements bash completion for perf subcommands such
> > > as record, report, script, probe, etc...
> > 
> > Humm, I get this when doing my usual workflow:
> > 
> > [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > make: Entering directory `/home/git/linux/tools/perf'
> > PERF_VERSION = 3.6.rc1.152.g5758f7
> > <SNIP>
> > install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> > install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> > install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> > install -m 755 bash_completion /etc/bash_completion.d/perf
> > install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> > make: *** [install] Error 1
> > make: Leaving directory `/home/git/linux/tools/perf'
> > [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > 
> > 	Shouldn't it install on ~/etc/bash_completion.d/perf ?
> 
> Are you sure you have the third patch?

So should I fold the third into the first?
 
> > 
> > 	Is there a way to have per user bash completion files like that?
> 
> It seems that some manual tweaking is needed :(
> 
> http://www.simplicidade.org/notes/archives/2008/02/bash_completion.html

Will read.

- Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 17:11       ` Arnaldo Carvalho de Melo
@ 2012-08-09 17:13         ` Frederic Weisbecker
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 17:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, David Ahern, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On Thu, Aug 09, 2012 at 02:11:22PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 07:00:10PM +0200, Frederic Weisbecker escreveu:
> > On Thu, Aug 09, 2012 at 01:35:15PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> > > > This implements bash completion for perf subcommands such
> > > > as record, report, script, probe, etc...
> > > 
> > > Humm, I get this when doing my usual workflow:
> > > 
> > > [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > > make: Entering directory `/home/git/linux/tools/perf'
> > > PERF_VERSION = 3.6.rc1.152.g5758f7
> > > <SNIP>
> > > install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > > install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> > > install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > > install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> > > install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> > > install -m 755 bash_completion /etc/bash_completion.d/perf
> > > install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> > > make: *** [install] Error 1
> > > make: Leaving directory `/home/git/linux/tools/perf'
> > > [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > > 
> > > 	Shouldn't it install on ~/etc/bash_completion.d/perf ?
> > 
> > Are you sure you have the third patch?
> 
> So should I fold the third into the first?

That's up to you. I kept the third patch seperate to let the credit
to Namhyung.

>  
> > > 
> > > 	Is there a way to have per user bash completion files like that?
> > 
> > It seems that some manual tweaking is needed :(
> > 
> > http://www.simplicidade.org/notes/archives/2008/02/bash_completion.html
> 
> Will read.
> 
> - Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 16:40     ` David Ahern
@ 2012-08-09 17:14       ` Arnaldo Carvalho de Melo
  2012-08-09 17:24         ` David Ahern
                           ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-09 17:14 UTC (permalink / raw)
  To: David Ahern
  Cc: Frederic Weisbecker, LKML, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

Em Thu, Aug 09, 2012 at 10:40:19AM -0600, David Ahern escreveu:
> On 8/9/12 10:35 AM, Arnaldo Carvalho de Melo wrote:
> >Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> >>This implements bash completion for perf subcommands such
> >>as record, report, script, probe, etc...
> >
> >Humm, I get this when doing my usual workflow:
> >
> >[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> >make: Entering directory `/home/git/linux/tools/perf'
> >PERF_VERSION = 3.6.rc1.152.g5758f7
> ><SNIP>
> >install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> >install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> >install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> >install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> >install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> >install -m 755 bash_completion /etc/bash_completion.d/perf
> >install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> >make: *** [install] Error 1
> >make: Leaving directory `/home/git/linux/tools/perf'
> >[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> >
> >	Shouldn't it install on ~/etc/bash_completion.d/perf ?
> >
> >	Is there a way to have per user bash completion files like that?
> 
> 3rd patch should fix this.

Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
its just that I'm not using sudo nor installing as root, this new bash
completion file is the only one that is being installed on the root
filesystem, all others are in ~acme/

- Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 17:14       ` Arnaldo Carvalho de Melo
@ 2012-08-09 17:24         ` David Ahern
  2012-08-09 17:31         ` Frederic Weisbecker
  2012-08-09 18:27         ` Alan Cox
  2 siblings, 0 replies; 18+ messages in thread
From: David Ahern @ 2012-08-09 17:24 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Frederic Weisbecker, LKML, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On 8/9/12 11:14 AM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 10:40:19AM -0600, David Ahern escreveu:
>> On 8/9/12 10:35 AM, Arnaldo Carvalho de Melo wrote:
>>> Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
>>>> This implements bash completion for perf subcommands such
>>>> as record, report, script, probe, etc...
>>>
>>> Humm, I get this when doing my usual workflow:
>>>
>>> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
>>> make: Entering directory `/home/git/linux/tools/perf'
>>> PERF_VERSION = 3.6.rc1.152.g5758f7
>>> <SNIP>
>>> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
>>> install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
>>> install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
>>> install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
>>> install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
>>> install -m 755 bash_completion /etc/bash_completion.d/perf
>>> install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
>>> make: *** [install] Error 1
>>> make: Leaving directory `/home/git/linux/tools/perf'
>>> [acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
>>>
>>> 	Shouldn't it install on ~/etc/bash_completion.d/perf ?
>>>
>>> 	Is there a way to have per user bash completion files like that?
>>
>> 3rd patch should fix this.
>
> Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
> its just that I'm not using sudo nor installing as root, this new bash
> completion file is the only one that is being installed on the root
> filesystem, all others are in ~acme/

3rd patch uses sysconfdir_SQ instead of /etc.

ifndef DESTDIR
prefix = $(HOME)
endif
...

ifeq ($(prefix),/usr)
sysconfdir = /etc
ETC_PERFCONFIG = $(sysconfdir)/perfconfig
else
sysconfdir = $(prefix)/etc
ETC_PERFCONFIG = etc/perfconfig
endif

So, sysconfdir should be set to $(HOME)/etc in your case.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 17:14       ` Arnaldo Carvalho de Melo
  2012-08-09 17:24         ` David Ahern
@ 2012-08-09 17:31         ` Frederic Weisbecker
  2012-08-09 18:27         ` Alan Cox
  2 siblings, 0 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-09 17:31 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: David Ahern, LKML, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On Thu, Aug 09, 2012 at 02:14:19PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 10:40:19AM -0600, David Ahern escreveu:
> > On 8/9/12 10:35 AM, Arnaldo Carvalho de Melo wrote:
> > >Em Thu, Aug 09, 2012 at 04:31:51PM +0200, Frederic Weisbecker escreveu:
> > >>This implements bash completion for perf subcommands such
> > >>as record, report, script, probe, etc...
> > >
> > >Humm, I get this when doing my usual workflow:
> > >
> > >[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > >make: Entering directory `/home/git/linux/tools/perf'
> > >PERF_VERSION = 3.6.rc1.152.g5758f7
> > ><SNIP>
> > >install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > >install -d -m 755 '/home/acme/libexec/perf-core/scripts/python/bin'
> > >install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/acme/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
> > >install scripts/python/*.py -t '/home/acme/libexec/perf-core/scripts/python'
> > >install scripts/python/bin/* -t '/home/acme/libexec/perf-core/scripts/python/bin'
> > >install -m 755 bash_completion /etc/bash_completion.d/perf
> > >install: cannot create regular file `/etc/bash_completion.d/perf': Permission denied
> > >make: *** [install] Error 1
> > >make: Leaving directory `/home/git/linux/tools/perf'
> > >[acme@sandy linux]$ make -j8 -C tools/perf/ O=/home/acme/git/build/perf install
> > >
> > >	Shouldn't it install on ~/etc/bash_completion.d/perf ?
> > >
> > >	Is there a way to have per user bash completion files like that?
> > 
> > 3rd patch should fix this.
> 
> Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
> its just that I'm not using sudo nor installing as root, this new bash
> completion file is the only one that is being installed on the root
> filesystem, all others are in ~acme/

No the third patch handles sysconfdir which should take care of that:

$ make -C tools/perf O=/home/fweisbec/build install
make: entrant dans le répertoire « /home/fweisbec/linux-2.6-tip/tools/perf »
make[1]: entrant dans le répertoire « /home/fweisbec/linux-2.6-tip/tools/lib/traceevent »
make[1]: quittant le répertoire « /home/fweisbec/linux-2.6-tip/tools/lib/traceevent »
    LINK /home/fweisbec/build/perf
    GEN perf-archive
install -d -m 755 '/home/fweisbec/bin'
install /home/fweisbec/build/perf '/home/fweisbec/bin'
install -d -m 755 '/home/fweisbec/libexec/perf-core/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
install -d -m 755 '/home/fweisbec/libexec/perf-core/scripts/perl/bin'
install /home/fweisbec/build/perf-archive -t '/home/fweisbec/libexec/perf-core'
install scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/fweisbec/libexec/perf-core/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
install scripts/perl/*.pl -t '/home/fweisbec/libexec/perf-core/scripts/perl'
install scripts/perl/bin/* -t '/home/fweisbec/libexec/perf-core/scripts/perl/bin'
install -d -m 755 '/home/fweisbec/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
install -d -m 755 '/home/fweisbec/libexec/perf-core/scripts/python/bin'
install scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '/home/fweisbec/libexec/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
install scripts/python/*.py -t '/home/fweisbec/libexec/perf-core/scripts/python'
install scripts/python/bin/* -t '/home/fweisbec/libexec/perf-core/scripts/python/bin'
install -d -m 755 '/home/fweisbec/etc/bash_completion.d'
install bash_completion '/home/fweisbec/etc/bash_completion.d/perf'
make: quittant le répertoire « /home/fweisbec/linux-2.6-tip/tools/perf »

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 17:14       ` Arnaldo Carvalho de Melo
  2012-08-09 17:24         ` David Ahern
  2012-08-09 17:31         ` Frederic Weisbecker
@ 2012-08-09 18:27         ` Alan Cox
  2012-08-09 19:08           ` Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 18+ messages in thread
From: Alan Cox @ 2012-08-09 18:27 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: David Ahern, Frederic Weisbecker, LKML, Ingo Molnar, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian

> > 3rd patch should fix this.
> 
> Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
> its just that I'm not using sudo nor installing as root, this new bash
> completion file is the only one that is being installed on the root
> filesystem, all others are in ~acme/

And even with permissions it might not have the right security labels on
a well secured box.

It's a neat little script (or once its been properly security audited
will be) but IMHO it belongs in the distro bash script packages.

Alan

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 18:27         ` Alan Cox
@ 2012-08-09 19:08           ` Arnaldo Carvalho de Melo
  2012-08-10 13:30             ` Frederic Weisbecker
  0 siblings, 1 reply; 18+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-09 19:08 UTC (permalink / raw)
  To: Alan Cox
  Cc: David Ahern, Frederic Weisbecker, LKML, Ingo Molnar, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian

Em Thu, Aug 09, 2012 at 07:27:06PM +0100, Alan Cox escreveu:
> > > 3rd patch should fix this.
> > 
> > Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
> > its just that I'm not using sudo nor installing as root, this new bash
> > completion file is the only one that is being installed on the root
> > filesystem, all others are in ~acme/
> 
> And even with permissions it might not have the right security labels on
> a well secured box.
> 
> It's a neat little script (or once its been properly security audited
> will be) but IMHO it belongs in the distro bash script packages.

Yeah, I think we can keep it in the kernel sources and then send new
versions to the bash-completion-devel@lists.alioth.debian.org guys.

To test I just did:

  ln -s ~/etc/bash_completion.d/perf ~/.bash_completion

Frédéric, I merged your patches as-is and pushed them to my perf/core
branch, thanks!

- Arnaldo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] perf tools: Initial bash completion support
  2012-08-09 19:08           ` Arnaldo Carvalho de Melo
@ 2012-08-10 13:30             ` Frederic Weisbecker
  0 siblings, 0 replies; 18+ messages in thread
From: Frederic Weisbecker @ 2012-08-10 13:30 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Alan Cox, David Ahern, LKML, Ingo Molnar, Jiri Olsa, Namhyung Kim,
	Peter Zijlstra, Stephane Eranian

On Thu, Aug 09, 2012 at 04:08:19PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 09, 2012 at 07:27:06PM +0100, Alan Cox escreveu:
> > > > 3rd patch should fix this.
> > > 
> > > Huh? The problem is not /etc/bash_completion.d/ not existing, it exists,
> > > its just that I'm not using sudo nor installing as root, this new bash
> > > completion file is the only one that is being installed on the root
> > > filesystem, all others are in ~acme/
> > 
> > And even with permissions it might not have the right security labels on
> > a well secured box.
> > 
> > It's a neat little script (or once its been properly security audited
> > will be) but IMHO it belongs in the distro bash script packages.
> 
> Yeah, I think we can keep it in the kernel sources and then send new
> versions to the bash-completion-devel@lists.alioth.debian.org guys.
> 
> To test I just did:
> 
>   ln -s ~/etc/bash_completion.d/perf ~/.bash_completion
> 
> Frédéric, I merged your patches as-is and pushed them to my perf/core
> branch, thanks!

Thanks!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [tip:perf/core] perf tools: Initial bash completion support
  2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
  2012-08-09 16:35   ` Arnaldo Carvalho de Melo
@ 2012-08-21 15:38   ` tip-bot for Frederic Weisbecker
  1 sibling, 0 replies; 18+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2012-08-21 15:38 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, hpa, mingo, a.p.zijlstra, namhyung,
	jolsa, fweisbec, dsahern, tglx

Commit-ID:  98a4179c9aa1e99adf5103e6e0d05f563d902de1
Gitweb:     http://git.kernel.org/tip/98a4179c9aa1e99adf5103e6e0d05f563d902de1
Author:     Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Thu, 9 Aug 2012 16:31:51 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 9 Aug 2012 15:58:51 -0300

perf tools: Initial bash completion support

This implements bash completion for perf subcommands such as record,
report, script, probe, etc...

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1344522713-27951-2-git-send-email-fweisbec@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile        |    1 +
 tools/perf/bash_completion |   22 ++++++++++++++
 tools/perf/perf.c          |   69 +++++++++++++++++++++++++-------------------
 3 files changed, 62 insertions(+), 30 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2d4bf6e..84b4227 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -951,6 +951,7 @@ install: all
 	$(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
 	$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
 	$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+	$(INSTALL) -m 755 bash_completion $(DESTDIR_SQ)/etc/bash_completion.d/perf
 
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
new file mode 100644
index 0000000..9a31fa5
--- /dev/null
+++ b/tools/perf/bash_completion
@@ -0,0 +1,22 @@
+# perf completion
+
+have perf &&
+_perf()
+{
+	local cur cmd
+
+	COMPREPLY=()
+	_get_comp_words_by_ref cur
+
+	cmd=${COMP_WORDS[0]}
+
+	# List perf subcommands
+	if [ $COMP_CWORD -eq 1 ]; then
+		cmds=$($cmd --list-cmds)
+		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+	# Fall down to list regular files
+	else
+		_filedir
+	fi
+} &&
+complete -F _perf perf
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 2b2e225..db37ee3 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -24,6 +24,37 @@ const char perf_more_info_string[] =
 int use_browser = -1;
 static int use_pager = -1;
 
+struct cmd_struct {
+	const char *cmd;
+	int (*fn)(int, const char **, const char *);
+	int option;
+};
+
+static struct cmd_struct commands[] = {
+	{ "buildid-cache", cmd_buildid_cache, 0 },
+	{ "buildid-list", cmd_buildid_list, 0 },
+	{ "diff",	cmd_diff,	0 },
+	{ "evlist",	cmd_evlist,	0 },
+	{ "help",	cmd_help,	0 },
+	{ "list",	cmd_list,	0 },
+	{ "record",	cmd_record,	0 },
+	{ "report",	cmd_report,	0 },
+	{ "bench",	cmd_bench,	0 },
+	{ "stat",	cmd_stat,	0 },
+	{ "timechart",	cmd_timechart,	0 },
+	{ "top",	cmd_top,	0 },
+	{ "annotate",	cmd_annotate,	0 },
+	{ "version",	cmd_version,	0 },
+	{ "script",	cmd_script,	0 },
+	{ "sched",	cmd_sched,	0 },
+	{ "probe",	cmd_probe,	0 },
+	{ "kmem",	cmd_kmem,	0 },
+	{ "lock",	cmd_lock,	0 },
+	{ "kvm",	cmd_kvm,	0 },
+	{ "test",	cmd_test,	0 },
+	{ "inject",	cmd_inject,	0 },
+};
+
 struct pager_config {
 	const char *cmd;
 	int val;
@@ -160,6 +191,14 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			fprintf(stderr, "dir: %s\n", debugfs_mountpoint);
 			if (envchanged)
 				*envchanged = 1;
+		} else if (!strcmp(cmd, "--list-cmds")) {
+			unsigned int i;
+
+			for (i = 0; i < ARRAY_SIZE(commands); i++) {
+				struct cmd_struct *p = commands+i;
+				printf("%s ", p->cmd);
+			}
+			exit(0);
 		} else {
 			fprintf(stderr, "Unknown option: %s\n", cmd);
 			usage(perf_usage_string);
@@ -245,12 +284,6 @@ const char perf_version_string[] = PERF_VERSION;
  */
 #define NEED_WORK_TREE	(1<<2)
 
-struct cmd_struct {
-	const char *cmd;
-	int (*fn)(int, const char **, const char *);
-	int option;
-};
-
 static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 {
 	int status;
@@ -296,30 +329,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
 static void handle_internal_command(int argc, const char **argv)
 {
 	const char *cmd = argv[0];
-	static struct cmd_struct commands[] = {
-		{ "buildid-cache", cmd_buildid_cache, 0 },
-		{ "buildid-list", cmd_buildid_list, 0 },
-		{ "diff",	cmd_diff,	0 },
-		{ "evlist",	cmd_evlist,	0 },
-		{ "help",	cmd_help,	0 },
-		{ "list",	cmd_list,	0 },
-		{ "record",	cmd_record,	0 },
-		{ "report",	cmd_report,	0 },
-		{ "bench",	cmd_bench,	0 },
-		{ "stat",	cmd_stat,	0 },
-		{ "timechart",	cmd_timechart,	0 },
-		{ "top",	cmd_top,	0 },
-		{ "annotate",	cmd_annotate,	0 },
-		{ "version",	cmd_version,	0 },
-		{ "script",	cmd_script,	0 },
-		{ "sched",	cmd_sched,	0 },
-		{ "probe",	cmd_probe,	0 },
-		{ "kmem",	cmd_kmem,	0 },
-		{ "lock",	cmd_lock,	0 },
-		{ "kvm",	cmd_kvm,	0 },
-		{ "test",	cmd_test,	0 },
-		{ "inject",	cmd_inject,	0 },
-	};
 	unsigned int i;
 	static const char ext[] = STRIP_EXTENSION;
 

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [tip:perf/core] perf tools: Support for events bash completion
  2012-08-09 14:31 ` [PATCH 2/3] perf tools: Support for events bash completion Frederic Weisbecker
@ 2012-08-21 15:39   ` tip-bot for Frederic Weisbecker
  0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Frederic Weisbecker @ 2012-08-21 15:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, hpa, mingo, a.p.zijlstra, namhyung,
	jolsa, fweisbec, dsahern, tglx

Commit-ID:  a3277d2d5a0d5d9492993ab68af8a8dc96760dd1
Gitweb:     http://git.kernel.org/tip/a3277d2d5a0d5d9492993ab68af8a8dc96760dd1
Author:     Frederic Weisbecker <fweisbec@gmail.com>
AuthorDate: Thu, 9 Aug 2012 16:31:52 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 9 Aug 2012 15:59:26 -0300

perf tools: Support for events bash completion

Add basic bash completion for the -e option in record, top and stat
subcommands. Only hardware, software and tracepoint events are
supported.

Breakpoints, raw events and events grouping completion need more
thinking.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1344522713-27951-3-git-send-email-fweisbec@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/bash_completion     |    6 +++-
 tools/perf/builtin-list.c      |   14 ++++---
 tools/perf/util/parse-events.c |   70 +++++++++++++++++++++++++---------------
 tools/perf/util/parse-events.h |    7 ++--
 4 files changed, 61 insertions(+), 36 deletions(-)

diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 9a31fa5..1958fa5 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -6,7 +6,7 @@ _perf()
 	local cur cmd
 
 	COMPREPLY=()
-	_get_comp_words_by_ref cur
+	_get_comp_words_by_ref cur prev
 
 	cmd=${COMP_WORDS[0]}
 
@@ -14,6 +14,10 @@ _perf()
 	if [ $COMP_CWORD -eq 1 ]; then
 		cmds=$($cmd --list-cmds)
 		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+	# List possible events for -e option
+	elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
+		cmds=$($cmd list --raw-dump)
+		COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
 	# Fall down to list regular files
 	else
 		_filedir
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 6313b6e..bdcff81 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -19,15 +19,15 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 	setup_pager();
 
 	if (argc == 1)
-		print_events(NULL);
+		print_events(NULL, false);
 	else {
 		int i;
 
 		for (i = 1; i < argc; ++i) {
-			if (i > 1)
+			if (i > 2)
 				putchar('\n');
 			if (strncmp(argv[i], "tracepoint", 10) == 0)
-				print_tracepoint_events(NULL, NULL);
+				print_tracepoint_events(NULL, NULL, false);
 			else if (strcmp(argv[i], "hw") == 0 ||
 				 strcmp(argv[i], "hardware") == 0)
 				print_events_type(PERF_TYPE_HARDWARE);
@@ -36,13 +36,15 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 				print_events_type(PERF_TYPE_SOFTWARE);
 			else if (strcmp(argv[i], "cache") == 0 ||
 				 strcmp(argv[i], "hwcache") == 0)
-				print_hwcache_events(NULL);
+				print_hwcache_events(NULL, false);
+			else if (strcmp(argv[i], "--raw-dump") == 0)
+				print_events(NULL, true);
 			else {
 				char *sep = strchr(argv[i], ':'), *s;
 				int sep_idx;
 
 				if (sep == NULL) {
-					print_events(argv[i]);
+					print_events(argv[i], false);
 					continue;
 				}
 				sep_idx = sep - argv[i];
@@ -51,7 +53,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __used)
 					return -1;
 
 				s[sep_idx] = '\0';
-				print_tracepoint_events(s, s + sep_idx + 1);
+				print_tracepoint_events(s, s + sep_idx + 1, false);
 				free(s);
 			}
 		}
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 8bdfa3e..3ec4bfc 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -799,7 +799,8 @@ static const char * const event_type_descriptors[] = {
  * Print the events from <debugfs_mount_point>/tracing/events
  */
 
-void print_tracepoint_events(const char *subsys_glob, const char *event_glob)
+void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
+			     bool name_only)
 {
 	DIR *sys_dir, *evt_dir;
 	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
@@ -829,6 +830,11 @@ void print_tracepoint_events(const char *subsys_glob, const char *event_glob)
 			    !strglobmatch(evt_dirent.d_name, event_glob))
 				continue;
 
+			if (name_only) {
+				printf("%s:%s ", sys_dirent.d_name, evt_dirent.d_name);
+				continue;
+			}
+
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
 				 sys_dirent.d_name, evt_dirent.d_name);
 			printf("  %-50s [%s]\n", evt_path,
@@ -906,7 +912,7 @@ void print_events_type(u8 type)
 		__print_events_type(type, event_symbols_hw, PERF_COUNT_HW_MAX);
 }
 
-int print_hwcache_events(const char *event_glob)
+int print_hwcache_events(const char *event_glob, bool name_only)
 {
 	unsigned int type, op, i, printed = 0;
 	char name[64];
@@ -923,8 +929,11 @@ int print_hwcache_events(const char *event_glob)
 				if (event_glob != NULL && !strglobmatch(name, event_glob))
 					continue;
 
-				printf("  %-50s [%s]\n", name,
-					event_type_descriptors[PERF_TYPE_HW_CACHE]);
+				if (name_only)
+					printf("%s ", name);
+				else
+					printf("  %-50s [%s]\n", name,
+					       event_type_descriptors[PERF_TYPE_HW_CACHE]);
 				++printed;
 			}
 		}
@@ -934,7 +943,8 @@ int print_hwcache_events(const char *event_glob)
 }
 
 static void print_symbol_events(const char *event_glob, unsigned type,
-				struct event_symbol *syms, unsigned max)
+				struct event_symbol *syms, unsigned max,
+				bool name_only)
 {
 	unsigned i, printed = 0;
 	char name[MAX_NAME_LEN];
@@ -946,6 +956,11 @@ static void print_symbol_events(const char *event_glob, unsigned type,
 		      (syms->alias && strglobmatch(syms->alias, event_glob))))
 			continue;
 
+		if (name_only) {
+			printf("%s ", syms->symbol);
+			continue;
+		}
+
 		if (strlen(syms->alias))
 			snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias);
 		else
@@ -963,39 +978,42 @@ static void print_symbol_events(const char *event_glob, unsigned type,
 /*
  * Print the help text for the event symbols:
  */
-void print_events(const char *event_glob)
+void print_events(const char *event_glob, bool name_only)
 {
-
-	printf("\n");
-	printf("List of pre-defined events (to be used in -e):\n");
+	if (!name_only) {
+		printf("\n");
+		printf("List of pre-defined events (to be used in -e):\n");
+	}
 
 	print_symbol_events(event_glob, PERF_TYPE_HARDWARE,
-			    event_symbols_hw, PERF_COUNT_HW_MAX);
+			    event_symbols_hw, PERF_COUNT_HW_MAX, name_only);
 
 	print_symbol_events(event_glob, PERF_TYPE_SOFTWARE,
-			    event_symbols_sw, PERF_COUNT_SW_MAX);
+			    event_symbols_sw, PERF_COUNT_SW_MAX, name_only);
 
-	print_hwcache_events(event_glob);
+	print_hwcache_events(event_glob, name_only);
 
 	if (event_glob != NULL)
 		return;
 
-	printf("\n");
-	printf("  %-50s [%s]\n",
-	       "rNNN",
-	       event_type_descriptors[PERF_TYPE_RAW]);
-	printf("  %-50s [%s]\n",
-	       "cpu/t1=v1[,t2=v2,t3 ...]/modifier",
-	       event_type_descriptors[PERF_TYPE_RAW]);
-	printf("   (see 'perf list --help' on how to encode it)\n");
-	printf("\n");
-
-	printf("  %-50s [%s]\n",
-			"mem:<addr>[:access]",
+	if (!name_only) {
+		printf("\n");
+		printf("  %-50s [%s]\n",
+		       "rNNN",
+		       event_type_descriptors[PERF_TYPE_RAW]);
+		printf("  %-50s [%s]\n",
+		       "cpu/t1=v1[,t2=v2,t3 ...]/modifier",
+		       event_type_descriptors[PERF_TYPE_RAW]);
+		printf("   (see 'perf list --help' on how to encode it)\n");
+		printf("\n");
+
+		printf("  %-50s [%s]\n",
+		       "mem:<addr>[:access]",
 			event_type_descriptors[PERF_TYPE_BREAKPOINT]);
-	printf("\n");
+		printf("\n");
+	}
 
-	print_tracepoint_events(NULL, NULL);
+	print_tracepoint_events(NULL, NULL, name_only);
 }
 
 int parse_events__is_hardcoded_term(struct parse_events__term *term)
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 163aad4..00416d7f 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -96,10 +96,11 @@ void parse_events_update_lists(struct list_head *list_event,
 void parse_events_error(void *data, void *scanner, char const *msg);
 int parse_events__test(void);
 
-void print_events(const char *event_glob);
+void print_events(const char *event_glob, bool name_only);
 void print_events_type(u8 type);
-void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
-int print_hwcache_events(const char *event_glob);
+void print_tracepoint_events(const char *subsys_glob, const char *event_glob,
+			     bool name_only);
+int print_hwcache_events(const char *event_glob, bool name_only);
 extern int is_valid_tracepoint(const char *event_string);
 
 extern int valid_debugfs_mount(const char *debugfs);

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [tip:perf/core] perf tools: Fix /etc config related installation
  2012-08-09 14:31 ` [PATCH 3/3] perf tools: Fix /etc config related installation Frederic Weisbecker
@ 2012-08-21 15:40   ` tip-bot for Namhyung Kim
  0 siblings, 0 replies; 18+ messages in thread
From: tip-bot for Namhyung Kim @ 2012-08-21 15:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, eranian, hpa, mingo, a.p.zijlstra, namhyung,
	jolsa, fweisbec, dsahern, tglx

Commit-ID:  b25085be457b4292a563c0bf2fab2ef5b7bb3c45
Gitweb:     http://git.kernel.org/tip/b25085be457b4292a563c0bf2fab2ef5b7bb3c45
Author:     Namhyung Kim <namhyung@gmail.com>
AuthorDate: Thu, 9 Aug 2012 16:31:53 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 9 Aug 2012 15:59:40 -0300

perf tools: Fix /etc config related installation

Fix missing /etc/bash_completion.d directory creation, otherwise
the installation fails miserably on systems that don't have bash
completion installed yet or on specific target:

	   $ make DESTDIR=/tmp/junk-perf O=/tmp/pbuild -C tools/perf/ install
	   ...
	   install -m 755 bash_completion /tmp/junk-perf/etc/bash_completion.d/perf
	   install: cannot create regular file
	   `/tmp/junk-perf/etc/bash_completion.d/perf': No such file or directory
	   make: *** [install] Error 1
	   make: Leaving directory `/opt/sw/ahern/perf.git/tools/perf'

Also use sysconfdir variable instead of the hardcoded /etc to handle
overriden conf directory.

Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1344522713-27951-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 84b4227..a9458b9 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -700,6 +700,7 @@ perfexecdir_SQ = $(subst ','\'',$(perfexecdir))
 template_dir_SQ = $(subst ','\'',$(template_dir))
 htmldir_SQ = $(subst ','\'',$(htmldir))
 prefix_SQ = $(subst ','\'',$(prefix))
+sysconfdir_SQ = $(subst ','\'',$(sysconfdir))
 
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 
@@ -951,7 +952,8 @@ install: all
 	$(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
 	$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
 	$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
-	$(INSTALL) -m 755 bash_completion $(DESTDIR_SQ)/etc/bash_completion.d/perf
+	$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+	$(INSTALL) bash_completion '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
 
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-08-21 15:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-09 14:31 [PATCH 0/3] perf tools: Basic bash completion support v3 Frederic Weisbecker
2012-08-09 14:31 ` [PATCH 1/3] perf tools: Initial bash completion support Frederic Weisbecker
2012-08-09 16:35   ` Arnaldo Carvalho de Melo
2012-08-09 16:40     ` David Ahern
2012-08-09 17:14       ` Arnaldo Carvalho de Melo
2012-08-09 17:24         ` David Ahern
2012-08-09 17:31         ` Frederic Weisbecker
2012-08-09 18:27         ` Alan Cox
2012-08-09 19:08           ` Arnaldo Carvalho de Melo
2012-08-10 13:30             ` Frederic Weisbecker
2012-08-09 17:00     ` Frederic Weisbecker
2012-08-09 17:11       ` Arnaldo Carvalho de Melo
2012-08-09 17:13         ` Frederic Weisbecker
2012-08-21 15:38   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2012-08-09 14:31 ` [PATCH 2/3] perf tools: Support for events bash completion Frederic Weisbecker
2012-08-21 15:39   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2012-08-09 14:31 ` [PATCH 3/3] perf tools: Fix /etc config related installation Frederic Weisbecker
2012-08-21 15:40   ` [tip:perf/core] " tip-bot for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).