[v2] meta/classes/debianize: Add copyright file to debian folder

Message ID 20240307144801.3685495-1-srinuvasan.a@siemens.com
State Superseded, archived
Headers show
Series [v2] meta/classes/debianize: Add copyright file to debian folder | expand

Commit Message

Arjunan, Srinu March 7, 2024, 2:48 p.m. UTC
From: Srinuvasan A <srinuvasan.a@siemens.com>

In downstream layer we uses copyright files for most of the packages,
this is very important for our OSS clearing.

User can add the copyright to the required recipe, then the generated
packages from the recipes contains the debian/copyright file.

Added example copyright file in example-raw recipe.

Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
---
 doc/user_manual.md                            |  2 ++
 .../example-raw/example-raw_0.3.bb            |  3 ++-
 .../example-raw/files/default-copyright.tmpl  | 21 +++++++++++++++++++
 meta/classes/debianize.bbclass                |  4 ++++
 4 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 meta-isar/recipes-app/example-raw/files/default-copyright.tmpl

Comments

Jan Kiszka March 8, 2024, 7:15 a.m. UTC | #1
On 07.03.24 15:48, srinuvasan.a@siemens.com wrote:
> From: Srinuvasan A <srinuvasan.a@siemens.com>
> 
> In downstream layer we uses copyright files for most of the packages,
> this is very important for our OSS clearing.
> 
> User can add the copyright to the required recipe, then the generated
> packages from the recipes contains the debian/copyright file.
> 
> Added example copyright file in example-raw recipe.
> 
> Signed-off-by: Srinuvasan A <srinuvasan.a@siemens.com>
> ---
>  doc/user_manual.md                            |  2 ++
>  .../example-raw/example-raw_0.3.bb            |  3 ++-
>  .../example-raw/files/default-copyright.tmpl  | 21 +++++++++++++++++++
>  meta/classes/debianize.bbclass                |  4 ++++
>  4 files changed, 29 insertions(+), 1 deletion(-)
>  create mode 100644 meta-isar/recipes-app/example-raw/files/default-copyright.tmpl
> 
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index bc730243..6b851985 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -940,6 +940,8 @@ Other (optional) customization variables include:
>   - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies
>   - `DEBIAN_REPLACES` - to replace a package with another
>  
> +Added provision to generate copyright file in debian packages, this would be helpful for downstream project's OSS clearing.
> +
>  ### Prebuilt .deb packages from somewhere
>  
>  In some cases you might find yourself having a `.deb` that someone else built,
> 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 ffa14340..b4dfaa4d 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
> @@ -9,7 +9,8 @@ DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2)"
>  
>  SRC_URI = "file://README \
>  	   file://postinst \
> -	   file://rules"
> +	   file://rules \
> +	   file://default-copyright.tmpl"
>  
>  inherit dpkg-raw
>  
> diff --git a/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl
> new file mode 100644
> index 00000000..8bede266
> --- /dev/null
> +++ b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl
> @@ -0,0 +1,21 @@
> +MIT License
> +
> +Copyright (c) 2024 srinuvasan

We need to be accurate here. You do not have personal copyright on any
of these files, rather (according to git):

