diff --git a/src/termux_language_server/assets/json/PKGBUILD.json b/src/termux_language_server/assets/json/PKGBUILD.json index 471f4d5..683830b 100644 --- a/src/termux_language_server/assets/json/PKGBUILD.json +++ b/src/termux_language_server/assets/json/PKGBUILD.json @@ -69,39 +69,610 @@ "description": "This field specifies the license(s) that apply to the package. Commonly used licenses can be found in */usr/share/licenses/common*. If you see the package's license there, simply reference it in the license field (e.g., license=(GPL)). If the package provides a license not available in */usr/share/licenses/common*, then you should include it in the package itself and set license=(custom) or license=(custom:LicenseName). The license should be placed in *\\$pkgdir/usr/share/licenses/\\$pkgname/* when building the package. If multiple licenses are applicable, list all of them: license=(GPL FDL).", "type": "array", "items": { - "type": "string", - "enum": [ - "AGPL3", - "Apache", - "Artistic2.0", - "Boost", - "CCPL", - "CDDL", - "CPL", - "EPL", - "FDL1.2", - "FDL1.3", - "GPL2", - "GPL3", - "LGPL2.1", - "LGPL3", - "LPPL", - "MPL", - "MPL2", - "PHP", - "PSF", - "PerlArtistic", - "Unlicense", - "W3C", - "ZPL", - "WTFPL", - "AGPL", - "APACHE", - "FDL", - "GPL", - "LGPL", - "RUBY", - "Ruby" + "oneOf": [ + { + "type": "string", + "enum": [ + "389-exception", + "Abstyles", + "CDL-1.0", + "DOC", + "GNAT-exception", + "AdaCore-doc", + "APL-1.0", + "Adobe-Glyph", + "Adobe-2006", + "ADSL", + "AFL-1.1", + "AFL-1.2", + "AFL-2.0", + "AFL-2.1", + "AFL-3.0", + "Afmparse", + "Aladdin", + "AGPL-1.0-only", + "AGPL-1.0-or-later", + "AGPL-3.0-only", + "AGPL-3.0-or-later", + "Giftware", + "LicenseRef-.amazon.com.-AmznSL-1.0", + "AMDPLPA", + "AML", + "AMPAS", + "ANTLR-PD", + "ANTLR-PD-fallback", + "Apache-1.0", + "Apache-1.1", + "Apache-2.0", + "APAFML", + "App-s2p", + "Swift-exception", + "APSL-1.0", + "APSL-1.1", + "APSL-1.2", + "APSL-2.0", + "Arphic-1999", + "Artistic-1.0", + "Artistic-1.0-cl8", + "Artistic-2.0", + "ClArtistic", + "Artistic-1.0-Perl", + "AAL", + "Autoconf-exception-2.0", + "Autoconf-exception-3.0", + "Autoconf-exception-generic", + "Baekmuk", + "Bahyph", + "Barr", + "Beerware", + "Bison-exception-2.2", + "Bitstream-Vera", + "BitTorrent-1.0", + "BitTorrent-1.1", + "blessing", + "BlueOak-1.0.0", + "BSL-1.0", + "Bootloader-exception", + "Borceux", + "Brian-Gladman-3-Clause", + "BSD-1-Clause", + "BSD-2-Clause-Views", + "BSD-3-Clause-No-Military-License", + "BSD-3-Clause-No-Nuclear-Warranty", + "BSD-3-Clause-Open-MPI", + "BSD-4-Clause-Shortened", + "BSD-3-Clause-Attribution", + "BSD-Advertising-Acknowledgement", + "BSD-3-Clause", + "BSD-4-Clause", + "BSD-4-Clause-UC", + "BSD-4.3RENO", + "BSD-2-Clause-Patent", + "BSD-Protection", + "BSD-2-Clause", + "BSD-Source-Code", + "0BSD", + "BUSL-1.1", + "BSD-4.3TAHOE", + "bzip2-1.0.6", + "C-UDA-1.0", + "CATOSL-1.1", + "CAL-1.0", + "CAL-1.0-Combined-Work-Exception", + "Caldera", + "OGL-Canada-2.0", + "CMU-Mach", + "CC-BY-1.0", + "CC-BY-2.0", + "CC-BY-2.5", + "CC-BY-2.5-AU", + "CC-BY-3.0", + "CC-BY-3.0-AT", + "CC-BY-3.0-DE", + "CC-BY-3.0-IGO", + "CC-BY-3.0-NL", + "CC-BY-3.0-US", + "CC-BY-4.0", + "CC-BY-NC-1.0", + "CC-BY-NC-2.0", + "CC-BY-NC-2.5", + "CC-BY-NC-3.0", + "CC-BY-NC-3.0-DE", + "CC-BY-NC-4.0", + "CC-BY-NC-ND-1.0", + "CC-BY-NC-ND-2.0", + "CC-BY-NC-ND-2.5", + "CC-BY-NC-ND-3.0", + "CC-BY-NC-ND-3.0-DE", + "CC-BY-NC-ND-3.0-IGO", + "CC-BY-NC-ND-4.0", + "CC-BY-NC-SA-1.0", + "CC-BY-NC-SA-2.0", + "CC-BY-NC-SA-2.0-DE", + "CC-BY-NC-SA-2.0-FR", + "CC-BY-NC-SA-2.0-UK", + "CC-BY-NC-SA-2.5", + "CC-BY-NC-SA-3.0", + "CC-BY-NC-SA-3.0-DE", + "CC-BY-NC-SA-3.0-IGO", + "CC-BY-NC-SA-4.0", + "CC-BY-ND-1.0", + "CC-BY-ND-2.0", + "CC-BY-ND-2.5", + "CC-BY-ND-3.0", + "CC-BY-ND-3.0-DE", + "CC-BY-ND-4.0", + "CC-BY-SA-1.0", + "CC-BY-SA-2.0", + "CC-BY-SA-2.0-UK", + "CC-BY-SA-2.1-JP", + "CC-BY-SA-2.5", + "CC-BY-SA-3.0", + "CC-BY-SA-3.0-AT", + "CC-BY-SA-3.0-DE", + "CC-BY-SA-4.0", + "CC-PDDC", + "CC0-1.0", + "CDDL-1.0", + "CDDL-1.1", + "CDLA-Permissive-1.0", + "CDLA-Permissive-2.0", + "CDLA-Sharing-1.0", + "CECILL-1.0", + "CECILL-1.1", + "CECILL-2.0", + "CECILL-2.1", + "CECILL-B", + "CECILL-C", + "CERN-OHL-1.1", + "CERN-OHL-1.2", + "CERN-OHL-P-2.0", + "CERN-OHL-S-2.0", + "CERN-OHL-W-2.0", + "CFITSIO", + "checkmk", + "Classpath-exception-2.0", + "BSD-3-Clause-Clear", + "Clips", + "CLISP-exception-2.0", + "BSD-Attribution-HPND-disclaimer", + "MIT-CMU", + "CNRI-Jython", + "CNRI-Python", + "CNRI-Python-GPL-Compatible", + "COIL-1.0", + "Condor-1.1", + "copyleft-next-0.3.0", + "copyleft-next-0.3.1", + "Cornell-Lossless-JPEG", + "CPAL-1.0", + "CPL-1.0", + "CPOL-1.02", + "Crossword", + "CrystalStacker", + "Community-Spec-1.0", + "CUA-OPL-1.0", + "Cube", + "curl", + "D-FSL-1.0", + "diffmark", + "DigiRule-FOSS-exception", + "DL-DE-BY-2.0", + "Plexus", + "Dotseqn", + "DRL-1.0", + "DSDP", + "dvipdfm", + "ECL-1.0", + "ECL-2.0", + "eCos-2.0", + "eCos-exception-2.0", + "RHeCos-1.1", + "EFL-1.0", + "EFL-2.0", + "eGenix", + "Elastic-2.0", + "MIT-advertising", + "MIT-enna", + "Entessa", + "EPICS", + "EPL-1.0", + "EPL-2.0", + "ErlPL-1.1", + "etalab-2.0", + "EUDatagrid", + "EUPL-1.0", + "EUPL-1.1", + "EUPL-1.2", + "Eurosym", + "Fair", + "OML", + "Fawkes-Runtime-exception", + "FLTK-exception", + "Font-exception-2.0", + "Frameworx-1.0", + "FDK-AAC", + "FreeBSD-DOC", + "FreeImage", + "freertos-exception-2.0", + "FTL", + "FSFAP", + "FSFUL", + "FSFULLR", + "FSFULLRWD", + "GCC-exception-3.1", + "GCC-exception-2.0", + "GFDL-1.1-only", + "GFDL-1.1-invariants-only", + "GFDL-1.1-invariants-or-later", + "GFDL-1.1-no-invariants-only", + "GFDL-1.1-no-invariants-or-later", + "GFDL-1.1-or-later", + "GFDL-1.2-only", + "GFDL-1.2-invariants-only", + "GFDL-1.2-invariants-or-later", + "GFDL-1.2-no-invariants-only", + "GFDL-1.2-no-invariants-or-later", + "GFDL-1.2-or-later", + "GFDL-1.3-only", + "GFDL-1.3-invariants-only", + "GFDL-1.3-invariants-or-later", + "GFDL-1.3-no-invariants-only", + "GFDL-1.3-no-invariants-or-later", + "GFDL-1.3-or-later", + "GL2PS", + "Glide", + "Glulxe", + "GLWTPL", + "gnu-javamail-exception", + "gnuplot", + "GPL-1.0-only", + "GPL-1.0-or-later", + "GPL-2.0-only", + "GPL-2.0-with-autoconf-exception", + "GPL-2.0-with-classpath-exception", + "GPL-2.0-with-font-exception", + "GPL-2.0-with-GCC-exception", + "GPL-2.0-or-later", + "GPL-3.0-only", + "GPL-3.0-with-autoconf-exception", + "GPL-3.0-with-GCC-exception", + "GPL-3.0-linking-exception", + "GPL-3.0-linking-source-exception", + "GPL-3.0-or-later", + "GPL-CC-1.0", + "Graphics-Gems", + "gSOAP-1.3b", + "GStreamer-exception-2005", + "GStreamer-exception-2008", + "HaskellReport", + "Spencer-99", + "Hippocratic-2.1", + "HPND", + "HPND-export-US", + "HPND-sell-variant-MIT-disclaimer", + "Spencer-94", + "i2p-gpl-java-exception", + "IBM-pibs", + "IPL-1.0", + "IEC-Code-Components-EULA", + "IJG", + "IJG-short", + "ImageMagick", + "Imlib2", + "xpp", + "Info-ZIP", + "QPL-1.0-INRIA-2004-exception", + "Intel-ACPI", + "Intel", + "Interbase-1.0", + "IPA", + "ISC", + "Jam", + "JasPer-2.0", + "JPL-image", + "JPNIC", + "JSON", + "Kazlib", + "KiCad-libraries-exception", + "Knuth-CTAN", + "LAL-1.2", + "LAL-1.3", + "Latex2e", + "BSD-3-Clause-LBNL", + "Leptonica", + "LGPL-2.0-only", + "LGPL-2.0-or-later", + "LGPL-2.1-only", + "LGPL-2.1-or-later", + "LGPL-3.0-only", + "LGPL-3.0-linking-exception", + "LGPL-3.0-or-later", + "LGPLLR", + "GD", + "xlock", + "Libpng", + "libpng-2.0", + "Libtool-exception", + "libutil-David-Nugent", + "LiLiQ-P-1.1", + "LiLiQ-R-1.1", + "LiLiQ-Rplus-1.1", + "Linux-OpenIB", + "Linux-syscall-note", + "LLVM-exception", + "LOOP", + "LPPL-1.0", + "LPPL-1.1", + "LPPL-1.2", + "LPPL-1.3a", + "LPPL-1.3c", + "LPL-1.0", + "LPL-1.02", + "LZMA-exception", + "LZMA-SDK-9.11-to-9.20", + "LZMA-SDK-9.22", + "mplus", + "MakeIndex", + "HPND-Markus-Kuhn", + "Martin-Birgmeier", + "mif-exception", + "Minpack", + "MirOS", + "MIT", + "MIT-0", + "MIT-feh", + "MIT-Wu", + "Xerox", + "MIT-Modern-Variant", + "MITNFA", + "NTP", + "SSPL-1.0", + "Motosoto", + "mpi-permissive", + "mpich2", + "MPL-1.0", + "MPL-1.1", + "MPL-2.0", + "MPL-2.0-no-copyleft-exception", + "MS-LPL", + "MS-PL", + "MS-RL", + "MTLL", + "MulanPSL-1.0", + "MulanPSL-2.0", + "Multics", + "Mup", + "NAIST-2003", + "NASA-1.3", + "Naumen", + "NBPL-1.0", + "NCGL-UK-2.0", + "Net-SNMP", + "NetCDF", + "Newsletr", + "NGPL", + "NICTA-1.0", + "NIST-PD", + "NIST-PD-fallback", + "NLOD-1.0", + "NLOD-2.0", + "NLPL", + "Nokia", + "NOSL", + "NPOSL-3.0", + "Noweb", + "NPL-1.0", + "NPL-1.1", + "NRL", + "NTP-0", + "O-UDA-1.0", + "OCaml-LGPL-linking-exception", + "OCCT-exception-1.0", + "OCCT-PL", + "OCLC-2.0", + "ODbL-1.0", + "ODC-By-1.0", + "OFFIS", + "OFL-1.0", + "OFL-1.0-no-RFN", + "OFL-1.0-RFN", + "OFL-1.1", + "OFL-1.1-no-RFN", + "OFL-1.1-RFN", + "OGC-1.0", + "OGDL-Taiwan-1.0", + "OGL-UK-1.0", + "OGL-UK-2.0", + "OGL-UK-3.0", + "OPL-1.0", + "OGTSL", + "OpenJDK-assembly-exception-1.0", + "OLDAP-1.1", + "OLDAP-1.2", + "OLDAP-1.3", + "OLDAP-1.4", + "OLDAP-2.0", + "OLDAP-2.0.1", + "OLDAP-2.1", + "OLDAP-2.2", + "OLDAP-2.2.1", + "OLDAP-2.2.2", + "OLDAP-2.3", + "OLDAP-2.4", + "OLDAP-2.5", + "OLDAP-2.6", + "OLDAP-2.7", + "OLDAP-2.8", + "OpenPBS-2.3", + "OPUBL-1.0", + "SSH-OpenSSH", + "x11vnc-openssl-exception", + "OpenSSL", + "openvpn-openssl-exception", + "BSD-3-Clause-No-Nuclear-License-2014", + "OSET-PL-2.1", + "HP-1986", + "OSL-1.0", + "OSL-1.1", + "OSL-2.0", + "OSL-2.1", + "OSL-3.0", + "Parity-6.0.0", + "Parity-7.0.0", + "PDDL-1.0", + "PHP-3.0", + "PHP-3.01", + "PolyForm-Noncommercial-1.0.0", + "PolyForm-Small-Business-1.0.0", + "PostgreSQL", + "PS-or-PDF-font-exception-20170817", + "PSF-2.0", + "psfrag", + "psutils", + "Python-2.0", + "Python-2.0.1", + "Qhull", + "QPL-1.0", + "QPL-1.0-INRIA-2004", + "Qt-GPL-exception-1.0", + "Qt-LGPL-exception-1.1", + "Qwt-exception-1.0", + "Rdisc", + "Spencer-86", + "BSD-3-Clause-Modification", + "RSCPL", + "RPL-1.1", + "RPL-1.5", + "RPSL-1.0", + "RSA-MD", + "Ruby", + "SAX-PD", + "Saxpath", + "SCEA", + "SchemeReport", + "libselinux-1.0", + "Sendmail", + "Sendmail-8.23", + "iMatix", + "SGI-B-1.1", + "SGI-B-2.0", + "SGI-B-1.0", + "SHL-0.5", + "SHL-0.51", + "SHL-2.0", + "SHL-2.1", + "SimPL-2.0", + "Sleepycat", + "SMPPL", + "SNIA", + "snprintf", + "SPL-1.0", + "SMLNJ", + "SugarCRM-1.1.3", + "BSD-3-Clause-No-Nuclear-License", + "SISSL", + "SISSL-1.2", + "SunPro", + "SWI-exception", + "SWL", + "Watcom-1.0", + "Symlinks", + "TAPR-OHL-1.0", + "SSH-short", + "TCL", + "TCP-wrappers", + "TPL-1.0", + "HTMLTIDY", + "TMate", + "TORQUE-1.1", + "TOSL", + "TPDL", + "TTWL", + "TU-Berlin-1.0", + "TU-Berlin-2.0", + "u-boot-exception-2.0", + "UCAR", + "UCL-1.0", + "Unicode-DFS-2015", + "Unicode-DFS-2016", + "Unicode-TOU", + "Universal-FOSS-exception-1.0", + "Unlicense", + "NCSA", + "UPL-1.0", + "Linux-man-pages-copyleft", + "Vim", + "VOSTROM", + "VSL-1.0", + "W3C", + "W3C-19980720", + "W3C-20150513", + "w3m", + "Wsuipa", + "WTFPL", + "wxWindows", + "WxWindows-exception-3.1", + "ICU", + "Bitstream-Charter", + "X11-distribute-modifications-variant", + "HPND-sell-variant", + "MIT-open-group", + "libtiff", + "X11", + "XFree86-1.1", + "xinetd", + "Xnet", + "XSkat", + "YPL-1.0", + "YPL-1.1", + "Zed", + "Zend-2.0", + "Zimbra-1.3", + "Zimbra-1.4", + "Zlib", + "zlib-acknowledgement", + "ZPL-1.1", + "ZPL-2.0", + "ZPL-2.1", + "AGPL3", + "Apache", + "Artistic2.0", + "Boost", + "CCPL", + "CDDL", + "CPL", + "EPL", + "FDL1.2", + "FDL1.3", + "GPL2", + "GPL3", + "LGPL2.1", + "LGPL3", + "LPPL", + "MPL", + "MPL2", + "PHP", + "PSF", + "PerlArtistic", + "Unlicense", + "W3C", + "ZPL", + "WTFPL", + "AGPL", + "APACHE", + "FDL", + "GPL", + "LGPL", + "RUBY", + "Ruby", + "custom" + ] + }, + { + "type": "string", + "pattern": "custom:.*" + } ] }, "uniqueItems": true diff --git a/src/termux_language_server/misc/pkgbuild.py b/src/termux_language_server/misc/pkgbuild.py index 008ecbf..17a31c4 100644 --- a/src/termux_language_server/misc/pkgbuild.py +++ b/src/termux_language_server/misc/pkgbuild.py @@ -8,6 +8,7 @@ from tree_sitter_lsp.misc import get_md_tokens, get_soup from .._metainfo import SOURCE, project +from .licenses import LICENSES def get_content(tokens: list[Token]) -> str: @@ -197,7 +198,15 @@ def init_schema() -> dict[str, Any]: schemas["PKGBUILD"]["properties"]["msys2_references"]["items"][ "pattern" ] = f"({'|'.join(names)})(|: .*)" - schemas["PKGBUILD"]["properties"]["license"]["items"]["enum"] = os.listdir( - "/usr/share/licenses/common" - ) + schemas["PKGBUILD"]["properties"]["license"]["items"] = { + "oneOf": [ + { + "type": "string", + "enum": LICENSES + + os.listdir("/usr/share/licenses/common") + + ["custom"], + }, + {"type": "string", "pattern": "custom:.*"}, + ] + } return schemas