Skip to content

Commit 34f72b3

Browse files
authored
Merge pull request #514 from nextcloud/backport-505-license-mailmap-9
[stable9] license and mailmap backports
2 parents a760564 + c445cc4 commit 34f72b3

2 files changed

Lines changed: 151 additions & 29 deletions

File tree

.mailmap

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Andreas Schönebeck <aschoenebeck@web.de>
1616
Andreas Ergenzinger <andreas.ergenzinger@gmx.de> AndreasErgenzinger <andreas.ergenzinger@gmx.de>
1717
Andrew Brown <andrew@casabrown.com>
1818
André Gaul <gaul@web-yard.de>
19-
Arthur Schiwon <blizzz@owncloud.com> Arthur Schiwon <blizzz@arthur-schiwon.de>
20-
Arthur Schiwon <blizzz@owncloud.com> blizzz <blizzz@owncloud.com>
19+
Arthur Schiwon <blizzz@arthur-schiwon.de> Arthur Schiwon <blizzz@owncloud.com>
20+
Arthur Schiwon <blizzz@arthur-schiwon.de> blizzz <blizzz@owncloud.com>
2121
Artur Duque de Souza <asouza@kde.org>
2222
Axel Roenn <axel@mpim-bonn.mpg.de>
2323
Bagera <victor@baquero-wihlborg.se>
@@ -30,14 +30,16 @@ Benjamin Diele <benjamin@diele.be>
3030
Benjamin Liles <benliles@arch.tamu.edu>
3131
Bernhard Posselt <dev@bernhard-posselt.com> Bernhard Posselt <nukeawhale@gmail.com>
3232
Bernhard Posselt <dev@bernhard-posselt.com> Bernhard Posselt <Raydiation@users.noreply.github.com>
33+
Bernhard Posselt <dev@bernhard-posselt.com> Bernhard Posselt <BernhardPosselt@users.noreply.github.com>
3334
Bernhard Reiter <ockham@raz.or.at>
3435
Birk Borkason <daniel.niccoli@gmail.com>
35-
Björn Schießle <schiessle@owncloud.com> Bjoern Schiessle <schiesbn@woody.(none)>
36-
Björn Schießle <schiessle@owncloud.com> Björn Schießle <bjoern@schiessle.org>
37-
Björn Schießle <schiessle@owncloud.com> Björn Schießle <schiesbn@potato.(none)>
38-
Björn Schießle <schiessle@owncloud.com> Björn Schiessle <schiessle@owncloud.com>
39-
Björn Schießle <schiessle@owncloud.com> Bjoern Schießle <schiessle@owncloud.com>
40-
Björn Schießle <schiessle@owncloud.com> Bjoern Schiessle <schiessle@owncloud.com>
36+
Björn Schießle <bjoern@schiessle.org> Bjoern Schiessle <schiesbn@woody.(none)>
37+
Björn Schießle <bjoern@schiessle.org> Björn Schießle <schiessle@owncloud.com>
38+
Björn Schießle <bjoern@schiessle.org> Björn Schießle <schiesbn@potato.(none)>
39+
Björn Schießle <bjoern@schiessle.org> Björn Schiessle <schiessle@owncloud.com>
40+
Björn Schießle <bjoern@schiessle.org> Bjoern Schießle <schiessle@owncloud.com>
41+
Björn Schießle <bjoern@schiessle.org> Bjoern Schiessle <schiessle@owncloud.com>
42+
Björn Schießle <bjoern@schiessle.org> Björn Schießle <schiessle@owncloud.com>
4143
BlackEagle <ike.devolder@gmail.com>
4244
Boris Rybalkin <ribalkin@gmail.com>
4345
Borjan Tchakaloff <borjan@tchakaloff.fr>
@@ -61,6 +63,8 @@ Christian Berendt <berendt@b1-systems.de>
6163
Christian Kampka <christian@kampka.net>
6264
Christian Koch <koch.chris@gmail.com>
6365
Christian Reiner <github@christian-reiner.info> Christian Reiner <arkascha@balder.site>
66+
Christoph Wurst <christoph@owncloud.com> Christoph Wurst <ChristophWurst@users.noreply.github.com>
67+
Christoph Wurst <christoph@owncloud.com> Christoph Wurst <christoph@winzerhof-wurst.at>
6468
Christopher Bunn <b11.chris@gmail.com>
6569
Christopher Schäpers <kondou@ts.unde.re> Christopher <kondou@ts.unde.re>
6670
Christopher Schäpers <kondou@ts.unde.re> kondou <kondou@ts.unde.re>
@@ -123,11 +127,11 @@ Florian Vichot <florian.vichot@gmail.com>
123127
Florin Peter <github@florin-peter.de> Florin Peter <fp@datawerk.de>
124128
Florin Peter <github@florin-peter.de> FlorinPeter <github@florin-peter.de>
125129
Francesco Piraneo G. <fpiraneo@iface.ch>
126-
Frank Karlitschek <frank@owncloud.org> Frank Karlitschek <frank@dev.(none)>
127-
Frank Karlitschek <frank@owncloud.org> Frank Karlitschek <frank@devel.(none)>
128-
Frank Karlitschek <frank@owncloud.org> Frank Karlitschek <frank@oc.(none)>
129-
Frank Karlitschek <frank@owncloud.org> Frank Karlitschek <karlitschek@gmx.de>
130-
Frank Karlitschek <frank@owncloud.org> Frank Karlitschek <karlitschek@kde.org>
130+
Frank Karlitschek <frank@karlitschek.de> Frank Karlitschek <frank@dev.(none)>
131+
Frank Karlitschek <frank@karlitschek.de> Frank Karlitschek <frank@devel.(none)>
132+
Frank Karlitschek <frank@karlitschek.de> Frank Karlitschek <frank@oc.(none)>
133+
Frank Karlitschek <frank@karlitschek.de> Frank Karlitschek <frank@owncloud.org>
134+
Frank Karlitschek <frank@karlitschek.de> Frank Karlitschek <karlitschek@kde.org>
131135
François Kubler <francois@kubler.org>
132136
Frédéric Fortier <frederic.fortier@oronospolytechnique.com> Frédéric Fortier <frederic.fortier@polymtl.ca>
133137
Frederik Gladhorn <gladhorn@kde.org>
@@ -179,7 +183,8 @@ Jesús Macias <jmacias@solidgear.es> Jesus Macias <jmacias@full-on-net.com>
179183
jknockaert <jasper@knockaert.nl>
180184
Joan <aseques@gmail.com>
181185
Joar Wandborg <git@wandborg.com>
182-
Joas Schilling <nickvergessen@owncloud.com> Joas Schilling <nickvergessen@gmx.de>
186+
Joas Schilling <coding@schilljs.com> Joas Schilling <nickvergessen@gmx.de>
187+
Joas Schilling <coding@schilljs.com> Joas Schilling <nickvergessen@owncloud.com>
183188
joel hansson <joel.hansson@gmail.com>
184189
Johan Björk <johanimon@gmail.com>
185190
Johannes Twittmann <github.com@deryo.de>
@@ -206,8 +211,8 @@ Sebastian Döll <sebastian.doell@libasys.de> libasys <sebastian.doell@libasys.de
206211
Lode Hoste <zillode@zillode.be>
207212
lolozere <laurent@chedanne.pro>
208213
Lorenzo M. Catucci <lorenzo@sancho.ccd.uniroma2.it>
209-
Lukas Reschke <lukas@owncloud.com> Lukas Reschke <lukas@owncloud.org>
210-
Lukas Reschke <lukas@owncloud.com> Lukas Reschke <lukas@statuscode.ch>
214+
Lukas Reschke <lukas@statuscode.ch> Lukas Reschke <lukas@owncloud.com>
215+
Lukas Reschke <lukas@statuscode.ch> Lukas Reschke <lukas@owncloud.org>
211216
Luke Policinski <lpolicinski@gmail.com>
212217
Lyonel Vincent <lyonel@ezix.org>
213218
macjohnny <estebanmarin@gmx.ch>
@@ -298,17 +303,18 @@ Riccardo Iaconelli <riccardo@kde.org>
298303
Richard Clarkson <robert@trash-mail.com>
299304
rnveach <rveach02@gmail.com>
300305
Robert Jäckel <rjaeckel@users.noreply.github.com>
301-
Robin Appelman <icewind@owncloud.com> icewind1991 <icewind1991@gmail.com>
302-
Robin Appelman <icewind@owncloud.com> icewind1991 <robin@icewind.nl>
303-
Robin Appelman <icewind@owncloud.com> Robin <Robin Appelman icewind1991@gmail.com>
304-
Robin Appelman <icewind@owncloud.com> Robin <robin@Amaya.(none)>
305-
Robin Appelman <icewind@owncloud.com> Robin Appelman <icewind1991@gmail.com>
306-
Robin Appelman <icewind@owncloud.com> Robin Appelman <icewind1991@gmail>
307-
Robin Appelman <icewind@owncloud.com> Robin Appelman <robin@icewind.nl>
306+
Robin Appelman <robin@icewind.nl> icewind1991 <icewind1991@gmail.com>
307+
Robin Appelman <robin@icewind.nl> icewind1991 <robin@icewind.nl>
308+
Robin Appelman <robin@icewind.nl> Robin <Robin Appelman icewind1991@gmail.com>
309+
Robin Appelman <robin@icewind.nl> Robin <robin@Amaya.(none)>
310+
Robin Appelman <robin@icewind.nl> Robin Appelman <icewind1991@gmail.com>
311+
Robin Appelman <robin@icewind.nl> Robin Appelman <icewind1991@gmail>
312+
Robin Appelman <robin@icewind.nl> Robin Appelman <icewind@owncloud.com>
308313
Robin McCorkell <robin@mccorkell.me.uk> Robin McCorkell <rmccorkell@karoshi.org.uk>
309314
Robin McCorkell <robin@mccorkell.me.uk> Robin McCorkell <rmccorkell@owncloud.com>
310315
Rodrigo Hjort <rodrigo.hjort@gmail.com>
311-
Roeland Jago Douma <rullzer@owncloud.com> Roeland Jago Douma <roeland@famdouma.nl>
316+
Roeland Jago Douma <roeland@famdouma.nl> Roeland Jago Douma <rullzer@owncloud.com>
317+
Roeland Jago Douma <roeland@famdouma.nl> Roeland Douma <rullzer@users.noreply.github.com>
312318
rok <brejktru@gmail.com>
313319
Roland Hager <roland.hager@tu-berlin.de>
314320
Roland van Laar <roland@micite.net>
@@ -368,6 +374,7 @@ TheSFReader <TheSFReader@gmail.com>
368374
Thibaut GRIDEL <tgridel@free.fr>
369375
thomas <thomas@thomas-VirtualBox.(none)>
370376
Thomas Müller <thomas.mueller@tmit.eu> Thomas Mueller <thomas.mueller@tmit.eu>
377+
Thomas Müller <thomas.mueller@tmit.eu> Thomas Müller <DeepDiver1975@users.noreply.github.com>
371378
Thomas Olsen <tol@tanghus>
372379
Thomas Schmidt <tschmidt@suse.de>
373380
Thomas Tanghus <thomas@tanghus.net>

