From patchwork Tue May 26 18:20:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Naour X-Patchwork-Id: 1298324 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=h0gV0t0F; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Wj2D5SD9z9sSd for ; Wed, 27 May 2020 04:20:51 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4C96787BE3; Tue, 26 May 2020 18:20:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6NZsLeLhTCr5; Tue, 26 May 2020 18:20:47 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id BE51A866BD; Tue, 26 May 2020 18:20:47 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 1DA0B1BF83E for ; Tue, 26 May 2020 18:20:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1853B2287D for ; Tue, 26 May 2020 18:20:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oRmnuSc3ejo3 for ; Tue, 26 May 2020 18:20:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by silver.osuosl.org (Postfix) with ESMTPS id 66435204D3 for ; Tue, 26 May 2020 18:20:44 +0000 (UTC) Received: by mail-wm1-f48.google.com with SMTP id c71so497316wmd.5 for ; Tue, 26 May 2020 11:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=2H7rETl40mxUEN9uDtgLmME14POLSVkpzXit1Kej/g0=; b=h0gV0t0Fb9Az6AOWv18ILAHpXgnaO/E+wcs3QM3Au3ZzcyG/hHQuNBlsuDXNKt/4NB UY4QA9XnMmLvDzpakBRQrJbUJqXo6DzUJ8Ng+FemohUJW0Pna/8IzrzDNyJuUX2TXdu2 UVS4ptw9ctW0mL+s6YqEdLp4eECJOjfsGFyUIgpkavMsO6mdnZxGih/xlAZN5Y5879Cs dsSUAiXzggmLdKGFriDmwcXmAkIEMOxYwc6sbjd9bZzQpte+HWTRVh3wMRByEeds0BkA SPQNVR3vHSgT3tXbgqtKyRXd9e9YYNW11J8ZjFX+rf8de6WH6CBgBkF+NVAUHm/J53mp TV5Q== 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:mime-version :content-transfer-encoding; bh=2H7rETl40mxUEN9uDtgLmME14POLSVkpzXit1Kej/g0=; b=GCl/ubSPHQydNQx6VGZZvXQOe5B8QmrFIy/EfkA3i6Lyci+ra+Ty7++2jX5QQEwcQR iH9bwMs32bUqNd6v46ULsBuZio42k8zzzUW/EcPxqpJj3fFEITh11EDaTZWOnDmQ/wjx 23qyScsMQWLMcH86FOs9/keonqjbHPgEPtQRRXTCEgz2/O7xE5jlUHigKpc8p0dePIj2 kyWsP3cRZr+kUnH7IQ7rhyxYbrpagWwPK90V01nymMr+TRJzc7vae6by/3W676hcyq++ MaMkYloG+W2z4jDXXyRKd/behVaTZlBp9wy4/+yB94nuASXL3B5D/WzYXWudwjSQ+xy5 lDHw== X-Gm-Message-State: AOAM5321sihoUsjEcIh08q9OPW/yFFglG5OoZ92iNk/aCtTdAciZGGwm xn+GQpYCBSZyoAAWIwc6hi7ogObD X-Google-Smtp-Source: ABdhPJy9iRqyt45iymPj2o9xmKNYAXt6aSIusKe/MngCl/B5+UufQcdIN8JWWUGa3P7LmYXBnPbbEw== X-Received: by 2002:a1c:dc02:: with SMTP id t2mr471669wmg.8.1590517242330; Tue, 26 May 2020 11:20:42 -0700 (PDT) Received: from localhost.localdomain (2a01cb0589880c0046708304bf1f24fd.ipv6.abo.wanadoo.fr. [2a01:cb05:8988:c00:4670:8304:bf1f:24fd]) by smtp.gmail.com with ESMTPSA id h7sm292274wml.24.2020.05.26.11.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 11:20:41 -0700 (PDT) From: Romain Naour To: buildroot@buildroot.org Date: Tue, 26 May 2020 20:20:37 +0200 Message-Id: <20200526182037.592824-1-romain.naour@gmail.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Subject: [Buildroot] [for-next] package/rust: allow using python3 interpreter X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Patrick Havelange , Romain Naour , Titouan Christophe Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Fedora packaging use python3 as python interpreter since rust 1.24.0 [1] by removing python2 tests from configure script [2]. Using python3 will help to remove python2 in a near future. [1] https://src.fedoraproject.org/rpms/rust/c/216b2d27716bf1031c526dbd0e01a1fa8e6d5aa2 [2] https://src.fedoraproject.org/rpms/rust/blob/216b2d27716bf1031c526dbd0e01a1fa8e6d5aa2/f/rust.spec#_314 Signed-off-by: Romain Naour Cc: Titouan Christophe Cc: Arnout Vandecappelle Cc: Patrick Havelange Tested-by: Titouan Christophe --- ...igure-use-default-python-interpreter.patch | 37 +++++++++++++++++++ package/rust/rust.mk | 17 ++++++--- 2 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 package/rust/0002-configure-use-default-python-interpreter.patch diff --git a/package/rust/0002-configure-use-default-python-interpreter.patch b/package/rust/0002-configure-use-default-python-interpreter.patch new file mode 100644 index 0000000000..34d97bb4cf --- /dev/null +++ b/package/rust/0002-configure-use-default-python-interpreter.patch @@ -0,0 +1,37 @@ +From aca7abb537f5caf1c9f027cf65dd0f53fb664e73 Mon Sep 17 00:00:00 2001 +From: Romain Naour +Date: Tue, 26 May 2020 18:24:25 +0200 +Subject: [PATCH] configure: use default python interpreter + +Don't try to use python2 if available, use the python interpreter available +in ouput/host/bin/python whateverer the python version is. + +Signed-off-by: Romain Naour +--- + configure | 12 ------------ + 1 file changed, 12 deletions(-) + +diff --git a/configure b/configure +index eeb8d081d34..6014a982f47 100755 +--- a/configure ++++ b/configure +@@ -2,16 +2,4 @@ + + script="$(dirname $0)"/src/bootstrap/configure.py + +-try() { +- cmd=$1 +- shift +- T=$($cmd --version 2>/dev/null) +- if [ $? -eq 0 ]; then +- exec $cmd "$script" "$@" +- fi +-} +- +-try python2.7 "$@" +-try python27 "$@" +-try python2 "$@" + exec python $script "$@" +-- +2.25.4 + diff --git a/package/rust/rust.mk b/package/rust/rust.mk index 5d14fc6682..25153966f2 100644 --- a/package/rust/rust.mk +++ b/package/rust/rust.mk @@ -17,9 +17,16 @@ HOST_RUST_DEPENDENCIES = \ host-rust-bin \ host-cargo-bin \ host-openssl \ - host-python \ $(BR2_CMAKE_HOST_DEPENDENCY) +ifeq ($(BR2_PACKAGE_PYTHON3),y) +HOST_RUST_PYTHON_VERSION = $(PYTHON3_VERSION_MAJOR) +HOST_RUST_DEPENDENCIES += host-python3 +else +HOST_RUST_PYTHON_VERSION = $(PYTHON_VERSION_MAJOR) +HOST_RUST_DEPENDENCIES += host-python +endif + HOST_RUST_VERBOSITY = $(if $(VERBOSE),2,0) # Some vendor crates contain Cargo.toml.orig files. The associated @@ -44,7 +51,7 @@ define HOST_RUST_CONFIGURE_CMDS echo 'target = ["$(RUSTC_TARGET_NAME)"]'; \ echo 'cargo = "$(HOST_CARGO_BIN_DIR)/cargo/bin/cargo"'; \ echo 'rustc = "$(HOST_RUST_BIN_DIR)/rustc/bin/rustc"'; \ - echo 'python = "$(HOST_DIR)/bin/python2"'; \ + echo 'python = "$(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION)"'; \ echo 'submodules = false'; \ echo 'vendor = true'; \ echo 'compiler-docs = false'; \ @@ -61,12 +68,12 @@ define HOST_RUST_CONFIGURE_CMDS endef define HOST_RUST_BUILD_CMDS - cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py build + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py build endef define HOST_RUST_INSTALL_CMDS - cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py dist - cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python2 x.py install + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py dist + cd $(@D); $(HOST_MAKE_ENV) $(HOST_DIR)/bin/python$(HOST_RUST_PYTHON_VERSION) x.py install endef $(eval $(host-generic-package))