From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572151760657317888 X-Received: by 2002:a1c:a00e:: with SMTP id j14-v6mr195132wme.24.1532090294161; Fri, 20 Jul 2018 05:38:14 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:eb4b:: with SMTP id u11-v6ls598325wrn.0.gmail; Fri, 20 Jul 2018 05:38:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdij/yhiP29y8TVCzTSm4UnEmNL+Vn4dlnL8ZdE3fK97TQTlnAk92eYBa8sd+Ixvfc0VRY4 X-Received: by 2002:adf:ed11:: with SMTP id a17-v6mr171615wro.18.1532090293735; Fri, 20 Jul 2018 05:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532090293; cv=none; d=google.com; s=arc-20160816; b=kwru5aUVeIVwaXDiD1zPk0Ot2HgTd8ZvzIKG78pTeC8KQmFk7eKDhFKnxlA2jYmPNJ NqBm3yTAQtMvOA9D3zuYFAohwSO2mYIxByGPeVFp0XH0tWkNEsIsWJ4EUb2C3iIc1bB0 Fm/VdRgdn40LMq9BzojmhFmQxH+UFJWKK3oeL2stE+VI1CSj6UebCHKKztKXaTBNZ/HV FQqXYY0iwzc97ZDD0cJBBagKKZb70B+XF+FvcgubQkRgNFWRqhhbcWSN6ynSbFpckoPz aZ1XB0ruSI9+V4ImtJ04AFFDgMVrdAq0W+WiOp5ZMZ/6x3sEP4XsmzvqRYWtFeMPSzpt z+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=Echc8vm3+ME4MUdo8hIFvtmZ+Mq8Z2tkld3LG+df7HU=; b=eesrwLR19RZw6p7jrFL/gyNvTpEX4aMnkE3UtD3zfjpUSE70vx9vd6W15IvHJkQVoc kxQ9ttb5l9SYiSdEeb6lgdHHIAJHjMei2pKiLKBmqD/XpO7UEZfoistuYYnVh0PbaCm/ jJno6Az8O67aqUMI8Oqnp3lWw0l+84jT3KPwZnSkcTeDCW6NLiq8CZ8gCzT1+WCjiNDp QsOdE0HxQOmUVKR4Bz/OK/B/fyrI/CiBtWCE6kB7PrK6vuOqkPx+owPx++SkEOTxgqNy 6/zbhvyyGs8Y/6kMEGoeLS+xeLn8p1NLntyYCzOTrkpI2Kp1gNVJUoIkkddfGb6W8+Xn GAEw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id z66-v6si56660wmc.3.2018.07.20.05.38.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 05:38:13 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id w6KCcDfl014253 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jul 2018 14:38:13 +0200 Received: from md1pvb1c.ad001.siemens.net (md1pvb1c.ad001.siemens.net [139.25.68.40]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w6KCcDnF026956; Fri, 20 Jul 2018 14:38:13 +0200 Date: Fri, 20 Jul 2018 14:38:12 +0200 From: Henning Schild To: Cc: "Maxim Yu . Osipov" , Jan Kiszka Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID Message-ID: <20180720143812.4366ba27@md1pvb1c.ad001.siemens.net> In-Reply-To: <20180703073928.25857-1-henning.schild@siemens.com> References: <4cb847ca-f5ce-6765-602e-9d5263746a3f@ilbers.de> <20180703073928.25857-1-henning.schild@siemens.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: q5SMJ7G2s3y8 Please have a look at this one. It fixes a commit that is currently already in next. 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)