From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6572151760657317888 X-Received: by 2002:a5d:52c1:: with SMTP id r1-v6mr1004633wrv.0.1532331271080; Mon, 23 Jul 2018 00:34:31 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:db03:: with SMTP id s3-v6ls1600997wri.2.gmail; Mon, 23 Jul 2018 00:34:30 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdpX1oLC2JUUsGN8zED5ygj5EEfxkobe9Sq7QrBJwAezE6zxvT0RAX1n0/CRIghLmdj4onX X-Received: by 2002:adf:904f:: with SMTP id h73-v6mr1001518wrh.30.1532331270693; Mon, 23 Jul 2018 00:34:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532331270; cv=none; d=google.com; s=arc-20160816; b=XOp6MI+qcdsrreKQDANG9n6kaYzquPHxnn9Up6v++AZs0YumgruCYEx4GhaiKxp/bH asEBRG5fq6algORNZtVr9UCBJFQVd++6AtTKNknnKHWBzrB0EogP5TcL9bRIrd3sp0D8 9EnKb5+nn4m9//J78SWN4EYOJjC9dRDSnIsN970kGo47J9kxIz+7vdMytHwqOU3q9Bns j5/Q4rypTlVjUkeCVvzmwPT5W9CjpEDQheQiVXDzUwtjZcl3TOKxATBqZlVYEjLJ9HHC WaFrnsnwLe+SfdafNycnRzhNVoy0oftnxlvEMk1KXrJT8thdnVHsWw85iplbqHiY1KVx Jc3A== 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=afn5FJR2eZHZVQ+o5iAC83UZ1DCDGt3Xffb0/Sxxn6U=; b=ENcYDjWwocUz7vX8su99nATWFTXx1uiLFilKioB/ixJL6weuJLsbCLv65yGnnQswDJ CqvlIeg1ulTMyWakHAoyGsDIaLoQLZWYg6SQR0WYcol1Mx1ED6hvnChk7Y8NFWsSAPHC ayM/GExXj0Auu9UqDps+e23zl6+qgvUwLvQwHPbl3WFZxS9Ws6lCvknbe9a2q4/MGOgA WgCP/ZkmCxCl9pUWRQEE6+51O733zMc8JInvciBrL8OZTWeg8UQXVDFVMG48rvZpF0BX cNwmptrzcLYbb1o7WET0JeNhNQFHHuvFDegCB544QkTLd/f8gSmd4JrydC2SIbLHZXrh Letw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id h2-v6si268436wri.1.2018.07.23.00.34.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 00:34:30 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w6N7YUX4024898 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Jul 2018 09:34:30 +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 w6N7YTDr018379; Mon, 23 Jul 2018 09:34:29 +0200 Date: Mon, 23 Jul 2018 09:34:29 +0200 From: Henning Schild To: Jan Kiszka Cc: , "Maxim Yu . Osipov" Subject: Re: [PATCH] meta/image: allow customization of command we use fo BUILD_ID Message-ID: <20180723093429.090bbc0e@md1pvb1c.ad001.siemens.net> In-Reply-To: <81c1ee82-5981-e20f-9182-8a808daf8151@siemens.com> References: <4cb847ca-f5ce-6765-602e-9d5263746a3f@ilbers.de> <20180703073928.25857-1-henning.schild@siemens.com> <7301e609-8b14-cb64-f402-dd71d2451fa5@siemens.com> <81c1ee82-5981-e20f-9182-8a808daf8151@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=UTF-8 Content-Transfer-Encoding: quoted-printable X-TUID: QsgIUMd2Tyqe Am Mon, 23 Jul 2018 08:40:50 +0200 schrieb Jan Kiszka : > On 2018-07-23 08:38, Jan Kiszka wrote: > > On 2018-07-03 09:39, Henning Schild wrote: =20 > >> 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 > >> --- > >> =C2=A0 meta-isar/recipes-core/images/isar-image-base.bb |=C2=A0 3 ++- > >> =C2=A0 meta/classes/image.bbclass=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 | 27=20 > >> ++++++++++++------------ > >> =C2=A0 2 files changed, 16 insertions(+), 14 deletions(-) > >> > >> diff --git a/meta-isar/recipes-core/images/isar-image-base.bb=20 > >> 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 +=3D > >> "isar-cfg-localepurge" WORKDIR =3D > >> "${TMPDIR}/work/${DISTRO}-${DISTRO_ARCH}/${PN}" > >> -ISAR_GIT_RELEASE_PATH ?=3D "${LAYERDIR_isar}" > >> +ISAR_RELEASE_CMD_DEFAULT =3D "git -C ${LAYERDIR_isar} describe > >> --tags --dirty --match 'v[0-9].[0-9]*'" =20 > >=20 > > I think we should keep ISAR_GIT_RELEASE_PATH as overridable API=20 > > variable. Many project will use the default pattern and just > > deviate in the layer name. > > =20 >=20 > Just to clarify: We should have *both* ISAR_GIT_RELEASE_PATH and=20 > ISAR_RELEASE_CMD as API. The former for the common customizations, > the latter for deviating tag schemes or different version control > systems. I think that would introduce too many knobs to turn. The CMD instead of the default git is not just there to abstract away from git. It also takes care of its arguments, like matching a tag. While it is more than likely that people will use git, i am not sure the args will match for everyone. If you still want that variable back, i will send an update. Henning=20 > Jan >=20 > >> +ISAR_RELEASE_CMD ?=3D "${ISAR_RELEASE_CMD_DEFAULT}" > >> =C2=A0 do_rootfs[root_cleandirs] =3D "${IMAGE_ROOTFS} \ > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ${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): > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 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 > >> =C2=A0 def get_build_id(d): > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 import subprocess > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (len(d.getVar("BBLAYERS", True).stri= p().split(' ')) !=3D 2 > >> and > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (d.getVar("ISAR_GIT_RELEAS= E_PATH", True) =3D=3D > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 d.getVar("LAYERDIR_i= sar", True))): > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (d.getVar("ISAR_RELEASE_CM= D", True) =3D=3D > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 d.getVar("ISAR_RELEA= SE_CMD_DEFAULT", True))): > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bb.warn('You ar= e using external layers that will not be=20 > >> considered' + > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 ' in the build_id. Considder setting=20 > >> ISAR_GIT_RELEASE_PATH.') > >> -=C2=A0=C2=A0=C2=A0 base =3D ["git", "-C", d.getVar("ISAR_GIT_RELEASE_= PATH", True)] > >> -=C2=A0=C2=A0=C2=A0 if (0 =3D=3D subprocess.call(base + ["rev-parse"])= ): > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 v =3D subprocess.check_out= put(base + > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ["descri= be", "--long", > >> "--dirty", > >> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "-= -always"],=20 > >> universal_newlines=3DTrue) > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 ' in the build_id. Consider changing > >> ISAR_RELEASE_CMD.') > >> +=C2=A0=C2=A0=C2=A0 cmd =3D d.getVar("ISAR_RELEASE_CMD", True) > >> +=C2=A0=C2=A0=C2=A0 try: > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 v =3D subprocess.check_out= put(cmd, shell=3DTrue,=20 > >> universal_newlines=3DTrue) > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return v.rstrip= () > >> -=C2=A0=C2=A0=C2=A0 return "" > >> +=C2=A0=C2=A0=C2=A0 except subprocess.CalledProcessError as e: > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 bb.warn('\"%s\" returned %= d, returning empty build_id' % > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 (e.cmd, e.returncode)) > >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return "" > >> =C2=A0 python set_image_size () { > >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 rootfs_size =3D get_rootfs_size(d) > >> =20 > >=20 > > =20 >=20 >=20