1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
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 55 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
This can take around 55 minutes total on a 3.3-GHz Opteron 4238 CPU.
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
|