public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: "Maxim Yu. Osipov" <mosipov@ilbers.de>
Cc: <isar-users@googlegroups.com>, Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID
Date: Fri, 20 Jul 2018 15:44:00 +0200	[thread overview]
Message-ID: <20180720154400.7463c3b5@md1pvb1c.ad001.siemens.net> (raw)
In-Reply-To: <c00fff84-40bd-599b-b13c-8b7c219a0638@ilbers.de>

My bad, i forgot to version those patches ... twice.

Henning

Am Fri, 20 Jul 2018 16:17:01 +0300
schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>:

> 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 <henning.schild@siemens.com>
> To: isar-users@googlegroups.com
> CC: Maxim Yu . Osipov <mosipov@ilbers.de>, Jan Kiszka 
> <jan.kiszka@siemens.com>
> 
> 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 <henning.schild@siemens.com>:
> >   
> >> 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 <henning.schild@siemens.com>
> >> ---
> >>   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)  
> >   
> 
> 


  reply	other threads:[~2018-07-20 13:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 15:05 [PATCH] meta/image: leave BUILD_ID and VARIANT in /etc/os-release Henning Schild
2018-06-28 15:09 ` Henning Schild
2018-06-29 10:04   ` Maxim Yu. Osipov
2018-06-29 11:46     ` Henning Schild
2018-07-02  9:15 ` Maxim Yu. Osipov
2018-07-02 18:19   ` [PATCH] meta/image: allow customization of git command we use fo BUILD_ID Henning Schild
2018-07-02 18:30     ` Henning Schild
2018-07-03  7:50     ` Henning Schild
2018-07-03  7:39   ` [PATCH] meta/image: allow customization of " Henning Schild
2018-07-03  7:49     ` Henning Schild
2018-07-20 12:38     ` Henning Schild
2018-07-20 13:17       ` Maxim Yu. Osipov
2018-07-20 13:44         ` Henning Schild [this message]
2018-07-23  6:38     ` Jan Kiszka
2018-07-23  6:40       ` Jan Kiszka
2018-07-23  7:34         ` Henning Schild
2018-07-25 10:33     ` Maxim Yu. Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180720154400.7463c3b5@md1pvb1c.ad001.siemens.net \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=mosipov@ilbers.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox