~edwargix/git.sr.ht

a00fc083e409caab36f480d0ba0a459b4abca00e — Vlad-Stefan Harbuz 2 years ago 0797e15
add REUSE-based licenses to repo page

Signed-off-by: Vlad-Stefan Harbuz <vlad@vladh.net>
A contrib/spdx-transform.py => contrib/spdx-transform.py +26 -0
@@ 0,0 1,26 @@
#!/usr/bin/env python3
"""
This program reads licenses.json from the current directory and prints out a
Python dict with just the information needed for git.sr.ht. The licenses.json
file can be found in the "license-list-data" repository published by the
SPDX team, currently hosted here:

https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json
"""

import json


def main():
    with open('./licenses.json') as f:
        license_data = json.load(f)
        print('SPDX_LICENSES = {')
        for l in license_data['licenses']:
            l_id = l['licenseId']
            l_name = l['name'].replace('"', '\\"')
            print(f'    "{l_id}": "{l_name}",')
        print('}')


if __name__ == '__main__':
    main()

M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +63 -20
@@ 12,6 12,7 @@ from gitsrht.editorconfig import EditorConfig
from gitsrht.git import Repository as GitRepository, commit_time, annotate_tree
from gitsrht.git import diffstat, get_log, diff_for_commit, strip_pgp_signature
from gitsrht.rss import generate_feed
from gitsrht.spdx import SPDX_LICENSES
from gitsrht.types import Artifact, User
from io import BytesIO
from markupsafe import Markup, escape


@@ 28,6 29,38 @@ from urllib.parse import urlparse

repo = Blueprint('repo', __name__)

def get_license_info_for_tip(tip):
        license_exists = False
        for path in [
                "LICENSE", "LICENCE", "COPYING",
                "LICENSE.txt", "license.txt",
                "LICENCE.txt", "licence.txt",
                "COPYING.txt", "copying.txt",
                "COPYRIGHT.txt", "copyright.txt",
                "LICENSE.md", "license.md",
                "LICENCE.md", "licence.md",
                "COPYING.md", "copying.md",
                "COPYRIGHT.md", "copyright.md",
                "COPYRIGHT", "copyright",
                "LICENSES", "licenses",
                "LICENCES", "licences",
        ]:
            if path in tip.tree:
                license_exists = True
                break

        licenses = []
        if 'LICENSES' in tip.tree:
            for o in tip.tree['LICENSES']:
                license_id = os.path.splitext(o.name)[0]
                if license_id in SPDX_LICENSES:
                    licenses.append({
                        'id': license_id,
                        'name': SPDX_LICENSES[license_id],
                    })

        return license_exists, licenses

def get_readme(repo, git_repo, tip, link_prefix=None):
    if repo.readme is not None:
        return Markup(sanitize(repo.readme))


@@ 112,26 145,10 @@ def summary(owner, repo):
        tags = sorted(tags, key=lambda c: commit_time(c[1]), reverse=True)
        latest_tag = tags[0] if len(tags) else None

        license = False
        for path in [
                "LICENSE", "LICENCE", "COPYING",
                "LICENSE.txt", "license.txt",
                "LICENCE.txt", "licence.txt",
                "COPYING.txt", "copying.txt",
                "COPYRIGHT.txt", "copyright.txt",
                "LICENSE.md", "license.md",
                "LICENCE.md", "licence.md",
                "COPYING.md", "copying.md",
                "COPYRIGHT.md", "copyright.md",
                "COPYRIGHT", "copyright",
                "LICENSES", "licenses",
                "LICENCES", "licences",
        ]:
            if path in tip.tree:
                license = True
                break

        message = session.pop("message", None)

        license_exists, licenses = get_license_info_for_tip(tip)

        if latest_tag:
            sig = lookup_signature(git_repo, latest_tag[0].decode('utf-8'))[1]
        else:


@@ 141,7 158,8 @@ def summary(owner, repo):
                signature=sig,
                latest_tag=latest_tag, default_branch=default_branch,
                is_annotated=lambda t: isinstance(t, pygit2.Tag),
                message=message, license=license)
                message=message, license_exists=license_exists,
                licenses=licenses)

@repo.route("/<owner>/<repo>/<path:path>")
def go_get(owner, repo, path):


@@ 615,6 633,31 @@ def refs(owner, repo):
                default_branch=default_branch,
                strip_pgp_signature=strip_pgp_signature)

@repo.route("/<owner>/<repo>/licenses")
def licenses(owner, repo):
    owner, repo = get_repo_or_redir(owner, repo)

    with GitRepository(repo.path) as git_repo:
        if git_repo.is_empty:
            return render_empty_repo(owner, repo, "licenses")

        default_branch = git_repo.default_branch()
        if not default_branch:
            return render_empty_repo(owner, repo, "licenses")

        default_branch_name = default_branch.raw_name \
            .decode("utf-8", "replace")[len("refs/heads/"):]
        tip = git_repo.get(default_branch.raw_target)

        license_exists, licenses = get_license_info_for_tip(tip)

        message = session.pop("message", None)

        return render_template("licenses.html", view="licenses",
                owner=owner, repo=repo,
                message=message, license_exists=license_exists,
                licenses=licenses)


@repo.route("/<owner>/<repo>/refs/rss.xml")
def refs_rss(owner, repo):

A gitsrht/spdx.py => gitsrht/spdx.py +496 -0
@@ 0,0 1,496 @@
SPDX_LICENSES = {
    "VSL-1.0": "Vovida Software License v1.0",
    "GPL-2.0": "GNU General Public License v2.0 only",
    "blessing": "SQLite Blessing",
    "BSD-4-Clause-Shortened": "BSD 4 Clause Shortened",
    "Libpng": "libpng License",
    "OFL-1.0-no-RFN": "SIL Open Font License 1.0 with no Reserved Font Name",
    "MakeIndex": "MakeIndex License",
    "OSL-2.0": "Open Software License 2.0",
    "CC-BY-ND-1.0": "Creative Commons Attribution No Derivatives 1.0 Generic",
    "Artistic-1.0-cl8": "Artistic License 1.0 w/clause 8",
    "Xerox": "Xerox License",
    "ZPL-2.0": "Zope Public License 2.0",
    "Adobe-Glyph": "Adobe Glyph List License",
    "LPPL-1.1": "LaTeX Project Public License v1.1",
    "Arphic-1999": "Arphic Public License",
    "Unicode-TOU": "Unicode Terms of Use",
    "CC-BY-NC-SA-2.0-UK": "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales",
    "MIT-advertising": "Enlightenment License (e16)",
    "EUPL-1.1": "European Union Public License 1.1",
    "AGPL-1.0-or-later": "Affero General Public License v1.0 or later",
    "YPL-1.1": "Yahoo! Public License v1.1",
    "OML": "Open Market License",
    "copyleft-next-0.3.0": "copyleft-next 0.3.0",
    "CC-BY-ND-2.0": "Creative Commons Attribution No Derivatives 2.0 Generic",
    "OLDAP-1.3": "Open LDAP Public License v1.3",
    "CC-BY-NC-SA-3.0": "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
    "GFDL-1.3-invariants-or-later": "GNU Free Documentation License v1.3 or later - invariants",
    "CC-BY-2.5": "Creative Commons Attribution 2.5 Generic",
    "YPL-1.0": "Yahoo! Public License v1.0",
    "SHL-0.5": "Solderpad Hardware License v0.5",
    "FreeImage": "FreeImage Public License v1.0",
    "Intel-ACPI": "Intel ACPI Software License Agreement",
    "CC-BY-NC-3.0-DE": "Creative Commons Attribution Non Commercial 3.0 Germany",
    "OFL-1.1-no-RFN": "SIL Open Font License 1.1 with no Reserved Font Name",
    "LGPL-2.1-or-later": "GNU Lesser General Public License v2.1 or later",
    "GL2PS": "GL2PS License",
    "Ruby": "Ruby License",
    "OCCT-PL": "Open CASCADE Technology Public License",
    "Naumen": "Naumen Public License",
    "OpenSSL": "OpenSSL License",
    "CC-BY-SA-4.0": "Creative Commons Attribution Share Alike 4.0 International",
    "NOSL": "Netizen Open Source License",
    "Artistic-1.0": "Artistic License 1.0",
    "zlib-acknowledgement": "zlib/libpng License with Acknowledgement",
    "GFDL-1.2-no-invariants-or-later": "GNU Free Documentation License v1.2 or later - no invariants",
    "CC-BY-4.0": "Creative Commons Attribution 4.0 International",
    "LPL-1.0": "Lucent Public License Version 1.0",
    "Spencer-86": "Spencer License 86",
    "dvipdfm": "dvipdfm License",
    "CNRI-Python": "CNRI Python License",
    "Saxpath": "Saxpath License",
    "Apache-1.0": "Apache License 1.0",
    "BSL-1.0": "Boost Software License 1.0",
    "BUSL-1.1": "Business Source License 1.1",
    "RPSL-1.0": "RealNetworks Public Source License v1.0",
    "Afmparse": "Afmparse License",
    "GFDL-1.1-invariants-or-later": "GNU Free Documentation License v1.1 or later - invariants",
    "EPL-2.0": "Eclipse Public License 2.0",
    "CDLA-Permissive-1.0": "Community Data License Agreement Permissive 1.0",
    "LiLiQ-P-1.1": "Licence Libre du Québec – Permissive version 1.1",
    "ANTLR-PD": "ANTLR Software Rights Notice",
    "AFL-2.0": "Academic Free License v2.0",
    "libselinux-1.0": "libselinux public domain notice",
    "RPL-1.5": "Reciprocal Public License 1.5",
    "CECILL-C": "CeCILL-C Free Software License Agreement",
    "Zimbra-1.4": "Zimbra Public License v1.4",
    "BSD-2-Clause-FreeBSD": "BSD 2-Clause FreeBSD License",
    "LGPL-2.1-only": "GNU Lesser General Public License v2.1 only",
    "OLDAP-2.8": "Open LDAP Public License v2.8",
    "CC-PDDC": "Creative Commons Public Domain Dedication and Certification",
    "Leptonica": "Leptonica License",
    "AGPL-3.0": "GNU Affero General Public License v3.0",
    "LGPL-3.0": "GNU Lesser General Public License v3.0 only",
    "BSD-4-Clause": "BSD 4-Clause \"Original\" or \"Old\" License",
    "SimPL-2.0": "Simple Public License 2.0",
    "GFDL-1.3": "GNU Free Documentation License v1.3",
    "BSD-2-Clause-Views": "BSD 2-Clause with views sentence",
    "LPPL-1.3a": "LaTeX Project Public License v1.3a",
    "W3C-20150513": "W3C Software Notice and Document License (2015-05-13)",
    "AFL-1.1": "Academic Free License v1.1",
    "OGTSL": "Open Group Test Suite License",
    "FSFULLR": "FSF Unlimited License (with License Retention)",
    "BSD-3-Clause-Open-MPI": "BSD 3-Clause Open MPI variant",
    "IPA": "IPA Font License",
    "CC-BY-NC-2.0": "Creative Commons Attribution Non Commercial 2.0 Generic",
    "PSF-2.0": "Python Software Foundation License 2.0",
    "BSD-Protection": "BSD Protection License",
    "BSD-3-Clause-No-Nuclear-License-2014": "BSD 3-Clause No Nuclear License 2014",
    "CECILL-2.0": "CeCILL Free Software License Agreement v2.0",
    "CC-BY-NC-3.0": "Creative Commons Attribution Non Commercial 3.0 Unported",
    "NLOD-1.0": "Norwegian Licence for Open Government Data (NLOD) 1.0",
    "BSD-3-Clause-No-Nuclear-Warranty": "BSD 3-Clause No Nuclear Warranty",
    "Parity-6.0.0": "The Parity Public License 6.0.0",
    "CC-BY-NC-1.0": "Creative Commons Attribution Non Commercial 1.0 Generic",
    "Borceux": "Borceux license",
    "GFDL-1.3-invariants-only": "GNU Free Documentation License v1.3 only - invariants",
    "Spencer-94": "Spencer License 94",
    "Unlicense": "The Unlicense",
    "TAPR-OHL-1.0": "TAPR Open Hardware License v1.0",
    "DSDP": "DSDP License",
    "CC-BY-NC-ND-3.0-IGO": "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO",
    "EUPL-1.0": "European Union Public License 1.0",
    "HTMLTIDY": "HTML Tidy License",
    "OFL-1.0-RFN": "SIL Open Font License 1.0 with Reserved Font Name",
    "APSL-1.0": "Apple Public Source License 1.0",
    "LPPL-1.2": "LaTeX Project Public License v1.2",
    "Zed": "Zed License",
    "NGPL": "Nethack General Public License",
    "CC-BY-SA-2.5": "Creative Commons Attribution Share Alike 2.5 Generic",
    "LAL-1.2": "Licence Art Libre 1.2",
    "LPPL-1.3c": "LaTeX Project Public License v1.3c",
    "OLDAP-2.1": "Open LDAP Public License v2.1",
    "MIT-CMU": "CMU License",
    "IJG": "Independent JPEG Group License",
    "CC-BY-3.0-DE": "Creative Commons Attribution 3.0 Germany",
    "BSD-3-Clause-Modification": "BSD 3-Clause Modification",
    "GPL-2.0+": "GNU General Public License v2.0 or later",
    "CNRI-Jython": "CNRI Jython License",
    "CC-BY-NC-ND-3.0": "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
    "TCP-wrappers": "TCP Wrappers License",
    "GFDL-1.1-or-later": "GNU Free Documentation License v1.1 or later",
    "OGL-UK-2.0": "Open Government Licence v2.0",
    "App-s2p": "App::s2p License",
    "NTP": "NTP License",
    "OLDAP-2.2": "Open LDAP Public License v2.2",
    "GPL-1.0+": "GNU General Public License v1.0 or later",
    "Imlib2": "Imlib2 License",
    "OSET-PL-2.1": "OSET Public License version 2.1",
    "SISSL-1.2": "Sun Industry Standards Source License v1.2",
    "GPL-3.0-with-GCC-exception": "GNU General Public License v3.0 w/GCC Runtime Library exception",
    "OPL-1.0": "Open Public License v1.0",
    "DRL-1.0": "Detection Rule License 1.0",
    "BSD-3-Clause": "BSD 3-Clause \"New\" or \"Revised\" License",
    "BitTorrent-1.0": "BitTorrent Open Source License v1.0",
    "Linux-OpenIB": "Linux Kernel Variant of OpenIB.org license",
    "D-FSL-1.0": "Deutsche Freie Software Lizenz",
    "NICTA-1.0": "NICTA Public Software License, Version 1.0",
    "MPL-2.0": "Mozilla Public License 2.0",
    "GPL-1.0-or-later": "GNU General Public License v1.0 or later",
    "Xnet": "X.Net License",
    "Parity-7.0.0": "The Parity Public License 7.0.0",
    "XFree86-1.1": "XFree86 License 1.1",
    "Watcom-1.0": "Sybase Open Watcom Public License 1.0",
    "NPL-1.1": "Netscape Public License v1.1",
    "HaskellReport": "Haskell Language Report License",
    "CC-BY-NC-SA-1.0": "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
    "CC-BY-2.5-AU": "Creative Commons Attribution 2.5 Australia",
    "LZMA-SDK-9.22": "LZMA SDK License (versions 9.22 and beyond)",
    "TCL": "TCL/TK License",
    "curl": "curl License",
    "CPOL-1.02": "Code Project Open License 1.02",
    "GD": "GD License",
    "Apache-2.0": "Apache License 2.0",
    "OFL-1.1-RFN": "SIL Open Font License 1.1 with Reserved Font Name",
    "ODbL-1.0": "Open Data Commons Open Database License v1.0",
    "OLDAP-2.2.1": "Open LDAP Public License v2.2.1",
    "ImageMagick": "ImageMagick License",
    "FDK-AAC": "Fraunhofer FDK AAC Codec Library",
    "CPAL-1.0": "Common Public Attribution License 1.0",
    "GFDL-1.2-no-invariants-only": "GNU Free Documentation License v1.2 only - no invariants",
    "O-UDA-1.0": "Open Use of Data Agreement v1.0",
    "LGPL-2.0-or-later": "GNU Library General Public License v2 or later",
    "CDLA-Permissive-2.0": "Community Data License Agreement Permissive 2.0",
    "BitTorrent-1.1": "BitTorrent Open Source License v1.1",
    "CECILL-1.1": "CeCILL Free Software License Agreement v1.1",
    "ICU": "ICU License",
    "Net-SNMP": "Net-SNMP License",
    "bzip2-1.0.5": "bzip2 and libbzip2 License v1.0.5",
    "CrystalStacker": "CrystalStacker License",
    "CUA-OPL-1.0": "CUA Office Public License v1.0",
    "OFL-1.1": "SIL Open Font License 1.1",
    "LiLiQ-R-1.1": "Licence Libre du Québec – Réciprocité version 1.1",
    "Beerware": "Beerware License",
    "Community-Spec-1.0": "Community Specification License 1.0",
    "CERN-OHL-S-2.0": "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
    "Fair": "Fair License",
    "ClArtistic": "Clarified Artistic License",
    "BSD-3-Clause-LBNL": "Lawrence Berkeley National Labs BSD variant license",
    "StandardML-NJ": "Standard ML of New Jersey License",
    "MirOS": "The MirOS Licence",
    "GPL-2.0-with-GCC-exception": "GNU General Public License v2.0 w/GCC Runtime Library exception",
    "mplus": "mplus Font License",
    "ISC": "ISC License",
    "Minpack": "Minpack License",
    "GFDL-1.2-invariants-or-later": "GNU Free Documentation License v1.2 or later - invariants",
    "SSPL-1.0": "Server Side Public License, v 1",
    "OGC-1.0": "OGC Software License, Version 1.0",
    "FTL": "Freetype Project License",
    "BSD-Source-Code": "BSD Source Code Attribution",
    "VOSTROM": "VOSTROM Public License for Open Source",
    "OSL-1.1": "Open Software License 1.1",
    "AFL-3.0": "Academic Free License v3.0",
    "ECL-2.0": "Educational Community License v2.0",
    "SugarCRM-1.1.3": "SugarCRM Public License v1.1.3",
    "GPL-2.0-with-bison-exception": "GNU General Public License v2.0 w/Bison exception",
    "CC-BY-ND-3.0-DE": "Creative Commons Attribution No Derivatives 3.0 Germany",
    "NIST-PD-fallback": "NIST Public Domain Notice with license fallback",
    "PolyForm-Noncommercial-1.0.0": "PolyForm Noncommercial License 1.0.0",
    "BSD-2-Clause-NetBSD": "BSD 2-Clause NetBSD License",
    "NLOD-2.0": "Norwegian Licence for Open Government Data (NLOD) 2.0",
    "CC-BY-SA-2.1-JP": "Creative Commons Attribution Share Alike 2.1 Japan",
    "CC-BY-NC-SA-2.0": "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
    "GFDL-1.1-invariants-only": "GNU Free Documentation License v1.1 only - invariants",
    "ZPL-2.1": "Zope Public License 2.1",
    "MPL-2.0-no-copyleft-exception": "Mozilla Public License 2.0 (no copyleft exception)",
    "Mup": "Mup License",
    "Eurosym": "Eurosym License",
    "X11-distribute-modifications-variant": "X11 License Distribution Modification Variant",
    "Plexus": "Plexus Classworlds License",
    "OGDL-Taiwan-1.0": "Taiwan Open Government Data License, version 1.0",
    "AGPL-3.0-or-later": "GNU Affero General Public License v3.0 or later",
    "OGL-UK-1.0": "Open Government Licence v1.0",
    "MIT-feh": "feh License",
    "APAFML": "Adobe Postscript AFM License",
    "NetCDF": "NetCDF license",
    "CECILL-1.0": "CeCILL Free Software License Agreement v1.0",
    "TU-Berlin-2.0": "Technische Universitaet Berlin License 2.0",
    "NLPL": "No Limit Public License",
    "EPICS": "EPICS Open License",
    "eCos-2.0": "eCos license version 2.0",
    "OLDAP-1.4": "Open LDAP Public License v1.4",
    "Zend-2.0": "Zend License v2.0",
    "GFDL-1.2-only": "GNU Free Documentation License v1.2 only",
    "iMatix": "iMatix Standard Function Library Agreement",
    "CDDL-1.0": "Common Development and Distribution License 1.0",
    "LPL-1.02": "Lucent Public License v1.02",
    "GPL-1.0-only": "GNU General Public License v1.0 only",
    "ADSL": "Amazon Digital Services License",
    "OLDAP-2.3": "Open LDAP Public License v2.3",
    "MulanPSL-2.0": "Mulan Permissive Software License, Version 2",
    "Linux-man-pages-copyleft": "Linux man-pages Copyleft",
    "ANTLR-PD-fallback": "ANTLR Software Rights Notice with license fallback",
    "MIT": "MIT License",
    "LZMA-SDK-9.11-to-9.20": "LZMA SDK License (versions 9.11 to 9.20)",
    "Hippocratic-2.1": "Hippocratic License 2.1",
    "SGI-B-1.0": "SGI Free Software License B v1.0",
    "Nunit": "Nunit License",
    "COIL-1.0": "Copyfree Open Innovation License",
    "GPL-2.0-with-autoconf-exception": "GNU General Public License v2.0 w/Autoconf exception",
    "HPND": "Historical Permission Notice and Disclaimer",
    "GPL-3.0": "GNU General Public License v3.0 only",
    "CDDL-1.1": "Common Development and Distribution License 1.1",
    "GPL-2.0-with-classpath-exception": "GNU General Public License v2.0 w/Classpath exception",
    "CC-BY-SA-2.0": "Creative Commons Attribution Share Alike 2.0 Generic",
    "OCLC-2.0": "OCLC Research Public License 2.0",
    "GFDL-1.1-only": "GNU Free Documentation License v1.1 only",
    "C-UDA-1.0": "Computational Use of Data Agreement v1.0",
    "Crossword": "Crossword License",
    "libtiff": "libtiff License",
    "IPL-1.0": "IBM Public License v1.0",
    "MS-LPL": "Microsoft Limited Public License",
    "GFDL-1.3-no-invariants-or-later": "GNU Free Documentation License v1.3 or later - no invariants",
    "Sleepycat": "Sleepycat License",
    "gSOAP-1.3b": "gSOAP Public License v1.3b",
    "OLDAP-2.0.1": "Open LDAP Public License v2.0.1",
    "AFL-2.1": "Academic Free License v2.1",
    "CC-BY-NC-SA-4.0": "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
    "ErlPL-1.1": "Erlang Public License v1.1",
    "Unicode-DFS-2016": "Unicode License Agreement - Data Files and Software (2016)",
    "CC-BY-3.0-NL": "Creative Commons Attribution 3.0 Netherlands",
    "BSD-3-Clause-Clear": "BSD 3-Clause Clear License",
    "SchemeReport": "Scheme Language Report License",
    "CC-BY-NC-ND-4.0": "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
    "Elastic-2.0": "Elastic License 2.0",
    "CC0-1.0": "Creative Commons Zero v1.0 Universal",
    "MIT-open-group": "MIT Open Group variant",
    "Motosoto": "Motosoto License",
    "TMate": "TMate Open Source License",
    "PDDL-1.0": "Open Data Commons Public Domain Dedication & License 1.0",
    "MITNFA": "MIT +no-false-attribs license",
    "CC-BY-1.0": "Creative Commons Attribution 1.0 Generic",
    "MulanPSL-1.0": "Mulan Permissive Software License, Version 1",
    "GPL-3.0-only": "GNU General Public License v3.0 only",
    "SCEA": "SCEA Shared Source License",
    "psfrag": "psfrag License",
    "OLDAP-2.6": "Open LDAP Public License v2.6",
    "Newsletr": "Newsletr License",
    "W3C-19980720": "W3C Software Notice and License (1998-07-20)",
    "NAIST-2003": "Nara Institute of Science and Technology License (2003)",
    "JPNIC": "Japan Network Information Center License",
    "Glulxe": "Glulxe License",
    "QPL-1.0": "Q Public License 1.0",
    "AAL": "Attribution Assurance License",
    "Frameworx-1.0": "Frameworx Open License 1.0",
    "OPUBL-1.0": "Open Publication License v1.0",
    "LGPL-3.0-or-later": "GNU Lesser General Public License v3.0 or later",
    "gnuplot": "gnuplot License",
    "Jam": "Jam License",
    "GFDL-1.1-no-invariants-only": "GNU Free Documentation License v1.1 only - no invariants",
    "CAL-1.0-Combined-Work-Exception": "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
    "OLDAP-2.7": "Open LDAP Public License v2.7",
    "Nokia": "Nokia Open Source License",
    "Adobe-2006": "Adobe Systems Incorporated Source Code License Agreement",
    "Cube": "Cube License",
    "Sendmail-8.23": "Sendmail License 8.23",
    "Abstyles": "Abstyles License",
    "PostgreSQL": "PostgreSQL License",
    "BlueOak-1.0.0": "Blue Oak Model License 1.0.0",
    "X11": "X11 License",
    "Bitstream-Vera": "Bitstream Vera Font License",
    "GPL-2.0-with-font-exception": "GNU General Public License v2.0 w/Font exception",
    "EFL-1.0": "Eiffel Forum License v1.0",
    "Python-2.0": "Python License 2.0",
    "UPL-1.0": "Universal Permissive License v1.0",
    "copyleft-next-0.3.1": "copyleft-next 0.3.1",
    "CC-BY-SA-3.0-AT": "Creative Commons Attribution Share Alike 3.0 Austria",
    "EUPL-1.2": "European Union Public License 1.2",
    "SSH-short": "SSH short notice",
    "CC-BY-3.0-AT": "Creative Commons Attribution 3.0 Austria",
    "MIT-enna": "enna License",
    "CC-BY-3.0-US": "Creative Commons Attribution 3.0 United States",
    "xpp": "XPP License",
    "GFDL-1.1": "GNU Free Documentation License v1.1",
    "Condor-1.1": "Condor Public License v1.1",
    "GFDL-1.2-invariants-only": "GNU Free Documentation License v1.2 only - invariants",
    "SPL-1.0": "Sun Public License v1.0",
    "Baekmuk": "Baekmuk License",
    "NCGL-UK-2.0": "Non-Commercial Government Licence",
    "DL-DE-BY-2.0": "Data licence Germany – attribution – version 2.0",
    "CDLA-Sharing-1.0": "Community Data License Agreement Sharing 1.0",
    "JSON": "JSON License",
    "GPL-3.0-with-autoconf-exception": "GNU General Public License v3.0 w/Autoconf exception",
    "GFDL-1.3-or-later": "GNU Free Documentation License v1.3 or later",
    "APSL-2.0": "Apple Public Source License 2.0",
    "GPL-3.0+": "GNU General Public License v3.0 or later",
    "OGL-Canada-2.0": "Open Government Licence - Canada",
    "MS-PL": "Microsoft Public License",
    "Glide": "3dfx Glide License",
    "CC-BY-NC-ND-2.0": "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
    "TOSL": "Trusster Open Source License",
    "OGL-UK-3.0": "Open Government Licence v3.0",
    "CC-BY-NC-SA-2.5": "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
    "OSL-1.0": "Open Software License 1.0",
    "MS-RL": "Microsoft Reciprocal License",
    "Artistic-2.0": "Artistic License 2.0",
    "OLDAP-2.2.2": "Open LDAP Public License 2.2.2",
    "diffmark": "diffmark license",
    "BSD-3-Clause-Attribution": "BSD with attribution",
    "Dotseqn": "Dotseqn License",
    "CC-BY-ND-3.0": "Creative Commons Attribution No Derivatives 3.0 Unported",
    "wxWindows": "wxWindows Library License",
    "GPL-3.0-or-later": "GNU General Public License v3.0 or later",
    "AGPL-3.0-only": "GNU Affero General Public License v3.0 only",
    "OSL-3.0": "Open Software License 3.0",
    "NBPL-1.0": "Net Boolean Public License v1",
    "Multics": "Multics License",
    "AGPL-1.0": "Affero General Public License v1.0",
    "0BSD": "BSD Zero Clause License",
    "BSD-2-Clause": "BSD 2-Clause \"Simplified\" License",
    "LGPL-2.0+": "GNU Library General Public License v2 or later",
    "CECILL-B": "CeCILL-B Free Software License Agreement",
    "eGenix": "eGenix.com Public License 1.1.0",
    "APL-1.0": "Adaptive Public License 1.0",
    "CC-BY-NC-4.0": "Creative Commons Attribution Non Commercial 4.0 International",
    "MIT-Modern-Variant": "MIT License Modern Variant",
    "Bahyph": "Bahyph License",
    "LGPL-3.0-only": "GNU Lesser General Public License v3.0 only",
    "CERN-OHL-W-2.0": "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
    "PHP-3.01": "PHP License v3.01",
    "Zlib": "zlib License",
    "CC-BY-SA-3.0-DE": "Creative Commons Attribution Share Alike 3.0 Germany",
    "SNIA": "SNIA Public License 1.1",
    "APSL-1.1": "Apple Public Source License 1.1",
    "HPND-sell-variant": "Historical Permission Notice and Disclaimer - sell variant",
    "CC-BY-ND-4.0": "Creative Commons Attribution No Derivatives 4.0 International",
    "SWL": "Scheme Widget Library (SWL) Software License Agreement",
    "BSD-3-Clause-No-Nuclear-License": "BSD 3-Clause No Nuclear License",
    "MPL-1.1": "Mozilla Public License 1.1",
    "CERN-OHL-P-2.0": "CERN Open Hardware Licence Version 2 - Permissive",
    "LAL-1.3": "Licence Art Libre 1.3",
    "Spencer-99": "Spencer License 99",
    "FreeBSD-DOC": "FreeBSD Documentation License",
    "LGPL-2.1+": "GNU Library General Public License v2.1 or later",
    "BSD-4-Clause-UC": "BSD-4-Clause (University of California-Specific)",
    "GFDL-1.1-no-invariants-or-later": "GNU Free Documentation License v1.1 or later - no invariants",
    "WTFPL": "Do What The F*ck You Want To Public License",
    "CC-BY-NC-ND-3.0-DE": "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany",
    "Sendmail": "Sendmail License",
    "AMDPLPA": "AMD's plpa_map.c License",
    "IBM-pibs": "IBM PowerPC Initialization and Boot Software",
    "GPL-2.0-only": "GNU General Public License v2.0 only",
    "NASA-1.3": "NASA Open Source Agreement 1.3",
    "TU-Berlin-1.0": "Technische Universitaet Berlin License 1.0",
    "mpich2": "mpich2 License",
    "EPL-1.0": "Eclipse Public License 1.0",
    "DOC": "DOC License",
    "BSD-2-Clause-Patent": "BSD-2-Clause Plus Patent License",
    "AGPL-1.0-only": "Affero General Public License v1.0 only",
    "Latex2e": "Latex2e License",
    "UCL-1.0": "Upstream Compatibility License v1.0",
    "ECL-1.0": "Educational Community License v1.0",
    "CC-BY-SA-2.0-UK": "Creative Commons Attribution Share Alike 2.0 England and Wales",
    "OLDAP-2.4": "Open LDAP Public License v2.4",
    "Unicode-DFS-2015": "Unicode License Agreement - Data Files and Software (2015)",
    "PolyForm-Small-Business-1.0.0": "PolyForm Small Business License 1.0.0",
    "GFDL-1.2": "GNU Free Documentation License v1.2",
    "BSD-1-Clause": "BSD 1-Clause License",
    "Apache-1.1": "Apache License 1.1",
    "GLWTPL": "Good Luck With That Public License",
    "Giftware": "Giftware License",
    "Zimbra-1.3": "Zimbra Public License v1.3",
    "bzip2-1.0.6": "bzip2 and libbzip2 License v1.0.6",
    "Caldera": "Caldera License",
    "NRL": "NRL License",
    "SGI-B-1.1": "SGI Free Software License B v1.1",
    "etalab-2.0": "Etalab Open License 2.0",
    "JasPer-2.0": "JasPer License",
    "RHeCos-1.1": "Red Hat eCos Public License v1.1",
    "NTP-0": "NTP No Attribution",
    "CC-BY-NC-2.5": "Creative Commons Attribution Non Commercial 2.5 Generic",
    "Info-ZIP": "Info-ZIP License",
    "RPL-1.1": "Reciprocal Public License 1.1",
    "PHP-3.0": "PHP License v3.0",
    "SAX-PD": "Sax Public Domain Notice",
    "NIST-PD": "NIST Public Domain Notice",
    "EFL-2.0": "Eiffel Forum License v2.0",
    "GFDL-1.3-only": "GNU Free Documentation License v1.3 only",
    "CDL-1.0": "Common Documentation License 1.0",
    "LGPL-3.0+": "GNU Lesser General Public License v3.0 or later",
    "CC-BY-SA-1.0": "Creative Commons Attribution Share Alike 1.0 Generic",
    "SMLNJ": "Standard ML of New Jersey License",
    "CC-BY-ND-2.5": "Creative Commons Attribution No Derivatives 2.5 Generic",
    "GFDL-1.2-or-later": "GNU Free Documentation License v1.2 or later",
    "CC-BY-NC-SA-3.0-IGO": "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO",
    "Vim": "Vim License",
    "CC-BY-NC-SA-3.0-DE": "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany",
    "Noweb": "Noweb License",
    "Aladdin": "Aladdin Free Public License",
    "LPPL-1.0": "LaTeX Project Public License v1.0",
    "SISSL": "Sun Industry Standards Source License v1.1",
    "FSFAP": "FSF All Permissive License",
    "SSH-OpenSSH": "SSH OpenSSH license",
    "GFDL-1.3-no-invariants-only": "GNU Free Documentation License v1.3 only - no invariants",
    "NCSA": "University of Illinois/NCSA Open Source License",
    "CNRI-Python-GPL-Compatible": "CNRI Python Open Source GPL Compatible License Agreement",
    "MPL-1.0": "Mozilla Public License 1.0",
    "W3C": "W3C Software Notice and License (2002-12-31)",
    "ZPL-1.1": "Zope Public License 1.1",
    "LGPL-2.0-only": "GNU Library General Public License v2 only",
    "CC-BY-NC-SA-2.0-FR": "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France",
    "MTLL": "Matrix Template Library License",
    "CC-BY-3.0-IGO": "Creative Commons Attribution 3.0 IGO",
    "Barr": "Barr License",
    "AML": "Apple MIT License",
    "CERN-OHL-1.1": "CERN Open Hardware Licence v1.1",
    "GPL-2.0-or-later": "GNU General Public License v2.0 or later",
    "OSL-2.1": "Open Software License 2.1",
    "Qhull": "Qhull License",
    "ODC-By-1.0": "Open Data Commons Attribution License v1.0",
    "AFL-1.2": "Academic Free License v1.2",
    "CC-BY-2.0": "Creative Commons Attribution 2.0 Generic",
    "SMPPL": "Secure Messaging Protocol Public License",
    "RSCPL": "Ricoh Source Code Public License",
    "psutils": "psutils License",
    "FSFUL": "FSF Unlimited License",
    "Entessa": "Entessa Public License v1.0",
    "Rdisc": "Rdisc License",
    "libpng-2.0": "PNG Reference Library version 2",
    "AMPAS": "Academy of Motion Picture Arts and Sciences BSD",
    "CATOSL-1.1": "Computer Associates Trusted Open Source License 1.1",
    "SGI-B-2.0": "SGI Free Software License B v2.0",
    "CC-BY-NC-ND-1.0": "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
    "SHL-0.51": "Solderpad Hardware License, Version 0.51",
    "OLDAP-2.0": "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
    "GPL-1.0": "GNU General Public License v1.0 only",
    "CPL-1.0": "Common Public License 1.0",
    "BSD-3-Clause-No-Military-License": "BSD 3-Clause No Military License",
    "EUDatagrid": "EU DataGrid Software License",
    "TORQUE-1.1": "TORQUE v2.5+ Software License v1.1",
    "XSkat": "XSkat License",
    "xinetd": "xinetd License",
    "LGPLLR": "Lesser General Public License For Linguistic Resources",
    "NPL-1.0": "Netscape Public License v1.0",
    "Wsuipa": "Wsuipa License",
    "CC-BY-SA-3.0": "Creative Commons Attribution Share Alike 3.0 Unported",
    "APSL-1.2": "Apple Public Source License 1.2",
    "CERN-OHL-1.2": "CERN Open Hardware Licence v1.2",
    "CC-BY-3.0": "Creative Commons Attribution 3.0 Unported",
    "RSA-MD": "RSA Message-Digest License",
    "CC-BY-NC-ND-2.5": "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
    "OLDAP-1.2": "Open LDAP Public License v1.2",
    "LiLiQ-Rplus-1.1": "Licence Libre du Québec – Réciprocité forte version 1.1",
    "Intel": "Intel Open Source License",
    "LGPL-2.0": "GNU Library General Public License v2 only",
    "OLDAP-2.5": "Open LDAP Public License v2.5",
    "OLDAP-1.1": "Open LDAP Public License v1.1",
    "OFL-1.0": "SIL Open Font License 1.0",
    "LGPL-2.1": "GNU Lesser General Public License v2.1 only",
    "CECILL-2.1": "CeCILL Free Software License Agreement v2.1",
    "NPOSL-3.0": "Non-Profit Open Software License 3.0",
    "Artistic-1.0-Perl": "Artistic License 1.0 (Perl)",
    "Interbase-1.0": "Interbase Public License v1.0",
    "MIT-0": "MIT No Attribution",
    "CAL-1.0": "Cryptographic Autonomy License 1.0",
}

