aboutsummaryrefslogtreecommitdiff
blob: 13c36e595c4ace9cb83578ebb89fcea4cd02fb8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""module for extracting packages from a package/architecture list """

from .gentooPackage import gentooPackage as gP

def findPackages (s, arch):
    """ Given a string s,
        and a string arch
        return all gentooPackages from that string that need actioning on that arch """

    packages = []

    for line in s.splitlines():
        if not line:
            continue
        atom, _, arches = line.partition(' ')
        if not arches or arch in arches.split(' '):
            packages.append(gP(atom))

    return(packages)