From patchwork Mon Jan 15 21:13:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10165369 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 1E8C760467 for ; Mon, 15 Jan 2018 21:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1076125404 for ; Mon, 15 Jan 2018 21:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04D9725D99; Mon, 15 Jan 2018 21:14:02 +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 CF0D5262AE for ; Mon, 15 Jan 2018 21:14:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750876AbeAOVN7 (ORCPT ); Mon, 15 Jan 2018 16:13:59 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35280 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbeAOVN4 (ORCPT ); Mon, 15 Jan 2018 16:13:56 -0500 Received: by mail-wr0-f194.google.com with SMTP id g38so9926893wrd.2 for ; Mon, 15 Jan 2018 13:13:56 -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:in-reply-to:references; bh=SlnyYRtReZXLJaa5P73jdPjEtvS89Yej1+gt9K3fRI4=; b=emqFQI+0ec6FsWVhZ3m5T2QfWbi9+aK2sCcSXB4F/tpsWXFeIpqXjEqMswayCMgMGi /jZ2yJSp/BhOQsoACLsjEFOk6CqdlsCG/mSnZf4iO4xMo0p/RqKl6Hoh2M/NiLR0CMYZ o62knQ3Z7+1I3Sfpn3kLRon0p3FYjuR0Z4sUAYC7vSUguJnoVvaJqwtfeMIZJPU0chQ1 SUYC8HoYWl76wAMefgjZqs0hJ7JF9UUGkjhXnIfIfO3DblSsTOoOGrgLAscKtkhPyZvB I2QtHzrXBlvQ4ll59ZKY4xm+Kwakgms0F2UlU/8rek+1KjP0wUV8vIwwri+tFA0ZLfBo T/Sg== 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:in-reply-to :references; bh=SlnyYRtReZXLJaa5P73jdPjEtvS89Yej1+gt9K3fRI4=; b=AFwtW8J/mYQkMI0Hgo4ViNnXqL6T93F363vXojJ3b/iVdRpf2QtvzJgxpJPKDa7YNx XBLt5TdyhssWira1A7++DnHVwCcSvbodJBv0ExO9i7KXMXSb9tYPl/TlwavJZVGqH8OH SUKimJR75+rRDpxKIynQe6JUKCdEzqvV5LcrjMACyKeDwEXGAYkFfgKTMASPq+3nXzXf B7pVJ8ciW07PRV38V+24i2qGDz+wiC4y86YYgsDnOQ+auoT9UvD3S03Y1Tl0pVi6Snfq kWvvRQzHbV+0ZXZ8MAphCR3Wvgsbn1duck+ieQJQ5HmAPNuZGC0x21+zcRJ3y7HNHtaI gLog== X-Gm-Message-State: AKwxytfkduZ92nC2XUpAM7W7xeAHw9DgC7hIp8PtU2hY6L+8Ke9GByKh kJLOMS4azQ+feRqqiyB7Wf/xrCezZpU= X-Google-Smtp-Source: ACJfBouVMKgQR2xhgaCmtAd9JzL3wEiYwC28KGJNquoVh6oPzqmqe1S4mBt7nvqIpzcCggyK9vr21g== X-Received: by 10.223.186.194 with SMTP id w2mr21902643wrg.173.1516050835553; Mon, 15 Jan 2018 13:13:55 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id e132sm1023884wmd.40.2018.01.15.13.13.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jan 2018 13:13:53 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1ebC4k-0001UQ-GG; Mon, 15 Jan 2018 14:13:50 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 1/3] cbuild: Support distros that only ship python3 Date: Mon, 15 Jan 2018 14:13:45 -0700 Message-Id: <20180115211347.5651-2-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180115211347.5651-1-jgg@ziepe.ca> References: <20180115211347.5651-1-jgg@ziepe.ca> 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 SuSE tumbleweed is no longer shipping python2 by default, at least in the minimal docker image. This breaks cbuild and travis. Revise this little scriptlet we run in the container to support both versions of python and use python3 in tumbleweed. Signed-off-by: Jason Gunthorpe --- buildlib/cbuild | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/buildlib/cbuild b/buildlib/cbuild index 3f659bf84ff68d..6e52328d489dea 100755 --- a/buildlib/cbuild +++ b/buildlib/cbuild @@ -73,6 +73,7 @@ class DockerFile(object): self.lines = ["FROM %s"%(src)]; class Environment(object): + python_cmd = "python"; aliases = set(); use_make = False; proxy = True; @@ -324,6 +325,9 @@ class tumbleweed(ZypperEnvironment): name = "tumbleweed"; specfile = "suse/rdma-core.spec"; rpmbuild_options = [ "--without=curlmini" ]; + # tumbleweed no longer includes python2 in the base docker images, only python3, + # use that instead. + python_cmd = "python3"; # ------------------------------------------------------------------------- @@ -474,17 +478,17 @@ def run_rpm_build(args,spec_file,env): print >> F,""" import os,subprocess; with open("/etc/passwd","a") as F: - print >> F, {passwd!r}; + F.write({passwd!r} + "\\n"); with open("/etc/group","a") as F: - print >> F, {group!r}; + F.write({group!r} + "\\n"); os.setgid({gid:d}); os.setuid({uid:d}); # Get RPM to tell us the expected tar filename. for ln in subprocess.check_output(["rpmspec","-P",{tspec_file!r}]).splitlines(): - if ln.startswith("Source:"): - tarfn = ln.strip().partition(' ')[2].strip(); -os.symlink({tarfn!r},os.path.join("SOURCES",tarfn)); + if ln.startswith(b"Source:"): + tarfn = ln.strip().partition(b' ')[2].strip(); +os.symlink({tarfn!r},os.path.join(b"SOURCES",tarfn)); """.format(passwd=":".join(str(I) for I in pwd.getpwuid(os.getuid())), group=":".join(str(I) for I in grp.getgrgid(os.getgid())), uid=os.getuid(), @@ -505,7 +509,7 @@ os.symlink({tarfn!r},os.path.join("SOURCES",tarfn)); if args.run_shell: opts.append("/bin/bash"); else: - opts.extend(["python","go.py"]); + opts.extend([env.python_cmd,"go.py"]); docker_cmd(args,*opts)