From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7366159435478073344 Date: Tue, 7 May 2024 23:24:41 -0700 (PDT) From: Srinuvasan Arjunan To: isar-users Message-Id: <822e7adf-c319-4c76-aad6-7f3159ee6758n@googlegroups.com> In-Reply-To: <811483d4-8009-44dc-84b4-0e23baa7cfef@siemens.com> References: <20240507074102.1147439-1-srinuvasan.a@siemens.com> <811483d4-8009-44dc-84b4-0e23baa7cfef@siemens.com> Subject: Re: [PATCH] meta/classes/debianize: install appropriate copyright file MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_60438_1514999978.1715149481801" X-TUID: aulaFhHzr1MM ------=_Part_60438_1514999978.1715149481801 Content-Type: multipart/alternative; boundary="----=_Part_60439_173933187.1715149481801" ------=_Part_60439_173933187.1715149481801 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wednesday, May 8, 2024 at 11:05:46=E2=80=AFAM UTC+5:30 Jan Kiszka wrote: On 07.05.24 09:41, srinuv...@siemens.com wrote:=20 > From: Srinuvasan A =20 >=20 > Presently we have an example to install the copyright file in the debian= =20 > package, now we improved little bit to install the appropriate copyright= =20 > file based on the configured variable "LICENSE" in the recipe.=20 >=20 > Added the example for example-raw recipe.=20 >=20 > Signed-off-by: Srinuvasan A =20 > ---=20 > .../example-raw/example-raw_0.3.bb | 7 +++--=20 > .../example-raw/files/default-copyright | 22 ---------------=20 > meta/classes/debianize.bbclass | 6 ++---=20 > meta/classes/dpkg-helper-license.bbclass | 27 +++++++++++++++++++=20 > .../debian/GPL-2.0+/default-copyright.tmpl | 24 +++++++++++++++++=20 > .../debian/GPL-2.0/default-copyright.tmpl | 23 ++++++++++++++++=20 > .../debian/GPL-3.0/default-copyright.tmpl | 22 +++++++++++++++=20 > .../debian/MIT/default-copyright.tmpl | 26 ++++++++++++++++++=20 > 8 files changed, 130 insertions(+), 27 deletions(-)=20 > delete mode 100644=20 meta-isar/recipes-app/example-raw/files/default-copyright=20 > create mode 100644 meta/classes/dpkg-helper-license.bbclass=20 > create mode 100644 meta/licenses/debian/GPL-2.0+/default-copyright.tmpl= =20 > create mode 100644 meta/licenses/debian/GPL-2.0/default-copyright.tmpl=20 > create mode 100644 meta/licenses/debian/GPL-3.0/default-copyright.tmpl=20 > create mode 100644 meta/licenses/debian/MIT/default-copyright.tmpl=20 >=20 > diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb=20 b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb=20 > index 35f4b3d9..1730431e 100644=20 > --- a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb=20 > +++ b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb=20 > @@ -6,13 +6,16 @@=20 > DESCRIPTION =3D "Sample application for ISAR"=20 > MAINTAINER =3D "Your name here "=20 > DEBIAN_DEPENDS =3D "adduser, apt (>=3D 0.4.2)"=20 > +HOMEPAGE =3D ""=20 This visualizes that we have a missing default... You meant that we should provide the actual home page of this recipe= =20 instead of ?=20 > +=20 > +LICENSE =3D "MIT"=20 >=20 > SRC_URI =3D "file://README \=20 > file://postinst \=20 > - file://rules \=20 > - file://default-copyright"=20 > + file://rules"=20 >=20 > inherit dpkg-raw=20 > +inherit dpkg-helper-license=20 Can't we get this via debianize automatically? If LICENSE is unset or an=20 own copyright file is provided, it won't do any harm, right? Initially i tried with that approach, i meant selection of licenses in= =20 debianize class instead of dpkg-helper-license class, but here i faced=20 build issue with the prebuilt-deb recipe, here we are inheriting the= =20 dpkg-prebuilt class , in this class we are getting SRC_URI without expansio= n =20 https://github.com/ilbers/isar/blob/master/meta/classes/dpkg-prebuilt.bbcl= ass#L10,=20 but we are appending to the SRC_URI for selection of template files based= =20 on the LICENSE variable this not works with that recipes, due to this the= =20 build is not completed successfully. Already started discussion to fix this issue in mailing list, please= =20 refer: https://groups.google.com/g/isar-users/c/DnT1KcBiFtc =20 But for other valid reason i don't want to add the SRC_URI expansion= =20 in the dpkg-prebuilt class, instead introduced a new class, suppose if we= =20 want to configure the LICENSE in any recipes just inherit the=20 dpkg-helper-licenses class is fine.=20 If we not configured the LICENSE it won't do any harm. =20 >=20 > do_install() {=20 > bbnote "Creating ${PN} binary"=20 > diff --git a/meta-isar/recipes-app/example-raw/files/default-copyright=20 b/meta-isar/recipes-app/example-raw/files/default-copyright=20 > deleted file mode 100644=20 > index 3511cb51..00000000=20 > --- a/meta-isar/recipes-app/example-raw/files/default-copyright=20 > +++ /dev/null=20 > @@ -1,22 +0,0 @@=20 > -MIT License=20 > -=20 > -Copyright (c) 2017-2024, Siemens=20 > -Copyright (c) 2024 ilbers GmbH=20 > -=20 > -Permission is hereby granted, free of charge, to any person obtaining a= =20 copy=20 > -of this software and associated documentation files (the "Software"), to= =20 deal=20 > -in the Software without restriction, including without limitation the=20 rights=20 > -to use, copy, modify, merge, publish, distribute, sublicense, and/or=20 sell=20 > -copies of the Software, and to permit persons to whom the Software is=20 > -furnished to do so, subject to the following conditions:=20 > -=20 > -The above copyright notice and this permission notice shall be included= =20 in all=20 > -copies or substantial portions of the Software.=20 > -=20 > -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= =20 OR=20 > -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,= =20 > -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= =20 THE=20 > -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER= =20 > -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= =20 FROM,=20 > -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS= =20 IN THE=20 > -SOFTWARE.=20 > diff --git a/meta/classes/debianize.bbclass=20 b/meta/classes/debianize.bbclass=20 > index adb6cf2b..54a16260 100644=20 > --- a/meta/classes/debianize.bbclass=20 > +++ b/meta/classes/debianize.bbclass=20 > @@ -120,9 +120,9 @@ deb_debianize() {=20 > else=20 > deb_create_rules=20 > fi=20 > - # Add the copyright if unpacked sources does not contain copyright file= =20 > - if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}/default-copyright= =20 ]; then=20 > - install -v -m 644 ${WORKDIR}/default-copyright ${S}/debian/copyright=20 > + # Add the copyright if unpacked sources does not contain copyright file= =20 as well as the recipes configured the LICENSE=20 > + if [ ! -f ${S}/debian/copyright ] && [ -f=20 ${WORKDIR}/${LICENSE}/default-copyright ]; then=20 > + install -v -m 644 ${WORKDIR}/${LICENSE}/default-copyright=20 ${S}/debian/copyright=20 > fi=20 > # prepend a changelog-entry unless an existing changelog file already=20 > # contains an entry with CHANGELOG_V=20 > diff --git a/meta/classes/dpkg-helper-license.bbclass=20 b/meta/classes/dpkg-helper-license.bbclass=20 > new file mode 100644=20 > index 00000000..81e6d4e6=20 > --- /dev/null=20 > +++ b/meta/classes/dpkg-helper-license.bbclass=20 > @@ -0,0 +1,27 @@=20 > +# This software is a part of ISAR.=20 > +# Copyright (C) 2024 Siemens AG=20 > +#=20 > +# SPDX-License-Identifier: MIT=20 > +=20 > +LICENSE ??=3D ""=20 > +=20 Missing HOMEPAGE default, given that all templates require this variable. Will add this variable=20 > +inherit template=20 > +=20 > +# Path to copyright template files=20 > +FILESPATH:prepend :=3D "${LAYERDIR_core}/licenses/debian:"=20 > +=20 > +# GPL-2.0 licensed packages=20 > +SRC_URI:append =3D " ${@ 'file://GPL-2.0/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }"=20 > +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }"=20 > +=20 > +# GPL-2.0+ licensed packages=20 > +SRC_URI:append =3D " ${@ 'file://GPL-2.0+/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '' }"=20 > +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0+/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '' }"=20 > +=20 > +# GPL-3.0 licensed packages=20 > +SRC_URI:append =3D " ${@ 'file://GPL-3.0/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }"=20 > +TEMPLATE_FILES:append =3D "${@ ' GPL-3.0/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }"=20 > +=20 > +# MIT licensed packages=20 > +SRC_URI:append =3D " ${@ 'file://MIT/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'MIT' else '' }"=20 > +TEMPLATE_FILES:append =3D "${@ ' MIT/default-copyright.tmpl' if=20 d.getVar('LICENSE') =3D=3D 'MIT' else '' }"=20 This could be enhanced by supporting license choices ("A | B") and=20 multiple license ("A & B"). OTOH, the "Files:" tag in the templates are=20 even more likely to become incorrect in such cases. This will take a look.=20 > diff --git a/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl=20 b/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl=20 > new file mode 100644=20 > index 00000000..5c6d27c5=20 > --- /dev/null=20 > +++ b/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl=20 > @@ -0,0 +1,24 @@=20 > +Format:=20 https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/=20 > +Upstream-Name: ${BPN}=20 > +Source: ${HOMEPAGE}=20 > +=20 > +Files: *=20 > +Copyright: ${MAINTAINER}=20 > +License: GPL-2.0+=20 > +=20 > +License: GPL-2.0+=20 > + This package is free software; you can redistribute it and/or modify=20 > + it under the terms of the GNU General Public License as published by=20 > + the Free Software Foundation; either version 2 of the License, or=20 > + (at your option) any later version.=20 > + .=20 > + This package is distributed in the hope that it will be useful,=20 > + but WITHOUT ANY WARRANTY; without even the implied warranty of=20 > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=20 > + GNU General Public License for more details.=20 > + .=20 > + You should have received a copy of the GNU General Public License=20 > + along with this program. If not, see =20 > + .=20 > + On Debian systems, the complete text of the GNU General=20 > + Public License version 2 can be found in=20 "/usr/share/common-licenses/GPL-2".=20 > diff --git a/meta/licenses/debian/GPL-2.0/default-copyright.tmpl=20 b/meta/licenses/debian/GPL-2.0/default-copyright.tmpl=20 > new file mode 100644=20 > index 00000000..223e5841=20 > --- /dev/null=20 > +++ b/meta/licenses/debian/GPL-2.0/default-copyright.tmpl=20 > @@ -0,0 +1,23 @@=20 > +Format:=20 https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/=20 > +Upstream-Name: ${BPN}=20 > +Source: ${HOMEPAGE}=20 > +=20 > +Files: *=20 > +Copyright: ${MAINTAINER}=20 > +License: GPL-2.0=20 > +=20 > +License: GPL-2.0=20 > + This package is free software; you can redistribute it and/or modify=20 > + it under the terms of the GNU General Public License as published by=20 > + the Free Software Foundation; either version 2 of the License.=20 > + .=20 > + This package is distributed in the hope that it will be useful,=20 > + but WITHOUT ANY WARRANTY; without even the implied warranty of=20 > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the=20 > + GNU General Public License for more details.=20 > + .=20 > + You should have received a copy of the GNU General Public License=20 > + along with this program. If not, see =20 > + .=20 > + On Debian systems, the complete text of the GNU General=20 > + Public License version 2 can be found in=20 "/usr/share/common-licenses/GPL-2".=20 > diff --git a/meta/licenses/debian/GPL-3.0/default-copyright.tmpl=20 b/meta/licenses/debian/GPL-3.0/default-copyright.tmpl=20 > new file mode 100644=20 > index 00000000..c2511481=20 > --- /dev/null=20 > +++ b/meta/licenses/debian/GPL-3.0/default-copyright.tmpl=20 > @@ -0,0 +1,22 @@=20 > +Format:=20 https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/=20 > +Upstream-Name: ${BPN}=20 > +Source: ${HOMEPAGE}=20 > +=20 > +Files: *=20 > +Copyright: ${MAINTAINER}=20 > +License: GPL-3.0=20 > +=20 > +License: GPL-3.0=20 > + This program is free software: you can redistribute it and/or modify it= =20 under=20 > + the terms of the GNU General Public License as published by the Free=20 > + Software Foundation, version 3 of the License.=20 > + .=20 > + This program is distributed in the hope that it will be useful, but=20 WITHOUT ANY=20 > + WARRANTY; without even the implied warranty of MERCHANTABILITY or=20 FITNESS FOR A=20 > + PARTICULAR PURPOSE. See the GNU General Public License for more=20 details.=20 > + .=20 > + You should have received a copy of the GNU General Public License along= =20 with=20 > + this program. If not, see .=20 > + .=20 > + On Debian systems, the complete text of the GNU General Public License= =20 version=20 > + 3 can be found in "/usr/share/common-licenses/GPL-3".=20 > diff --git a/meta/licenses/debian/MIT/default-copyright.tmpl=20 b/meta/licenses/debian/MIT/default-copyright.tmpl=20 > new file mode 100644=20 > index 00000000..2bced7f5=20 > --- /dev/null=20 > +++ b/meta/licenses/debian/MIT/default-copyright.tmpl=20 > @@ -0,0 +1,26 @@=20 > +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0= /=20 > +Upstream-Name: ${BPN}=20 > +Source: ${HOMEPAGE}=20 > +=20 > +Files: *=20 > +Copyright: ${MAINTAINER}=20 > +License: MIT=20 > +=20 > +License: MIT=20 > + Permission is hereby granted, free of charge, to any person obtaining a= =20 copy=20 > + of this software and associated documentation files (the "Software"),= =20 to deal=20 > + in the Software without restriction, including without limitation the= =20 rights=20 > + to use, copy, modify, merge, publish, distribute, sublicense, and/or=20 sell=20 > + copies of the Software, and to permit persons to whom the Software is= =20 > + furnished to do so, subject to the following conditions:=20 > + .=20 > + The above copyright notice and this permission notice shall be included= =20 in all=20 > + copies or substantial portions of the Software.=20 > + .=20 > + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= =20 OR=20 > + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF=20 MERCHANTABILITY,=20 > + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= =20 THE=20 > + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER= =20 > + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= =20 FROM,=20 > + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS= =20 IN THE=20 > + SOFTWARE.=20 Jan=20 --=20 Siemens AG, Technology=20 Linux Expert Center=20 ------=_Part_60439_173933187.1715149481801 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

