On Thu, 2026-12-03 at 19:14 +0100, Matthias Klose wrote:
> On 12/3/26 16:31, [email protected] wrote:
> > We send you the file d/copyright also shown in the public notes as
> > bug report.
> 
> thanks for giving that a try, however at a first glance, there seems
> to 
> be some confusion about the GPL and GPL+exception.  Your are
> crediting 
> so many files falsely to the GPL+exception.
> 
> The rewrite also seems to drop a lot of names, mainly for files which
> have a different license within a subdirectory.
> 
> So, in the current state the rewrite cannot be used.

That's totally reasonable.  Things like the linux kernel and gcc and
other packages that have attracted active development for many years
have inevitably accumulated all sorts of special complexity in their
copyright and licensing - things are so much more rigorous around this
stuff even in just the last fifteen years.

The LLM tool is not designed for these kinds of things and that's why
we have humans review it's operation.  It's particularly screwed by
this package because the upstream source is double gzipped, and it
doesn't have the tools to unpack that (it's very, *very* sandboxed) so
it just makes stuff up on the basis of it's vague corpus of knowledge
around "gcc" in general and definitely not "gcc in specific".

If you're curious, I did build a tool that can (maybe) build a machine-
readable debian/copyright for gcc-17, which I attach.  Note that this
is *not* a debian/copyright but is instead a Python program which can
write it. And a second python program which will try and verify that
the first one did a good job.  This is done more as an exercise in "I
wonder if it works..." than in "you should totally use this thing".

I don't expect you to bother changing debian/copyright at all, but if
you wanted to, maybe this tool gives you something workable - and can
possibly update that when a new version comes out.

Anyway: gen-copyright.py builds a DEP-5 file from each file's own
notice. It uses Python only and takes about a minute on GCC plus
newlib.
  - It is consistent with its own reading: every one of the 45,027
files with a notice gets the licence that notice states, and no
    file is left unmatched. It passes the report tool's form check.

The checker is verify.py.
  - It backs up the maintainer's first complaint with numbers. The
    review's proposal credited 11,182 files with plain GPL-3 notices to
    the runtime exception: 8,970 in libstdc++-v3/testsuite, 1,591 in
    gcc/config, 425 in gcc/m2 and 68 in gcc/algol68. It also gave
    1,871 files that do carry the exception (1,747 in gcc/ada) plain
    GPL or another licence.
  - On dropped names: holders are taken from every file's Copyright
    lines. Of the holders named in the current file, the ones the
    generator leaves out are not holders of anything in the tree:
    - one appears in no file at all;
    - one only as an author;
    - one only in a ChangeLog;
    - one only in newlib's licence summary.

This gives a starting point, not a finished file:
  - It is long: about 12,000 lines, against 1,639 now, most of them
