Example #1
0
def _bz_acls_cached(name=None, out_format='text'):
    '''Return the package attributes used by bugzilla.

    :kwarg collection: Name of the bugzilla collection to gather data on.
    :kwarg out_format: Specify if the output if text or json.

    Note: The data returned by this function is for the way the current
    Fedora bugzilla is setup as of (2007/6/25).  In the future, bugzilla
    may change to have separate products for each collection-version.
    When that happens we'll have to change what this function returns.

    The returned data looks like this:

    bugzillaAcls[collection][package].attribute
    attribute is one of:
        :owner: FAS username for the owner
        :qacontact: if the package has a special qacontact, their userid
            is listed here
        :summary: Short description of the package
        :cclist: list of FAS userids that are watching the package
    '''

    packages = pkgdblib.bugzilla(session=SESSION, name=name)

    output = []
    if out_format == 'json':
        output = {
            'bugzillaAcls': {},
            'title': 'Fedora Package Database -- Bugzilla ACLs'
        }

    for clt in sorted(packages):
        for pkg in sorted(packages[clt]):
            if out_format == 'json':
                user = []
                group = []
                for ppl in packages[clt][pkg]['cc'].split(','):
                    if ppl.startswith('group::'):
                        group.append(ppl)
                    elif ppl:
                        user.append(ppl)
                poc = packages[clt][pkg]['poc']
                if poc.startswith('group::'):
                    poc = poc.replace('group::', '@')
                if clt not in output['bugzillaAcls']:
                    output['bugzillaAcls'][clt] = {}
                output['bugzillaAcls'][clt][pkg] = {
                    'owner': poc,
                    'cclist': {
                        'groups': group,
                        'people': user,
                    },
                    'qacontact': None,
                    'summary': packages[clt][pkg]['summary']
                }
            else:
                output.append(
                    '%(collection)s|%(name)s|%(summary)s|%(poc)s|%(qa)s'
                    '|%(cc)s' % (packages[clt][pkg]))
    return output
Example #2
0
def _bz_acls_cached(name=None, out_format='text'):
    '''Return the package attributes used by bugzilla.

    :kwarg collection: Name of the bugzilla collection to gather data on.
    :kwarg out_format: Specify if the output if text or json.

    Note: The data returned by this function is for the way the current
    Fedora bugzilla is setup as of (2007/6/25).  In the future, bugzilla
    may change to have separate products for each collection-version.
    When that happens we'll have to change what this function returns.

    The returned data looks like this:

    bugzillaAcls[collection][package].attribute
    attribute is one of:
        :owner: FAS username for the owner
        :qacontact: if the package has a special qacontact, their userid
            is listed here
        :summary: Short description of the package
        :cclist: list of FAS userids that are watching the package
    '''

    packages = pkgdblib.bugzilla(
        session=SESSION,
        name=name)

    output = []
    if out_format == 'json':
        output = {'bugzillaAcls': {},
                  'title': 'Fedora Package Database -- Bugzilla ACLs'}

    for clt in sorted(packages):
        for pkg in sorted(packages[clt]):
            if out_format == 'json':
                user = []
                group = []
                for ppl in packages[clt][pkg]['cc'].split(','):
                    if ppl.startswith('group::'):
                        group.append(ppl)
                    elif ppl:
                        user.append(ppl)
                poc = packages[clt][pkg]['poc']
                if poc.startswith('group::'):
                    poc = poc.replace('group::', '@')
                if clt not in output['bugzillaAcls']:
                    output['bugzillaAcls'][clt] = {}
                output['bugzillaAcls'][clt][pkg] = {
                    'owner': poc,
                    'cclist': {
                        'groups': group,
                        'people': user,
                    },
                    'qacontact': None,
                    'summary': packages[clt][pkg]['summary']
                }
            else:
                output.append(
                    '%(collection)s|%(name)s|%(summary)s|%(poc)s|%(qa)s'
                    '|%(cc)s' % (packages[clt][pkg])
                )
    return output