On Wednesday, May 8, 2024 at 11:05:46=E2= =80=AFAM UTC+5:30 Jan Kiszka wrote:
On 07.05.24 09:41, srinuv...@siemens.= com wrote:
> From: Srinuvasan A <srinuv...@s= iemens.com>
>=20
> Presently we have an example to install the copyright file in th= e debian
> package, now we improved little bit to install the appropriate c= opyright
> file based on the configured variable "LICENSE" in the recipe.
>=20
> Added the example for example-raw recipe.
>=20
> Signed-off-by: Srinuvasan A <sr= inuv...@siemens.com>
> ---
> .../example-raw/example-raw_0.3.bb | 7 +++--
> .../example-raw/files/default-copyright | 22 ------------= ---
> meta/classes/debianize.bbclass | 6 ++---
> meta/classes/dpkg-helper-license.bbclass | 27 ++++++++++++= +++++++
> .../debian/GPL-2.0+/default-copyright.tmpl | 24 ++++++++++++= +++++
> .../debian/GPL-2.0/default-copyright.tmpl | 23 ++++++++++++= ++++
> .../debian/GPL-3.0/default-copyright.tmpl | 22 ++++++++++++= +++
> .../debian/MIT/default-copyright.tmpl | 26 ++++++++++++= ++++++
> 8 files changed, 130 insertions(+), 27 deletions(-)
> delete mode 100644 meta-isar/recipes-app/example-raw/files/defa= ult-copyright
> create mode 100644 meta/classes/dpkg-helper-license.bbclass
> create mode 100644 meta/licenses/debian/GPL-2.0+/default-copyri= ght.tmpl
> create mode 100644 meta/licenses/debian/GPL-2.0/default-copyrig= ht.tmpl
> create mode 100644 meta/licenses/debian/GPL-3.0/default-copyrig= ht.tmpl
> create mode 100644 meta/licenses/debian/MIT/default-copyright.t= mpl
>=20
> diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb<= /a> b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> index 35f4b3d9..1730431e 100644
> --- a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> +++ b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb
> @@ -6,13 +6,16 @@
> DESCRIPTION =3D "Sample application for ISAR"
> MAINTAINER =3D "Your name here <y...@domain.com>"
> DEBIAN_DEPENDS =3D "adduser, apt (>=3D 0.4.2)"
> +HOMEPAGE =3D "<Home page of the recipe>"

