Hi All, Any feedback on this RFC patch? Thanks, Srinu On Monday, March 18, 2024 at 2:55:18 PM UTC+5:30 srinuv...@siemens.com wrote: > From: Srinuvasan A > > Now we introduced a few more OSS licenses template files, user can simply > set the license f.e LICENSE = "MIT" in the recipe. > > Based on the license configuartion in the recipe, the respective > copyright file installed in the debian package. > > Added example for example-raw recipe. > > Signed-off-by: Srinuvasan A > --- > .../example-raw/example-raw_0.3.bb | 1 + > meta/classes/debianize.bbclass | 26 +++++++++++++++++-- > .../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 +++++++++++++++++++ > 6 files changed, 120 insertions(+), 2 deletions(-) > create mode 100644 meta/licenses/debian/GPL-2.0+/default-copyright.tmpl > create mode 100644 meta/licenses/debian/GPL-2.0/default-copyright.tmpl > create mode 100644 meta/licenses/debian/GPL-3.0/default-copyright.tmpl > create mode 100644 meta/licenses/debian/MIT/default-copyright.tmpl > > diff --git a/meta-isar/recipes-app/example-raw/example-raw_0.3.bb > b/meta-isar/recipes-app/example-raw/example-raw_0.3.bb > index 35f4b3d9..166f4a94 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,6 +6,7 @@ > DESCRIPTION = "Sample application for ISAR" > MAINTAINER = "Your name here " > DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2)" > +LICENSE = "MIT" > > SRC_URI = "file://README \ > file://postinst \ > diff --git a/meta/classes/debianize.bbclass > b/meta/classes/debianize.bbclass > index 0febcbe2..9a4357c1 100644 > --- a/meta/classes/debianize.bbclass > +++ b/meta/classes/debianize.bbclass > @@ -15,6 +15,7 @@ DEBIAN_MULTI_ARCH ??= "no" > DEBIAN_COMPAT ??= "10" > DESCRIPTION ??= "must not be empty" > MAINTAINER ??= "Unknown maintainer " > +LICENSE ??= "" > > deb_add_changelog() { > changelog_v="${CHANGELOG_V}" > @@ -121,8 +122,9 @@ deb_debianize() { > deb_create_rules > fi > # Add the copyright if unpacked sources does not contain copyright file > - if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}/default-copyright > ]; then > - install -v -m 644 ${WORKDIR}/default-copyright ${S}/debian/copyright > + # as well as the recipes configured the LICENSE > + if [ ! -f ${S}/debian/copyright ] && [ -f > ${WORKDIR}/${LICENSE}/default-copyright ]; then > + install -v -m 644 ${WORKDIR}/${LICENSE}/default-copyright > ${S}/debian/copyright > fi > # prepend a changelog-entry unless an existing changelog file already > # contains an entry with CHANGELOG_V > @@ -140,3 +142,23 @@ deb_debianize() { > done > done > } > + > +inherit template > + > +FILESPATH:prepend := "${LAYERDIR_core}/licenses/debian:" > + > +# GPL-2.0 licensed packages > +SRC_URI:append = " ${@ 'file://GPL-2.0/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-2.0' else '' }" > +TEMPLATE_FILES:append = "${@ ' GPL-2.0/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-2.0' else '' }" > + > +# GPL-2.0+ licensed packages > +SRC_URI:append = " ${@ 'file://GPL-2.0+/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-2.0+' else '' }" > +TEMPLATE_FILES:append = "${@ ' GPL-2.0+/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-2.0+' else '' }" > + > +# GPL-3.0 licensed packages > +SRC_URI:append = " ${@ 'file://GPL-3.0/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-3.0' else '' }" > +TEMPLATE_FILES:append = "${@ ' GPL-3.0/default-copyright.tmpl' if > d.getVar('LICENSE') == 'GPL-3.0' else '' }" > + > +#MIT licensed packages > +SRC_URI:append = " ${@ 'file://MIT/default-copyright.tmpl' if > d.getVar('LICENSE') == 'MIT' else '' }" > +TEMPLATE_FILES:append = "${@ ' MIT/default-copyright.tmpl' if > d.getVar('LICENSE') == 'MIT' else '' }" > 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..5c6d27c5 > --- /dev/null > +++ b/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl > @@ -0,0 +1,24 @@ > +Format: > https://www.debian.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 published 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 License > + along with this program. If not, see > + . > + On Debian systems, the complete text of the GNU General > + Public License version 2 can be found in > "/usr/share/common-licenses/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.debian.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 published 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 License > + along with this program. If not, see > + . > + On Debian systems, the complete text of the GNU General > + Public License version 2 can be found in > "/usr/share/common-licenses/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.debian.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 the 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 more details. > + . > + You should have received a copy of the GNU General Public License along > with > + this program. If not, see . > + . > + 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/meta/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 obtaining a > copy > + of this software and associated documentation files (the "Software"), to > deal > + in the Software without restriction, including without limitation the > rights > + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell > + copies of the Software, and to permit persons to whom the Software 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 MERCHANTABILITY, > + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 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. > -- > 2.34.1 > >