From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-801282-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E365F138CD0 for <garchives@archives.gentoo.org>; Tue, 19 May 2015 17:37:33 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0A0B8E0A60; Tue, 19 May 2015 17:37:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9BE53E0A60 for <gentoo-commits@lists.gentoo.org>; Tue, 19 May 2015 17:37:28 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CDCC4340BDE for <gentoo-commits@lists.gentoo.org>; Tue, 19 May 2015 17:37:27 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 222709F9 for <gentoo-commits@lists.gentoo.org>; Tue, 19 May 2015 17:37:24 +0000 (UTC) From: "Mike Frysinger" <vapier@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" <vapier@gentoo.org> Message-ID: <1432054570.eeb816f6dcf9a634303e3f1bd1e43d472a3fcff6.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: main.c qlop.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: eeb816f6dcf9a634303e3f1bd1e43d472a3fcff6 X-VCS-Branch: master Date: Tue, 19 May 2015 17:37:24 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 7db803ab-68b4-4972-b366-1362d72f12bf X-Archives-Hash: 3242abf4f67a2376655abda9e4378c83 commit: eeb816f6dcf9a634303e3f1bd1e43d472a3fcff6 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Tue May 19 16:56:10 2015 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Tue May 19 16:56:10 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=eeb816f6 qlop: support $EMERGE_LOG_DIR Portage stores its emerge.log in the $EMERGE_LOG_DIR dir, so try loading that setting instead of hardcoding /var/log ourselves. URL: https://bugs.gentoo.org/513592 Reported-by: Kerin Millar <kerframil <AT> fastmail.co.uk> main.c | 2 ++ qlop.c | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index d127621..29a889f 100644 --- a/main.c +++ b/main.c @@ -32,6 +32,7 @@ int portcachedir_type = 0; char pretend = 0; char reinitialize = 0; char reinitialize_metacache = 0; +static char *portlogdir; static char *portdir; static char *portarch; static char *portvdb; @@ -694,6 +695,7 @@ void initialize_portage_env(void) _Q_EVB(BOOL, NOCOLOR, nocolor, 0) _Q_EVS(ISTR, FEATURES, features, "noman noinfo nodoc") _Q_EVS(STR, EPREFIX, eprefix, CONFIG_EPREFIX) + _Q_EVS(STR, EMERGE_LOG_DIR, portlogdir, CONFIG_EPREFIX "var/log") _Q_EVS(STR, PORTDIR, portdir, CONFIG_EPREFIX "usr/portage") _Q_EVS(STR, PORTAGE_BINHOST, binhost, DEFAULT_PORTAGE_BINHOST) _Q_EVS(STR, PORTAGE_TMPDIR, port_tmpdir, CONFIG_EPREFIX "var/tmp/portage/") diff --git a/qlop.c b/qlop.c index 93dbcc8..390865a 100644 --- a/qlop.c +++ b/qlop.c @@ -26,7 +26,7 @@ # include <sys/sysctl.h> #endif -#define QLOP_DEFAULT_LOGFILE CONFIG_EPREFIX "var/log/emerge.log" +#define QLOP_DEFAULT_LOGFILE "emerge.log" #define QLOP_FLAGS "gtHluscf:" COMMON_FLAGS static struct option const qlop_long_opts[] = { @@ -48,7 +48,7 @@ static const char * const qlop_opts_help[] = { "Show unmerge history", "Show sync history", "Show current emerging packages", - "Read emerge logfile instead of " QLOP_DEFAULT_LOGFILE, + "Read emerge logfile instead of $EMERGE_LOG_DIR/" QLOP_DEFAULT_LOGFILE, COMMON_OPTS_HELP }; #define qlop_usage(ret) usage(ret, QLOP_FLAGS, qlop_long_opts, qlop_opts_help, lookup_applet_idx("qlop")) @@ -646,13 +646,11 @@ int qlop_main(int argc, char **argv) { int i, average = 1; char do_time, do_list, do_unlist, do_sync, do_current, do_human_readable = 0; - char *opt_logfile; - const char *logfile = QLOP_DEFAULT_LOGFILE; + char *logfile = NULL; DBG("argc=%d argv[0]=%s argv[1]=%s", argc, argv[0], argc > 1 ? argv[1] : "NULL?"); - opt_logfile = NULL; do_time = do_list = do_unlist = do_sync = do_current = 0; while ((i = GETOPT_LONG(QLOP, qlop, "")) != -1) { @@ -667,15 +665,15 @@ int qlop_main(int argc, char **argv) case 'g': do_time = 1; average = 0; break; case 'H': do_human_readable = 1; break; case 'f': - if (opt_logfile) err("Only use -f once"); - opt_logfile = xstrdup(optarg); + if (logfile) err("Only use -f once"); + logfile = xstrdup(optarg); break; } } if (!do_list && !do_unlist && !do_time && !do_sync && !do_current) qlop_usage(EXIT_FAILURE); - if (opt_logfile != NULL) - logfile = opt_logfile; + if (logfile == NULL) + xasprintf(&logfile, "%s/%s", portlogdir, QLOP_DEFAULT_LOGFILE); argc -= optind; argv += optind; @@ -696,7 +694,7 @@ int qlop_main(int argc, char **argv) show_merge_times(argv[i], logfile, average, do_human_readable); } - if (opt_logfile) free(opt_logfile); + free(logfile); return EXIT_SUCCESS; }