diff options
| -rw-r--r-- | obsapi/core.py | 11 | ||||
| -rw-r--r-- | test/test_api.py | 8 |
2 files changed, 19 insertions, 0 deletions
diff --git a/obsapi/core.py b/obsapi/core.py index 58ffb79..443e593 100644 --- a/obsapi/core.py +++ b/obsapi/core.py @@ -389,3 +389,14 @@ class ObsApi(object): etree.SubElement(meta, 'group', groupid=groupid, role=role) return self.put_meta(prj, pkg, etree.tostring(meta)) + + def get_spec_files(self, prj, pkg=None): + if pkg is not None: + pkgs = [pkg] + else: + pkgs = self.ls(prj) + for pkg in pkgs: + d, flist = self.ls(prj, pkg) + for srcfile in flist: + if srcfile.name.endswith('.spec'): + yield self.source.get(prj, pkg, srcfile.name) diff --git a/test/test_api.py b/test/test_api.py index e5a82df..6992492 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -120,3 +120,11 @@ def test_get_groups(): groups = api.get_groups(prj) print groups assert groups == [] + + +def test_get_spec_files(): + for specfile in api.get_spec_files(prj, pkg): + assert 'Name:' in specfile + assert 'Summary:' in specfile + assert '%description' in specfile + assert '%setup' in specfile |
