public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core] Have cbuild map the git alternates
@ 2017-12-14 22:41 Jason Gunthorpe
       [not found] ` <20171214224106.31017-1-jgg-uk2M96/98Pc@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2017-12-14 22:41 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jason Gunthorpe

From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

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 <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 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:
-- 
2.15.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH rdma-core] Have cbuild map the git alternates
       [not found] ` <20171214224106.31017-1-jgg-uk2M96/98Pc@public.gmane.org>
@ 2017-12-25 10:32   ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2017-12-25 10:32 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Jason Gunthorpe

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

On Thu, Dec 14, 2017 at 03:41:06PM -0700, Jason Gunthorpe wrote:
> From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> 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 <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  buildlib/cbuild | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
>

Thanks, applied

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-25 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-14 22:41 [PATCH rdma-core] Have cbuild map the git alternates Jason Gunthorpe
     [not found] ` <20171214224106.31017-1-jgg-uk2M96/98Pc@public.gmane.org>
2017-12-25 10:32   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox