From 118556af4fcc851a7cca1ea13e9f5f45641a0e27 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 16 May 2020 14:13:01 +0200 Subject: [PATCH 1/3] keyfile: add "keyfile-history.sh" script for finding copyright holders of "shared/nm-keyfile" --- libnm-core/nm-keyfile/keyfile-history.sh | 97 ++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 libnm-core/nm-keyfile/keyfile-history.sh diff --git a/libnm-core/nm-keyfile/keyfile-history.sh b/libnm-core/nm-keyfile/keyfile-history.sh new file mode 100755 index 0000000000..37db48366c --- /dev/null +++ b/libnm-core/nm-keyfile/keyfile-history.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +# Script for searching the git history of keyfile code +# in order to find contributors and copyright holders. + +# Base commit. Since this commit are all contributions already +# LGPL-2.1+ licensed. See RELICENSE.md. +H0=a3e75f329446a93a61ca4c458a7657bd919f4fe6 + +show_related_keyfile_files_origin() { + # print all related filenames to the keyfile plugin. + for F in \ + libnm-core/nm-keyfile-internal.h \ + libnm-core/nm-keyfile-utils.c \ + libnm-core/nm-keyfile-utils.h \ + libnm-core/nm-keyfile.c \ + libnm-core/nm-keyfile-reader.c \ + libnm-core/nm-keyfile-writer.c \ + ; do + git log --pretty='' --name-only --full-history --follow $H0 -- $F \ + | uniq; + echo; + done + + git log --pretty='' --name-only $H0 -- system-settings/plugins/keyfile | sort -u | grep -v /tests/ | grep '\.[hc]$' + echo + git log --pretty='' --name-only $H0 -- src/settings/plugins/keyfile | sort -u | grep -v /tests/ | grep '\.[hc]$' +} + +show_related_keyfile_files_blacklist() { + # show_related_keyfile_files_origin() prints some files that + # are unrelated. Blacklist them. + cat \ + | grep -v info-daemon/NetworkManagerInfoNetworksDialog.h \ + | grep -v nfo-daemon/NetworkManagerInfoPassphraseDialog.h \ + | grep -v src/nm-dbus-nm.h \ + | grep -v src/nm-logging.h \ + | grep -v src/NetworkManagerWireless.h \ + ; +} + +show_related_keyfile_files() { + # print the files names in the git history that are related + # to keyfile code. + show_related_keyfile_files_origin \ + | sort -u \ + | grep -v '^$' \ + | show_related_keyfile_files_blacklist +} + +commit_has_file() { + git ls-tree -r "$1" | grep -q "\\s$2"\$ +} + +print_commit_authors() { + git --no-pager log --full-history --follow --no-merges --pretty='format:<%ae>' $H0 -- "$1" | sort -u +} + +print_blame_authors() { + local LAST_H + + if commit_has_file $H0 "$1"; then + LAST_H=$H0 + else + LAST_H="$(git log --full-history --no-merges -n1 --pretty='format:%H' $H0 -- "$1")"^1 + fi + git blame --no-progress -C -C -C20 -M -M10 -e "$LAST_H" -- "$1" | sed 's/.*\(<[^>]\+@[^>]\+>\).*/\1/' | sort -u +} + +print_grep() { + git --no-pager log -p --full-history --follow $H0 -- "$1" | grep -i '[a-z0-9]@\|author\|copyright' | sort -u +} + +prefix() { + sed "s/^/>>>$1 /" +} + +collect_all() { + for F; do + print_commit_authors "$F" | prefix 1 + echo + print_blame_authors "$F" | prefix 2 + echo + print_grep "$F" | prefix 3 + done | + sort | + uniq | + sed 's/@/(at)/' +} + + +F=( $(show_related_keyfile_files) ) +for f in "${F[@]}"; do + echo ">>>>>> file $f" +done +echo +collect_all "${F[@]}" From bd4b067186d67111c2e3b3626b9602c17fa87776 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 16 May 2020 14:18:23 +0200 Subject: [PATCH 2/3] keyfile: relicense the code under LGPL-2.1+ Historically, keyfile read/write code was part of core, and thus GPL-2.0+ licensed. Keyfile is the native file format for NetworkManager connection profiles, and code to handle that should be part of libnm. This would unlock many interesting features, like tools being able to import/export connection profiles in the native file format. However, libnm is LGPL-2.1+ licensed, so this is a problem. The alternative would be to add a separate, GPL licensed library (libnm-keyfile.so or libnm-gpl.so). However that also requires a larger rework, because the current keyfile implementation uses internal API from libnm-core and it would need to be reworked to only use public API of libnm. Relicense the code instead. According to research and "keyfile-history.sh" script, the following individuals and companies possibly hold copyright on the code: Intel Corporation Novell, Inc. Red Hat, Inc. Ximian, Inc. Most contributors on this list agreed to relicensing according to RELICENSE.md. The following copyright holders did not answer the request for agreeing to relicensing: - : no contributions were made that are related to keyfile implementation. The script just gives a false positive. - : the contribution is a fix of a spelling error (commit 6029288ffb18435ca7d2cde645be53cd414ae5fa). - : the contribution to keyfile code are small (I only identified commit 5b7503e95eb9d84935efea708b9dc326ef14d8ce). Also, Thomas worked for Red Hat at the time. After research, I think it's fair to conclude that everybody who holds non-trivial copyright on the keyfile code agreed to the relicensing. --- libnm-core/nm-keyfile/nm-keyfile-internal.h | 2 +- libnm-core/nm-keyfile/nm-keyfile-utils.c | 2 +- libnm-core/nm-keyfile/nm-keyfile-utils.h | 2 +- libnm-core/nm-keyfile/nm-keyfile.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libnm-core/nm-keyfile/nm-keyfile-internal.h b/libnm-core/nm-keyfile/nm-keyfile-internal.h index 77372f3ac9..a0a153d75c 100644 --- a/libnm-core/nm-keyfile/nm-keyfile-internal.h +++ b/libnm-core/nm-keyfile/nm-keyfile-internal.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: LGPL-2.1+ */ /* * Copyright (C) 2008 Novell, Inc. * Copyright (C) 2015 Red Hat, Inc. diff --git a/libnm-core/nm-keyfile/nm-keyfile-utils.c b/libnm-core/nm-keyfile/nm-keyfile-utils.c index be12f8a83f..05a4412469 100644 --- a/libnm-core/nm-keyfile/nm-keyfile-utils.c +++ b/libnm-core/nm-keyfile/nm-keyfile-utils.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: LGPL-2.1+ */ /* * Copyright (C) 2010 Red Hat, Inc. */ diff --git a/libnm-core/nm-keyfile/nm-keyfile-utils.h b/libnm-core/nm-keyfile/nm-keyfile-utils.h index efad8317b0..9d18f5b54d 100644 --- a/libnm-core/nm-keyfile/nm-keyfile-utils.h +++ b/libnm-core/nm-keyfile/nm-keyfile-utils.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: LGPL-2.1+ */ /* * Copyright (C) 2010 - 2015 Red Hat, Inc. */ diff --git a/libnm-core/nm-keyfile/nm-keyfile.c b/libnm-core/nm-keyfile/nm-keyfile.c index a8aefe6349..4c09039d07 100644 --- a/libnm-core/nm-keyfile/nm-keyfile.c +++ b/libnm-core/nm-keyfile/nm-keyfile.c @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ +/* SPDX-License-Identifier: LGPL-2.1+ */ /* * Copyright (C) 2008 - 2009 Novell, Inc. * Copyright (C) 2008 - 2017 Red Hat, Inc. From a12a0d0c0316c842580b2f7906a4f5cb5746e7f4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 20 Oct 2020 21:04:46 +0200 Subject: [PATCH 3/3] keyfile: remove "keyfile-history.sh" script --- libnm-core/nm-keyfile/keyfile-history.sh | 97 ------------------------ 1 file changed, 97 deletions(-) delete mode 100755 libnm-core/nm-keyfile/keyfile-history.sh diff --git a/libnm-core/nm-keyfile/keyfile-history.sh b/libnm-core/nm-keyfile/keyfile-history.sh deleted file mode 100755 index 37db48366c..0000000000 --- a/libnm-core/nm-keyfile/keyfile-history.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash - -# Script for searching the git history of keyfile code -# in order to find contributors and copyright holders. - -# Base commit. Since this commit are all contributions already -# LGPL-2.1+ licensed. See RELICENSE.md. -H0=a3e75f329446a93a61ca4c458a7657bd919f4fe6 - -show_related_keyfile_files_origin() { - # print all related filenames to the keyfile plugin. - for F in \ - libnm-core/nm-keyfile-internal.h \ - libnm-core/nm-keyfile-utils.c \ - libnm-core/nm-keyfile-utils.h \ - libnm-core/nm-keyfile.c \ - libnm-core/nm-keyfile-reader.c \ - libnm-core/nm-keyfile-writer.c \ - ; do - git log --pretty='' --name-only --full-history --follow $H0 -- $F \ - | uniq; - echo; - done - - git log --pretty='' --name-only $H0 -- system-settings/plugins/keyfile | sort -u | grep -v /tests/ | grep '\.[hc]$' - echo - git log --pretty='' --name-only $H0 -- src/settings/plugins/keyfile | sort -u | grep -v /tests/ | grep '\.[hc]$' -} - -show_related_keyfile_files_blacklist() { - # show_related_keyfile_files_origin() prints some files that - # are unrelated. Blacklist them. - cat \ - | grep -v info-daemon/NetworkManagerInfoNetworksDialog.h \ - | grep -v nfo-daemon/NetworkManagerInfoPassphraseDialog.h \ - | grep -v src/nm-dbus-nm.h \ - | grep -v src/nm-logging.h \ - | grep -v src/NetworkManagerWireless.h \ - ; -} - -show_related_keyfile_files() { - # print the files names in the git history that are related - # to keyfile code. - show_related_keyfile_files_origin \ - | sort -u \ - | grep -v '^$' \ - | show_related_keyfile_files_blacklist -} - -commit_has_file() { - git ls-tree -r "$1" | grep -q "\\s$2"\$ -} - -print_commit_authors() { - git --no-pager log --full-history --follow --no-merges --pretty='format:<%ae>' $H0 -- "$1" | sort -u -} - -print_blame_authors() { - local LAST_H - - if commit_has_file $H0 "$1"; then - LAST_H=$H0 - else - LAST_H="$(git log --full-history --no-merges -n1 --pretty='format:%H' $H0 -- "$1")"^1 - fi - git blame --no-progress -C -C -C20 -M -M10 -e "$LAST_H" -- "$1" | sed 's/.*\(<[^>]\+@[^>]\+>\).*/\1/' | sort -u -} - -print_grep() { - git --no-pager log -p --full-history --follow $H0 -- "$1" | grep -i '[a-z0-9]@\|author\|copyright' | sort -u -} - -prefix() { - sed "s/^/>>>$1 /" -} - -collect_all() { - for F; do - print_commit_authors "$F" | prefix 1 - echo - print_blame_authors "$F" | prefix 2 - echo - print_grep "$F" | prefix 3 - done | - sort | - uniq | - sed 's/@/(at)/' -} - - -F=( $(show_related_keyfile_files) ) -for f in "${F[@]}"; do - echo ">>>>>> file $f" -done -echo -collect_all "${F[@]}"