Merge pull request #238739 from apfelkuchen6/texlive-licenses-v2
texlive.combine: expose licensing information of combined packages [v2]
This commit is contained in:
commit
0c7765a38a
|
@ -321,4 +321,54 @@
|
||||||
echo "tested $binCount binCount: $ignoredCount ignored, $brokenCount broken, $failedCount failed"
|
echo "tested $binCount binCount: $ignoredCount ignored, $brokenCount broken, $failedCount failed"
|
||||||
[[ $failedCount = 0 ]]
|
[[ $failedCount = 0 ]]
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# verify that the precomputed licensing information in default.nix
|
||||||
|
# does indeed match the metadata of the individual packages.
|
||||||
|
#
|
||||||
|
# This is part of the test suite (and not the normal evaluation) to save
|
||||||
|
# time for "normal" evaluations. To be more in line with the other tests, this
|
||||||
|
# also builds a derivation, even though it is essentially an eval-time assertion.
|
||||||
|
licenses =
|
||||||
|
let
|
||||||
|
concatLicenses = builtins.foldl' (acc: el: if builtins.elem el acc then acc else acc ++ [ el ]);
|
||||||
|
# converts a license to its attribute name in lib.licenses
|
||||||
|
licenseToAttrName = license:
|
||||||
|
builtins.head (builtins.attrNames
|
||||||
|
(lib.filterAttrs (n: v: license == v) lib.licenses));
|
||||||
|
lt = (a: b: a < b);
|
||||||
|
|
||||||
|
savedLicenses = scheme: scheme.meta.license;
|
||||||
|
savedLicensesAttrNames = scheme: map licenseToAttrName (savedLicenses scheme);
|
||||||
|
|
||||||
|
correctLicenses = scheme: builtins.foldl'
|
||||||
|
(acc: pkg: concatLicenses acc (lib.toList (pkg.meta.license or [])))
|
||||||
|
[]
|
||||||
|
scheme.passthru.packages;
|
||||||
|
correctLicensesAttrNames = scheme:
|
||||||
|
lib.sort lt
|
||||||
|
(map licenseToAttrName (correctLicenses scheme));
|
||||||
|
|
||||||
|
hasLicenseMismatch = scheme:
|
||||||
|
(lib.isDerivation scheme) &&
|
||||||
|
(savedLicensesAttrNames scheme) != (correctLicensesAttrNames scheme);
|
||||||
|
incorrectSchemes = lib.filterAttrs
|
||||||
|
(n: hasLicenseMismatch)
|
||||||
|
texlive.combined;
|
||||||
|
prettyPrint = name: scheme:
|
||||||
|
''
|
||||||
|
license info for ${name} is incorrect! Note that order is enforced.
|
||||||
|
saved: [ ${lib.concatStringsSep " " (savedLicensesAttrNames scheme)} ]
|
||||||
|
correct: [ ${lib.concatStringsSep " " (correctLicensesAttrNames scheme)} ]
|
||||||
|
'';
|
||||||
|
errorText = lib.concatStringsSep "\n\n" (lib.mapAttrsToList prettyPrint incorrectSchemes);
|
||||||
|
in
|
||||||
|
runCommand "texlive-test-license" {
|
||||||
|
inherit errorText;
|
||||||
|
}
|
||||||
|
(if (incorrectSchemes == {})
|
||||||
|
then "echo everything is fine! > $out"
|
||||||
|
else ''
|
||||||
|
echo "$errorText"
|
||||||
|
false
|
||||||
|
'');
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,23 @@ CTAN and the various mirrors) and that the build recipe continues to produce
|
||||||
the same output. Should those assumptions not hold, remove the previous fixed
|
the same output. Should those assumptions not hold, remove the previous fixed
|
||||||
hashes for the relevant package, or for all packages.
|
hashes for the relevant package, or for all packages.
|
||||||
|
|
||||||
|
### Updating the licensing information
|
||||||
|
|
||||||
|
The license of each package in texlive is automatically extracted from texlive's
|
||||||
|
texlive.tlpdb into tlpdb.nix. The combined licenses of the schemes is stored
|
||||||
|
separately in `default.nix` and must be kept in sync with the licenses of the
|
||||||
|
actual contents of these schemes. Whether this is the case can be verified with the
|
||||||
|
`pkgs.tests.texlive.licenses` test. In case of a mismatch, copy the “correct”
|
||||||
|
license lists reported by the test into `default.nix`.
|
||||||
|
|
||||||
|
### Running the testsuite
|
||||||
|
|
||||||
|
There are a some other useful tests that haven't been mentioned before. Build them with
|
||||||
|
```
|
||||||
|
nix-build ../../../../.. -A tests.texlive --no-out-link
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Commit changes
|
### Commit changes
|
||||||
|
|
||||||
Commit the updated `tlpdb.nix` and `fixed-hashes.nix` to the repository with
|
Commit the updated `tlpdb.nix` and `fixed-hashes.nix` to the repository with
|
||||||
|
|
|
@ -43,6 +43,7 @@ let
|
||||||
# it seems to need it to transform fonts
|
# it seems to need it to transform fonts
|
||||||
xdvi.deps = (orig.xdvi.deps or []) ++ [ "metafont" ];
|
xdvi.deps = (orig.xdvi.deps or []) ++ [ "metafont" ];
|
||||||
|
|
||||||
|
# TODO: remove when updating to texlive-2023, metadata has been corrected in the TeX catalogue
|
||||||
# tlpdb lists license as "unknown", but the README says lppl13: http://mirrors.ctan.org/language/arabic/arabi-add/README
|
# tlpdb lists license as "unknown", but the README says lppl13: http://mirrors.ctan.org/language/arabic/arabi-add/README
|
||||||
arabi-add.license = [ "lppl13c" ];
|
arabi-add.license = [ "lppl13c" ];
|
||||||
|
|
||||||
|
@ -254,13 +255,38 @@ in
|
||||||
|
|
||||||
# Pre-defined combined packages for TeX Live schemes,
|
# Pre-defined combined packages for TeX Live schemes,
|
||||||
# to make nix-env usage more comfortable and build selected on Hydra.
|
# to make nix-env usage more comfortable and build selected on Hydra.
|
||||||
combined = with lib; recurseIntoAttrs (
|
combined = with lib;
|
||||||
|
let
|
||||||
|
# these license lists should be the sorted union of the licenses of the packages the schemes contain.
|
||||||
|
# The correctness of this collation is tested by tests.texlive.licenses
|
||||||
|
licenses = with lib.licenses; {
|
||||||
|
scheme-basic = [ free gfl gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ];
|
||||||
|
scheme-context = [ bsd2 bsd3 cc-by-sa-40 free gfl gfsl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21
|
||||||
|
lppl1 lppl13c mit ofl publicDomain x11 ];
|
||||||
|
scheme-full = [ artistic1 artistic1-cl8 asl20 bsd2 bsd3 bsdOriginal cc-by-10 cc-by-40 cc-by-sa-10 cc-by-sa-20
|
||||||
|
cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl1Plus gpl2 gpl2Plus gpl3 gpl3Plus isc knuth
|
||||||
|
lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ];
|
||||||
|
scheme-gust = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gfsl gpl1Only gpl2
|
||||||
|
gpl2Plus gpl3 gpl3Plus knuth lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ];
|
||||||
|
scheme-infraonly = [ gpl2 lgpl21 ];
|
||||||
|
scheme-medium = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0 fdl13Only
|
||||||
|
free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a lppl13c mit ofl
|
||||||
|
publicDomain x11 ];
|
||||||
|
scheme-minimal = [ free gpl1Only gpl2 gpl2Plus knuth lgpl21 lppl1 lppl13c mit ofl publicDomain ];
|
||||||
|
scheme-small = [ asl20 cc-by-40 cc-by-sa-40 cc0 fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus knuth
|
||||||
|
lgpl2 lgpl21 lppl1 lppl12 lppl13a lppl13c mit ofl publicDomain x11 ];
|
||||||
|
scheme-tetex = [ artistic1-cl8 asl20 bsd2 bsd3 cc-by-40 cc-by-sa-10 cc-by-sa-20 cc-by-sa-30 cc-by-sa-40 cc0
|
||||||
|
fdl13Only free gfl gpl1Only gpl2 gpl2Plus gpl3 gpl3Plus isc knuth lgpl2 lgpl21 lgpl3 lppl1 lppl12 lppl13a
|
||||||
|
lppl13c mit ofl publicDomain x11];
|
||||||
|
};
|
||||||
|
in recurseIntoAttrs (
|
||||||
mapAttrs
|
mapAttrs
|
||||||
(pname: attrs:
|
(pname: attrs:
|
||||||
addMetaAttrs rec {
|
addMetaAttrs rec {
|
||||||
description = "TeX Live environment for ${pname}";
|
description = "TeX Live environment for ${pname}";
|
||||||
platforms = lib.platforms.all;
|
platforms = lib.platforms.all;
|
||||||
maintainers = with lib.maintainers; [ veprbl ];
|
maintainers = with lib.maintainers; [ veprbl ];
|
||||||
|
license = licenses.${pname};
|
||||||
}
|
}
|
||||||
(combine {
|
(combine {
|
||||||
${pname} = attrs;
|
${pname} = attrs;
|
||||||
|
|
Loading…
Reference in a new issue