From: srinuvasan.a@siemens.com
To: isar-users@googlegroups.com
Cc: cedric.hombourger@siemens.com, jan.kiszka@siemens.com,
Srinuvasan A <srinuvasan.a@siemens.com>
Subject: [RFC] meta/classes/debianize: get the copyright file based on LICENSE variable
Date: Mon, 18 Mar 2024 14:54:53 +0530 [thread overview]
Message-ID: <20240318092453.918778-1-srinuvasan.a@siemens.com> (raw)
From: Srinuvasan A <srinuvasan.a@siemens.com>
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 <srinuvasan.a@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.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 <you@domain.com>"
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 <unknown@example.com>"
+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 <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.
--
2.34.1
next reply other threads:[~2024-03-18 9:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 9:24 srinuvasan.a [this message]
2024-03-21 5:27 ` srinu
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=20240318092453.918778-1-srinuvasan.a@siemens.com \
--to=srinuvasan.a@siemens.com \
--cc=cedric.hombourger@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@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