From 992a5ec1ae7fb57e1b2df04a9b372c81debc9748 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Fri, 5 Feb 2016 11:28:44 +0100 Subject: [PATCH] prepare_port: prefix git clone output To raise readability when preparing multiple ports in parallel we prefix also the git clone output with the port name dark-yellow-coloured. To achieve this we sed the git output. In sed \x1b[ resolves to an escape sequence and \033[, that we use normally, doesn't. The echo command, at the other hand, resolves both to an escape sequence. Thus we use the sed-compatible version in general. This commit inhibits the progress output of git clone as it can't be redirected to sed. Ref #1872 --- tool/ports/mk/common.inc | 22 ++++++++++++---------- tool/ports/mk/install.mk | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tool/ports/mk/common.inc b/tool/ports/mk/common.inc index 5117747c8..5a65fcbcd 100644 --- a/tool/ports/mk/common.inc +++ b/tool/ports/mk/common.inc @@ -9,15 +9,17 @@ VERBOSE ?= @ ECHO := echo -e HASHSUM := sha1sum -BRIGHT_COL ?= \033[01;33m -DARK_COL ?= \033[00;33m -DEFAULT_COL ?= \033[0m +BRIGHT_COL ?= \x1b[01;33m +DARK_COL ?= \x1b[00;33m +DEFAULT_COL ?= \x1b[0m -MSG_PREFIX := $(ECHO) "$(DARK_COL)$(notdir $(PORT:.port=)) $(DEFAULT_COL)" -MSG_DOWNLOAD := $(MSG_PREFIX)"download " -MSG_APPLY := $(MSG_PREFIX)"apply " -MSG_UPDATE := $(MSG_PREFIX)"update " -MSG_INSTALL := $(MSG_PREFIX)"install " -MSG_GENERATE := $(MSG_PREFIX)"generate " -MSG_EXTRACT := $(MSG_PREFIX)"extract " +MSG_PREFIX_TXT := $(DARK_COL)$(notdir $(PORT:.port=)) $(DEFAULT_COL) +MSG_PREFIX := $(ECHO) "$(MSG_PREFIX_TXT)" +MSG_DOWNLOAD := $(MSG_PREFIX)"download " +MSG_APPLY := $(MSG_PREFIX)"apply " +MSG_UPDATE := $(MSG_PREFIX)"update " +MSG_INSTALL := $(MSG_PREFIX)"install " +MSG_GENERATE := $(MSG_PREFIX)"generate " +MSG_EXTRACT := $(MSG_PREFIX)"extract " +MSG_GIT := $(MSG_PREFIX_TXT)git diff --git a/tool/ports/mk/install.mk b/tool/ports/mk/install.mk index 4c0f4bbde..4fc45ff39 100644 --- a/tool/ports/mk/install.mk +++ b/tool/ports/mk/install.mk @@ -160,7 +160,7 @@ _git_dir = $(call _assert,$(DIR($1)),Missing declaration of DIR($*)) ($(ECHO) "Error: Undefined URL for $*"; false); $(VERBOSE)dir=$(call _git_dir,$*);\ test -d $$dir || $(MSG_DOWNLOAD)$(URL($*)); \ - test -d $$dir || git clone $(URL($*)) $$dir; \ + test -d $$dir || git clone $(URL($*)) $$dir &> >(sed 's/^/$(MSG_GIT)/'); \ $(MSG_UPDATE)$$dir; \ cd $$dir && git fetch && git reset -q --hard HEAD && git checkout -q $(REV($*))