A gitsrht/templates/licenses.html => gitsrht/templates/licenses.html +26 -0
@@ 0,0 1,26 @@
{% extends "repo.html" %}
{% import "utils.html" as utils with context %}
{% block title %}
<title>{{repo.owner.canonical_name}}/{{repo.name}} licenses - {{cfg("sr.ht", "site-name")}} git</title>
{% endblock %}

{% block content %}
<div class="container">
    {% if len(licenses) == 0 %}
    <p>No licenses were found in {{repo.owner.canonical_name}}/{{repo.name}}.</p>
    {% else %}
    <p>The following licenses are used in {{repo.owner.canonical_name}}/{{repo.name}}:</p>
    <div class="event-list license-list">
      {% for l in licenses %}
      <div class="event">
        <h2>{{ l.name }} <small>({{ l.id }})</small></h2>
        <a href="https://spdx.org/licenses/{{ l.id }}.html">
          Full license text&nbsp;{{icon("caret-right")}}
        </a>
      </div>
      {% endfor %}
    </div>
    {% endif %}
  </div>
</div>
{% endblock %}

M gitsrht/templates/repo.html => gitsrht/templates/repo.html +7 -0
@@ 80,6 80,13 @@
          owner=repo.owner.canonical_name,
          repo=repo.name), "refs")}}
      </li>
      {% if len(licenses) > 0 %}
      <li class="nav-item">
        {{link(url_for("repo.licenses",
          owner=repo.owner.canonical_name,
          repo=repo.name), "licenses")}}
      </li>
      {% endif %}
      {% if current_user.id == repo.owner_id %}
      <li class="nav-item">
        {{link(url_for("manage.settings_info",

M gitsrht/templates/summary.html => gitsrht/templates/summary.html +30 -2
@@ 6,7 6,24 @@
{% block content %}
{% if repo.description %}
<div class="header-extension">
  <div class="container">{{ repo.description }}</div>
  <div class="container">
    <div class="row">
      <div class="col-md-6">
        {{ repo.description }}
      </div>
      <div class="col-md-6 licenses">
      {% if len(licenses) > 0 %}
      <a href="{{url_for("repo.licenses",
        owner=repo.owner.canonical_name, repo=repo.name)}}">
      Licensed under
      {% for l in licenses %}
      {{ l['id'] }}{% if loop.index != len(licenses) %}, {% endif %}
      {% endfor %}
      {% endif %}
      </a>
      </div>
    </div>
  </div>
</div>
{% endif %}
<div class="container">


@@ 120,7 137,7 @@
      </div>
    </div>
  </div>
  {% if current_user == repo.owner and not license
  {% if current_user == repo.owner and not license_exists
    and repo.visibility.value == 'PUBLIC' %}
  <div class="alert alert-danger">
    <strong>Heads up!</strong> We couldn't find a license file for your


@@ 139,4 156,15 @@
  </div>
  {% endif %}
</div>
{% if len(licenses) > 0 %}
<div class="container license-footer">
  <a href="{{url_for("repo.licenses",
    owner=repo.owner.canonical_name, repo=repo.name)}}">
  {{repo.owner.canonical_name}}/{{repo.name}} license{% if len(licenses) > 1 %}s{% endif %}:
  {% for l in licenses %}
  {{ l['id'] }}{% if loop.index != len(licenses) %}, {% endif %}
  {% endfor %}
  </a>
</div>
{% endif %}
{% endblock %}

M scss/main.scss => scss/main.scss +39 -0
@@ 30,6 30,45 @@ del {
  text-decoration: underline;
}

.licenses {
  text-align: right;
  a {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.license-footer {
  display: none;
  margin-bottom: -1rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  background: #ddd;
}

@media(prefers-color-scheme: dark) {
  .license-footer {
    background: darken($gray-900, 6);
  }
}

@include media-breakpoint-down(sm) {
  .licenses {
    display: none;
  }
  .license-footer {
    display: block;
  }
}

.license-list {
  h2 {
    font-size: 1.1rem;
  }
}

.tree-list {
  display: grid;
  // mode name