From patchwork Fri Jun 5 20:59:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Duskett X-Patchwork-Id: 1304375 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.133; helo=hemlock.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=G4Erhiyw; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dw4f1B35z9sRW for ; Sat, 6 Jun 2020 06:59:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 18F9289128; Fri, 5 Jun 2020 20:59:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 652RT+FUQpoS; Fri, 5 Jun 2020 20:59:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 7EA2A8907E; Fri, 5 Jun 2020 20:59:26 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 2D1B41BF292 for ; Fri, 5 Jun 2020 20:59:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2737C8907E for ; Fri, 5 Jun 2020 20:59:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id arh6js4Xrrwh for ; Fri, 5 Jun 2020 20:59:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by hemlock.osuosl.org (Postfix) with ESMTPS id 7928188F93 for ; Fri, 5 Jun 2020 20:59:24 +0000 (UTC) Received: by mail-qk1-f175.google.com with SMTP id q8so11173763qkm.12 for ; Fri, 05 Jun 2020 13:59:24 -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=0WLuKw7MkE7velbGmUF8FmDXrk775atl2m9Fm7fkDLw=; b=G4Erhiyw3rVWc0/lNMNMdhuDHIRFnX3guZHKYrOcdvq1dYrCBAJN7kIjJjj+vR4UXz Zh7vmj257cITd/Ow3BUW1Pc2NJMXPEg+rw6hhDlrUa4UFSZfPleTi8Sm9/hF5gefPdxX acmsFwZvDaZ1jZRc4eLtM35Un0/Nx0yxO35UEvUgvBVeu1g/Mx/gVb+YGVWYv7iLDu7B d0hBUkWWB4sLuEG6SOScDjpxfGvOjbOC+hmRMaGOC32oE9B9shoV/ElHhWo68MDmLAwE yvMlKxKbrW1Ip+iinkLm0eBnb12HOVcm5fg7eTRluPib+EBhktxvjKo9zVZhs8Ir4B4U 7ojg== 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=0WLuKw7MkE7velbGmUF8FmDXrk775atl2m9Fm7fkDLw=; b=NmhR7tD6LEeG+BZXKpry9n/nvjuxVPEXFhvtsJfHwGaULwtxeWdhwzbKVY1ICtblSC KUonWRZL0nFVH0gUfknkwQfKVFzuHeQH46fTvm/QWrSm8fRF9hmxeDap3X58+CTzAbRA l3EyLh9231Oy1RJbC2P81kQ/n0jwMmJTZMdTfmeeCknQtRvXIEx5F6YCNMSv4cGBzh15 umqFixsNHo89TFhPvGe6hl1Cpy9nHgbdDSgRSNDQsSJjumJWQoB17jTj8j9DXNFSj989 nO0uHs/G4IaxQhEmHyQ1etMjMu3UZ8tik9hQTbHfp9Oj7//ELEuQ1QY3QfL4dftIhTnm vyDA== X-Gm-Message-State: AOAM533G1Fv7xzJqRab7YU67DOcLX78aI1vDYnNhUNroaNXS5KnUQhYz hwUyLPLDNH/pOoBO11LZwx23dHxK X-Google-Smtp-Source: ABdhPJxypvBgILdSIPVRHW3Gu4DJGeLVWfPO2d/hZ84dwPd93bJNMYqL7f1iS9ACdtH0NfyPlV7pag== X-Received: by 2002:ae9:ef03:: with SMTP id d3mr12368446qkg.390.1591390763093; Fri, 05 Jun 2020 13:59:23 -0700 (PDT) Received: from aduskett-workstation.rai.com ([47.149.8.172]) by smtp.gmail.com with ESMTPSA id g28sm740301qts.88.2020.06.05.13.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 13:59:22 -0700 (PDT) From: aduskett@gmail.com To: buildroot@buildroot.org Date: Fri, 5 Jun 2020 13:59:20 -0700 Message-Id: <20200605205920.465052-1-aduskett@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] package/pkg-python: use a shell expansion for sysconfigdata_name 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: Adam Duskett , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Adam Duskett Currently, GNU Make expands the Python SYSCONFIGDATA_NAME variable; however, when building with per-package directories, this variable is not set because the evaluation of this variable occurs before buildroot creates the per-package directories of a given package. There are two solutions to fix this problem: - Add a step between "patch" and "configure," which would evaluate all of the variables after creating the per-package directories. - Evaluate SYSCONFIGDATA_NAME via a shell expansion instead of GNU Make. As the second option is more expedient, the second option is what this commit impliments. Remove the current PKG_PYTHON_SYSCONFIGDATA_NAME definition and replace it with the following: PKG_PYTHON_SYSCONFIGDATA_PATH: - This variable is used to make the next line easier to read. PKG_PYTHON_SYSCONFIGDATA_NAME = `{ [ -e $(PKG_PYTHON_SYSCONFIGDATA_PATH) ] && basename $(PKG_PYTHON_SYSCONFIGDATA_PATH) .py; } || true` - The "-e" check ensures the path exists, as the basename command only evaluates strings. - The "|| true" is added to ensure the old behavior of returning an empty string if the file does not exist still works. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12941 Signed-off-by: Adam Duskett --- package/pkg-python.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/pkg-python.mk b/package/pkg-python.mk index 4bf762e662..73fe9954e7 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -20,9 +20,11 @@ # ################################################################################ -define PKG_PYTHON_SYSCONFIGDATA_NAME -$(basename $(notdir $(wildcard $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/_sysconfigdata__linux_*.py))) -endef +# basename does not evaluate if a file exists, so we must check to ensure +# the _sysconfigdata__linux_*.py file exists. The "|| true" is added to return +# an empty string if the file does not exist. +PKG_PYTHON_SYSCONFIGDATA_PATH = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/_sysconfigdata__linux_*.py +PKG_PYTHON_SYSCONFIGDATA_NAME = `{ [ -e $(PKG_PYTHON_SYSCONFIGDATA_PATH) ] && basename $(PKG_PYTHON_SYSCONFIGDATA_PATH) .py; } || true` # Target distutils-based packages PKG_PYTHON_DISTUTILS_ENV = \