build/license.php

Lines changed: 120 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,39 @@ class Licenses
2222
{
2323
protected $paths = [];
2424
protected $mailMap = [];
25+
protected $checkFiles = [];
2526
public $authors = [];
2627

2728
public function __construct() {
2829
$this->licenseText = <<<EOD
2930
/**
31+
@COPYRIGHT@
32+
*
33+
@AUTHORS@
34+
*
35+
* @license GNU AGPL version 3 or any later version
36+
*
37+
* This program is free software: you can redistribute it and/or modify
38+
* it under the terms of the GNU Affero General Public License as
39+
* published by the Free Software Foundation, either version 3 of the
40+
* License, or (at your option) any later version.
41+
*
42+
* This program is distributed in the hope that it will be useful,
43+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
44+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45+
* GNU Affero General Public License for more details.
46+
*
47+
* You should have received a copy of the GNU Affero General Public License
48+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
49+
*
50+
*/
51+
EOD;
52+
$this->licenseTextLegacy = <<<EOD
53+
/**
54+
@COPYRIGHT@
55+
*
3056
@AUTHORS@
3157
*
32-
* @copyright Copyright (c) @YEAR@, ownCloud, Inc.
3358
* @license AGPL-3.0
3459
*
3560
* This code is free software: you can redistribute it and/or modify
@@ -46,7 +71,7 @@ public function __construct() {
4671
*
4772
*/
4873
EOD;
49-
$this->licenseText = str_replace('@YEAR@', date("Y"), $this->licenseText);
74+
$this->licenseTextLegacy = str_replace('@YEAR@', date("Y"), $this->licenseTextLegacy);
5075
}
5176

5277
/**
@@ -68,6 +93,7 @@ function exec($folder, $gitRoot = false) {
6893

6994
if (is_file($folder)) {
7095
$this->handleFile($folder, $gitRoot);
96+
$this->printFilesToCheck();
7197
return;
7298
}
7399

@@ -92,11 +118,13 @@ function exec($folder, $gitRoot = false) {
92118
/** @var SplFileInfo $file */
93119
$this->handleFile($file, $gitRoot);
94120
}
121+
122+
$this->printFilesToCheck();
95123
}
96124

