From patchwork Wed Jun 17 12:34:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 6625291 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6312EC0020 for ; Wed, 17 Jun 2015 12:34:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EA132037C for ; Wed, 17 Jun 2015 12:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7193920364 for ; Wed, 17 Jun 2015 12:34:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755338AbbFQMeF (ORCPT ); Wed, 17 Jun 2015 08:34:05 -0400 Received: from mail-la0-f48.google.com ([209.85.215.48]:35659 "EHLO mail-la0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752878AbbFQMeE (ORCPT ); Wed, 17 Jun 2015 08:34:04 -0400 Received: by labko7 with SMTP id ko7so32004820lab.2 for ; Wed, 17 Jun 2015 05:34: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=GFBzssl9I1bvrIj2IRMF/Oy0PE+lq3/Cg1BqiUA1pB0=; b=D16q+O1VkVXHYB3eK8Rs5WnU/VqqE3yS1VEUDtnFNqTKle+4K8uDQ9+LHMtG4wEqaI lIUrWQ0G9SNZAWJ87gIMzE/ry4kc6Mb4IRI/aKAsJe6kb2ONoLDJZHAilBWf1zOYbNaS yvCbYOsWIGyjNH3G4kkz8rn2uKR9hLax28c3xIFPe5/xZFUYcjeSKfx7nfoQZNh1r5sV kUYazep01iqw/IUzCn0vUZJMOg/xz0wgddh4xP3bTxsqUDSznxoe+CWorvpTOJ8S2r9Y UWApPOgllERAXPUkq4MXSU6sIIjTH0NcJEuvsPB+TunvSamqk98Ak/tnqtrYAESblE14 ELcg== X-Gm-Message-State: ALoCoQkqaDfk7UREKroFU+9dfrXu8WUbVycle0B18y7CK2tWG2fVBlEY+O19E0O3q+hp88dDwv1n X-Received: by 10.112.137.99 with SMTP id qh3mr7722325lbb.108.1434544443420; Wed, 17 Jun 2015 05:34:03 -0700 (PDT) Received: from localhost.localdomain (91-157-196-38.elisa-laajakaista.fi. [91.157.196.38]) by mx.google.com with ESMTPSA id jl4sm937307lbc.14.2015.06.17.05.34.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Jun 2015 05:34: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: Wed, 17 Jun 2015 15:34:01 +0300 Message-Id: <1434544441-2973-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.5 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 easy fix is removing the unneccesary cd $objtree bit. 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. Signed-off-by: Riku Voipio --- scripts/package/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 99ca6e7..98f934c 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 @@ -110,13 +115,12 @@ perf-tar=perf-$(KERNELVERSION) 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)) \ + HEAD^{tree} $$(echo $$(cat $(srctree)/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,$@),, \