This visualizes that we have a missing default...
=C2=A0 =C2=A0 =C2=A0You meant that we should provide the act= ual home page of this recipe instead of <replace home page of the recipe= > ?=C2=A0


> +
> +LICENSE =3D "MIT"
> =20
> SRC_URI =3D "file://README \
> =09 file://postinst \
> -=09 file://rules \
> -=09 file://default-copyright"
> +=09 file://rules"
> =20
> inherit dpkg-raw
> +inherit dpkg-helper-license

Can't we get this via debianize automatically? If LICENSE is unset or= an
own copyright file is provided, it won't do any harm, right?


=C2=A0 =C2=A0 =C2=A0Initially i = tried with that approach, i meant selection of licenses in debianize class = instead of dpkg-helper-license class, but here i faced=C2=A0
=C2= =A0 =C2=A0 =C2=A0build issue with the prebuilt-deb recipe, here we are inhe= riting the dpkg-prebuilt class , in this class we are getting SRC_URI witho= ut expansion
=C2=A0 =C2=A0 =C2=A0https://github.com/ilbers/isar/b= lob/master/meta/classes/dpkg-prebuilt.bbclass#L10, but we are appending to = the SRC_URI for selection of template files based on the LICENSE variable t= his not works with that recipes, due to this the build is not completed suc= cessfully.

