From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7347632129940914176 Date: Wed, 20 Mar 2024 22:27:30 -0700 (PDT) From: srinu To: isar-users Message-Id: In-Reply-To: <20240318092453.918778-1-srinuvasan.a@siemens.com> References: <20240318092453.918778-1-srinuvasan.a@siemens.com> Subject: Re: [RFC] meta/classes/debianize: get the copyright file based on LICENSE variable MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_49770_742395356.1710998850561" X-TUID: 03pijmbIxqBN ------=_Part_49770_742395356.1710998850561 Content-Type: multipart/alternative; boundary="----=_Part_49771_698949425.1710998850561" ------=_Part_49771_698949425.1710998850561 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi All, =20 Any feedback on this RFC patch? Thanks, Srinu On Monday, March 18, 2024 at 2:55:18=E2=80=AFPM UTC+5:30 srinuv...@siemens.= com=20 wrote: > From: Srinuvasan A > > Now we introduced a few more OSS licenses template files, user can simply > set the license f.e LICENSE =3D "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=20 > 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 =3D "Sample application for ISAR" > MAINTAINER =3D "Your name here " > DEBIAN_DEPENDS =3D "adduser, apt (>=3D 0.4.2)" > +LICENSE =3D "MIT" > > SRC_URI =3D "file://README \ > file://postinst \ > diff --git a/meta/classes/debianize.bbclass=20 > 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 ??=3D "no" > DEBIAN_COMPAT ??=3D "10" > DESCRIPTION ??=3D "must not be empty" > MAINTAINER ??=3D "Unknown maintainer " > +LICENSE ??=3D "" > > deb_add_changelog() { > changelog_v=3D"${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= =20 > ]; 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=20 > ${WORKDIR}/${LICENSE}/default-copyright ]; then > + install -v -m 644 ${WORKDIR}/${LICENSE}/default-copyright=20 > ${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 :=3D "${LAYERDIR_core}/licenses/debian:" > + > +# GPL-2.0 licensed packages > +SRC_URI:append =3D " ${@ 'file://GPL-2.0/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }" > +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '' }" > + > +# GPL-2.0+ licensed packages > +SRC_URI:append =3D " ${@ 'file://GPL-2.0+/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '' }" > +TEMPLATE_FILES:append =3D "${@ ' GPL-2.0+/default-copyright.tmpl' if=20 > 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=20 > d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }" > +TEMPLATE_FILES:append =3D "${@ ' GPL-3.0/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '' }" > + > +#MIT licensed packages > +SRC_URI:append =3D " ${@ 'file://MIT/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'MIT' else '' }" > +TEMPLATE_FILES:append =3D "${@ ' MIT/default-copyright.tmpl' if=20 > d.getVar('LICENSE') =3D=3D 'MIT' else '' }" > diff --git a/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl=20 > 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:=20 > 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=20 > "/usr/share/common-licenses/GPL-2". > diff --git a/meta/licenses/debian/GPL-2.0/default-copyright.tmpl=20 > 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:=20 > 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=20 > "/usr/share/common-licenses/GPL-2". > diff --git a/meta/licenses/debian/GPL-3.0/default-copyright.tmpl=20 > 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:=20 > 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= =20 > 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=20 > WITHOUT ANY > + WARRANTY; without even the implied warranty of MERCHANTABILITY or=20 > 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= =20 > with > + this program. If not, see . > + . > + On Debian systems, the complete text of the GNU General Public License= =20 > version > + 3 can be found in "/usr/share/common-licenses/GPL-3". > diff --git a/meta/licenses/debian/MIT/default-copyright.tmpl=20 > 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= =20 > copy > + of this software and associated documentation files (the "Software"), t= o=20 > deal > + in the Software without restriction, including without limitation the= =20 > rights > + to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll > + 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= =20 > in all > + copies or substantial portions of the Software. > + . > + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= =20 > OR > + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY= , > + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL= =20 > THE > + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= =20 > FROM, > + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS= =20 > IN THE > + SOFTWARE. > --=20 > 2.34.1 > > ------=_Part_49771_698949425.1710998850561 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi All,
=C2=A0=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0Any feedback on this RFC patch?

Thanks,
Srinu

On Monday, March 18, 2024 at 2:55:1= 8=E2=80=AFPM UTC+5:30 srinuv...@siemens.com wrote:
From: Srinuvasan A <srinuv...@siemens.com>

Now we introduced a few more OSS licenses template files, user can simp= ly
set the license f.e LICENSE =3D "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 <srinuv...@siemens.com>
---
.../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.tmp= l
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/exam= ple-raw_0.3.bb
+++ b/meta-isar/recipes-app/example-raw/exam= ple-raw_0.3.bb
@@ -6,6 +6,7 @@
DESCRIPTION =3D "Sample application for ISAR"
MAINTAINER =3D "Your name here <y...@domain.com>"
DEBIAN_DEPENDS =3D "adduser, apt (>=3D 0.4.2)"
+LICENSE =3D "MIT"
=20
SRC_URI =3D "file://README \
=09 file://postinst \
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bb= class
index 0febcbe2..9a4357c1 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -15,6 +15,7 @@ DEBIAN_MULTI_ARCH ??=3D "no"
DEBIAN_COMPAT ??=3D "10"
DESCRIPTION ??=3D "must not be empty"
MAINTAINER ??=3D "Unknown maintainer <unk...@example.com>"
+LICENSE ??=3D ""
=20
deb_add_changelog() {
=09changelog_v=3D"${CHANGELOG_V}"
@@ -121,8 +122,9 @@ deb_debianize() {
=09=09deb_create_rules
=09fi
=09# Add the copyright if unpacked sources does not contain copyright = file
-=09if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}/defaul= t-copyright ]; then
-=09=09install -v -m 644 ${WORKDIR}/default-copyright ${S}/debian/copyr= ight
+=09# as well as the recipes configured the LICENSE
+=09if [ ! -f ${S}/debian/copyright ] && [ -f ${WORKDIR}/${LICE= NSE}/default-copyright ]; then
+=09=09install -v -m 644 ${WORKDIR}/${LICENSE}/default-copyright ${S}/d= ebian/copyright
=09fi
=09# prepend a changelog-entry unless an existing changelog file alrea= dy
=09# contains an entry with CHANGELOG_V
@@ -140,3 +142,23 @@ deb_debianize() {
=09=09done
=09done
}
+
+inherit template
+
+FILESPATH:prepend :=3D "${LAYERDIR_core}/licenses/debian:"
+
+# GPL-2.0 licensed packages
+SRC_URI:append =3D " ${@ 'file://GPL-2.0/default-copyright.tm= pl' if d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '&= #39; }"
+TEMPLATE_FILES:append =3D "${@ ' GPL-2.0/default-copyright.tm= pl' if d.getVar('LICENSE') =3D=3D 'GPL-2.0' else '&= #39; }"
+
+# GPL-2.0+ licensed packages
+SRC_URI:append =3D " ${@ 'file://GPL-2.0+/default-copyright.t= mpl' if d.getVar('LICENSE') =3D=3D 'GPL-2.0+' else '= ;' }"
+TEMPLATE_FILES:append =3D "${@ ' GPL-2.0+/default-copyright.t= mpl' 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.tm= pl' if d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '&= #39; }"
+TEMPLATE_FILES:append =3D "${@ ' GPL-3.0/default-copyright.tm= pl' if d.getVar('LICENSE') =3D=3D 'GPL-3.0' else '&= #39; }"
+
+#MIT licensed packages
+SRC_URI:append =3D " ${@ 'file://MIT/default-copyright.tmpl&#= 39; if d.getVar('LICENSE') =3D=3D 'MIT' else '' }&q= uot;
+TEMPLATE_FILES:append =3D "${@ ' MIT/default-copyright.tmpl&#= 39; if d.getVar('LICENSE') =3D=3D 'MIT' else '' }&q= uot;
diff --git a/meta/licenses/debian/GPL-2.0+/default-copyright.tmpl b/met= a/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/p= ackaging-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 <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-lice= nses/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/p= ackaging-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 <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-lice= nses/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/p= ackaging-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 W= ITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT= NESS FOR A
+ PARTICULAR PURPOSE. See the GNU General Public License for more deta= ils.
+ .
+ You should have received a copy of the GNU General Public License alo= ng with
+ this program. If not, see <http:= //www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General Public Licens= e version
+ 3 can be found in "/usr/share/common-licenses/GPL-3".
diff --git a/meta/licenses/debian/MIT/default-copyright.tmpl b/meta/lic= enses/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/pack= aging-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 "Softwa= re"), 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 includ= ed in all
+ copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY K= IND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHA= LL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHE= R
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISI= NG FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALING= S IN THE
+ SOFTWARE.
--=20
2.34.1

------=_Part_49771_698949425.1710998850561-- ------=_Part_49770_742395356.1710998850561--