97125
function writeAuthorsFile() {
98126
ksort($this->authors);
99-
$template = "ownCloud is written by:
127+
$template = "Nextcloud is written by:
100128
@AUTHORS@
101129
102130
With help from many libraries and frameworks including:
@@ -118,17 +146,25 @@ function handleFile($path, $gitRoot) {
118146
echo "MIT licensed file: $path" . PHP_EOL;
119147
return;
120148
}
121-
$source = $this->eatOldLicense($source);
149+
$copyrightNotices = $this->getCopyrightNotices($path, $source);
122150
$authors = $this->getAuthors($path, $gitRoot);
123-
$license = str_replace('@AUTHORS@', $authors, $this->licenseText);
151+
if ($this->isOwnCloudLicensed($source)) {
152+
$license = str_replace('@AUTHORS@', $authors, $this->licenseTextLegacy);
153+
$this->checkCopyrightState($path, $gitRoot);
154+
} else {
155+
$license = str_replace('@AUTHORS@', $authors, $this->licenseText);
156+
}
157+
$license = str_replace('@COPYRIGHT@', $copyrightNotices, $license);
124158

159+
$source = $this->eatOldLicense($source);
125160
$source = "<?php" . PHP_EOL . $license . PHP_EOL . $source;
126161
file_put_contents($path,$source);
127162
echo "License updated: $path" . PHP_EOL;
128163
}
129164

