From patchwork Mon Feb 25 01:02:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadym Kochan X-Patchwork-Id: 1047549 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="BuKtXgUP"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4473NN5zcCz9s9y for ; Mon, 25 Feb 2019 11:53:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EDF2485C9A; Mon, 25 Feb 2019 00:53:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FLuYtowI0Lff; Mon, 25 Feb 2019 00:53:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 8732A85BCA; Mon, 25 Feb 2019 00:53:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6944C1BF834 for ; Mon, 25 Feb 2019 00:53:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 613AF85166 for ; Mon, 25 Feb 2019 00:53:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iFmJnkR28jg1 for ; Mon, 25 Feb 2019 00:53:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by fraxinus.osuosl.org (Postfix) with ESMTPS id D6C738512E for ; Mon, 25 Feb 2019 00:53:30 +0000 (UTC) Received: by mail-lj1-f176.google.com with SMTP id z25so5897756ljk.8 for ; Sun, 24 Feb 2019 16:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=XaeHV94pwq3BcNWlQfaNrfbp5mZcAVZxAhhdLwXcctQ=; b=BuKtXgUPH8EgeIoRLJNwDBAXcFN05+AIS6Uepa0QA+3uZkklqfrj47+xY5S2dPykjo LPnUbaWlnMjqusHuyMlyUe6zs7M0Dlfd31Hb7CU6o42oYmt4KPNcvd5ad0T4+oQ6NG+Q UcvbNul8leuGbcKtkCoPf9OP3BrzT8EhnqJ78kcCN6Ob4PGiLqtXkRVaEafK68X5JTLU dJi5E0QnrBjdb0HVtSRoCPj37xMYE0mBsWayHzdtCBIm3DcGFvVl3pf6JIQJ29vgratm R3uftcwcbu4RR0v0nPgpwyREpX9/lbyxi95WObC1BDuut7XD1mN5UdkznMWDY8wVtPAJ b9bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XaeHV94pwq3BcNWlQfaNrfbp5mZcAVZxAhhdLwXcctQ=; b=bgP7iYiM4E3PRu8oL8GhYkP4gnqW4D5SWtSCEQBgxJcuD+4ftzSqzmgwpuNgCkZ1/E ZcwwSw3HNvanImS/cbqbgmktUWNV9jzJXBpmJceAl27mlKRelZF4y3CZiUw1KwLQ/Ebl 7QwetzEzzN4y4C7+wk37GaRg+gWJuwKvgaqoe3Bg1Na86q4cuCT/yNPcbAFInA/MgJ53 KWP2hl4FWj6cQkuf2zYynlbTDvrjK1s0WvSlRUiMWIHrQk5orkKrFt9lW5R4U3WQA2ET Jm/SMToH3yy92x8gyssPGPzOsSUMFSPTePH3PtK7tyKN+c1idVFV7pWqkhj/opN+6PT4 g6/g== X-Gm-Message-State: AHQUAuYhi2DdBml2TXRmlwRO1AOn5bAFPENKIcHxU7J1tI32i7PTnrpw bPc79VRfkF6amtWuHOx6oY2GdrgQkX4= X-Google-Smtp-Source: AHgI3IaBIwUn9wEv3n3ktbtPMCQpELc0QNL8PVqhLAsGbvZhGPEJS6Xinr5qMeevrtYNhLak+kVXjA== X-Received: by 2002:a2e:8886:: with SMTP id k6mr9169878lji.43.1551056008751; Sun, 24 Feb 2019 16:53:28 -0800 (PST) Received: from vkochan-ThinkPad-T470p.lan ([93.75.250.209]) by smtp.gmail.com with ESMTPSA id h3sm2336432lfj.25.2019.02.24.16.53.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Feb 2019 16:53:28 -0800 (PST) From: Vadim Kochan To: buildroot@buildroot.org, Thomas Petazzoni Date: Mon, 25 Feb 2019 03:02:32 +0200 Message-Id: <20190225010232.8476-1-vadim4j@gmail.com> X-Mailer: git-send-email 2.14.1 Subject: [Buildroot] [POC, ppsh-v7-work] make: Redirect logs per-package if per-package build is enabled X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vadim Kochan MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" There might a messy logs In case of parellel per-package build, so each package will mix together it's logs on stdout, therefor needs some approach to log output of each package into separate file. Implemented approach which overrides 'SHELL' variable in the main Makefile with a path to the 'support/shell_proxy' which duplicates output from executed commands to the 'output/per-package/$(pkg)/build.log' file, this path is specified from Makefile only if there is $PKG variable defined. Signed-off-by: Vadim Kochan --- Makefile | 1 + support/shell_proxy | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 support/shell_proxy diff --git a/Makefile b/Makefile index 25bd0d40d9..ff92009785 100644 --- a/Makefile +++ b/Makefile @@ -444,6 +444,7 @@ LZCAT := $(call qstrip,$(BR2_LZCAT)) TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +SHELL = $(CURDIR)/support/shell_proxy $(if $(PKG),--redir=$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/build.log) HOST_DIR = $(if $(PKG),$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/host,$(call qstrip,$(BR2_HOST_DIR))) TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(if $(PKG),$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/target,$(BASE_TARGET_DIR))) else diff --git a/support/shell_proxy b/support/shell_proxy new file mode 100755 index 0000000000..a5068a1d5f --- /dev/null +++ b/support/shell_proxy @@ -0,0 +1,19 @@ +#! /bin/sh + +shell="/bin/sh" + +if [ -x "$BASH" ]; then + shell=$BASH +elif [ -x /bin/bash ]; then + shell=/bin/bash +fi + +echo "$1" | grep -q 'redir' +if [ $? -eq 0 ] ; then + redir_out=`echo $1 | awk -F'=' '{ print $2 }'` + mkdir -p `dirname $redir_out` + touch $redir_out + shift +fi + +$shell "$@" | tee -a $redir_out