aboutsummaryrefslogtreecommitdiff
blob: e8693ceefe3e6f854887c5f3ac97cfd32d39c5c9 (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
"""Subroutines with repositories"""
from os import path

import portage

rsets = portage.db[portage.root]['vartree'].settings.repositories

def portage_repos():
    for repo in rsets.prepos_order:
        yield repo

def portage_repo_path(repo):
    """Get the path of a given portage repository"""
    if repo in rsets.prepos_order:
        return rsets.prepos[repo].location
    return None

def pomu_status(repo_path):
    """Check if pomu is enabled for a repository at a given path"""
    return path.isdir(path.join(repo_path, 'metadata', 'pomu'))

def pomu_active_repo():
    for repo in portage_repos():
        if pomu_status(portage_repo_path(repo)):
            return repo
    return None