From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572151760657317888 X-Received: by 2002:a19:d20e:: with SMTP id j14-v6mr929775lfg.29.1532514826320; Wed, 25 Jul 2018 03:33:46 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:9bd9:: with SMTP id w25-v6ls1386917ljj.15.gmail; Wed, 25 Jul 2018 03:33:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdbqTiywB6HsNppePyquUJLaf+NN9xQJYPGkuFPf1MteoCS6//dufXKoFaXj6069K6YdPvS X-Received: by 2002:a2e:9b83:: with SMTP id z3-v6mr1146753lji.20.1532514825897; Wed, 25 Jul 2018 03:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532514825; cv=none; d=google.com; s=arc-20160816; b=TjPjRQ24x7CaDLYZIp91SnM0Ja+bSEBchX9HkpZNdjbrOUPBQFlDSRvJqK+KhnZYYr BSeJ1D3a+kFc+lKU71rnTWHautEwoVbFDneYvvlgfO/citiWELr2iefgzXEJDzHPkzHC Ela5wAhacs+IxsHTJOudMNN4VeiaZWtlP6I1PmT8DOTmF5610hTalgjUXsbR/R2dWXpK ydEg6CSD834ad6sZ1S1TdnaRg+K0inYamtBfqgTJXG5gCASOMQOjkll3WAc4iASn1mHr 4bdzXL7btTSQ9LJHgcK/AKWB+ZRDB0L6KT19ll1m1WSZU7edLDDgX3v4cODh0/CJwwiD +rew== 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=XVNG+KT3/gifkq296DSH2NdayCUteUV5ACsq4br1UN4=; b=pncvlt1VJdCV/3XUf7o0X2A+oEXfNrlVedGjZwLPohh3atdxtvliXpkAhgd1LYJTp4 JOFdzwJ2rrQ/j2fQRoDmuO6HZOpbFlWT8s570bmUugm9aVYtq02AVZd3ucl9QXXqXq3O /vc3Ur0tJytTr+04tU6vX5zOYs0YItYUmJzmdSVHCWFXGyLx18ruSLIm5KULkwZlK0v/ xpHdfhQm/Ucn9JU2/G82bOw+HPj/ldekObrAZ+Ld3g8FmBP1ajsEnWSliT/D/O8WP7By 3I7auqxB2ai62fXraph/cNaMsXMEnLwmXeDP1yZfukdVoyZV7dSfaOStwuwMIj0J+5yu 66DQ== 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 z74-v6si413545lff.3.2018.07.25.03.33.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jul 2018 03:33:45 -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.55]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id w6PAXgDb023205 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 25 Jul 2018 12:33:43 +0200 Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID To: Henning Schild Cc: isar-users@googlegroups.com References: <4cb847ca-f5ce-6765-602e-9d5263746a3f@ilbers.de> <20180703073928.25857-1-henning.schild@siemens.com> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: <82326671-90d0-e0b7-cde4-af2f4e779f42@ilbers.de> Date: Wed, 25 Jul 2018 13:33:37 +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: <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: xw1ZN22dsub0 On 07/03/2018 10:39 AM, 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. Applied to the 'next', Thanks, Maxim. > 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