Copyright (c) 2017-2014, Siemens
Copyright (c) 2022 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 f256333d..29898aeb 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -120,6 +120,10 @@ deb_debianize() {
>  	else
>  		deb_create_rules
>  	fi
> +	# Add the copyright if unpacked sources does not contain copyright file

...do not...

> +	if [ ! -f ${S}/debian/copyright.tmpl ] && [ -f ${WORKDIR}/default-copyright.tmpl ]; then

Why *.tmpl? This file is not processed by the templating class, is it?

> +		install -v -m 644 ${WORKDIR}/default-copyright.tmpl ${S}/debian/copyright
> +	fi
>  	# prepend a changelog-entry unless an existing changelog file already
>  	# contains an entry with CHANGELOG_V
>  	deb_add_changelog

Jan
Arjunan, Srinu March 8, 2024, 7:18 a.m. UTC | #2
On Friday, March 8, 2024 at 12:45:08 PM UTC+5:30 Jan Kiszka wrote:

On 07.03.24 15:48, srinuv...@siemens.com wrote: 
> From: Srinuvasan A <srinuv...@siemens.com> 
> 
> In downstream layer we uses copyright files for most of the packages, 
> this is very important for our OSS clearing. 
> 
> User can add the copyright to the required recipe, then the generated 
> packages from the recipes contains the debian/copyright file. 
> 
> Added example copyright file in example-raw recipe. 
> 
> Signed-off-by: Srinuvasan A <srinuv...@siemens.com> 
> --- 
> doc/user_manual.md | 2 ++ 
> .../example-raw/example-raw_0.3.bb | 3 ++- 
> .../example-raw/files/default-copyright.tmpl | 21 +++++++++++++++++++ 
> meta/classes/debianize.bbclass | 4 ++++ 
> 4 files changed, 29 insertions(+), 1 deletion(-) 
> create mode 100644 
meta-isar/recipes-app/example-raw/files/default-copyright.tmpl 
> 
> diff --git a/doc/user_manual.md b/doc/user_manual.md 
> index bc730243..6b851985 100644 
> --- a/doc/user_manual.md 
> +++ b/doc/user_manual.md 
> @@ -940,6 +940,8 @@ Other (optional) customization variables include: 
> - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies 
> - `DEBIAN_REPLACES` - to replace a package with another 
> 
> +Added provision to generate copyright file in debian packages, this 
would be helpful for downstream project's OSS clearing. 
> + 
> ### Prebuilt .deb packages from somewhere 
> 
> In some cases you might find yourself having a `.deb` that someone else 
built, 
> 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 ffa14340..b4dfaa4d 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 
> @@ -9,7 +9,8 @@ DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2)" 
> 
> SRC_URI = "file://README \ 
> file://postinst \ 
> - file://rules" 
> + file://rules \ 
> + file://default-copyright.tmpl" 
> 
> inherit dpkg-raw 
> 
> diff --git 
a/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl 
b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl 
> new file mode 100644 
> index 00000000..8bede266 
> --- /dev/null 
> +++ b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl 
> @@ -0,0 +1,21 @@ 
> +MIT License 
> + 
> +Copyright (c) 2024 srinuvasan 

We need to be accurate here. You do not have personal copyright on any 
of these files, rather (according to git): 

Copyright (c) 2017-2014, Siemens 
Copyright (c) 2022 ilbers GmbH 


    got it, thanks 

> + 
> +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 f256333d..29898aeb 100644 
> --- a/meta/classes/debianize.bbclass 
> +++ b/meta/classes/debianize.bbclass 
> @@ -120,6 +120,10 @@ deb_debianize() { 
> else 
> deb_create_rules 
> fi 
> + # Add the copyright if unpacked sources does not contain copyright file 

...do not... 

> + if [ ! -f ${S}/debian/copyright.tmpl ] && [ -f 
${WORKDIR}/default-copyright.tmpl ]; then 

Why *.tmpl? This file is not processed by the templating class, is it?


    Yes, will update to normal file. 



> + install -v -m 644 ${WORKDIR}/default-copyright.tmpl 
${S}/debian/copyright 
> + fi 
> # prepend a changelog-entry unless an existing changelog file already 
> # contains an entry with CHANGELOG_V 
> deb_add_changelog 

Jan

Patch

diff --git a/doc/user_manual.md b/doc/user_manual.md
index bc730243..6b851985 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -940,6 +940,8 @@  Other (optional) customization variables include:
  - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies
  - `DEBIAN_REPLACES` - to replace a package with another
 
+Added provision to generate copyright file in debian packages, this would be helpful for downstream project's OSS clearing.
+
 ### Prebuilt .deb packages from somewhere
 
 In some cases you might find yourself having a `.deb` that someone else built,
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 ffa14340..b4dfaa4d 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
@@ -9,7 +9,8 @@  DEBIAN_DEPENDS = "adduser, apt (>= 0.4.2)"
 
 SRC_URI = "file://README \
 	   file://postinst \
-	   file://rules"
+	   file://rules \
+	   file://default-copyright.tmpl"
 
 inherit dpkg-raw
 
diff --git a/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl
new file mode 100644
index 00000000..8bede266
--- /dev/null
+++ b/meta-isar/recipes-app/example-raw/files/default-copyright.tmpl
@@ -0,0 +1,21 @@ 
+MIT License
+
+Copyright (c) 2024 srinuvasan
+
+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 f256333d..29898aeb 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -120,6 +120,10 @@  deb_debianize() {
 	else
 		deb_create_rules
 	fi
+	# Add the copyright if unpacked sources does not contain copyright file
+	if [ ! -f ${S}/debian/copyright.tmpl ] && [ -f ${WORKDIR}/default-copyright.tmpl ]; then
+		install -v -m 644 ${WORKDIR}/default-copyright.tmpl ${S}/debian/copyright
+	fi
 	# prepend a changelog-entry unless an existing changelog file already
 	# contains an entry with CHANGELOG_V
 	deb_add_changelog