Blame SOURCES/0010-buildlib-Remove-travis-CI.patch

764884
From 6ce72aaa5963b28a2a01b47f332fa20c02eeb0db Mon Sep 17 00:00:00 2001
764884
From: Jason Gunthorpe <jgg@mellanox.com>
764884
Date: Thu, 31 Oct 2019 13:17:11 -0300
764884
Subject: [PATCH rdma-core 10/13] buildlib: Remove travis CI
764884
764884
[ Upstream commit ae029ac74d62b12ea69127c91f83ad5944130764 ]
764884
764884
Azure Pipelines replaces it completely now, remove the word 'travis' from
764884
the source tree.
764884
764884
v26 was supposed to transition to azp for releases and it lacks the
764884
ability for travis to make the offical github tar.gz, so this needs to be
764884
back ported.
764884
764884
Cc: stable@linux-rdma.org #v26
764884
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
764884
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
764884
---
764884
 .travis.yml             |  45 -----------
764884
 CMakeLists.txt          |   2 +-
764884
 Documentation/stable.md |   8 +-
764884
 README.md               |  12 +--
764884
 buildlib/cbuild         | 173 ++--------------------------------------
764884
 buildlib/check-build    |   6 --
764884
 buildlib/travis-build   |  58 --------------
764884
 7 files changed, 17 insertions(+), 287 deletions(-)
764884
 delete mode 100644 .travis.yml
764884
 delete mode 100755 buildlib/travis-build
764884
764884
diff --git a/.travis.yml b/.travis.yml
764884
deleted file mode 100644
764884
index e00b0165..00000000
764884
--- a/.travis.yml
764884
+++ /dev/null
764884
@@ -1,45 +0,0 @@
764884
-language: c
764884
-dist: xenial
764884
-addons:
764884
-  # We run our builds sequentially in one VM rather than try and use the
764884
-  # matrix feature. This is because Travis is unreasonably inefficient
764884
-  # doing this APT setup pass.
764884
-  apt:
764884
-    sources:
764884
-      - ubuntu-toolchain-r-test
764884
-    packages:
764884
-      - debhelper
764884
-      - dh-systemd
764884
-      - fakeroot
764884
-      - gcc-8
764884
-      - git-core
764884
-      - libnl-3-dev
764884
-      - libnl-route-3-dev
764884
-      - libudev-dev
764884
-      - make
764884
-      - ninja-build
764884
-      - pandoc
764884
-      - python-docutils
764884
-      - pkg-config
764884
-      - python
764884
-      - valgrind
764884
-      - sparse
764884
-      - wget
764884
-      - abi-compliance-checker
764884
-      - abi-dumper
764884
-
764884
-      # 32 bit support packages
764884
-      - gcc-multilib
764884
-      # xenial craziness, need to give specific version of multilib,
764884
-      # in addition to general multilib
764884
-      - gcc-8-multilib
764884
-      - lib32gcc-8-dev
764884
-
764884
-      # pyverbs
764884
-      - python3-dev
764884
-      - python3-pip
764884
-
764884
-before_script:
764884
-  - http_proxy= pip3 install cython
764884
-script:
764884
-  - buildlib/travis-build
764884
diff --git a/CMakeLists.txt b/CMakeLists.txt
764884
index 59ffdf83..b5da62b1 100644
764884
--- a/CMakeLists.txt
764884
+++ b/CMakeLists.txt
764884
@@ -44,7 +44,7 @@
764884
 #      prefers python3 if available.
764884
 #   -DNO_PYVERBS=1 (default, build pyverbs)
764884
 #      Invoke cython to build pyverbs. Usually you will run with this option
764884
-#      is set, but it will be disabled for travis runs.
764884
+#      set
764884
 #   -DENABLE_IBDIAGS_COMPAT=True (default False)
764884
 #      Include obsolete scripts. These scripts are replaced by C programs with
764884
 #      a different interface now.
764884
diff --git a/Documentation/stable.md b/Documentation/stable.md
764884
index 76f5cf32..c12b2768 100644
764884
--- a/Documentation/stable.md
764884
+++ b/Documentation/stable.md
764884
@@ -10,7 +10,7 @@ Branched stable releases, off a mainline release, are on as-needed basis and lim
764884
 
764884
 All bug fixes are to be backported from mainline and applied by stable branch maintainer.
764884
 
764884
-Branched stable releases will append an additional release number (e.g. 15.1) and will ensure that Travis CI reports a successful build.
764884
+Branched stable releases will append an additional release number (e.g. 15.1) and will ensure that Azure Pipelines CI reports a successful build.
764884
 
764884
 Regular stable releases will be generated at the same time as mainline releases.