file lists in gcc/testsuite and newlib.
  - 241 files need checking by hand. Their licence could not be named,
    and they are listed in gen.report. A further 50 say "GPL" without
    a version.
  - Some licence texts need writing in: the older "special exception"
    wordings, and the ACATS and ISO notices, which are cut from a
    file and need trimming.
  - The debian/* paragraph is a guess, since the generator doesn't
    read the packaging.


Out of all this, the one finding of interest: about 49 files in
gcc/m2/gm2-libs-iso say they "may be freely copied for the purpose of
implementation" under an ISO copyright. That permission is narrow, and
the current file mentions it without comment.

I am, of course, curious as to whether this is close to an answer, but
you should probably close this bug as "wontfix" because this level of
effort is unwarranted!

Regardless, this *has* been a useful exercise to try, since it has
uncovered a few deficiencies in the review process, as well as given an
indication on some limits where it should throw it's hands up and say
"this is beyond me".  Hopefully in the future it can do better (just
not with this package :-).

Realistically we should move gcc-* into the same kind of automatically
approved category that we put the linux kernel into.  I'm certainly
open to that, and perhaps the team need to discuss a process for
accepting packages into that group.

Cheers,
Andrew.

-- 
----------------------------------------------------------------------
Porirua, New Zealand                                 +64 (27) 288 6741
                    https://andrew.mcmillan.net.nz

           It is easier to get forgiveness than permission.
----------------------------------------------------------------------
#!/usr/bin/python3
"""Classify each file of a tree by the licence wording in its first 24 KiB.

Writes path<TAB>class<TAB>first copyright line to stdout.
"""
import os
import re
import sys

root = sys.argv[1]

def norm(t):
    t = re.sub(r'[\s#*/;!@c\-]*\n[\s#*/;!@c\-]*', ' ', t)  # join comment lines
    t = re.sub(r'\s+', ' ', t)
    return t

SPDX = re.compile(r'SPDX-License-Identifier:\s*([^\n*]+?)\s*(?:\*/|-->|$)', re.M)
CR = re.compile(r'Copyright\s*(?:\([cC]\)|©)?\s*[0-9].{0,100}', re.I)

def classify(raw):
    t = norm(raw)
    tags = []
    m = SPDX.search(raw)
    if m:
        tags.append('SPDX:' + m.group(1).strip())
    if re.search(r'Runtime Library Exception', t, re.I):
        tags.append('GPL3+exc')
    elif re.search(r'GNU (Affero )?General Public License', t, re.I) and not re.search(r'(Lesser|Library) General Public', t, re.I):
        if re.search(r'version 3', t, re.I):
            v = 'GPL3'
        elif re.search(r'version 2', t, re.I):
            v = 'GPL2'
        elif re.search(r'version 1', t, re.I):
            v = 'GPL1'
        else:
            v = 'GPL?'
        if re.search(r'any later version', t, re.I):
            v += '+'
        if re.search(r'special exception|linking exception|As a special', t, re.I):
            v += 'exc-old'
        tags.append(v)
    if re.search(r'(Lesser|Library) General Public', t, re.I):
        v = 'LGPL'
        if re.search(r'version 2\.1', t):
            v += '2.1'
        elif re.search(r'version 3', t):
            v += '3'
        elif re.search(r'version 2', t):
            v += '2'
        if re.search(r'any later version', t, re.I):
            v += '+'
        tags.append(v)
    if re.search(r'Free Documentation License', t):
        tags.append('GFDL')
    if re.search(r'Apache License,? v(ersion )?2\.0 with LLVM Exception', t, re.I):
        tags.append('Apache-2.0-LLVM')
    elif re.search(r'Apache License', t):
        tags.append('Apache')
    if re.search(r'Boost Software License', t):
        tags.append('BSL')
    if re.search(r'Redistribution and use in source and binary forms', t):
        tags.append('BSD-ish')
    if re.search(r'Permission is hereby granted, free of charge', t):
        tags.append('MIT-ish')
    if re.search(r'University of Illinois Open Source License|LLVM Release License', t):
        tags.append('UIUC')
    if re.search(r'Permission to use, copy, modify,? (and|and/or) distribute', t):
        tags.append('ISC/HPND-ish')
    if re.search(r'Artistic License', t):
        tags.append('Artistic')
    if re.search(r'public domain', t, re.I):
        tags.append('PD?')
    if re.search(r'Unicode', t) and re.search(r'Terms of Use|UNICODE LICENSE', t):
        tags.append('Unicode')
    if re.search(r'This (file|program) is free software', t) and not tags:
        tags.append('free-unclassified')
    if re.search(r'unlimited permission to copy', t):
        tags.append('FSFUL/FSFAP')
    return '|'.join(sorted(set(tags))) or 'NONE'

for dp, dns, fns in os.walk(root):
    dns.sort()
    for fn in sorted(fns):
        p = os.path.join(dp, fn)
        if os.path.islink(p) or not os.path.isfile(p):
            continue
        try:
            with open(p, 'rb') as f:
                raw = f.read(24576).decode('utf-8', 'replace')
        except OSError:
            continue
        c = classify(raw)
        m = CR.search(raw)
        cr = m.group(0).strip().replace('\t', ' ') if m else ''
        print(f'{os.path.relpath(p, root)}\t{c}\t{cr}')
#!/usr/bin/python3
"""Write a machine-readable debian/copyright for GCC from the licence
notices in its sources.

Usage: gen-copyright.py [--tree PREFIX=DIR ...] [--report FILE] > copyright

Each --tree is an unpacked source tree and the path its files are given
under in the output: for gcc-NN, the GCC tarball's tree with the prefix ""
(so paths read gcc/config/..., libgcc/..., as the current file has them) and
the newlib tarball's with "newlib-X.Y.Z/".

How it works:

- Each file's first 24 KiB are read, comment markers taken off and lines
  joined, and the licence is decided from the wording: GPL, LGPL and GFDL by
  version and "or any later version"; GPL-3+ with the GCC Runtime Library
  Exception 3.1 only where the file says so; the older exceptions (libgcc's
  "unlimited permission to link", Autoconf's, Bison's, Libtool's) by their
  wording; permissive licences (BSD, MIT, ISC-like, zlib, the FSF's
  all-permissive notices) by their text, so that two files share a short name
  only if their licence text is the same once spacing and the copyright
  holder's name in the disclaimer are set aside. A file with no notice takes
  the licence of the paragraph that covers it.
- Paragraphs: the licence most files have is Files: *. For each directory,
  the licence most of the files below it have (those with a notice) becomes a
  "dir/*" paragraph if it differs from the one above, and the files in the
  directory whose own licence differs from that are listed after it. The
  last paragraph that matches a file wins (copyright-format 1.0), so the
  order is general to specific.
- Copyright: every "Copyright" line of the files a paragraph is the last
  match for, holders merged without regard to case and punctuation, with
  their years from earliest to latest.
- What it could not decide is License: UNKNOWN-<n>, with the file's wording
  in the stand-alone paragraph, and is listed in --report: check those by
  hand.

It reads only. It needs Python 3 and nothing else.
"""

import argparse
import collections
import hashlib
import os
import re
import sys

HEAD = 24576

# Directories never looked at.
SKIP_DIRS = {".git", ".svn", "CVS", "autom4te.cache"}


def norm(raw):
    """The text of a header with comment markers and line breaks gone."""
    lines = []
    for line in raw.splitlines():
        line = re.sub(r"^\s*(?:/\*+|\*+/|\*|//+|#+|;+|--+|!+|@c(?:omment)?\b|dnl\b|\(\*|\*\)|%+|'|\"\"\"|C\s)\s?", "", line)
        line = re.sub(r"\s*(?:\*+/|--|\*\))\s*$", "", line)
        lines.append(line.strip())
    text = " ".join(lines)
    # Words hyphenated across lines, as Ada's boxed headers are ("Soft- ware").
    text = re.sub(r"(\w)- (\w)", r"\1\2", text)
    return re.sub(r"\s+", " ", text)


def later(t):
    return bool(re.search(r"any later version|or \(at your option\) any later|or later version", t, re.I))


def version(t, family):
    """The version of a GNU licence the text names, with "+" if it allows later ones."""
    m = re.search(family + r"[^.]{0,200}?version (\d(?:\.\d)?)", t, re.I) or re.search(r"version (\d(?:\.\d)?)(?: of the License)?,? or \(at your option\)", t, re.I)
    if not m:
        m = re.search(r"\bv(?:ersion)? ?(\d(?:\.\d)?)\b", t, re.I)
    if not m:
        return None
    v = m.group(1)
    if v.endswith(".0"):
        v = v[:-2]
    if "Lesser" in family:
        allowed = {"2", "2.1", "3"}
    elif "Documentation" in family:
        allowed = {"1.1", "1.2", "1.3"}
    else:
        allowed = {"1", "2", "3"}
    if v not in allowed:
        return None
    return v + ("+" if later(t) else "")


EXCEPTIONS = [
    ("GCC-exception-3.1", r"GCC Runtime Library Exception"),
    ("libgcc-exception", r"unlimited permission to link the compiled version of this file"),
    ("Autoconf-exception", r"configuration script generated by Autoconf|Autoconf Configure Script Exception"),
    ("Bison-exception", r"part or all of the Bison parser skeleton|Bison parser skeleton"),
    ("Libtool-exception", r"built using GNU Libtool"),
    ("libstdc++-exception", r"this file does not by itself cause the resulting executable to be covered by the GNU General Public License"),
    ("GNAT-exception", r"As a special exception, if other files instantiate generics from this unit"),
    ("special-exception", r"As a special exception|special exception"),
]

PERMISSIVE = [
    ("BSL-1.0", r"Boost Software License|Boost License,? (?:Version )?1\.0|boost\.org/LICENSE_1_0\.txt"),
    ("BSD", r"Redistribution and use in source and binary forms"),
    ("MIT", r"Permission is hereby granted, (?:free of charge|without written agreement)"),
    ("ISC-like", r"Permission to use, copy, modify,? (?:and(?:/or)?|or) distribute this software"),
    ("Zlib", r"provided 'as-is', without any express or implied warranty"),
    ("FSFAP", r"Copying and distribution of this file, with or without modification, are permitted in any medium without royalty"),
    ("FSFUL", r"(?:configure script|This file) is free software; the Free Software Foundation gives unlimited permission to copy, distribute(?:,)? and modify it"),
    ("FSFULLR", r"the Free Software Foundation gives unlimited permission to copy and/or distribute it, with or without modifications"),
    ("ACATS-unlimited-rights", r"Grant of Unlimited Rights"),
    ("ISO-M2-implementation", r"may be freely copied for the purpose of implementation"),
    ("Apache-2.0-with-LLVM-exception", r"Apache License v2\.0 with LLVM Exceptions|Apache-2\.0 WITH LLVM-exception"),
    ("Apache-2.0", r"Apache License,? Version 2\.0"),
    ("Unicode", r"UNICODE (?:LICENSE|, INC\. LICENSE AGREEMENT)|Unicode Terms of Use"),
]

# Looked for in the header only (its first 60 lines): wording that is often in the text
# of a program for other reasons.
HEADER_ONLY = [
    ("public-domain", r"(?:placed|released|put|dedicated|is|are|been) (?:in|into|to) the public domain|\bpublic domain\b"),
]
GRANT = re.compile(
    r"\bis free software\b|\blicen[cs]ed under\b|\bpermission is (?:hereby )?granted\b|\bmay be freely (?:copied|distributed|used)\b|"
    r"\bdistributed under the\b|\bsee (?:the file )?COPYING\b|\bunder the terms of\b",
    re.I,
)

# Where a permissive licence's own text begins and ends, to tell its variants apart.
TEXT_START = {
    "BSD": r"Redistribution and use in source and binary forms",
    "MIT": r"Permission is hereby granted",
    "ISC-like": r"Permission to use, copy, modify",
    "Zlib": r"This software is provided 'as-is'",
    "FSFAP": r"Copying and distribution of this file",
    "FSFUL": r"(?:This configure script|This file) is free software; the Free Software Foundation",
    "FSFULLR": r"This file is free software; the Free Software Foundation",
    "X11": r"Permission is hereby granted",
}
TEXT_END = (
    r"(?:SUCH DAMAGE\.|OTHER DEALINGS IN THE SOFTWARE\.|PERFORMANCE OF THIS SOFTWARE\.|"
    r"source distribution\.|notice are preserved\.|this notice is preserved\.|"
    r"as long as this notice is preserved\.|FITNESS FOR A PARTICULAR PURPOSE\.|"
    r"without express or implied warranty\.|ANY PARTICULAR PURPOSE\.)"
)


class Licences:
    """The licence texts met, by short name."""

    def __init__(self):
        self.texts = {}  # short name -> (text, an example file)
        self.variants = collections.defaultdict(dict)  # family -> {digest: name}
        self.unknown = {}  # digest -> name

    def permissive(self, family, t, path):
        m = re.search(TEXT_START.get(family, "$^"), t, re.I)
        if not m:
            return family
        rest = t[m.start():]
        e = re.search(TEXT_END, rest, re.I)
        text = rest[: e.end()] if e else rest[:1500]
        # The name in "IN NO EVENT SHALL <holder> BE LIABLE" differs from file to
        # file and does not make another licence.
        key = text
        for pattern, put in [
            (r"IN NO EVENT SHALL .{0,200}? BE LIABLE", "IN NO EVENT SHALL [holder] BE LIABLE"),
            (r"PROVIDED BY .{0,200}? (?:''|``|\"|')?AS IS", "PROVIDED BY [holder] AS IS"),
            (r"Neither the names? of .{0,200}? nor the names", "Neither the name of [holder] nor the names"),
            (r"(?:the )?names? of .{0,120}? (?:may|must) not be used to endorse", "the name of [holder] may not be used to endorse"),
            (r"name of .{0,120}? not be used in advertising", "name of [holder] not be used in advertising"),
            (r"\b(?:THE )?(?:AUTHORS?|COPYRIGHT HOLDERS?|REGENTS|CONTRIBUTORS)( AND (?:CONTRIBUTORS|COPYRIGHT HOLDERS))?\b", "[holder]"),
        ]:
            key = re.sub(pattern, put, key, flags=re.I)
        key = re.sub(r"\W+", " ", key).strip().lower()
        digest = hashlib.sha1(key.encode()).hexdigest()
        base = family
        if family == "BSD":
            if re.search(r"advertising materials", text, re.I):
                base = "BSD-4-clause"
            elif re.search(r"endorse or promote|Neither the name", text, re.I):
                base = "BSD-3-clause"
            else:
                base = "BSD-2-clause"
        seen = self.variants[base]
        if digest not in seen:
            name = base if not seen else f"{base}~{len(seen) + 1}"
            seen[digest] = name
            self.texts[name] = (text, path)
        return seen[digest]

    def unknown_text(self, t, path):
        m = GRANT.search(t)
        start = max(0, m.start() - 200) if m else 0
        text = t[start:start + 600]
        digest = hashlib.sha1(re.sub(r"\W+", " ", text).lower().encode()).hexdigest()
        if digest not in self.unknown:
            name = f"UNKNOWN-{len(self.unknown) + 1}"
            self.unknown[digest] = name
            self.texts[name] = (text, path)
        return self.unknown[digest]


SPDX = {
    "GPL-3.0-or-later": "GPL-3+", "GPL-3.0+": "GPL-3+", "GPL-2.0-or-later": "GPL-2+", "GPL-2.0+": "GPL-2+",
    "GPL-3.0-only": "GPL-3", "GPL-2.0-only": "GPL-2", "GPL-2.0": "GPL-2", "GPL-3.0": "GPL-3",
    "LGPL-2.1-or-later": "LGPL-2.1+", "LGPL-2.1+": "LGPL-2.1+", "LGPL-3.0-or-later": "LGPL-3+",
    "Apache-2.0 WITH LLVM-exception": "Apache-2.0-with-LLVM-exception", "Apache-2.0": "Apache-2.0",
    "BSL-1.0": "BSL-1.0", "MIT": "MIT", "BSD-3-Clause": "BSD", "BSD-2-Clause": "BSD", "ISC": "ISC-like",
    "GPL-3.0-or-later WITH GCC-exception-3.1": "GPL-3+ with GCC-exception-3.1",
}


def also(name, t, lic, path):
    """A GNU licence, and a permissive notice the same file has beside it (fdlibm's, in
    libquadmath), as "A and B"."""
    for family, pattern in PERMISSIVE:
        if family in ("ACATS-unlimited-rights", "ISO-M2-implementation"):
            continue
        if re.search(pattern, t, re.I | re.S):
            other = lic.permissive(family, t, path) if family in TEXT_START else family
            return f"{name} and {other}"
    return name


def classify(raw, path, lic):
    """The licence of a file from its header: a short name, or None for no notice."""
    name = gnu_or_other(raw, path, lic)
    m = re.search(r"SPDX-License-Identifier:\s*([^\s*][^*\n]*?)\s*(?:\*/|-->|$)", raw, re.M)
    spdx = SPDX.get(m.group(1).strip()) if m else None
    if spdx and "BSD" not in spdx and spdx != "MIT":
        if name is None or name.startswith("UNKNOWN"):
            return spdx
        if spdx not in name.split(" and ") and spdx != name.split(" and ")[0]:
            return f"{name} and {spdx}"
    return name


def gnu_or_other(raw, path, lic):
    # The licence is read from the header: the first 100 lines. Code further down says
    # "as a special exception" and "public domain" for other reasons.
    raw = "\n".join(raw.splitlines()[:100])
    t = norm(raw)
    gpl = re.search(r"GNU (?:Affero )?General Public License|\bGNU GPL\b", t) and not re.search(r"(?:Lesser|Library) General Public License", t)
    lgpl = re.search(r"GNU (?:Lesser|Library) General Public License|\bLGPL\b", t)
    gfdl = re.search(r"GNU Free Documentation License", t)
    if gfdl and re.search(r"(?:copy, distribute and/or modify|under the terms of) (?:this document )?(?:under the terms of )?the GNU Free Documentation License", t, re.I):
        gpl = lgpl = None
    if gpl:
        v = version(t, r"General Public License")
        if v is None:
            if re.search(r"GPL with exception|GPL, with the exception", t, re.I):
                return "GPL-unstated with exception"
            return "GPL-unstated"
        name = f"GPL-{v}"
        for exc, pattern in EXCEPTIONS:
            if re.search(pattern, t, re.I):
                return also(f"{name} with {exc}", t, lic, path)
        if re.search(r"GNU Affero", t):
            name = "A" + name
        return also(name, t, lic, path)
    if lgpl:
        v = version(t, r"(?:Lesser|Library) General Public License")
        if v is None:
            return lic.unknown_text(t, path)
        name = f"LGPL-{v}"
        for exc, pattern in EXCEPTIONS:
            if re.search(pattern, t, re.I):
                name = f"{name} with {exc}"
                break
        return also(name, t, lic, path)
    if gfdl:
        v = version(t, r"Free Documentation License") or "1.3+"
        if re.search(r"no Invariant Sections", t, re.I):
            return f"GFDL-{v}-no-invariants"
        return f"GFDL-{v}"
    for family, pattern in PERMISSIVE:
        m = re.search(pattern, t, re.I | re.S)
        if m:
            if family in TEXT_START:
                return lic.permissive(family, t, path)
            lic.texts.setdefault(family, (t[max(0, m.start() - 300):m.end() + 600], path))
            return family
    header = norm("\n".join(raw.splitlines()[:60]))
    for family, pattern in HEADER_ONLY:
        if re.search(pattern, header, re.I):
            return family
    if re.search(r"(?:governed by|under) a BSD-style license that can be found in the LICENSE file", t, re.I):
        return "SEE-LICENSE-FILE"
    if GRANT.search(header) and not re.search(r"^\s*(?:README|ChangeLog)", os.path.basename(path)):
        return lic.unknown_text(header, path)
    return None


YEARS = r"(?:\d{4}(?:\s*[-–]\s*\d{2,4})?(?:\s*,\s*|\s+|\s*-\s*)?)+"
HOLDER_LINE = re.compile(r"Copyright\s*(?:\(C\)|\(c\)|©)?\s*(" + YEARS + r")?,?\s*(?:by\s+)?([^\n]{2,160})", re.I)


def years(text):
    found = []
    for m in re.finditer(r"\d{4}(?:\s*[-–]\s*(\d{2,4}))?", text or ""):
        y = int(m.group(0)[:4])
        found.append(y)
        if m.group(1):
            end = m.group(1)
            if len(end) == 2:
                end = str(y)[:2] + end
            found.append(int(end))
    return [y for y in found if 1970 <= y <= 2100]


def holders(raw):
    out = []
    for line in raw.splitlines()[:200]:
        if not re.search(r"Copyright", line):
            continue
        clean = re.sub(r"^\s*(?:/\*+|\*+|//+|#+|;+|--+|!|@c|dnl)\s?", "", line).strip()
        clean = re.sub(r"\s*(?:\*+/|--)\s*$", "", clean)
        m = HOLDER_LINE.search(clean)
        if not m:
            continue
        y, who = m.group(1), m.group(2)
        who = re.split(r"\\n|\\\\|\"\)|\s{3,}|\*/", who)[0]
        who = re.sub(r"\s*All [Rr]ights [Rr]eserved\.?", "", who)
        who = re.sub(r"[\s.,;:*\"'`)]+$", "", who).strip()
        who = re.sub(r"^(?:\(C\)|\(c\)|©)\s*", "", who).strip()
        if not who or re.match(r"(?:(?:notice|holders?|owners?|statement|the above|and|law|info|years?|dates?|XXXX|YEAR|NAME)\b|\(C\)$|[^A-Za-z])", who, re.I):
            continue
        if re.search(r"\b(?:notice|permission notice|this list of conditions)\b", who, re.I):
            continue
        out.append((who, years(y)))
    return out


def key_of(holder):
    k = holder.lower()
    k = re.sub(r"<[^>]*>", "", k)
    k = re.sub(r"\b(?:inc|ltd|llc|corp|corporation|co)\b\.?", "", k)
    return re.sub(r"\W+", " ", k).strip()


class Holders:
    def __init__(self):
        self.names = {}
        self.years = collections.defaultdict(set)

    def add(self, who, ys):
        k = key_of(who)
        if not k:
            return
        self.names.setdefault(k, who)
        self.years[k].update(ys)

    def merge(self, other):
        for k, name in other.names.items():
            self.names.setdefault(k, name)
            self.years[k].update(other.years[k])

    def lines(self):
        out = []
        for k in sorted(self.names, key=lambda k: (-len(self.years[k]) if "free software foundation" in k else 0, self.names[k].lower())):
            ys = sorted(self.years[k])
            span = "" if not ys else (f"{ys[0]}" if ys[0] == ys[-1] else f"{ys[0]}-{ys[-1]}")
            out.append(f"{span} {self.names[k]}".strip())
        return out


LICENCE_FILE = re.compile(r"^LICEN[CS]E(?:\.txt|\.TXT|\.md|_1_0\.txt)?$")


def dir_licence(dp, fns, lic):
    """The licence a LICENSE file in a directory gives the files below it with no notice of
    their own, or None: one LICENSE file, or the MIT and Apache pair of Rust's crates."""
    def text(name):
        with open(os.path.join(dp, name), encoding="utf-8", errors="replace") as f:
            return f.read(HEAD)
    if "LICENSE-MIT" in fns and "LICENSE-APACHE" in fns:
        mit = classify(text("LICENSE-MIT"), os.path.join(dp, "LICENSE-MIT"), lic)
        return f"{mit} or Apache-2.0" if mit else None
    found = [fn for fn in fns if LICENCE_FILE.match(fn)]
    if len(found) != 1:
        return None
    name = classify(text(found[0]), os.path.join(dp, found[0]), lic)
    return None if name in (None, "SEE-LICENSE-FILE") else name


def walk(trees, lic, report):
    """Every file: (path in the output, licence or None, holders)."""
    files = []
    go = None
    for _, top in trees:
        p = os.path.join(top, "libgo", "LICENSE")
        if os.path.isfile(p):
            with open(p, encoding="utf-8", errors="replace") as f:
                go = classify(f.read(), p, lic)
    for prefix, top in trees:
        inherited = {}
        for dp, dns, fns in os.walk(top):
            dns[:] = sorted(d for d in dns if d not in SKIP_DIRS)
            here = dir_licence(dp, fns, lic) if dp != top else None
            inherited[dp] = here or inherited.get(os.path.dirname(dp))
            for fn in sorted(fns):
                p = os.path.join(dp, fn)
                if os.path.islink(p) or not os.path.isfile(p):
                    continue
                try:
                    with open(p, "rb") as f:
                        data = f.read(HEAD)
                except OSError:
                    report.write(f"unreadable\t{p}\n")
                    continue
                if b"\x00" in data[:8192]:
                    # Binary: no notice to read.
                    raw = ""
                else:
                    raw = data.decode("utf-8", "replace")
                rel = prefix + os.path.relpath(p, top).replace(os.sep, "/")
                # A licence's own text is not a notice for the file.
                text_of_licence = re.match(r"(?:COPYING|LICEN[CS]E)", fn) is not None
                name = classify(raw, rel, lic) if raw and not text_of_licence else None
                if name in (None, "SEE-LICENSE-FILE") and inherited[dp]:
                    name = inherited[dp]
                elif name == "SEE-LICENSE-FILE" and go and "The Go Authors" in raw:
                    name = go
                files.append((rel, name, holders(raw) if raw else []))
    return files


class Node:
    def __init__(self):
        self.dirs = {}
        self.files = []  # (name, licence, holders)
        self.count = collections.Counter()


def build(files):
    root = Node()
    for rel, name, hs in files:
        parts = rel.split("/")
        node = root
        if name:
            node.count[name] += 1
        for d in parts[:-1]:
            node = node.dirs.setdefault(d, Node())
            if name:
                node.count[name] += 1
        node.files.append((parts[-1], name, hs))
    return root


def dominant(count, inherited):
    if not count:
        return inherited
    best = max(count.values())
    if count.get(inherited) == best:
        return inherited
    return sorted(n for n, c in count.items() if c == best)[0]


def paragraphs(root):
    """Paragraphs as (patterns, licence, Holders), general to specific."""
    out = []
    top = dominant(root.count, None)
    star = [["*"], top, Holders()]
    out.append(star)

    def visit(node, path, inherited, para):
        # The licence most files directly in the directory have, or if none has a notice,
        # most of those below it: gcc/d/* is the front end's GPL-3+, though most of its
        # files are in gcc/d/dmd/, which is BSL-1.0.
        direct = collections.Counter(l for _, l, _ in node.files if l)
        here = dominant(direct or node.count, inherited)
        if here != inherited:
            para = [[f"{path}*"], here, Holders()]
            out.append(para)
        odd = collections.defaultdict(lambda: [[], Holders()])
        for name, licence, hs in node.files:
            target = para
            if licence and licence != here:
                entry = odd[licence]
                entry[0].append(f"{path}{name}")
                target = None
                for who, ys in hs:
                    entry[1].add(who, ys)
            if target is not None:
                for who, ys in hs:
                    target[2].add(who, ys)
        for licence, (patterns, hs) in sorted(odd.items()):
            out.append([patterns, licence, hs])
        for d in sorted(node.dirs):
            visit(node.dirs[d], f"{path}{d}/", here, para)

    visit(root, "", top, star)
    return out


def merge_same(paras):
    """Paragraphs next to each other with the same licence and only file names, as one."""
    out = []
    for p in paras:
        if out and out[-1][1] == p[1] and not any(x.endswith("*") for x in p[0] + out[-1][0]):
            out[-1][0].extend(p[0])
            out[-1][2].merge(p[2])
        else:
            out.append(p)
    return out


def field(name, values):
    if not values:
        return f"{name}:"
    return f"{name}: {values[0]}" + "".join(f"\n {v}" for v in values[1:])


def wrap(text, width=76):
    words, lines, line = text.split(), [], ""
    for w in words:
        if line and len(line) + 1 + len(w) > width:
            lines.append(line)
            line = w
        else:
            line = f"{line} {w}" if line else w
    if line:
        lines.append(line)
    return [l if l else "." for l in lines]


COMMON = {
    "GPL-1": "GPL-1", "GPL-1+": "GPL-1", "GPL-2": "GPL-2", "GPL-2+": "GPL-2", "GPL-3": "GPL-3", "GPL-3+": "GPL-3",
    "LGPL-2": "LGPL-2", "LGPL-2+": "LGPL-2", "LGPL-2.1": "LGPL-2.1", "LGPL-2.1+": "LGPL-2.1",
    "LGPL-3": "LGPL-3", "LGPL-3+": "LGPL-3", "Apache-2.0": "Apache-2.0", "GFDL-1.3": "GFDL-1.3",
    "GFDL-1.3+": "GFDL-1.3", "GFDL-1.2": "GFDL-1.2", "GFDL-1.2+": "GFDL-1.2",
}


def standalone(name, lic, trees):
    base = name.split(" with ")[0]
    body = []
    if base.startswith("GPL-unstated"):
        body.append("The file says it is under the GNU General Public License, but not which version. CHECK BY HAND.")
    elif base.rstrip("+") in ("GPL-1", "GPL-2", "GPL-3", "LGPL-2", "LGPL-2.1", "LGPL-3", "AGPL-3"):
        gnu = {"G": "GNU General Public License", "L": "GNU Lesser General Public License", "A": "GNU Affero General Public License"}[base[0]]
        v = base.split("-")[1].rstrip("+")
        body.append(
            f"This program is free software; you can redistribute it and/or modify it under the terms of the {gnu} as published by the "
            f"Free Software Foundation; {'either ' if base.endswith('+') else ''}version {v}{' of the License, or (at your option) any later version' if base.endswith('+') else ''}."
        )
        if base in COMMON:
            body.append(f"On Debian systems, the complete text of the license is in /usr/share/common-licenses/{COMMON[base]}.")
    elif base in COMMON:
        body.append(f"On Debian systems, the complete text of the license is in /usr/share/common-licenses/{COMMON[base]}.")
    elif base in lic.texts:
        text, example = lic.texts[base]
        body.append(text)
        if base in ("ACATS-unlimited-rights", "ISO-M2-implementation", "public-domain", "Unicode"):
            body.append(f"CHECK BY HAND: this is the notice around the wording, from {example}; cut it to the licence.")
        if base.startswith("UNKNOWN"):
            body.append(f"CHECK BY HAND: the generator could not name this licence. Its wording, from {example}, is above.")
    elif base.startswith("GFDL"):
        body.append("On Debian systems, the complete text of the license is in /usr/share/common-licenses/GFDL-1.3.")
    elif base == "BSL-1.0":
        body.append(boost(trees))
    elif base == "Apache-2.0-with-LLVM-exception":
        body.append("Apache License v2.0 with LLVM Exceptions. On Debian systems, the text of the Apache License 2.0 is in /usr/share/common-licenses/Apache-2.0; the LLVM exception follows.")
        body.append(LLVM_EXCEPTION)
    else:
        body.append(f"CHECK BY HAND: no text for {base}.")
    if " with " in name:
        exc = name.split(" with ")[1]
        body.append(exception_text(exc, trees, lic))
    lines = [f"License: {name}"]
    for i, para in enumerate(body):
        if i:
            lines.append(" .")
        lines.extend(" " + l for l in wrap(para))
    return "\n".join(lines)


LLVM_EXCEPTION = (
    "---- LLVM Exceptions to the Apache 2.0 License ---- As an exception, if, as a result of your compiling your source code, portions of "
    "this Software are embedded into an Object form of such source code, you may redistribute such embedded portions in such Object form "
    "without complying with the conditions of Sections 4(a), 4(b) and 4(d) of the License. In addition, if you combine or link compiled "
    "forms of this Software with software that is licensed under the GPLv2 (\"Combined Software\") and if a court of competent jurisdiction "
    "determines that the patent provision (Section 3), the indemnity provision (Section 9) or other Section of the License conflicts with "
    "the conditions of the GPLv2, you may retroactively and prospectively choose to deem waived or otherwise exclude such Section(s) of the "
    "License, but only in their entirety and only with respect to the Combined Software."
)


def read_first(trees, names):
    for _, top in trees:
        for n in names:
            p = os.path.join(top, n)
            if os.path.isfile(p):
                with open(p, encoding="utf-8", errors="replace") as f:
                    return f.read()
    return None


def boost(trees):
    for _, top in trees:
        for dp, _, fns in os.walk(top):
            if "LICENSE_1_0.txt" in fns:
                with open(os.path.join(dp, "LICENSE_1_0.txt"), encoding="utf-8", errors="replace") as f:
                    return re.sub(r"\s+", " ", f.read()).strip()
    return "Boost Software License, Version 1.0. CHECK BY HAND: its text was not found in the tree."


def exception_text(exc, trees, lic):
    if exc == "GCC-exception-3.1":
        text = read_first(trees, ["COPYING.RUNTIME"])
        if text:
            return re.sub(r"\s+", " ", text).strip()
    return f"The {exc.replace('-', ' ')} as worded in each file it covers. CHECK BY HAND: give its text here."


def main():
    ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
    ap.add_argument("--tree", action="append", required=True, help="PREFIX=DIR")
    ap.add_argument("--report", help="file to list what needs checking by hand")
    ap.add_argument("--files", help="file to list every file with the licence found for it")
    ap.add_argument("--upstream-name", default="GCC")
    ap.add_argument("--source", default="https://gcc.gnu.org/";)
    o = ap.parse_args()
    trees = []
    for t in o.tree:
        prefix, _, top = t.partition("=")
        trees.append((prefix, top))
    report = open(o.report, "w") if o.report else open(os.devnull, "w")
    lic = Licences()
    files = walk(trees, lic, report)
    paras = merge_same(paragraphs(build(files)))

    out = [
        "\n".join([
            "Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/";,
            f"Upstream-Name: {o.upstream_name}",
            f"Source: {o.source}",
            "Comment: Generated by gen-copyright.py from the licence notices in the",
            " sources. Paths are those of the upstream trees, as unpacked by",
            " debian/rules.unpack. A file with no notice of its own is covered by",
            " the paragraph for its directory. Check every UNKNOWN-n licence and",
            " every CHECK BY HAND before use.",
        ])
    ]
    used = set()
    for patterns, licence, hs in paras:
        if not licence:
            licence = "UNKNOWN-none"
        used.add(licence)
        cr = hs.lines() or ["(no notice in these files)"]
        out.append("\n".join([field("Files", patterns), field("Copyright", cr), f"License: {licence}"]))
    out.append(
        "\n".join([
            "Files: debian/*",
            "Copyright: Debian GCC Maintainers <[email protected]>",
            "License: GPL-3+",
            "Comment: CHECK BY HAND: the generator does not look at the packaging.",
        ])
    )
    used.add("GPL-3+")
    parts = set()
    for name in used:
        for part in re.split(r" and | or ", name):
            parts.add(part)
    for name in sorted(parts):
        out.append(standalone(name, lic, trees))
    sys.stdout.write("\n\n".join(out) + "\n")

    if o.files:
        with open(o.files, "w") as f:
            for rel, name, _ in files:
                f.write(f"{rel}\t{name or '-'}\n")
    for rel, name, _ in files:
        if name and name.startswith("UNKNOWN"):
            report.write(f"{name}\t{rel}\n")
    counts = collections.Counter(name for _, name, _ in files)
    report.write("\n# files by licence\n")
    for name, n in counts.most_common():
        report.write(f"{n}\t{name}\n")


if __name__ == "__main__":
    main()
#!/usr/bin/python3
"""Check a debian/copyright against a per-file licence list (path TAB licence, "-" for
none): match each file as copyright-format 1.0 does (the last paragraph whose pattern
matches wins; * matches any characters, / included) and count those whose notice names
another licence than their paragraph."""
import collections, re, sys

def paras(path):
    out, cur = [], {}
    field = None
    for line in open(path, encoding="utf-8"):
        line = line.rstrip("\n")
        if not line.strip():
            if cur: out.append(cur); cur = {}
            continue
        if line[0] in " \t":
            cur[field] += " " + line.strip()
        else:
            field, _, v = line.partition(":")
            cur[field] = v.strip()
    if cur: out.append(cur)
    return [(p["Files"].split(), p["License"].split("\n")[0].strip()) for p in out if "Files" in p]

def compile_(pats):
    exact, globs = set(), []
    for p in pats:
        if "*" in p or "?" in p:
            globs.append(re.compile(re.escape(p).replace(r"\*", ".*").replace(r"\?", ".") + r"\Z"))
        else:
            exact.add(p)
    return exact, globs

ps = [(compile_(f), l) for f, l in paras(sys.argv[1])]
bad, checked, unmatched = collections.Counter(), 0, 0
examples = {}
for line in open(sys.argv[2], encoding="utf-8"):
    path, own = line.rstrip("\n").split("\t")
    got = None
    for (exact, globs), l in reversed(ps):
        if path in exact or any(g.match(path) for g in globs):
            got = l; break
    if got is None:
        unmatched += 1; continue
    if own == "-": continue
    checked += 1
    if got != own:
        bad[(own, got)] += 1; examples.setdefault((own, got), path)
print(f"{checked} files with a notice checked, {sum(bad.values())} given another licence, {unmatched} matched by no paragraph")
for k, v in bad.most_common(20): print(v, k, examples[k])
UNKNOWN-1       config/gettext.m4
UNKNOWN-2       config/intlmacosx.m4
UNKNOWN-3       config/lcmessage.m4
UNKNOWN-4       config/nls.m4
UNKNOWN-5       config/po.m4
UNKNOWN-6       config/progtest.m4
UNKNOWN-7       gcc/objc/objc-map.cc
UNKNOWN-8       gcc/objc/objc-map.h
UNKNOWN-9       gcc/po/af.po
UNKNOWN-10      gcc/po/da.po
UNKNOWN-11      gcc/po/de.po
UNKNOWN-12      gcc/po/es.po
UNKNOWN-13      gcc/po/fi.po
UNKNOWN-14      gcc/po/fr.po
UNKNOWN-15      gcc/po/gcc.pot
UNKNOWN-16      gcc/po/hr.po
UNKNOWN-17      gcc/po/id.po
UNKNOWN-18      gcc/po/ja.po
UNKNOWN-19      gcc/po/ka.po
UNKNOWN-20      gcc/po/lv.po
UNKNOWN-21      gcc/po/nl.po
UNKNOWN-22      gcc/po/ru.po
UNKNOWN-23      gcc/po/sv.po
UNKNOWN-24      gcc/po/tr.po
UNKNOWN-25      gcc/po/uk.po
UNKNOWN-26      gcc/po/vi.po
UNKNOWN-27      gcc/po/zh_CN.po
UNKNOWN-28      gcc/po/zh_TW.po
UNKNOWN-29      gcc/testsuite/c-c++-common/analyzer/bzip2-arg-parse-1.c
UNKNOWN-30      
gcc/testsuite/c-c++-common/analyzer/fd-manpage-getaddrinfo-client.c
UNKNOWN-30      
gcc/testsuite/c-c++-common/analyzer/fd-manpage-getaddrinfo-server.c
UNKNOWN-31      
gcc/testsuite/c-c++-common/analyzer/infinite-recursion-pr108524-1.c
UNKNOWN-32      
gcc/testsuite/c-c++-common/analyzer/infinite-recursion-pr108524-qobject-json-parser.c
UNKNOWN-33      gcc/testsuite/c-c++-common/analyzer/pr99774-1.c
UNKNOWN-34      gcc/testsuite/g++.dg/asan/asan_globals_test.cc
UNKNOWN-35      gcc/testsuite/g++.dg/asan/asan_mem_test.cc
UNKNOWN-36      gcc/testsuite/g++.dg/asan/asan_oob_test.cc
UNKNOWN-37      gcc/testsuite/g++.dg/asan/asan_str_test.cc
UNKNOWN-38      gcc/testsuite/g++.dg/asan/asan_test.cc
UNKNOWN-39      gcc/testsuite/g++.dg/asan/asan_test_config.h
UNKNOWN-40      gcc/testsuite/g++.dg/asan/asan_test_utils.h
UNKNOWN-41      gcc/testsuite/g++.dg/asan/dlclose-test-1-so.cc
UNKNOWN-42      gcc/testsuite/g++.dg/asan/sanitizer_pthread_wrappers.h
UNKNOWN-43      gcc/testsuite/g++.dg/asan/sanitizer_test_config.h
UNKNOWN-44      gcc/testsuite/g++.dg/asan/sanitizer_test_utils.h
UNKNOWN-45      gcc/testsuite/g++.dg/asan/shared-lib-test-1-so.cc
UNKNOWN-46      gcc/testsuite/g++.dg/cpp0x/pr86379.C
UNKNOWN-47      gcc/testsuite/gcc.dg/analyzer/pipe-manpages.c
UNKNOWN-48      gcc/testsuite/gcc.dg/cpp/vararg2.c
UNKNOWN-49      gcc/testsuite/gcc.dg/params/blocksort-part.c
UNKNOWN-50      gcc/testsuite/gcc.dg/vect/tsvc/tsvc.h
UNKNOWN-51      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s000.c
UNKNOWN-52      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s111.c
UNKNOWN-53      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1111.c
UNKNOWN-54      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1112.c
UNKNOWN-55      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1113.c
UNKNOWN-56      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1115.c
UNKNOWN-57      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1119.c
UNKNOWN-58      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s112.c
UNKNOWN-59      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s113.c
UNKNOWN-60      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s114.c
UNKNOWN-61      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s115.c
UNKNOWN-62      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s116.c
UNKNOWN-63      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1161.c
UNKNOWN-64      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s118.c
UNKNOWN-65      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s119.c
UNKNOWN-66      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s121.c
UNKNOWN-67      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1213.c
UNKNOWN-68      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s122.c
UNKNOWN-69      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1221.c
UNKNOWN-70      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s123.c
UNKNOWN-71      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1232.c
UNKNOWN-72      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s124.c
UNKNOWN-73      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1244.c
UNKNOWN-74      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s125.c
UNKNOWN-75      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1251.c
UNKNOWN-76      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s126.c
UNKNOWN-77      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s127.c
UNKNOWN-78      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1279.c
UNKNOWN-79      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s128.c
UNKNOWN-80      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1281.c
UNKNOWN-81      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s131.c
UNKNOWN-82      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s13110.c
UNKNOWN-83      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s132.c
UNKNOWN-84      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1351.c
UNKNOWN-85      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s141.c
UNKNOWN-86      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s1421.c
UNKNOWN-87      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s151.c
UNKNOWN-88      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s152.c
UNKNOWN-89      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s161.c
UNKNOWN-90      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s162.c
UNKNOWN-91      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s171.c
UNKNOWN-92      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s172.c
UNKNOWN-93      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s173.c
UNKNOWN-94      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s174.c
UNKNOWN-95      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s175.c
UNKNOWN-96      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s176.c
UNKNOWN-97      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2101.c
UNKNOWN-98      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2102.c
UNKNOWN-99      gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s211.c
UNKNOWN-100     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2111.c
UNKNOWN-101     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s212.c
UNKNOWN-102     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s221.c
UNKNOWN-103     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s222.c
UNKNOWN-104     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2233.c
UNKNOWN-105     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2244.c
UNKNOWN-106     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2251.c
UNKNOWN-107     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2275.c
UNKNOWN-108     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s231.c
UNKNOWN-109     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s232.c
UNKNOWN-110     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s233.c
UNKNOWN-111     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s235.c
UNKNOWN-112     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s241.c
UNKNOWN-113     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s242.c
UNKNOWN-114     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s243.c
UNKNOWN-115     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s244.c
UNKNOWN-116     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s251.c
UNKNOWN-117     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s252.c
UNKNOWN-118     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s253.c
UNKNOWN-119     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s254.c
UNKNOWN-120     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s255.c
UNKNOWN-121     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s256.c
UNKNOWN-122     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s257.c
UNKNOWN-123     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s258.c
UNKNOWN-124     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s261.c
UNKNOWN-125     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s271.c
UNKNOWN-126     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2710.c
UNKNOWN-127     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2711.c
UNKNOWN-128     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s2712.c
UNKNOWN-129     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s272.c
UNKNOWN-130     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s273.c
UNKNOWN-131     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s274.c
UNKNOWN-132     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s275.c
UNKNOWN-133     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s276.c
UNKNOWN-134     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s277.c
UNKNOWN-135     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s278.c
UNKNOWN-136     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s279.c
UNKNOWN-137     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s281.c
UNKNOWN-138     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s291.c
UNKNOWN-139     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s292.c
UNKNOWN-140     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s293.c
UNKNOWN-141     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s311.c
UNKNOWN-142     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s3110.c
UNKNOWN-143     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s3111.c
UNKNOWN-144     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s31111.c
UNKNOWN-145     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s3112.c
UNKNOWN-146     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s3113.c
UNKNOWN-147     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s312.c
UNKNOWN-148     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s313.c
UNKNOWN-149     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s314.c
UNKNOWN-150     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s315.c
UNKNOWN-151     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s316.c
UNKNOWN-152     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s317.c
UNKNOWN-153     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s318.c
UNKNOWN-154     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s319.c
UNKNOWN-155     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s321.c
UNKNOWN-156     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s322.c
UNKNOWN-157     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s323.c
UNKNOWN-158     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s3251.c
UNKNOWN-159     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s331.c
UNKNOWN-160     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s332.c
UNKNOWN-161     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s341.c
UNKNOWN-162     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s342.c
UNKNOWN-163     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s343.c
UNKNOWN-164     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s351.c
UNKNOWN-165     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s352.c
UNKNOWN-166     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s353.c
UNKNOWN-167     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4112.c
UNKNOWN-168     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4113.c
UNKNOWN-169     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4114.c
UNKNOWN-170     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4115.c
UNKNOWN-171     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4116.c
UNKNOWN-172     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4117.c
UNKNOWN-173     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s4121.c
UNKNOWN-174     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s421.c
UNKNOWN-175     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s422.c
UNKNOWN-176     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s423.c
UNKNOWN-177     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s424.c
UNKNOWN-178     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s431.c
UNKNOWN-179     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s441.c
UNKNOWN-180     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s442.c
UNKNOWN-181     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s443.c
UNKNOWN-182     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s451.c
UNKNOWN-183     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s452.c
UNKNOWN-184     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s453.c
UNKNOWN-185     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s471.c
UNKNOWN-186     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s481.c
UNKNOWN-187     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s482.c
UNKNOWN-188     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s491.c
UNKNOWN-189     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-va.c
UNKNOWN-190     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vag.c
UNKNOWN-191     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vas.c
UNKNOWN-192     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vbor.c
UNKNOWN-193     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vdotr.c
UNKNOWN-194     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vif.c
UNKNOWN-195     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vpv.c
UNKNOWN-196     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vpvpv.c
UNKNOWN-197     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vpvts.c
UNKNOWN-198     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vpvtv.c
UNKNOWN-199     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vsumr.c
UNKNOWN-200     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vtv.c
UNKNOWN-201     gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-vtvtv.c
UNKNOWN-202     gcc/testsuite/gfortran.dg/g77/960317-1.f
UNKNOWN-203     gcc/testsuite/sarif-replay.dg/2.1.0-valid/tutorial-example.sarif
UNKNOWN-204     libcpp/po/ca.po
UNKNOWN-205     libcpp/po/cpplib.pot
UNKNOWN-206     libcpp/po/da.po
UNKNOWN-207     libcpp/po/de.po
UNKNOWN-208     libcpp/po/eo.po
UNKNOWN-209     libcpp/po/es.po
UNKNOWN-210     libcpp/po/fi.po
UNKNOWN-211     libcpp/po/fr.po
UNKNOWN-212     libcpp/po/id.po
UNKNOWN-213     libcpp/po/ja.po
UNKNOWN-214     libcpp/po/ka.po
UNKNOWN-215     libcpp/po/lv.po
UNKNOWN-216     libcpp/po/nl.po
UNKNOWN-217     libcpp/po/pt_BR.po
UNKNOWN-218     libcpp/po/ro.po
UNKNOWN-219     libcpp/po/ru.po
UNKNOWN-220     libcpp/po/sr.po
UNKNOWN-221     libcpp/po/sv.po
UNKNOWN-222     libcpp/po/tr.po
UNKNOWN-223     libcpp/po/uk.po
UNKNOWN-224     libcpp/po/vi.po
UNKNOWN-225     libcpp/po/zh_CN.po
UNKNOWN-226     libcpp/po/zh_TW.po
UNKNOWN-227     libgcc/config/m68k/fpgnulib.c
UNKNOWN-228     libphobos/src/etc/c/curl.d
UNKNOWN-229     libphobos/src/std/regex/internal/tests.d
UNKNOWN-230     libstdc++-v3/po/libstdc++.pot
UNKNOWN-231     zlib/contrib/amd64/amd64-match.S
UNKNOWN-232     zlib/doc/rfc1950.txt
UNKNOWN-233     zlib/doc/rfc1951.txt
UNKNOWN-233     zlib/doc/rfc1952.txt
UNKNOWN-234     newlib-4.6.0.20260123/config/gettext.m4
UNKNOWN-235     newlib-4.6.0.20260123/config/lcmessage.m4
UNKNOWN-4       newlib-4.6.0.20260123/config/nls.m4
UNKNOWN-5       newlib-4.6.0.20260123/config/po.m4
UNKNOWN-6       newlib-4.6.0.20260123/config/progtest.m4
UNKNOWN-236     newlib-4.6.0.20260123/libgloss/doc/porting.texi

# files by licence
126356  None
15251   GPL-3+
8190    ACATS-unlimited-rights
7874    BSD-3-clause
6287    GPL-3+ with GCC-exception-3.1
1221    GPL-2+
922     BSL-1.0
799     MIT or Apache-2.0
533     MIT
523     Apache-2.0-with-LLVM-exception
415     ISC-like
303     BSD-2-clause
284     BSD-3-clause~13
252     Zlib
176     BSD-3-clause~2
167     LGPL-2.1+ with libgcc-exception
156     BSD-3-clause~15
151     BSD-3-clause~18
146     public-domain
116     LGPL-2.1+
109     BSD-3-clause~19
107     FSFULLR
86      LGPL-2+
55      MIT~9
49      ISO-M2-implementation
47      GPL-unstated
45      ISC-like~9
39      FSFAP
39      FSFUL
39      Apache-2.0
30      ISC-like~8
28      BSD-3-clause~17
26      BSD-3-clause~5
23      BSD-2-clause~8
19      GPL-2+ with Autoconf-exception
15      BSD-3-clause~14
14      GPL-2+ with special-exception
13      GPL-unstated with exception
11      GFDL-1.3+
11      GPL-3+ and FSFULLR
10      GFDL-1.3+-no-invariants
10      GPL-2+ with libgcc-exception
10      ISC-like~5
10      ISC-like~6
9       GPL-3 with GCC-exception-3.1
9       BSD-3-clause~8
8       GPL-3+ with special-exception
8       LGPL-2.1+ and ISC-like
7       LGPL-2+ with libgcc-exception
7       ISC-like~3
7       BSD-3-clause~22
5       GPL-3
4       GPL-3+ with Autoconf-exception
4       LGPL-3+
4       LGPL-2.1+ and BSD-3-clause~5
4       GPL-3+ and Apache-2.0-with-LLVM-exception
4       BSD-2-clause~2
4       ISC-like~4
3       GPL-2+ with Libtool-exception and FSFULLR
3       GPL-2+ with Libtool-exception
3       GPL-2 with Autoconf-exception
3       GPL-2
3       BSD-3-clause~4
3       LGPL-2.1
3       MIT~7
3       GFDL-1.2+-no-invariants
3       GPL-3+ with GCC-exception-3.1 and BSL-1.0
3       BSD-3-clause~16
3       BSD-2-clause~3
3       BSD-2-clause~5
2       UNKNOWN-4
2       UNKNOWN-5
2       UNKNOWN-6
2       GFDL-1.2+
2       MIT~3
2       UNKNOWN-30
2       GPL-3+ and MIT~2
2       GPL-3+ with libgcc-exception
2       BSD-3-clause~11
2       BSL-1.0 and Apache-2.0-with-LLVM-exception
2       UNKNOWN-233
2       BSD-3-clause~23
2       ISC-like~10
1       BSD-4-clause
1       UNKNOWN-1
1       UNKNOWN-2
1       UNKNOWN-3
1       GPL-1
1       MIT~2
1       GPL-3+ with GCC-exception-3.1 and BSD-3-clause~2
1       BSD-3-clause~3
1       UNKNOWN-7
1       UNKNOWN-8
1       UNKNOWN-9
1       UNKNOWN-10
1       UNKNOWN-11
1       UNKNOWN-12
1       UNKNOWN-13
1       UNKNOWN-14
1       UNKNOWN-15
1       UNKNOWN-16
1       UNKNOWN-17
1       UNKNOWN-18
1       UNKNOWN-19
1       UNKNOWN-20
1       UNKNOWN-21
1       UNKNOWN-22
1       UNKNOWN-23
1       UNKNOWN-24
1       UNKNOWN-25
1       UNKNOWN-26
1       UNKNOWN-27
1       UNKNOWN-28
1       UNKNOWN-29
1       UNKNOWN-31
1       UNKNOWN-32
1       UNKNOWN-33
1       UNKNOWN-34
1       UNKNOWN-35
1       UNKNOWN-36
1       UNKNOWN-37
1       UNKNOWN-38
1       UNKNOWN-39
1       UNKNOWN-40
1       UNKNOWN-41
1       UNKNOWN-42
1       UNKNOWN-43
1       UNKNOWN-44
1       UNKNOWN-45
1       UNKNOWN-46
1       MIT~4
1       MIT~5
1       UNKNOWN-47
1       UNKNOWN-48
1       UNKNOWN-49
1       MIT~6
1       UNKNOWN-50
1       UNKNOWN-51
1       UNKNOWN-52
1       UNKNOWN-53
1       UNKNOWN-54
1       UNKNOWN-55
1       UNKNOWN-56
1       UNKNOWN-57
1       UNKNOWN-58
1       UNKNOWN-59
1       UNKNOWN-60
1       UNKNOWN-61
1       UNKNOWN-62
1       UNKNOWN-63
1       UNKNOWN-64
1       UNKNOWN-65
1       UNKNOWN-66
1       UNKNOWN-67
1       UNKNOWN-68
1       UNKNOWN-69
1       UNKNOWN-70
1       UNKNOWN-71
1       UNKNOWN-72
1       UNKNOWN-73
1       UNKNOWN-74
1       UNKNOWN-75
1       UNKNOWN-76
1       UNKNOWN-77
1       UNKNOWN-78
1       UNKNOWN-79
1       UNKNOWN-80
1       UNKNOWN-81
1       UNKNOWN-82
1       UNKNOWN-83
1       UNKNOWN-84
1       UNKNOWN-85
1       UNKNOWN-86
1       UNKNOWN-87
1       UNKNOWN-88
1       UNKNOWN-89
1       UNKNOWN-90
1       UNKNOWN-91
1       UNKNOWN-92
1       UNKNOWN-93
1       UNKNOWN-94
1       UNKNOWN-95
1       UNKNOWN-96
1       UNKNOWN-97
1       UNKNOWN-98
1       UNKNOWN-99
1       UNKNOWN-100
1       UNKNOWN-101
1       UNKNOWN-102
1       UNKNOWN-103
1       UNKNOWN-104
1       UNKNOWN-105
1       UNKNOWN-106
1       UNKNOWN-107
1       UNKNOWN-108
1       UNKNOWN-109
1       UNKNOWN-110
1       UNKNOWN-111
1       UNKNOWN-112
1       UNKNOWN-113
1       UNKNOWN-114
1       UNKNOWN-115
1       UNKNOWN-116
1       UNKNOWN-117
1       UNKNOWN-118
1       UNKNOWN-119
1       UNKNOWN-120
1       UNKNOWN-121
1       UNKNOWN-122
1       UNKNOWN-123
1       UNKNOWN-124
1       UNKNOWN-125
1       UNKNOWN-126
1       UNKNOWN-127
1       UNKNOWN-128
1       UNKNOWN-129
1       UNKNOWN-130
1       UNKNOWN-131
1       UNKNOWN-132
1       UNKNOWN-133
1       UNKNOWN-134
1       UNKNOWN-135
1       UNKNOWN-136
1       UNKNOWN-137
1       UNKNOWN-138
1       UNKNOWN-139
1       UNKNOWN-140
1       UNKNOWN-141
1       UNKNOWN-142
1       UNKNOWN-143
1       UNKNOWN-144
1       UNKNOWN-145
1       UNKNOWN-146
1       UNKNOWN-147
1       UNKNOWN-148
1       UNKNOWN-149
1       UNKNOWN-150
1       UNKNOWN-151
1       UNKNOWN-152
1       UNKNOWN-153
1       UNKNOWN-154
1       UNKNOWN-155
1       UNKNOWN-156
1       UNKNOWN-157
1       UNKNOWN-158
1       UNKNOWN-159
1       UNKNOWN-160
1       UNKNOWN-161
1       UNKNOWN-162
1       UNKNOWN-163
1       UNKNOWN-164
1       UNKNOWN-165
1       UNKNOWN-166
1       UNKNOWN-167
1       UNKNOWN-168
1       UNKNOWN-169
1       UNKNOWN-170
1       UNKNOWN-171
1       UNKNOWN-172
1       UNKNOWN-173
1       UNKNOWN-174
1       UNKNOWN-175
1       UNKNOWN-176
1       UNKNOWN-177
1       UNKNOWN-178
1       UNKNOWN-179
1       UNKNOWN-180
1       UNKNOWN-181
1       UNKNOWN-182
1       UNKNOWN-183
1       UNKNOWN-184
1       UNKNOWN-185
1       UNKNOWN-186
1       UNKNOWN-187
1       UNKNOWN-188
1       UNKNOWN-189
1       UNKNOWN-190
1       UNKNOWN-191
1       UNKNOWN-192
1       UNKNOWN-193
1       UNKNOWN-194
1       UNKNOWN-195
1       UNKNOWN-196
1       UNKNOWN-197
1       UNKNOWN-198
1       UNKNOWN-199
1       UNKNOWN-200
1       UNKNOWN-201
1       BSD-3-clause~6
1       UNKNOWN-202
1       UNKNOWN-203
1       BSD-3-clause~7
1       UNKNOWN-204
1       UNKNOWN-205
1       UNKNOWN-206
1       UNKNOWN-207
1       UNKNOWN-208
1       UNKNOWN-209
1       UNKNOWN-210
1       UNKNOWN-211
1       UNKNOWN-212
1       UNKNOWN-213
1       UNKNOWN-214
1       UNKNOWN-215
1       UNKNOWN-216
1       UNKNOWN-217
1       UNKNOWN-218
1       UNKNOWN-219
1       UNKNOWN-220
1       UNKNOWN-221
1       UNKNOWN-222
1       UNKNOWN-223
1       UNKNOWN-224
1       UNKNOWN-225
1       UNKNOWN-226
1       LGPL-3+ with GCC-exception-3.1
1       UNKNOWN-227
1       LGPL-3+ and BSD-3-clause
1       BSD-3-clause~9
1       BSD-3-clause~10
1       MIT~8
1       GPL-3+ with GCC-exception-3.1 and FSFULLR
1       UNKNOWN-228
1       UNKNOWN-229
1       GPL-3+ with GCC-exception-3.1 and Apache-2.0-with-LLVM-exception
1       UNKNOWN-230
1       Zlib~2
1       GPL-2+ with GNAT-exception
1       UNKNOWN-231
1       UNKNOWN-232
1       BSD-3-clause~12
1       UNKNOWN-234
1       UNKNOWN-235
1       UNKNOWN-236
1       ISC-like~2
1       BSD-3-clause~20
1       BSD-3-clause~21
1       BSD-2-clause~4
1       BSD-3-clause~24
1       BSD-2-clause~6
1       BSD-2-clause~7
1       ISC-like~7
1       BSD-3-clause~25
1       ISC-like~11
1       ISC-like~12
1       ISC-like~13
1       ISC-like~14
1       ISC-like~15
1       ISC-like~16
1       ISC-like~17
1       ISC-like~18
1       ISC-like~19
1       BSD-2-clause~9

Reply via email to