=C2=A0 =C2=A0 =C2=A0Already started d= iscussion to fix this issue in mailing list,=C2=A0 please refer:=C2=A0https= ://groups.google.com/g/isar-users/c/DnT1KcBiFtc
=C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 But for other valid reason i don't want to add t= he SRC_URI expansion in the dpkg-prebuilt class, instead introduced a new c= lass, suppose if we want to configure the LICENSE in any recipes just inher= it the dpkg-helper-licenses class is fine.=C2=A0

If we not configured the LICENSE it won't do any harm.
=C2=A0


> =20
> do_install() {
> =09bbnote "Creating ${PN} binary"
> diff --git a/meta-isar/recipes-app/example-raw/files/default-cop= yright b/meta-isar/recipes-app/example-raw/files/default-copyright
> deleted file mode 100644
> index 3511cb51..00000000
> --- a/meta-isar/recipes-app/example-raw/files/default-copyright
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -MIT License
> -
> -Copyright (c) 2017-2024, Siemens
> -Copyright (c) 2024 ilbers GmbH
> -
> -Permission is hereby granted, free of charge, to any person obt= aining a copy
> -of this software and associated documentation files (the "Softw= are"), to deal
> -in the Software without restriction, including without limitati= on the rights
> -to use, copy, modify, merge, publish, distribute, sublicense, a= nd/or sell
> -copies of the Software, and to permit persons to whom the Softw= are is
> -furnished to do so, subject to the following conditions:
> -
> -The above copyright notice and this permission notice shall be = included in all
> -copies or substantial portions of the Software.
> -
> -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,= EXPRESS OR
> -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHAN= TABILITY,
> -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVE= NT SHALL THE
> -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES O= R OTHER
> -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,= ARISING FROM,
> -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER D= EALINGS IN THE
> -SOFTWARE.
> diff --git a/meta/classes/debianize.bbclass b/meta/classes/debia= nize.bbclass
> index adb6cf2b..54a16260 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -120,9 +120,9 @@ deb_debianize() {
> =09else
> =09=09deb_create_rules
> =09fi
> -=09# Add the copyright if unpacked sources does not contain cop= yright file
> -=09if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}= /default-copyright ]; then
> -=09=09install -v -m 644 ${WORKDIR}/default-copyright ${S}/debia= n/copyright
> +=09# Add the copyright if unpacked sources does not contain cop= yright file as well as the recipes configured the LICENSE
> +=09if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}= /${LICENSE}/default-copyright ]; then
> +=09=09 install -v -m 644 ${WORKDIR}/${LICENSE}/default-copyrigh= t ${S}/debian/copyright
> =09fi
> =09# prepend a changelog-entry unless an existing changelog fil= e already
> =09# contains an entry with CHANGELOG_V
> diff --git a/meta/classes/dpkg-helper-license.bbclass b/meta/cla= sses/dpkg-helper-license.bbclass
> new file mode 100644
> index 00000000..81e6d4e6
> --- /dev/null
> +++ b/meta/classes/dpkg-helper-license.bbclass
> @@ -0,0 +1,27 @@
> +# This software is a part of ISAR.
> +# Copyright (C) 2024 Siemens AG
> +#
> +# SPDX-License-Identifier: MIT
> +
> +LICENSE ??=3D ""
> +

