Repository: sclorg/spec2scl

Issue:
Provides: bundled should not have scl prefix
Originally reported by: **Anonymous**

----------------------------------------

Provides: %{?scl_prefix}bundled(libname)
should be
Provides: bundled(libname)

----------------------------------------
- Bitbucket: https://bitbucket.org/bkabrda/spec2scl/issue/18


Comments:

Patch:
diff --git a/spec2scl/transformers/generic.py b/spec2scl/transformers/generic.py
index dcf3615..622d004 100644
--- a/spec2scl/transformers/generic.py
+++ b/spec2scl/transformers/generic.py
@@ -17,7 +17,7 @@ class GenericTransformer(transformer.Transformer):
 
     @matches(r'(?<!d)(Conflicts:\s*)([^\s]+)', sections=settings.METAINFO_SECTIONS)  # avoid BuildConflicts
     @matches(r'(BuildConflicts:\s*)([^\s]+)', sections=settings.METAINFO_SECTIONS)
-    @matches(r'(Provides:\s*)([^\s]+)', sections=settings.METAINFO_SECTIONS)
+    @matches(r'(Provides:\s*)(?!bundled\()([^\s]+)', sections=settings.METAINFO_SECTIONS)
     @matches(r'(Obsoletes:\s*)([^\s]+)', sections=settings.METAINFO_SECTIONS)
     def handle_dependency_tag(self, original_spec, pattern, text, scl_deps_effect=False):
         tag = text[0:text.find(':') + 1]
@@ -45,7 +45,7 @@ class GenericTransformer(transformer.Transformer):
     @matches(r'(?<!d)(Requires:\s*)(?!\w*/\w*)([^[\s]+)', sections=settings.METAINFO_SECTIONS)  # avoid BuildRequires
     @matches(r'(BuildRequires:\s*)(?!\w*/\w*)([^\s]+)', sections=settings.METAINFO_SECTIONS)
     def handle_dependency_tag_modified_by_list(self, original_spec, pattern, text):
-        return self.handle_dependency_tag(pattern, original_spec, text, True)
+        return self.handle_dependency_tag(original_spec, pattern, text, True)
 
     @matches(r'(%package\s+-n\s+)([^\s]+)', sections=['%package'])
     @matches(r'(%description\s+-n\s+)([^\s]+)', sections=['%description'])


Test patch:
diff --git a/tests/test_generic_transformer.py b/tests/test_generic_transformer.py
index 30c7114..98f043c 100644
--- a/tests/test_generic_transformer.py
+++ b/tests/test_generic_transformer.py
@@ -23,13 +23,17 @@ class TestGenericTransformer(TransformerTestCase):
         ('Conflicts:spam', 'Conflicts:%{?scl_prefix}spam'),
         ('BuildConflicts: \t spam', 'BuildConflicts: \t %{?scl_prefix}spam'),
         ('Provides: spam < 3.0', 'Provides: %{?scl_prefix}spam < 3.0'),
+        ('Provides: bundled(libname)', 'Provides: bundled(libname)'),
         ('Conflicts: spam > 2.0-1', 'Conflicts: %{?scl_prefix}spam > 2.0-1'),
         ('Obsoletes: spam, blah, foo', 'Obsoletes: %{?scl_prefix}spam, %{?scl_prefix}blah, %{?scl_prefix}foo'),
         ('Obsoletes: spam blah foo', 'Obsoletes: %{?scl_prefix}spam %{?scl_prefix}blah %{?scl_prefix}foo'),
     ])
     def test_handle_dependency_tag(self, spec, expected):
-        handler = self.t.handle_dependency_tag
-        assert self.t.handle_dependency_tag(spec, self.get_pattern_for_spec(handler, spec), spec) == expected
+        pattern = self.get_pattern_for_spec(self.t.handle_dependency_tag, spec)
+        if pattern:
+            assert self.t.handle_dependency_tag(spec, pattern, spec) == expected
+        else:
+            assert spec == expected
 
     @pytest.mark.parametrize(('spec', 'expected'), [
         ('Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))',