summaryrefslogtreecommitdiff
path: root/contrib/oeaudit/oe.py
blob: f3326a53385ecdcb7ad102073ccb41f54b88125e (plain)
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
def read_available(filename):
    """
    Parses the output of bitbake -s
    minus the first few lines
    """
    f = open(filename)
    packages = {}

    for line in f:
        if line.startswith("NOTE: ") or line.startswith("Parsing .bb") or line.startswith("done."):
            continue

        # str.split can not be used as we have multiple whitespace
        split = line.split(" ", 1)
        package = split[0]
        rest = split[1].strip()

        # we might have a latest package...
        split = rest.split(" ", 1)
        if len(split) == 2:
            version = split[1].strip()
        else:
            version = split[0]

        packages[package] = version
    return packages