From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6721684426774806528 X-Received: by 2002:a2e:8181:: with SMTP id e1mr1039283ljg.226.1565078824897; Tue, 06 Aug 2019 01:07:04 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a19:5053:: with SMTP id z19ls98479lfj.7.gmail; Tue, 06 Aug 2019 01:07:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkzfLvvVJk1o1zJigS0QXumTSqKIdXJqigHKnF4N00RsIz2ISLqMjNi2908eBaZDw5gBXX X-Received: by 2002:a19:5f46:: with SMTP id a6mr1560675lfj.142.1565078824421; Tue, 06 Aug 2019 01:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565078824; cv=none; d=google.com; s=arc-20160816; b=JdgdDq1o15agS8bOLXMx4z/KRQJtC4XSGQA28MoYWaDqs5v22qB9OL59ZKd4ZGpxU+ KgrgT4WiH23W8fZ1yb64P33saRAlZGRxgsw1BrQazvQ+niLlyWwH/2DVVSskkY8+0Jla y7bKdF14oa7DU+5XmU/V73YZv+dLDWN3cdXxklVph9FWsRdmAWNbfAUfl81MmcPiy4NS 5bmshJKcm2DILoJ8truQN9gO3I2dDRlui/pKCDH1LzK+gN/kYSKNSXVr0W+12stn6Gdv XRh1qbx+T0oXJ2bu+EDMApOrqPl0TD4LYU+LcT+caFitWpUpC2M/sMQvQqHSqB3bki7t 66TQ== 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:to:subject; bh=yZ93gj8tKZj/84P4qwsJbJzs7i8MplF7hXpEUpV0S2U=; b=1Ix4HRy5IfZtxr1qdjz1g8CJLmRVKQosUWJZCDyvdnfePSP4pax04xTeeitRsaXhTm puX8kpJSpV4Ho+EZmvBnMOyGHDK4RmXJOQp3pVMbr/0gByeUYeKpAj7UMRjRX/ahJAZB fci//9ha5jaKRIUEjON3CjGWAE5VLbg58bqwN2GHIY9NUHkHgw/L9Q39Zz7bcLlPcaDK NaiS9HI1abIe5BaXlR4ffGv1hyAYd+pSbqSAGJQssZGb9Azx6ZU3IrZNAiaKupV5TD07 KAdMrXFCxRhgTaudNCKqhztd78YHr7Jf055XJ/cVLn4hN9SbVMslX8jYpTomSSBineT8 DW2g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id f26si4263436lfp.5.2019.08.06.01.07.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 01:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of claudius.heine.ext@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=claudius.heine.ext@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id x76873UK019853 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 6 Aug 2019 10:07:03 +0200 Received: from [139.25.69.208] (linux-ses-ext02.ppmd.siemens.net [139.25.69.208]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x76873PY029626; Tue, 6 Aug 2019 10:07:03 +0200 Subject: Re: [PATCH] meta/classes: generate bill of material from image To: "[ext] Q. Gylstorff" , isar-users@googlegroups.com References: <20190805140742.11479-1-Quirin.Gylstorff@siemens.com> From: Claudius Heine Message-ID: Date: Tue, 6 Aug 2019 10:07:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: <20190805140742.11479-1-Quirin.Gylstorff@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: ZyscQLea/Gts Hi Quirin, On 05/08/2019 16.07, [ext] Q. Gylstorff wrote: > From: Quirin Gylstorff > > To create products it is necessary to have a list > of used packages for clearance and to security monitoring. > To get a simple list of packages use dpkg-query and generate > a list with the following pattern: > > source name| source version | binary package name | binary version > > To use it add following line to the local.conf: > ISAR_DO_PACKAGE_LIST ?= "1" I would rather that the commit message would not suggest adding this to the local.conf and instead adding this to the image recipe variable scope, wherever that is a .bb, .bbclass, .bbappend or any .conf file. > > Signed-off-by: Quirin Gylstorff > --- > meta-isar/conf/local.conf.sample | 4 ++++ > .../classes/image-package-list-extension.bbclass | 16 ++++++++++++++++ > meta/classes/image.bbclass | 1 + > 3 files changed, 21 insertions(+) > create mode 100644 meta/classes/image-package-list-extension.bbclass > > diff --git a/meta-isar/conf/local.conf.sample b/meta-isar/conf/local.conf.sample > index 5b3a0a1..d188051 100644 > --- a/meta-isar/conf/local.conf.sample > +++ b/meta-isar/conf/local.conf.sample > @@ -170,6 +170,10 @@ IMAGE_INSTALL = "hello-isar example-raw example-module-${KERNEL_NAME} enable-fsc > # NOTE: this works on build host >= stretch for armhf, arm64 and amd64 targets for now. > ISAR_CROSS_COMPILE ?= "0" > > +# > +# Generate package list > +ISAR_DO_PACKAGE_LIST ?= "1" > + > # > # Uncomment this to enable use of cached base repository > #ISAR_USE_CACHED_BASE_REPO ?= "1" > diff --git a/meta/classes/image-package-list-extension.bbclass b/meta/classes/image-package-list-extension.bbclass > new file mode 100644 > index 0000000..558922e > --- /dev/null > +++ b/meta/classes/image-package-list-extension.bbclass > @@ -0,0 +1,16 @@ > +# This software is a part of ISAR. > +# Copyright (C) Siemens AG, 2019 > +# > +# SPDX-License-Identifier: MIT > + > +ISAR_DO_PACKAGE_LIST ??= "0" > +image_package_list[dirs] = "${DEPLOY_DIR_IMAGE}" > +image_package_list() { Its a postprocess function so call it 'image_postprocess_package_list' instead. > + if [ "${@repr(bb.utils.to_boolean(d.getVar('ISAR_DO_PACKAGE_LIST')))}" = 'True' ]; then I don't like all those boolean values and tried to establish a better method using features. Take a look at the rootfs.bbclass, for example: ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'finalize-rootfs', 'rootfs_postprocess_finalize', '', d)}" You can adapt that. For instance like this: ROOTFS_POSTPROCESS_COMMAND += "${@bb.utils.contains('ROOTFS_FEATURES', 'generate-package-list', 'image_postprocess_package_list', '', d)}" Also it probably makes sense to have this as a default image feature. Otherwise people will not know about it and try to implement it themselves. > + dpkg-query --admindir=${IMAGE_ROOTFS}/var/lib/dpkg/ \ > + -f '${source:Package}|${source:Version}|${binary:Package}|${Version}\n' -W > \ > + ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.packages.lst As others have said, make it easily machine readable. JSON maybe? Maybe something like: echo "[" > ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.packages.lst dpkg-query ... -f '{"source_package": "${source:Package}", source_version": "${source:Version}", ...},\n' ... >> ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.packages.lst echo "]" >> ${DEPLOY_DIR_IMAGE}/${IMAGE_FULLNAME}.packages.lst Also maybe copy the licenses (/usr/share/doc/$package/copyright) somewhere? That might conflict with Hennings 'isar-exclude-docs' package, though... Maybe that can be changed to move them somewhere instead of removing them? kind regards, Claudius > + fi > +} > +ROOTFS_POSTPROCESS_COMMAND =+ "image_package_list" > + > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index ec6bd39..85bab64 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -68,6 +68,7 @@ inherit image-tools-extension > inherit image-postproc-extension > inherit image-locales-extension > inherit image-account-extension > +inherit image-package-list-extension > > # Extra space for rootfs in MB > ROOTFS_EXTRA ?= "64" > -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch@denx.de