From: Jan Kiszka <jan.kiszka@siemens.com>
To: srinuvasan.a@siemens.com, isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com
Subject: Re: [PATCH] meta/classes/debianize: install appropriate copyright file
Date: Wed, 8 May 2024 07:35:36 +0200 [thread overview]
Message-ID: <811483d4-8009-44dc-84b4-0e23baa7cfef@siemens.com> (raw)
In-Reply-To: <20240507074102.1147439-1-srinuvasan.a@siemens.com>
On 07.05.24 09:41, srinuvasan.a@siemens.com wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
>
> Presently we have an example to install the copyright file in the debian
> package, now we improved little bit to install the appropriate copyright
> file based on the configured variable "LICENSE" in the recipe.
>
> Added the example for example-raw recipe.
>
> Signed-off-by: Srinuvasan A <srinuvasan.a@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/default-copyright
> create mode 100644 meta/classes/dpkg-helper-license.bbclass
> 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..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 = "Sample application for ISAR"
> MAINTAINER = "Your name here <you@domain.com>"
> DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2)"
> +HOMEPAGE = "<Home page of the recipe>"
This visualizes that we have a missing default...
> +
> +LICENSE = "MIT"
>
> SRC_URI = "file://README \
> file://postinst \
> - file://rules \
> - file://default-copyright"
> + file://rules"
>
> 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?
>
> do_install() {
> bbnote "Creating ${PN} binary"
> diff --git a/meta-isar/recipes-app/example-raw/files/default-copyright 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 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.
> diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
> index adb6cf2b..54a16260 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -120,9 +120,9 @@ deb_debianize() {
> else
> 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
> + # Add the copyright if unpacked sources does not contain copyright file 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
> diff --git a/meta/classes/dpkg-helper-license.bbclass b/meta/classes/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 ??= ""
> +
Missing HOMEPAGE default, given that all templates require this variable.
> +inherit template
> +
> +# Path to copyright template files
> +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 '' }"
This could be enhanced by supporting license choices ("A | B") and
multiple license ("A & B"). OTOH, the "Files:" tag in the templates are
even more likely to become incorrect in such cases.
> 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 <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-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 <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-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 <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/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.
Jan
--
Siemens AG, Technology
Linux Expert Center
next prev parent reply other threads:[~2024-05-08 5:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 7:41 srinuvasan.a
2024-05-08 5:35 ` Jan Kiszka [this message]
2024-05-08 6:24 ` Srinuvasan Arjunan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=811483d4-8009-44dc-84b4-0e23baa7cfef@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=cedric.hombourger@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=srinuvasan.a@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox