From patchwork Thu Dec 14 22:41:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10113403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E9C6A60352 for ; Thu, 14 Dec 2017 22:41:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB16D285CD for ; Thu, 14 Dec 2017 22:41:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFCED29CD6; Thu, 14 Dec 2017 22:41:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C280295AB for ; Thu, 14 Dec 2017 22:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754045AbdLNWlQ (ORCPT ); Thu, 14 Dec 2017 17:41:16 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:46844 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753990AbdLNWlP (ORCPT ); Thu, 14 Dec 2017 17:41:15 -0500 Received: by mail-wm0-f68.google.com with SMTP id r78so14262491wme.5 for ; Thu, 14 Dec 2017 14:41:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id; bh=CFvX3yj8HfYin/Za/fyfXvSYHFO9k+W7qMWqaqyWKEQ=; b=GcHBH6KI5NWywPQtKq0IHaq8NVCC3Hw1MiGimDSe2y97Z3KcWCSTDwn8kDX82LRkfB qWDK8RBZfa33bfipOldyDIzizyuKBWYM7Umpgay4DD1LMnwW8dA6Tu4gfb0vDHtXneeg kaRTwMyGRm654/dJxjtDiw03SsGoRGCMGxYgDY2BjqdbTKFBuQU1owU24nQN53vrueNs 9zC3tUXnqmSxeB0nVu6ywcrC6TdPVea8k4SDeGsX7XawX2wj4Bg4+Bs9OAcG8IBGjxuF lunPd5NtUDnV+O8xOl9V/Ys84DkAEV3LQlMqAlk4Q8ewuuFGXQ5Z1a/5x3MF8Rz7zMmX ++NA== 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=CFvX3yj8HfYin/Za/fyfXvSYHFO9k+W7qMWqaqyWKEQ=; b=gSUGvzfeocpspNH0oscdnGafsWYdkNs4V9RV+h+cpmxG3XPQud1ZwCUgF14Z2BYwP5 A3FnkaLUGNC6BBiSHqkl8tfLhDhJBj9CVfey8+0C6wLJtqLxpBUyBJI99w5QSMm1tx+k Dur23k8CD8Rhx+M5enIw8zYoNF4EgBrCRcVx1T9sbzrmPEkVAKFomF/CwxXAK4ymBoej a/I9LA/g5fxswxp/k3sAnFHa3+SIrGWp6DV+WRMjQXeMnqy/3Gg5gVz+wJmx6lpCj1Lb QoH3uzTYIy7lMP1eF7XwrtC7I9tv+s8uXOHxp09SdqYxD569/NGZ6DHCNMVEsO69aQAZ tPLA== X-Gm-Message-State: AKGB3mLFVbUNnvBTINiWPj973zRF3dGQuXkKqkjBOiTJTPuj4PdJVGo4 P7HZAucfUG2bD6L72Kah4pgB3X8qgVA= X-Google-Smtp-Source: ACJfBouACnOLozC820eotBI+nl9o5BmqMleg/kIqoRH2FEEEfsfBBI7ZyDPC5xydK4Fjgy0/ty6gOQ== X-Received: by 10.28.149.203 with SMTP id x194mr3434426wmd.145.1513291274367; Thu, 14 Dec 2017 14:41:14 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id c54sm5732331wra.84.2017.12.14.14.41.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 14:41:13 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1ePcBj-00085C-KY; Thu, 14 Dec 2017 15:41:11 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core] Have cbuild map the git alternates Date: Thu, 14 Dec 2017 15:41:06 -0700 Message-Id: <20171214224106.31017-1-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe When running commands in the travis configuration it needs access to the git history to run checkpatch, but if the local repo is using alternates that fails. The simple solution is to just map the alternate directories into the container as well. Signed-off-by: Jason Gunthorpe --- buildlib/cbuild | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) This is https://github.com/linux-rdma/rdma-core/pull/277 diff --git a/buildlib/cbuild b/buildlib/cbuild index 29c5b4b87d9548..3f659bf84ff68d 100755 --- a/buildlib/cbuild +++ b/buildlib/cbuild @@ -402,6 +402,22 @@ def inDirectory(dir): finally: os.chdir(cdir); +def map_git_args(src_root,to): + """Return a list of docker arguments that will map the .git directory into the + container""" + srcd = os.path.join(src_root,".git"); + res = ["-v","%s:%s:ro"%(srcd, + os.path.join(to,".git"))]; + + alternates = os.path.join(srcd,"objects/info/alternates"); + if os.path.exists(alternates): + with open(alternates) as F: + for I in F.readlines(): + I = I.strip(); + res.extend(["-v","%s:%s:ro"%(I,I)]); + + return res; + def get_image_id(args,image_name): img = json.loads(docker_cmd_str(args,"inspect",image_name)); image_id = img[0]["Id"]; @@ -606,7 +622,6 @@ def run_travis_build(args,env): "--read-only", "--rm=true", "-v","%s:%s"%(tmpdir, home_build), - "-v","%s:%s:ro"%(os.path.join(opwd,".git"),os.path.join(home_build,"src",".git")), "-w",os.path.join(home_build,"src"), "-u",str(os.getuid()), "-e","TRAVIS_COMMIT_RANGE=%s..HEAD"%(base), @@ -614,7 +629,7 @@ def run_travis_build(args,env): "-e","TRAVIS_EVENT_TYPE=pull_request", "-e","HOME=%s"%(home), "-e","TMPDIR=%s"%(os.path.join(home_build,"tmp")), - ]; + ] + map_git_args(opwd,os.path.join(home_build,"src")); # Load the commands from the travis file with open(os.path.join(opwd,".travis.yml")) as F: