From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572151760657317888 X-Received: by 2002:a1c:e714:: with SMTP id e20-v6mr214969wmh.31.1532092630535; Fri, 20 Jul 2018 06:17:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:c909:: with SMTP id f9-v6ls437055wmb.5.gmail; Fri, 20 Jul 2018 06:17:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2xnMIkRS6JjcL/QYZRqY8NVvEaIxv+fq2zGGuv0WsdBtD3YeI303c8P4toGd2nWHcAeCJ X-Received: by 2002:a1c:4b12:: with SMTP id y18-v6mr211042wma.32.1532092630106; Fri, 20 Jul 2018 06:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532092630; cv=none; d=google.com; s=arc-20160816; b=mhYZvsNsAaTegPout2pDRWb5dcg9ty5EnIRFp+o2idJj3M0pjlKXbgnY5+1cPD6e6h f9+P8g9eaMh/tRf+nhDAHsTbZmZP3d6XokPgJEVTT9IOm8rQHOWMtc4ljlK0nApA0Xrk I1W+lNFmvpllj6yqDUPh+IS+Z7chDE0cLqej0bd+Tw7ZfRU+B3JkeObltaiPRDZZ49cl iMorkuw3lGp7BmR6cD+j24GINZUfJi5FR63xeUF8A52xnfffZIdqeibdmTlFPgIUKZPt Q9KxaybQjjIUmRcu/rGr5CU3OEvM8FHHuSmzlkXnUClEE+yBnoKcOIw0691lUs0yEjs2 Fmsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject:arc-authentication-results; bh=oLUNDsS4gKwSHmaXzaPS/xAGN0ZPxm3sQd8XAIOwjzY=; b=C7Xln9ZW45e8O8DhUIH35N4fDyLPRSSFxEWI2UiI0Mj659cBwLjymEm6Blq73QEdgd GxxO3dqHgcQKeALO0FFrNqZv111tZEI/oLX/QEj24UrDAUaXbk58lopzy1+FqkDPtXyP hleFTKV7NaOyJMWvswjVaX6K4p1v/8HqggfNIUIXzq7jMReiUI5iM2acjWTIBQtJ54AR 8UjMMI9hQyELoZ6OeRAIWdCRQBtzzrL9taIQhnZMSeZkmIbIZCrQRxdNZ5m1rn1Vjde9 M02NFkJLr1jCFOiUXcqFq/ZGyicaMo6yGrC+CAjWMapfYOmPIWjcYcsgtfNPIBxb3zLm doYw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id h6-v6si49374wmb.1.2018.07.20.06.17.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 06:17:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of mosipov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from [192.168.0.18] ([46.39.55.67]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w6KDH6RX003460 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Fri, 20 Jul 2018 15:17:08 +0200 Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID To: Henning Schild , isar-users@googlegroups.com Cc: Jan Kiszka References: <4cb847ca-f5ce-6765-602e-9d5263746a3f@ilbers.de> <20180703073928.25857-1-henning.schild@siemens.com> <20180720143812.4366ba27@md1pvb1c.ad001.siemens.net> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: Date: Fri, 20 Jul 2018 16:17:01 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180720143812.4366ba27@md1pvb1c.ad001.siemens.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: K5EMZQ3tKskM On 07/20/2018 03:38 PM, Henning Schild wrote: > Please have a look at this one. It fixes a commit that is currently > already in next. Sorry, I was confused by your last email in this thread: <------- -------- Forwarded Message -------- Subject: Re: [PATCH] meta/image: allow customization of git command we use fo BUILD_ID Date: Tue, 3 Jul 2018 09:50:09 +0200 From: Henning Schild To: isar-users@googlegroups.com CC: Maxim Yu . Osipov , Jan Kiszka obsolete, do not even look at that one. Sorry that the new one is missing the v2 in the subject. <--------- So, I'm testing your patch dated by Tue, 3 Jul 2018 09:39:28 +0200. Maxim. > Henning > > Am Tue, 3 Jul 2018 09:39:28 +0200 > schrieb Henning Schild : > >> One of the previous patches introduced the feature to leave some build >> system information in the rootfs. The git command to derive that >> information was kept pretty repository agnostic. >> >> This patch makes the command Isar-specific and allows users to >> customize the command to their needs if they use a different tagging >> scheme in their repository, or if they do not use git at all. >> >> Signed-off-by: Henning Schild >> --- >> meta-isar/recipes-core/images/isar-image-base.bb | 3 ++- >> meta/classes/image.bbclass | 27 >> ++++++++++++------------ 2 files changed, 16 insertions(+), 14 >> deletions(-) >> >> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb >> b/meta-isar/recipes-core/images/isar-image-base.bb index >> c72bfdb..a24aa3e 100644 --- >> a/meta-isar/recipes-core/images/isar-image-base.bb +++ >> b/meta-isar/recipes-core/images/isar-image-base.bb @@ -24,7 +24,8 @@ >> IMAGE_TRANSIENT_PACKAGES += "isar-cfg-localepurge" >> WORKDIR = "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}" >> >> -ISAR_GIT_RELEASE_PATH ?= "${LAYERDIR_isar}" >> +ISAR_RELEASE_CMD_DEFAULT = "git -C ${LAYERDIR_isar} describe --tags >> --dirty --match 'v[0-9].[0-9]*'" +ISAR_RELEASE_CMD ?= >> "${ISAR_RELEASE_CMD_DEFAULT}" >> do_rootfs[root_cleandirs] = "${IMAGE_ROOTFS} \ >> ${IMAGE_ROOTFS}/isar-apt" >> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass >> index 7935b69..077c550 100644 >> --- a/meta/classes/image.bbclass >> +++ b/meta/classes/image.bbclass >> @@ -34,24 +34,25 @@ def get_rootfs_size(d): >> >> return base_size + rootfs_extra * 1024 >> >> -# we assume that one git commit can describe the whole image, so you >> should be -# using submodules, kas, or something like that >> -# set ISAR_GIT_RELEASE_PATH to that one "most significant" layer >> -# when not using git, override do_mark_rootfs >> +# here we call a command that should describe your whole build >> system, +# this could be "git describe" or something similar. >> +# set ISAR_RELEASE_CMD to customize, or override do_mark_rootfs to >> do something +# completely different >> def get_build_id(d): >> import subprocess >> if (len(d.getVar("BBLAYERS", True).strip().split(' ')) != 2 and >> - (d.getVar("ISAR_GIT_RELEASE_PATH", True) == >> - d.getVar("LAYERDIR_isar", True))): >> + (d.getVar("ISAR_RELEASE_CMD", True) == >> + d.getVar("ISAR_RELEASE_CMD_DEFAULT", True))): >> bb.warn('You are using external layers that will not be >> considered' + >> - ' in the build_id. Considder setting >> ISAR_GIT_RELEASE_PATH.') >> - base = ["git", "-C", d.getVar("ISAR_GIT_RELEASE_PATH", True)] >> - if (0 == subprocess.call(base + ["rev-parse"])): >> - v = subprocess.check_output(base + >> - ["describe", "--long", "--dirty", >> - "--always"], >> universal_newlines=True) >> + ' in the build_id. Consider changing >> ISAR_RELEASE_CMD.') >> + cmd = d.getVar("ISAR_RELEASE_CMD", True) >> + try: >> + v = subprocess.check_output(cmd, shell=True, >> universal_newlines=True) return v.rstrip() >> - return "" >> + except subprocess.CalledProcessError as e: >> + bb.warn('\"%s\" returned %d, returning empty build_id' % >> + (e.cmd, e.returncode)) >> + return "" >> >> python set_image_size () { >> rootfs_size = get_rootfs_size(d) > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov