From patchwork Thu Jun 18 12:37:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 6636681 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0FC509F1C1 for ; Thu, 18 Jun 2015 12:38:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 120B520376 for ; Thu, 18 Jun 2015 12:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 21AEC2034C for ; Thu, 18 Jun 2015 12:38:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753302AbbFRMiF (ORCPT ); Thu, 18 Jun 2015 08:38:05 -0400 Received: from mail-la0-f45.google.com ([209.85.215.45]:35829 "EHLO mail-la0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbbFRMiE (ORCPT ); Thu, 18 Jun 2015 08:38:04 -0400 Received: by labko7 with SMTP id ko7so53551698lab.2 for ; Thu, 18 Jun 2015 05:38:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BbKNqHMjQE7DHxmAEv1DTxkWjr6kkcow4iB9nurYIn0=; b=bk1SKkIXxseMAQ18ExYyxo4nYte+G1/RbKhgdnurWRHcsJvY4orydBdedpiGXBok2S l8SGvkFp7GDc+zRiYN62HEfVy8EflN/ALcbBZpfUdOHn1ohSg7tNO/OvGWI9Pck2Y7hg i4jRZnTAf0QX5H5cZly7AAFvSSO0GF+0WQqVda9DBcF2mIgHqhGeLYkx8PYfvroWLLAU 2HTLL03i6e2emLjWa+5y0b2zQZRuvcrA0GHfemfuS00iQ2HFcjvOeQ/ugacDF9XU/Xv9 62LsxsmtkTWkdv7T28ebHpnqPxuyo2mIUW+NHNkOalFncUYyb9Wfyz1oCPXIeR++JFA7 7KKA== X-Gm-Message-State: ALoCoQnW3Nq7faZ9URA+cXOfrO+euXDo0Bqc/tFt66hlJVxH6b47XgwyEPWyEDPsdbIVLEEUhi/O X-Received: by 10.112.209.106 with SMTP id ml10mr12664446lbc.112.1434631083256; Thu, 18 Jun 2015 05:38:03 -0700 (PDT) Received: from beaming.home (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by mx.google.com with ESMTPSA id si3sm1748814lbb.32.2015.06.18.05.38.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jun 2015 05:38:02 -0700 (PDT) From: riku.voipio@linaro.org To: linux-kbuild@vger.kernel.org, mmarek@suse.cz Cc: Riku Voipio Subject: [PATCH] package Makefile: fix perf-tar targets when outdir is set Date: Thu, 18 Jun 2015 15:37:58 +0300 Message-Id: <1434631078-12035-1-git-send-email-riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Riku Voipio When building with $srctree != $objtree, perf-tar-* targets fail to read the MANIFEST file and add the PERF-VERSION-FILE needed by out-of-tree builds. The build errors and an incorrect tar is created: $ make O=build-x86 perf-targz-src-pkg TAR cat: ../tools/perf/MANIFEST: No such file or directory tar: perf-4.1.0-rc8/PERF-VERSION-FILE: Cannot stat: No such file or dir.. tar: Exiting with failure status due to previous errors Kbuild sets objtree to "." and srctree to ".." The command to output MANIFEST becomes: $(cd ..; echo $(cat ../tools/perf/MANIFEST)) Without MANIFEST, the entire kernel source tree is added to the perf source tarball. The *correct* fix is to keep the cd and remove srctree from cat command line since MANIFEST has wildcards that fail to expand working directory isn't srctree. Second, PERF-VERSION-FILE gets not added, because in-tree build path is hardcoded to Makefile: util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null) The PERF-VERSION-GEN needs to be run from tools/perf directory, so we can't just replace the hardcoded "../../" bit the relative $objtree contents - we need a fully expanded $objtree_full variable to place PERF-VERSION-FILE to the right place. Also remove the error redirect to /dev/null which hid the error. Patch v2: switch from easy fix to correct fix Signed-off-by: Riku Voipio --- scripts/package/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 99ca6e7..cd5a321 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -33,6 +33,11 @@ TAR_CONTENT := $(KBUILD_ALLDIRS) kernel.spec .config .scmversion Makefile \ TAR_CONTENT := $(addprefix $(KERNELPATH)/,$(TAR_CONTENT)) MKSPEC := $(srctree)/scripts/package/mkspec +# objtree is relative path, which doesn't work if we cd around +ifneq ($(objtree),) + objtree_full := $(shell readlink -f $(objtree) || echo $(objtree)) +endif + # rpm-pkg # --------------------------------------------------------------------------- rpm-pkg rpm: FORCE @@ -111,12 +116,12 @@ quiet_cmd_perf_tar = TAR cmd_perf_tar = \ git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \ HEAD^{tree} $$(cd $(srctree); \ - echo $$(cat $(srctree)/tools/perf/MANIFEST)) \ + echo $$(cat tools/perf/MANIFEST)) \ -o $(perf-tar).tar; \ mkdir -p $(perf-tar); \ git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ (cd $(srctree)/tools/perf; \ -util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \ +util/PERF-VERSION-GEN $(objtree_full)/$(perf-tar)/); \ tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \ rm -r $(perf-tar); \ $(if $(findstring tar-src,$@),, \