From patchwork Thu May 8 07:04:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 346904 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id E2A9E1401C6 for ; Thu, 8 May 2014 17:05:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 1DCD58C267; Thu, 8 May 2014 07:05:21 +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 zSW5j3K0B7pv; Thu, 8 May 2014 07:05:20 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 268068C251; Thu, 8 May 2014 07:05:20 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 0C8241BF9DB for ; Thu, 8 May 2014 07:05:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 092B187A5E for ; Thu, 8 May 2014 07:05:19 +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 ZLleolDH3h9y for ; Thu, 8 May 2014 07:05:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qc0-f177.google.com (mail-qc0-f177.google.com [209.85.216.177]) by hemlock.osuosl.org (Postfix) with ESMTPS id 7AE1687A44 for ; Thu, 8 May 2014 07:05:18 +0000 (UTC) Received: by mail-qc0-f177.google.com with SMTP id i17so2357055qcy.22 for ; Thu, 08 May 2014 00:05:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ya+ZM/P7CKU2oOdLD//XOyVRiiiVU++acQ8CgXZP/E8=; b=H1b0QnoMCc+USR+/yfTpv8qHYYEI5F7CdWBxiw2rs9GEqHamaJR2pY5t/G1g2JQr71 ED4xamsUmZBPLnvr6+XBCO80+zYwLZ9yb4kjIchfkSkSAVOffzjIaJpDW4ag+8rXTf09 uST+mF15zdyMD16ayuLAwVurTHUSB7VK0e4rX/I29kQHs8KhJ6GbfP2dBSF6WWNOZ7C5 /ixhTeZrqge4ZIMJuqH7xSWt+/vKviLWz0WYy+ZZk/XCMqPNxKLhkwy6hKghI241B2tj 85ioAhnrix/R5ubqgLYDg/4mtJkQL6/6PeFb1YLRoG7ha6vm8ynJSRj0iYMe1o/09P7S jsXA== X-Received: by 10.224.126.9 with SMTP id a9mr2075492qas.39.1399532717583; Thu, 08 May 2014 00:05:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.97.65 with HTTP; Thu, 8 May 2014 00:04:57 -0700 (PDT) In-Reply-To: References: <0533846efc9952901283.1399373479@argentina> <20140506140745.1b072d2c@skate> <3dba42f3-d595-4415-bd38-3220738fe4b6@email.android.com> From: Thomas De Schampheleire Date: Thu, 8 May 2014 09:04:57 +0200 Message-ID: To: Thomas Petazzoni , "Yann E. MORIN" , Arnout Vandecappelle Cc: buildroot Subject: Re: [Buildroot] [PATCH] toolchain package: set version as 'virtual' instead of 'undefined' X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Hi, On Wed, May 7, 2014 at 9:37 PM, Thomas De Schampheleire wrote: [..] >>> I tried using virtual-package in toolchain/toolchain/toolchain.mk, but TOOLCHAIN_VERSION becomes empty, while HOST_TOOLCHAIN_VERSION is virtual. [..] Some more feedback: I stepped away from toolchain and added a simple test package 'mytest' as below. I added a debug target 'bar' and some variable assignment in pkg-generic.mk. In pkg-generic.mk, the _VERSION variables are defined, and there is a subst() statement to replace / with _. My conclusion is that the line with the subst statement does not work when _VERSION is set like in virtual-package. The output of 'make bar' is: MYTEST_VERSION = HOST_MYTEST_VERSION = virtual MYTEST_X = MYTEST_Y = virtual HOST_MYTEST_X = HOST_MYTEST_Y = X is using the standard subst line as pkg-generic is using, while Y adds an extra dollar sign. When the version is set directly, as in MYTEST_VERSION = bla, then X seems to be correct. This is the way buildroot works today. However, when the version is set indirectly from an inner-xxx-package, like $(3)_VERSION, then X no longer works but Y does. However, adding an extra dollar by default doesn't work for the normal packages. So how to proceed? Any experts in the inner-xxx-package and make internals? Arnout, ThomasP, Yann? Thanks, Thomas diff --git a/package/mytest/mytest.mk b/package/mytest/mytest.mk new file mode 100644 --- /dev/null +++ b/package/mytest/mytest.mk @@ -0,0 +1,10 @@ + +$(eval $(virtual-package)) + +bar: + @echo MYTEST_VERSION = $(MYTEST_VERSION) + @echo HOST_MYTEST_VERSION = $(HOST_MYTEST_VERSION) + @echo MYTEST_X = $(MYTEST_X) + @echo MYTEST_Y = $(MYTEST_Y) + @echo HOST_MYTEST_X = $(HOST_MYTEST_X) + @echo HOST_MYTEST_Y = $(HOST_MYTEST_Y) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -262,6 +262,12 @@ define inner-generic-package # sanitize the package version that is used in paths, directory and file names. # Forward slashes may appear in the package's version when pointing to a # version control system branch or tag, for example remotes/origin/1_10_stable. + +ifdef $(2)_VERSION + $(2)_X := $(subst /,_,$($(2)_VERSION)) + $(2)_Y := $(subst /,_,$$($(2)_VERSION)) +endif + ifndef $(2)_VERSION ifdef $(3)_VERSION $(2)_DL_VERSION = $($(3)_VERSION)