From ffd62b64ec536ac15c7d8fae599a799908890efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Tamargo?= Date: Mon, 13 Mar 2023 19:01:16 +0200 Subject: [PATCH] MBS-12977: Correctly specify the licenses of the JSON dumps We were claiming this is all CC0, but that is not correct. The JSON dumps contain annotation, rating and tag data, all of which is supplementary / CC-BY-NC-SA data. Talked with mayhem and mwiencek about this, we agreed that the right thing to do is to update the dump docs to specify the right licenses rather than dropping the supplementary data, since it can be useful and there's no great way to provide it separately like on the MB dumps. --- lib/MusicBrainz/Script/JSONDump.pm | 22 ++++++++++++++++++++-- t/script/DumpJSON.t | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/lib/MusicBrainz/Script/JSONDump.pm b/lib/MusicBrainz/Script/JSONDump.pm index 42f38a6dd93..67fccaefe4d 100644 --- a/lib/MusicBrainz/Script/JSONDump.pm +++ b/lib/MusicBrainz/Script/JSONDump.pm @@ -91,6 +91,13 @@ sub create_json_dump { local $MusicBrainz::Script::MBDump::readme_text = <<'EOF'; The file under mbdump/ contains one document (entity) per line, in JSON format, and is named according to the type of entity in the dump. +EOF + + my $copying_text = <<'EOF'; +The content of this dump is licensed under the CC0 license +(see COPYING-PublicDomain), except for any data under keys "annotation", +"genres", "ratings" and "tags", which is licensed under a Creative Commons +Attribution-NonCommercial-ShareAlike 3.0 license (see COPYING-CCShareAlike). EOF my $mbdump = MusicBrainz::Script::MBDump->new( @@ -100,9 +107,16 @@ EOF %mbdump_options, ); + $mbdump->write_file('COPYING', $copying_text); + $mbdump->copy_file( catfile(DBDefs->MB_SERVER_ROOT, 'admin', 'COPYING-PublicDomain'), - 'COPYING' + 'COPYING-PublicDomain' + ) or die $OS_ERROR; + + $mbdump->copy_file( + catfile(DBDefs->MB_SERVER_ROOT, 'admin', 'COPYING-CCShareAlike'), + 'COPYING-CCShareAlike' ) or die $OS_ERROR; $mbdump->write_file('JSON_DUMPS_SCHEMA_NUMBER', "1\n"); @@ -114,7 +128,11 @@ EOF if ($self->compression_enabled) { $mbdump->make_tar( "$dump_fname.tar.xz", - "mbdump/$dump_fname", + ( + "mbdump/$dump_fname", + 'COPYING-PublicDomain', + 'COPYING-CCShareAlike', + ), 'JSON_DUMPS_SCHEMA_NUMBER', ); } else { diff --git a/t/script/DumpJSON.t b/t/script/DumpJSON.t index 7447eda0aa7..c6f68f9900a 100755 --- a/t/script/DumpJSON.t +++ b/t/script/DumpJSON.t @@ -127,6 +127,24 @@ test all => sub { File::Spec->catfile($dir, $entity, 'JSON_DUMPS_SCHEMA_NUMBER')); chomp $got; is($got, '1'); + + $got = read_file( + File::Spec->catfile($dir, $entity, 'COPYING')); + chomp $got; + ok( + $got =~ 'see COPYING-CCShareAlike', + 'The COPYING file refers users to the per-license COPYING files', + ); + + ok( + -f File::Spec->catfile($dir, $entity, 'COPYING-PublicDomain'), + 'The COPYING-PublicDomain file is included in the bundle', + ); + + ok( + -f File::Spec->catfile($dir, $entity, 'COPYING-CCShareAlike'), + 'The COPYING-CCShareAlike file is included in the bundle', + ); }; my $test_dumps_empty_except = sub {