From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572151760657317888 X-Received: by 2002:a1c:7302:: with SMTP id d2-v6mr1033537wmb.16.1532327925775; Sun, 22 Jul 2018 23:38:45 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:f40f:: with SMTP id z15-v6ls1890002wma.12.canary-gmail; Sun, 22 Jul 2018 23:38:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcRBVft921PZYUQ0FTZzMb2adzDpzp638VgCBshpuPjAo3xfl68oEz6XPgidKfSoyVxwt+e X-Received: by 2002:a1c:b8cf:: with SMTP id i198-v6mr1073323wmf.13.1532327925121; Sun, 22 Jul 2018 23:38:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532327925; cv=none; d=google.com; s=arc-20160816; b=pVI0DpOEdrYrK+j8eKQih/0P7yx05nPz7VmG77Hl8rIZ+TcqEE6l5Uta7C3MU8J93m m3J9jBrRE/NXweyRx4qxV+8eFzxqfYhVGlM6maDmSmj62cWPi8T8K+DvTljRsNoP+004 agKhADHmAkc4FMg2OvDVte60L+7Hd0Mh4fb1TTToPjw7Fk2pd/CepbQH1kccz82hFDN1 3FgCPEv2v4HnM5v4AQx+yqCvZ0/YrOrFHCwtlKQOnJ4JSuoAdAViIkgL7U/3ng0ubV4p WnK447fgIdArBybo0HOYKJAc+Nl7MQV+Bc2MXfPk6bP0nENSppEbIcG369T98dLX74vw dvzg== 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:from:references:cc:to:subject :arc-authentication-results; bh=KDwj7JnrMXPyaBZAfzPpbD0LUK2V0bZj1GRwV+Y0EEk=; b=ECetLalwHQ1jjEk7BDFoJzEA7+Pbhab2M8GqfrDtNzEmGyaUcppQCt84Z3WygRaA3f 8azpt9l3g8D6Kww/0v186k274VEICs8bfeLrLoD+LzmRczOuoQtTD/lJSGAhV9LlpTbx umcnlJx0h4IsvRuF+cTA7qhZGr7xMTCUQ6eBjh+DL+9pZRuxxVtmeHRgQD1boAGD6seH C/ok7uKwVe6NOPyNj1t66XcyDWW0g6lX2IUrovWGgmODT7d4THLi606jyHwxQhYW13O5 DX5ZTInW15vLckGoHxMSTSbg0Y9OKgPq7p4XB2oi4C//F5E7VWPYn3kvw7GrtrhWqvAj q6Mw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id h2-v6si233410wre.5.2018.07.22.23.38.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 23:38:45 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@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 jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) smtp.mailfrom=jan.kiszka@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 w6N6ciwn028349 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jul 2018 08:38:44 +0200 Received: from [139.22.37.206] ([139.22.37.206]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w6N6ciph029489; Mon, 23 Jul 2018 08:38:44 +0200 Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID To: Henning Schild , isar-users@googlegroups.com Cc: "Maxim Yu . Osipov" References: <4cb847ca-f5ce-6765-602e-9d5263746a3f@ilbers.de> <20180703073928.25857-1-henning.schild@siemens.com> From: Jan Kiszka Message-ID: <7301e609-8b14-cb64-f402-dd71d2451fa5@siemens.com> Date: Mon, 23 Jul 2018 08:38:43 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: <20180703073928.25857-1-henning.schild@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: h8Vxt4nc/2oy On 2018-07-03 09:39, Henning Schild wrote: > 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]*'" I think we should keep ISAR_GIT_RELEASE_PATH as overridable API variable. Many project will use the default pattern and just deviate in the layer name. Jan > +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) > -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux