diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-02 03:33:18 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2020-12-02 07:31:28 (EST) |
commit | b123eac322250f17b037b7cde275d2a0cf14824a (patch) | |
tree | 01237bd5e386ad21e4573579591e1d18e5c2900d | |
parent | 5f454f16586d637008f3e712f220f8ebf1bbb4b0 (diff) |
README.copyright: New file
-rw-r--r-- | README.copyright | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/README.copyright b/README.copyright new file mode 100644 index 0000000..c3cfe92 --- /dev/null +++ b/README.copyright @@ -0,0 +1,125 @@ +Starting from Scratch +===================== + +First of course, unpack a clean source tree: + + $ sudo rm -Rf tmp + $ sudo prokit build $root -bcT nop . + +Next get a list of all C source files (706 files as of version 1.32.0) that may +be built into the `busybox` binary: + + $ cd tmp/src/ + tmp/src$ find * -name '*.[ch]' -a \! -path 'examples/*' \ + > -a \! -path 'scripts/*' -a \! -path 'shell/*_test/*' | sort 0<../../.files + +The most common license notice text (in 359 files as of version 1.32.0) is +"Licensed under GPLv2 or later, see file LICENSE in this source tree." The +second most common text (in 210 files) is "Licensed under GPLv2, see file +LICENSE in this source tree." Some (5) files contain both notices: + + tmp/src$ cat ../../.files | xargs grep -Fl \ + > 'Licensed under GPLv2 or later, see file LICENSE in this source tree.' \ + > | xargs grep -Fl \ + > 'Licensed under GPLv2, see file LICENSE in this source tree.' + archival/bbunzip.c + coreutils/cat.c + libbb/hash_md5_sha.c + loginutils/cryptpw.c + util-linux/mount.c + +Extract copyright comments from these (354 and 205) files: + + tmp/src$ cat ../../.files | xargs grep -Fl \ + > 'Licensed under GPLv2 or later, see file LICENSE in this source tree.' \ + > | grep -Ev + > '^(archival/bbunzip.c|coreutils/cat.c|libbb/hash_md5_sha.c'\ + > '|loginutils/cryptpw.c|util-linux/mount.c)$' + > | xargs ../../extract-copyright-comments \ + > 1>../../.copyright-comments.gplv2orlater + tmp/src$ cat ../../.files | xargs grep -Fl \ + > 'Licensed under GPLv2, see file LICENSE in this source tree.' \ + > | grep -Ev + > '^(archival/bbunzip.c|coreutils/cat.c|libbb/hash_md5_sha.c'\ + > '|loginutils/cryptpw.c|util-linux/mount.c)$' + > | xargs ../../extract-copyright-comments \ + > 1>../../.copyright-comments.gplv2 + +This can take around 45 minutes total on a 3.3-GHz Opteron 4238 CPU. + +Edit the files `copyright`, `.copyright-comments.gplv2orlater`, and +`.copyright-comments.gplv2`. Find all the unusual copyright and license notices +(e.g. portions of code copied from elsewhere under other licenses), list them +separately in `copyright`, and remove them from the `.copyright-comments.*` +files. Also remove comments where "(c)" appears as C code rather than as a +copyright symbol (found in at least `shell/shell_common.c`). + +With only files with simply the common license notices remaining, extract the +file names: + + $ printf '%s, ' $(grep -v '^[[:space:]]' .copyright-comments.gplv2orlater) \ + > | fold -s -w 81 | sed 's/ $//; $s/,$//' + $ printf '%s, ' $(grep -v '^[[:space:]]' .copyright-comments.gplv2) \ + > | fold -s -w 81 | sed 's/ $//; $s/,$//' + +Add these file names and the copyright and license notices to `copyright`. + +Next extract copyright comments from the files found earlier to have both +GPLv2-or-later and GPLv2-only license notices: + + tmp/src$ ../../extract-copyright-comments \ + > archival/bbunzip.c coreutils/cat.c libbb/hash_md5_sha.c \ + > loginutils/cryptpw.c util-linux/mount.c \ + > 1>../../.copyright-comments.gplv2both + +Edit the files `copyright` and `.copyright-comments.gplv2both`, moving copyright +and license notices from the latter to the former. + +Now extract copyright comments from all the other (147 in version 1.32.0) files: + + tmp/src$ cat ../../.files | xargs grep -FL \ + > 'Licensed under GPLv2 or later, see file LICENSE in this source tree.' \ + > | xargs grep -FL \ + > 'Licensed under GPLv2, see file LICENSE in this source tree.' \ + > 1>../../.copyright-comments.other + +And again edit `copyright` and `.copyright-comments.other`, moving copyright and +license notices from the latter to the former. + +Also manually check the shell scripts under `applets_sh/` for copyright and +license notices. As of version 1.32.0 there are two files with no such notices, +and since these scripts are embedded as-is into the `busybox` binary, it's +unlikely that there will ever be any verbose comments. + +Upgrading to a New Upstream Version +=================================== + +Before upgrading, unpack a clean source tree of the old version: + + $ sudo rm -Rf tmp + $ sudo prokit build $root -bcT nop . + +Next get a list of all C source files (706 files as of version 1.32.0) that may +be built into the `busybox` binary, and extract all the copyright comments: + + $ cd tmp/src/ + tmp/src$ find * -name '*.[ch]' -a \! -path 'examples/*' \ + > -a \! -path 'scripts/*' -a \! -path 'shell/*_test/*' | \ + > xargs ../../extract-copyright-comments 1>../../.copyright-comments.old + +Now upgrade to the new upstream version (by editing `changelog` and downloading +the new upstream source archive). Unpack a clean source tree of the new +version, and then get the copyright commands from all relevant C source files in +the new version: + + $ sudo rm -Rf tmp + $ sudo prokit build $root -bcT nop . + $ cd tmp/src/ + tmp/src$ find * -name '*.[ch]' -a \! -path 'examples/*' \ + > -a \! -path 'scripts/*' -a \! -path 'shell/*_test/*' | \ + > xargs ../../extract-copyright-comments 1>../../.copyright-comments.new + +Finally compare the differences between the old and new copyright comments, and +add these changes to the `copyright` file: + + $ diff -u .copyright-comments.old .copyright-comments.new | less |