Missing HOMEPAGE default, given that all templates require this varia= ble.

=C2=A0 =C2=A0Will add this variable= =C2=A0


> +inherit template
> +
> +# Path to copyright template files
> +FILESPATH:prepend :=3D "${LAYERDIR_core}/licenses/debian:"
> +
> +# GPL-2.0 licensed packages
> +SRC_URI:append =3D " ${@ 'file://GPL-2.0/default-copyright.tmpl= ' if d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }"
> +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0/default-copyright.tmpl= ' if d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }"
> +
> +# GPL-2.0+ licensed packages
> +SRC_URI:append =3D " ${@ 'file://GPL-2.0+/default-copyright.tmp= l' if d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '' }"
> +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0+/default-copyright.tmp= l' if d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '' }"
> +
> +# GPL-3.0 licensed packages
> +SRC_URI:append =3D " ${@ 'file://GPL-3.0/default-copyright.tmpl= ' if d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }"
> +TEMPLATE_FILES:append =3D "${@ ' GPL-3.0/default-copyright.tmpl= ' if d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }"
> +
> +# MIT licensed packages
> +SRC_URI:append =3D " ${@ 'file://MIT/default-copyright.tmpl' if= d.getVar('LICENSE') =3D=3D 'MIT' else '' }"
> +TEMPLATE_FILES:append =3D "${@ ' MIT/default-copyright.tmpl' if= d.getVar('LICENSE') =3D=3D 'MIT' else '' }"

