diff mbox

[rdma-core,05/21] Make 'cbuild travis pkg' run sparse like real travis

Message ID 1500926429-31822-6-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe July 24, 2017, 8 p.m. UTC
Provide a git dir in the container and compute the package set
relative to the current top of tree on github.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 .travis.yml     |  1 +
 buildlib/cbuild | 12 ++++++++++++
 2 files changed, 13 insertions(+)
diff mbox

Patch

diff --git a/.travis.yml b/.travis.yml
index 4eba65be3353ca..c190a2418b651a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,6 +26,7 @@  addons:
       - fakeroot
       - gcc
       - gcc-7
+      - git
       - libnl-3-dev
       - libnl-route-3-dev
       - libudev-dev
diff --git a/buildlib/cbuild b/buildlib/cbuild
index 50e478154b0295..888fae6ccca692 100755
--- a/buildlib/cbuild
+++ b/buildlib/cbuild
@@ -550,6 +550,16 @@  def run_travis_build(args,env):
             subprocess.check_call(["git",
                                    "--git-dir",os.path.join(opwd,".git"),
                                    "reset","--hard","HEAD"]);
+            subprocess.check_call(["git",
+                                   "--git-dir",os.path.join(opwd,".git"),
+                                   "fetch",
+                                   "--no-tags",
+                                   "https://github.com/linux-rdma/rdma-core.git","HEAD",
+                                   "master"]);
+            base = subprocess.check_output(["git",
+                                            "--git-dir",os.path.join(opwd,".git"),
+                                            "merge-base",
+                                            "HEAD","FETCH_HEAD"]).strip();
 
         home = os.path.join(os.path.sep,"home","travis");
         home_build = os.path.join(os.path.sep,home,"build");
@@ -559,8 +569,10 @@  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),
             "-e","HOME=%s"%(home),
             "-e","TMPDIR=%s"%(os.path.join(home_build,"tmp")),
         ];