130165
/**
131166
* @param string $source
167+
* @return bool
132168
*/
133169
private function isMITLicensed($source) {
134170
$lines = explode(PHP_EOL, $source);
@@ -143,6 +179,19 @@ private function isMITLicensed($source) {
143179
return false;
144180
}
145181

182+
private function isOwnCloudLicensed($source) {
183+
$lines = explode(PHP_EOL, $source);
184+
while(!empty($lines)) {
185+
$line = $lines[0];
186+
array_shift($lines);
187+
if (strpos($line, 'ownCloud, Inc') !== false) {
188+
return true;
189+
}
190+
}
191+
192+
return false;
193+
}
194+
146195
/**
147196
* @param string $source
148197
* @return string
@@ -177,6 +226,68 @@ private function eatOldLicense($source) {
177226
return implode(PHP_EOL, $lines);
178227
}
179228

229+
private function getCopyrightNotices($path, $file) {
230+
$licenseHeaderEndsAtLine = (int)trim(shell_exec("grep -n '*/' $path | head -n 1 | cut -d ':' -f 1"));
231+
$lineByLine = explode(PHP_EOL, $file, $licenseHeaderEndsAtLine + 1);
232+
$copyrightNotice = [];
233+
$licensePart = array_slice($lineByLine, 0, $licenseHeaderEndsAtLine);
234+
foreach ($licensePart as $line) {
235+
if (strpos($line, '@copyright') !== false) {
236+
$copyrightNotice[] = $line;
237+
}
238+
}
239+
240+
return implode(PHP_EOL, $copyrightNotice);
241+
}
242+
243+
/**
244+
* check if all lines where changed after the Nextcloud fork.
245+
* That's not a guarantee that we can switch to AGPLv3 or later,
246+
* but a good indicator that we should have a look at the file
247+
*
248+
* @param $path
249+
* @param $gitRoot
250+
*/
251+
private function checkCopyrightState($path, $gitRoot) {
252+
// This was the date the Nextcloud fork was created
253+
$deadline = new DateTime('06/06/2016');
254+
$deadlineTimestamp = $deadline->getTimestamp();
255+
256+
$buildDir = getcwd();
257+
if ($gitRoot) {
258+
chdir($gitRoot);
259+
$path = substr($path, strlen($gitRoot));
260+
}
261+
$out = shell_exec("git --no-pager blame --line-porcelain $path | sed -n 's/^author-time //p'");
262+
if ($gitRoot) {
263+
chdir($buildDir);
264+
}
265+
$timestampChanges = explode(PHP_EOL, $out);
266+
$timestampChanges = array_slice($timestampChanges, 0, count($timestampChanges)-1);
267+
foreach ($timestampChanges as $timestamp) {
268+
if ((int)$timestamp < $deadlineTimestamp) {
269+
return;
270+
}
271+
}
272+
273+
//all changes after the deadline
274+
$this->checkFiles[] = $path;
275+
276+
}
277+
278+
private function printFilesToCheck() {
279+
if (!empty($this->checkFiles)) {
280+
print "\n";
281+
print "For following files all lines changed since the Nextcloud fork." . PHP_EOL;
282+
print "Please check if these files can be moved over to AGPLv3 or later" . PHP_EOL;
283+
print "\n";
284+
foreach ($this->checkFiles as $file) {
285+
print $file . PHP_EOL;
286+
}
287+
print "\n";
288+
}
289+
}
290+
180291
private function getAuthors($file, $gitRoot) {
181292
// only add authors that changed code and not the license header
182293
$licenseHeaderEndsAtLine = trim(shell_exec("grep -n '*/' $file | head -n 1 | cut -d ':' -f 1"));
@@ -209,6 +320,7 @@ private function getAuthors($file, $gitRoot) {
209320
$this->authors[$author] = $author;
210321
return " * @author $author";
211322
}, $authors);
323+
212324
return implode(PHP_EOL, $authors);
213325
}
214326

@@ -238,6 +350,7 @@ private function checkCoreMailMap($author) {
238350
$licenses->exec($argv[1], isset($argv[2]) ? $argv[1] : false);
239351
} else {
240352
$licenses->exec([
353+
'../apps/admin_audit',
241354
'../apps/comments',
242355
'../apps/dav',
243356
'../apps/encryption',
@@ -251,8 +364,10 @@ private function checkCoreMailMap($author) {
251364
'../apps/provisioning_api',
252365
'../apps/systemtags',
253366
'../apps/testing',
367+
'../apps/theming',
254368
'../apps/updatenotification',
255369
'../apps/user_ldap',
370+
'../build/integration/features/bootstrap',
256371
'../core',
257372
'../lib',
258373
'../ocs',

0 commit comments

Comments
 (0)