Beispiel #1
0
def load_package_group(path):
    """Load a package group.

    Args:
        path (str): Path to the root of the package group.

    Returns:
        PackageGroup
    """
    package_group = repounits.PackageGroup(path)
    package_group.mem = set(
        _load_lsv(
            os.path.join(package_group.path, 'group',
                         package_group.name + '.mem')))
    package_group.dep = set(
        _load_lsv(
            os.path.join(package_group.path, 'group',
                         package_group.name + '.dep')))

    package_group.opts = _load_opts(
        os.path.join(package_group.path, 'group',
                     package_group.name + '.opts'))
    package_group.defs = _load_opts(
        os.path.join(package_group.path, 'group',
                     package_group.name + '.defs'))
    package_group.cap = _load_opts(
        os.path.join(package_group.path, 'group', package_group.name + '.cap'))

    return package_group
Beispiel #2
0
    def test_load_package_group(self):
        opts_str = """*                   _   OPTS_FILE       = gr3.opts

*       _   COMPONENT_BDEBUILD_CFLAGS      = -DGR3_OPTS_C
*       _   COMPONENT_BDEBUILD_CXXFLAGS    = -DGR3_OPTS_CXX
*       _   COMPONENT_BDEBUILD_LDFLAGS     = -DGR3_OPTS_LD

*       _   TESTDRIVER_BDEBUILD_CFLAGS     = -DTEST_GR3_OPTS_C
*       _   TESTDRIVER_BDEBUILD_CXXFLAGS   = -DTEST_GR3_OPTS_CXX
*       _   TESTDRIVER_BDEBUILD_LDFLAGS    = -DTEST_GR3_OPTS_LD
"""
        defs_str = """*                   _   OPTS_FILE       = gr3.defs

*       _   COMPONENT_BDEBUILD_CFLAGS      = -DGR3_C
*       _   COMPONENT_BDEBUILD_CXXFLAGS    = -DGR3_CXX
*       _   COMPONENT_BDEBUILD_LDFLAGS     = -DGR3_LD

*       _   TESTDRIVER_BDEBUILD_CFLAGS     = -DTEST_GR3_C
*       _   TESTDRIVER_BDEBUILD_CXXFLAGS   = -DTEST_GR3_CXX
*       _   TESTDRIVER_BDEBUILD_LDFLAGS    = -DTEST_GR3_LD
"""
        cap_str = """ !! unix  _  CAPABILITY = ALWAYS
"""

        path = os.path.join(self.repo_root, 'groups', 'gr3')
        group = repoloadutil.load_package_group(path)

        exp_group = repounits.PackageGroup(path)
        exp_group.mem = set(['gr3p1', 'gr3p2'])
        exp_group.dep = set(['extlib1', 'gr2', 'gr1'])
        exp_group.opts = self._parse_opts_str(opts_str)
        exp_group.defs = self._parse_opts_str(defs_str)
        exp_group.cap = self._parse_opts_str(cap_str)
        self.assertEqual(group, exp_group)
Beispiel #3
0
    def test_get_uor_doc(self):
        group_path = os.path.join(self.repo_root, 'groups', 'gr1')
        group = repounits.PackageGroup(group_path)

        doc = repoloadutil.get_uor_doc(group)
        exp_doc = repounits.UorDoc('GRoup 1 (gr1)',
                                   'Provide a test package group.')

        self.assertEqual(doc, exp_doc)

        group_path = os.path.join(self.repo_root, 'groups', 'gr2')
        group = repounits.PackageGroup(group_path)

        doc = repoloadutil.get_uor_doc(group)
        exp_doc = repounits.UorDoc('gr2', 'N/A')

        self.assertEqual(doc, exp_doc)