764884
 Additional stable releases can be generated if the need arise (Needed by distributions or OFED).
764884
@@ -73,17 +73,17 @@ so that latters patches/fixes can be checked against this reference.
764884
 
764884
 To do that, the creator of the branch should run
764884
 ```
764884
-./buildlib/cbuild build-images travis
764884
+./buildlib/cbuild build-images azp
764884
 mkdir ABI
764884
 touch ABI/.gitignore
764884
 git add ABI/.gitignore
764884
 git commit -m "ABI Files"
764884
-./buildlib/cbuild pkg travis
764884
+./buildlib/cbuild pkg azp
764884
 git add ABI/*
764884
 git commit --amend
764884
 ```
764884
 
764884
-'cbuild pkg travis' will fail as the ABI verification step files, but it will
764884
+'cbuild pkg azp' will fail as the ABI verification step files, but it will
764884
 produce the ABI reference files.
764884
 
764884
 Note that the ABI directory must NOT be committed at any point in the master branch.
764884
diff --git a/README.md b/README.md
764884
index 451ff7fc..36273ad9 100644
764884
--- a/README.md
764884
+++ b/README.md
764884
@@ -1,4 +1,4 @@
764884
-[![Build Status](https://travis-ci.org/linux-rdma/rdma-core.svg?branch=master)](https://travis-ci.org/linux-rdma/rdma-core)
764884
+[![Build Status](https://dev.azure.com/ucfconsort/rdma-core/_apis/build/status/linux-rdma.rdma-core?branchName=master)](https://dev.azure.com/ucfconsort/rdma-core/_build/latest?definitionId=2&branchName=master)
764884
 
764884
 # RDMA Core Userspace Libraries and Daemons
764884
 
764884
@@ -137,13 +137,13 @@ Make sure that your contribution can be licensed under the same
764884
 license as the original code you are patching, and that you have all
764884
 necessary permissions to release your work.
764884
 
764884
-## TravisCI
764884
+## Azure Pipelines CI
764884
 
764884
-Submitted patches must pass the TravisCI automatic builds without warnings.
764884
-A build similar to TravisCI can be run locally using docker and the
764884
+Submitted patches must pass the Azure Pipelines CI automatic builds without
764884
+warnings.  A build similar to AZP can be run locally using docker and the
764884
 'buildlib/cbuild' script.
764884
 
764884
 ```sh
764884
-$ buildlib/cbuild build-images travis
764884
-$ buildlib/cbuild pkg travis
764884
+$ buildlib/cbuild build-images azp
764884
+$ buildlib/cbuild pkg azp
764884
 ```
764884
diff --git a/buildlib/cbuild b/buildlib/cbuild
764884
index 742a9e22..9825e099 100755
764884
--- a/buildlib/cbuild
764884
+++ b/buildlib/cbuild
764884
@@ -290,100 +290,6 @@ class debian_experimental(APTEnvironment):
764884
             " ".join(sorted(self.pkgs))));
764884
         return res;
764884
 
764884
-class travis(APTEnvironment):
764884
-    """This parses the .travis.yml "apt" add on and converts it to a dockerfile,
764884
-    basically creating a container that is similar to what travis would
764884
-    use. Note this does not use the base travis image, nor does it install the
764884
-    typical travis packages."""
764884
-    docker_parent = "ubuntu:16.04";
764884
-    name = "travis";
764884
-    is_deb = True;
764884
-    _yaml = None;
764884
-
764884
-    def get_yaml(self):
764884
-        if self._yaml:
764884
-            return self._yaml;
764884
-
764884
-        # Load the commands from the travis file
764884
-        with open(".travis.yml") as F:
764884
-            self._yaml = yaml.safe_load(F);
764884
-        return self._yaml;
764884
-    yaml = property(get_yaml);
764884
-
764884
-    def get_repos(self):
764884
-        """Return a list of things to add with apt-add-repository"""
764884
-        Source = collections.namedtuple("Source",["sourceline","key_url"]);
764884
-
764884
-        # See https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
764884
-        pre_defined = {
764884
-            "ubuntu-toolchain-r-test": Source("ppa:ubuntu-toolchain-r/test",None),
764884
-        };
764884
-
764884
-        # Unique the sources
764884
-        res = set();
764884
-        for src in self.yaml["addons"]["apt"]["sources"]:
764884
-            if isinstance(src,dict):
764884
-                res.add(Source(sourceline=src["sourceline"],
764884
-                               key_url=src.get("key_url",None)));
764884
-            else:
764884
-                res.add(pre_defined[src]);
764884
-
764884
-        # Add the sources
764884
-        scmds = [];
764884
-        scmds.extend("apt-key add /etc/apt/trusted.gpg.d/%s"%(os.path.basename(I.key_url))
764884
-                    for I in res if I.key_url is not None);
764884
-        scmds.extend("http_proxy= apt-add-repository -y %s"%(pipes.quote(I.sourceline))
764884
-                    for I in res);
764884
-
764884
-        # Download the keys
764884
-        cmds = ["ADD %s /etc/apt/trusted.gpg.d/"%(I.key_url)
764884
-                for I in res if I.key_url is not None];
764884
-
764884
-        cmds.append("RUN " + " && ".join(scmds));
764884
-        return cmds;
764884
-
764884
-    def get_before_script(self):
764884
-        """Return a list of commands to run from before_script"""
764884
-        cmds = ["RUN useradd -ms /bin/bash travis && \\"
764884
-                "su -l -c %s"%(pipes.quote(" && ".join(self.yaml["before_script"]))) + " travis"];
764884
-        return cmds
764884
-
764884
-    def get_clang(self):
764884
-        """We are using the clang that comes in travis, which is not part of our base
764884
-        docker container, install something similar by hand."""
764884
-        llvm_tar = "clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
764884
-        cmds = [
764884
-            """RUN wget -q http://releases.llvm.org/7.0.0/{0} -O /tmp/{0} && \\
764884
-            tar xf /tmp/{0} -C /usr/local/ && \\
764884
-            rm /tmp/{0} && \\
764884
-            (cd /usr/local/bin/ && ln -sf ../clang*/bin/clang-7 .)""".format(llvm_tar)];
764884
-        return cmds;
764884
-
764884
-    def get_cython(self):
764884
-        return ["""RUN pip3 install cython"""]
764884
-
764884
-    def get_docker_file(self,tmpdir):
764884
-        # First this to get apt-add-repository
764884
-        self.pkgs = {"software-properties-common"}
764884
-        res = APTEnvironment.get_docker_file(self,tmpdir);
764884
-
764884
-        # Sources list from the travis.yml
764884
-        res.lines.extend(self.get_repos());
764884
-
764884
-        # Package list from the travis.yml
764884
-        # Travis uses the new cmake built into the image, we need to get an
764884
-        # older version from ubuntu.
764884
-        res.lines.append("RUN apt-get update && apt-get install -y --no-install-recommends %s"%(
764884
-            " ".join(sorted(["cmake"] + self.yaml["addons"]["apt"]["packages"]))));
764884
-
764884
-        # Adding before_script commands
764884
-        res.lines.extend(self.get_before_script())
764884
-
764884
-        res.lines.extend(self.get_clang())
764884
-        res.lines.extend(self.get_cython())
764884
-
764884
-        return res;
764884
-
764884
 # -------------------------------------------------------------------------
764884
 
764884
 class ZypperEnvironment(Environment):
764884
@@ -521,7 +427,6 @@ deb [arch=arm64,ppc64el] http://ports.ubuntu.com/ bionic-updates main universe""
764884
 environments = [centos6(),
764884
                 centos7(),
764884
                 centos7_epel(),
764884
-                travis(),
764884
                 xenial(),
764884
                 bionic(),
764884
                 jessie(),
764884
@@ -572,7 +477,7 @@ def env_choices_pkg():
764884
     """All the names that can be used with ToEnvAction"""
764884
     envs = set(("all",));
764884
     for I in environments:
764884
-        if I.name == "travis" or getattr(I,"is_deb",False) or getattr(I,"is_rpm",False):
764884
+        if getattr(I,"is_deb",False) or getattr(I,"is_rpm",False):
764884
                 envs.add(I.name);
764884
                 envs.update(I.aliases);
764884
     return envs;
764884
@@ -660,12 +565,12 @@ def get_tar_file(args,tarfn,pandoc_prebuilt=False):
764884
         return;
764884
 
764884
     # When the OS does not support pandoc we got through the extra step to
764884
-    # build pandoc output in the travis container and include it in the
764884
+    # build pandoc output in the azp container and include it in the
764884
     # tar.
764884
     if not args.use_prebuilt_pandoc:
764884
-        subprocess.check_call(["buildlib/cbuild","make","travis","docs"]);
764884
+        subprocess.check_call(["buildlib/cbuild","make","azure_pipelines","docs"]);
764884
 
764884
-    cmd_make_dist_tar(argparse.Namespace(BUILD="build-travis",tarfn=tarfn,
764884
+    cmd_make_dist_tar(argparse.Namespace(BUILD="build-azure_pipelines",tarfn=tarfn,
764884
                                          script_pwd="",tag=None));
764884
 
764884
 def run_rpm_build(args,spec_file,env):
764884
@@ -839,70 +744,6 @@ def copy_abi_files(src):
764884
             print("Changed ABI File: ", ref_fn);
764884
             shutil.copy(cur_fn, ref_fn);
764884
 
764884
-def run_travis_build(args,env):
764884
-    with private_tmp(args) as tmpdir:
764884
-        os.mkdir(os.path.join(tmpdir,"src"));
764884
-        os.mkdir(os.path.join(tmpdir,"tmp"));
764884
-
764884
-        opwd = os.getcwd();
764884
-        with inDirectory(os.path.join(tmpdir,"src")):
764884
-            subprocess.check_call(["git",
764884
-                                   "--git-dir",os.path.join(opwd,".git"),
764884
-                                   "reset","--hard","HEAD"]);
764884
-            subprocess.check_call(["git",
764884
-                                   "--git-dir",os.path.join(opwd,".git"),
764884
-                                   "fetch",
764884
-                                   "--no-tags",
764884
-                                   "https://github.com/linux-rdma/rdma-core.git","HEAD",
764884
-                                   "master"]);
764884
-            base = subprocess.check_output(["git",
764884
-                                            "--git-dir",os.path.join(opwd,".git"),
764884
-                                            "merge-base",
764884
-                                            "HEAD","FETCH_HEAD"]).decode().strip();
764884
-
764884
-        home = os.path.join(os.path.sep,"home","travis");
764884
-        home_build = os.path.join(os.path.sep,home,"build");
764884
-
764884
-        opts = [
764884
-            "run",
764884
-            "--read-only",
764884
-            "--rm=true",
764884
-            "-v","%s:%s"%(tmpdir, home_build),
764884
-            "-w",os.path.join(home_build,"src"),
764884
-            "-u",str(os.getuid()),
764884
-            "-e","TRAVIS_COMMIT_RANGE=%s..HEAD"%(base),
764884
-            "-e","TRAVIS_BRANCH=%s"%(base),
764884
-            "-e","TRAVIS_EVENT_TYPE=pull_request",
764884
-            "-e","HOME=%s"%(home),
764884
-            "-e","TMPDIR=%s"%(os.path.join(home_build,"tmp")),
764884
-        ] + map_git_args(opwd,os.path.join(home_build,"src"));
764884
-
764884
-        # Load the commands from the travis file
764884
-        with open(os.path.join(opwd,".travis.yml")) as F:
764884
-            cmds = yaml.safe_load(F)["script"];
764884
-
764884
-        with open(os.path.join(tmpdir,"go.sh"),"w") as F:
764884
-            print("#!/bin/bash", file=F);
764884
-            print("set -e", file=F);
764884
-            for I in cmds:
764884
-                print(I, file=F);
764884
-
764884
-        if args.run_shell:
764884
-            opts.append("-ti");
764884
-        opts.append(env.image_name());
764884
-
764884
-        if args.run_shell:
764884
-            opts.append("/bin/bash");
764884
-        else:
764884
-            opts.extend(["/bin/bash",os.path.join(home_build,"go.sh")]);
764884
-
764884
-        try:
764884
-            docker_cmd(args,*opts);
764884
-        except subprocess.CalledProcessError as e:
764884
-            copy_abi_files(os.path.join(tmpdir, "src/ABI"));
764884
-            raise;
764884
-        copy_abi_files(os.path.join(tmpdir, "src/ABI"));
764884
-
764884
 def run_azp_build(args,env):
764884
     # Load the commands from the pipelines file
764884
     with open("buildlib/azure-pipelines.yml") as F:
764884
@@ -995,7 +836,7 @@ def args_pkg(parser):
764884
     parser.add_argument("--run-shell",default=False,action="store_true",
764884
                         help="Instead of running the build, enter a shell");
764884
     parser.add_argument("--use-prebuilt-pandoc",default=False,action="store_true",
764884
-                        help="Do not rebuild the pandoc cache in build-travis/pandoc-prebuilt/");
764884
+                        help="Do not rebuild the pandoc cache in build-azure_pipelines/pandoc-prebuilt/");
764884
     parser.add_argument("--with", default=[],action="append", dest="with_flags",
764884
                         help="Enable specified feature in RPM builds");
764884
     parser.add_argument("--without", default=[],action="append", dest="without_flags",
764884
@@ -1003,9 +844,7 @@ def args_pkg(parser):
764884
 def cmd_pkg(args):
764884
     """Build a package in the given environment."""
764884
     for env in args.ENV:
764884
-        if env.name == "travis":
764884
-            run_travis_build(args,env);
764884
-        elif env.name == "azure_pipelines":
764884
+        if env.name == "azure_pipelines":
764884
             run_azp_build(args,env);
764884
         elif getattr(env,"is_deb",False):
764884
             run_deb_build(args,env);
764884
diff --git a/buildlib/check-build b/buildlib/check-build
764884
index 46053527..ab8524e5 100755
764884
--- a/buildlib/check-build
764884
+++ b/buildlib/check-build
764884
@@ -364,12 +364,6 @@ def get_cc_args_from_pkgconfig(args, name, static):
764884
     if not static:
764884
         return opts
764884
 
764884
-    # The old pkg-config that travis uses incorrectly removes duplicated
764884
-    # flags, which breaks linking.
764884
-    if (name == "ibverbs" and
764884
-        subprocess.check_output(["pkg-config", "--version"]).decode().strip() == "0.26"):
764884
-        opts.insert(0, "-libverbs")
764884
-
764884
     # Only static link the pkg-config stuff, otherwise we get warnings about
764884
     # static linking portions of glibc that need NSS.
764884
     opts.insert(0, "-Wl,-Bstatic")
764884
diff --git a/buildlib/travis-build b/buildlib/travis-build
764884
deleted file mode 100755
764884
index 48c1c8f6..00000000
764884
--- a/buildlib/travis-build
764884
+++ /dev/null
764884
@@ -1,58 +0,0 @@
764884
-#!/bin/bash
764884
-
764884
-PATH=/home/`whoami`/.local/bin:$PATH
764884
-
764884
-# Stop on error
764884
-set -e
764884
-# Echo all commands to Travis log
764884
-set -x
764884
-
764884
-mkdir build-travis build32 build-sparse
764884
-
764884
-# Build with latest clang first
764884
-cd build-travis
764884
-CC=clang-7 CFLAGS=-Werror cmake -GNinja .. -DIOCTL_MODE=both -DENABLE_STATIC=1
764884
-ninja
764884
-../buildlib/check-build --src .. --cc clang-7
764884
-
764884
-# 32 bit build to check format strings/etc
764884
-cd ../build32
764884
-# travis is not configured in a way that enables all 32 bit
764884
-# packages. We could fix this with some sudo stuff.. For now turn off libnl
764884
-CC=gcc-8 CFLAGS="-Werror -m32 -msse3" cmake -GNinja .. -DENABLE_RESOLVE_NEIGH=0 -DIOCTL_MODE=both -DNO_PYVERBS=1
764884
-ninja
764884
-
764884
-# Run sparse on the subdirectories which are sparse clean
764884
-cd ../build-sparse
764884
-mv ../CMakeLists.txt ../CMakeLists-orig.txt
764884
-grep -v "# NO SPARSE" ../CMakeLists-orig.txt > ../CMakeLists.txt
764884
-CC=cgcc CFLAGS="-Werror" cmake -GNinja .. -DIOCTL_MODE=both -DNO_PYVERBS=1
764884
-ninja | grep -v '^\[' | tee out
764884
-# sparse does not fail gcc on messages
764884
-if [ -s out ]; then
764884
-   false
764884
-fi
764884
-mv ../CMakeLists-orig.txt ../CMakeLists.txt
764884
-
764884
-# Test with coherent DMA mode disabled (ie as would be on ARM32, etc)
764884
-cd ../build-travis
764884
-cp ../util/udma_barrier.h ../util/udma_barrier.h.old
764884
-echo "#error Fail" >> ../util/udma_barrier.h
764884
-rm CMakeCache.txt
764884
-CC=clang-7 CFLAGS=-Werror cmake -GNinja .. -DIOCTL_MODE=both
764884
-ninja
764884
-cp ../util/udma_barrier.h.old ../util/udma_barrier.h
764884
-
764884
-# Finally run through gcc-8 64 bit through the debian packaging This gives a
764884
-# good clue if patches are changing packaging related things, the RPM stuff
764884
-# will have to be audited by hand.
764884
-
764884
-# When running cmake through debian/rules it is hard to set -Werror,
764884
-# instead force it on by changing the CMakeLists.txt
764884
-cd ..
764884
-echo 'set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")' >> buildlib/RDMA_EnableCStd.cmake
764884
-sed -i -e 's/-DCMAKE_BUILD_TYPE=Release/-DCMAKE_BUILD_TYPE=Debug/g' debian/rules
764884
-sed -i -e 's/ninja \(.*\)-v/ninja \1/g' debian/rules
764884
-
764884
-CC=gcc-8 debian/rules build
764884
-fakeroot debian/rules binary
764884
-- 
764884
2.20.1
764884