This could be enhanced by supporting license choices ("A | B") and
multiple license ("A & B"). OTOH, the "Files:" tag in the templat= es are
even more likely to become incorrect in such cases.
=

=C2=A0 =C2=A0 This will take a look.=C2= =A0


> diff --git a/meta/licenses/debian/GPL-2.0+/default-copyright.tmp= l b/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl
> new file mode 100644
> index 00000000..5c6d27c5
> --- /dev/null
> +++ b/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl
> @@ -0,0 +1,24 @@
> +Format: https://www.debi= an.org/doc/packaging-manuals/copyright-format/1.0/
> +Upstream-Name: ${BPN}
> +Source: ${HOMEPAGE}
> +
> +Files: *
> +Copyright: ${MAINTAINER}
> +License: GPL-2.0+
> +
> +License: GPL-2.0+
> + This package is free software; you can redistribute it and/or = modify
> + it under the terms of the GNU General Public License as publis= hed by
> + the Free Software Foundation; either version 2 of the License,= or
> + (at your option) any later version.
> + .
> + This package is distributed in the hope that it will be useful= ,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> + .
> + You should have received a copy of the GNU General Public Lice= nse
> + along with this program. If not, see <https://www.gnu.org= /licenses/>
> + .
> + On Debian systems, the complete text of the GNU General
> + Public License version 2 can be found in "/usr/share/common-li= censes/GPL-2".
> diff --git a/meta/licenses/debian/GPL-2.0/default-copyright.tmpl= b/meta/licenses/debian/GPL-2.0/default-copyright.tmpl
> new file mode 100644
> index 00000000..223e5841
> --- /dev/null
> +++ b/meta/licenses/debian/GPL-2.0/default-copyright.tmpl
> @@ -0,0 +1,23 @@
> +Format: https://www.debi= an.org/doc/packaging-manuals/copyright-format/1.0/
> +Upstream-Name: ${BPN}
> +Source: ${HOMEPAGE}
> +
> +Files: *
> +Copyright: ${MAINTAINER}
> +License: GPL-2.0
> +
> +License: GPL-2.0
> + This package is free software; you can redistribute it and/or = modify
> + it under the terms of the GNU General Public License as publis= hed by
> + the Free Software Foundation; either version 2 of the License.
> + .
> + This package is distributed in the hope that it will be useful= ,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> + .
> + You should have received a copy of the GNU General Public Lice= nse
> + along with this program. If not, see <https://www.gnu.org= /licenses/>
> + .
> + On Debian systems, the complete text of the GNU General
> + Public License version 2 can be found in "/usr/share/common-li= censes/GPL-2".
> diff --git a/meta/licenses/debian/GPL-3.0/default-copyright.tmpl= b/meta/licenses/debian/GPL-3.0/default-copyright.tmpl
> new file mode 100644
> index 00000000..c2511481
> --- /dev/null
> +++ b/meta/licenses/debian/GPL-3.0/default-copyright.tmpl
> @@ -0,0 +1,22 @@
> +Format: https://www.debi= an.org/doc/packaging-manuals/copyright-format/1.0/
> +Upstream-Name: ${BPN}
> +Source: ${HOMEPAGE}
> +
> +Files: *
> +Copyright: ${MAINTAINER}
> +License: GPL-3.0
> +
> +License: GPL-3.0
> + This program is free software: you can redistribute it and/or = modify it under
> + the terms of the GNU General Public License as published by th= e Free
> + Software Foundation, version 3 of the License.
> + .
> + This program is distributed in the hope that it will be useful= , but WITHOUT ANY
> + WARRANTY; without even the implied warranty of MERCHANTABILITY= or FITNESS FOR A
> + PARTICULAR PURPOSE. See the GNU General Public License for mo= re details.
> + .
> + You should have received a copy of the GNU General Public Lice= nse along with
> + this program. If not, see <http://www.gnu.org/licenses/>.
> + .
> + On Debian systems, the complete text of the GNU General Public= License version
> + 3 can be found in "/usr/share/common-licenses/GPL-3".
> diff --git a/meta/licenses/debian/MIT/default-copyright.tmpl b/m= eta/licenses/debian/MIT/default-copyright.tmpl
> new file mode 100644
> index 00000000..2bced7f5
> --- /dev/null
> +++ b/meta/licenses/debian/MIT/default-copyright.tmpl
> @@ -0,0 +1,26 @@
> +Format:
http://www.debian= .org/doc/packaging-manuals/copyright-format/1.0/
> +Upstream-Name: ${BPN}
> +Source: ${HOMEPAGE}
> +
> +Files: *
> +Copyright: ${MAINTAINER}
> +License: MIT
> +
> +License: MIT
> + Permission is hereby granted, free of charge, to any person ob= taining a copy
> + of this software and associated documentation files (the "Soft= ware"), to deal
> + in the Software without restriction, including without limitat= ion the rights
> + to use, copy, modify, merge, publish, distribute, sublicense, = and/or sell
> + copies of the Software, and to permit persons to whom the Soft= ware is
> + furnished to do so, subject to the following conditions:
> + .
> + The above copyright notice and this permission notice shall be= included in all
> + copies or substantial portions of the Software.
> + .
> + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND= , EXPRESS OR
> + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHA= NTABILITY,
> + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EV= ENT SHALL THE
> + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES = OR OTHER
> + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE= , ARISING FROM,
> + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER = DEALINGS IN THE
> + SOFTWARE.

Jan

--=20
Siemens AG, Technology
Linux Expert Center

------=_Part_60439_173933187.1715149481801-- ------=_Part_60438_1514999978.1715149481801--