File: fasofstats.py

package info (click to toggle)
botch 0.24-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,084,624 kB
  • sloc: xml: 11,924,892; ml: 4,489; python: 3,890; sh: 1,268; makefile: 334
file content (39 lines) | stat: -rwxr-xr-x 878 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3

from __future__ import print_function
import sys

sys.path.append("/usr/share/botch")
from util import read_json_file


# string of package
def sos(srcpkg):
    name, ver = srcpkg
    return "src:" + name


def sob(binpkg):
    name, arch, ver = binpkg
    return name


# string of list
def sobl(L):
    return " ".join([sob(pkg) for pkg in L])


if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(
        description=("extract feedback arc set from stats.json")
    )
    parser.add_argument(
        "stats", metavar="stats.json", type=read_json_file, help="input json"
    )
    parser.add_argument("-v", "--verbose", action="store_true", help="be verbose")
    args = parser.parse_args()
    for scc in args.stats["buildgraph"]["sccs"]:
        for src, deps in scc["fas"]:
            print(sos(src), sobl(deps))