Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision 1b57c8e01a682145f576e101c868ba84ea38ec1b authored by ah744 on 06 August 2016, 01:41:28 UTC, committed by ah744 on 06 August 2016, 01:41:28 UTC
Fixed Rotation Decomposition Naming and BF Type Mismatch
1 parent 2eae3de
  • Files
  • Changes
  • 0c74162
  • /
  • clang
  • /
  • utils
  • /
  • SummarizeErrors
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:1b57c8e01a682145f576e101c868ba84ea38ec1b
directory badge
swh:1:dir:71f289464edb10a7ce95933f4968a5be3132032e
content badge
swh:1:cnt:b6e9122b74cfffed364dce52bd533b3875cdb941

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
SummarizeErrors
#!/usr/bin/env python

import os, sys, re

class multidict:
    def __init__(self, elts=()):
        self.data = {}
        for key,value in elts:
            self[key] = value
    
    def __getitem__(self, item):
        return self.data[item]
    def __setitem__(self, key, value):
        if key in self.data:
            self.data[key].append(value)
        else:
            self.data[key] = [value]
    def items(self):
        return self.data.items()
    def values(self):
        return self.data.values()
    def keys(self):
        return self.data.keys()
    def __len__(self):
        return len(self.data)

kDiagnosticRE = re.compile(': (error|warning): (.*)')
kAssertionRE = re.compile('Assertion failed: (.*, function .*, file .*, line [0-9]+\\.)')

def readInfo(path, opts):
    lastProgress = [-100,0]
    def progress(pos):
        pct = (100. * pos) / (size * 2)
        if (pct - lastProgress[0]) >= 10:
            lastProgress[0] = pct
            print '%d/%d = %.2f%%' % (pos, size*2, pct)

    f = open(path)
    data = f.read()
    f.close()

    if opts.truncate != -1:
        data = data[:opts.truncate]

    size = len(data)
    warnings = multidict()
    errors = multidict()
    for m in kDiagnosticRE.finditer(data):
        progress(m.end())
        if m.group(1) == 'error':
            d = errors
        else:
            d = warnings
        d[m.group(2)] = m
    warnings = warnings.items()
    errors = errors.items()
    assertions = multidict()
    for m in kAssertionRE.finditer(data):
        print '%d/%d = %.2f%%' % (size + m.end(), size, (float(m.end()) / (size*2)) * 100.)
        assertions[m.group(1)] = m
    assertions = assertions.items()

    # Manual scan for stack traces
    aborts = multidict()
    if 0:
        prevLine = None
        lnIter = iter(data.split('\n'))
        for ln in lnIter:
            m = kStackDumpLineRE.match(ln)
            if m:
                stack = [m.group(2)]
                for ln in lnIter:
                    m = kStackDumpLineRE.match(ln)
                    if not m:
                        break
                    stack.append(m.group(2))
                if prevLine is None or not kAssertionRE.match(prevLine):
                    aborts[tuple(stack)] = stack
            prevLine = ln

    sections = [
        (warnings, 'Warnings'),
        (errors, 'Errors'),
        (assertions, 'Assertions'),
        (aborts.items(), 'Aborts'),
        ]

    if opts.ascending:
        sections.reverse()

    for l,title in sections:
        l.sort(key = lambda (a,b): -len(b))
        if l:
            print '-- %d %s (%d kinds) --' % (sum([len(b) for a,b in l]), title, len(l))
            for name,elts in l:
                print '%5d:' % len(elts), name

def main():
    global options
    from optparse import OptionParser
    parser = OptionParser("usage: %prog [options] {inputs}")
    parser.add_option("", "--ascending", dest="ascending",
                      help="Print output in ascending order of severity.",
                      action="store_true", default=False)
    parser.add_option("", "--truncate", dest="truncate",
                      help="Truncate input file (for testing).",
                      type=int, action="store", default=-1)
    (opts, args) = parser.parse_args()
    
    if not args:
        parser.error('No inputs specified')

    for arg in args:
        readInfo(arg, opts)

if __name__=='__main__':
    main()
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API