File 0001-Add-support-for-Collax-build-recipes.patch of Package obs-service-set_version

From 3c3eb59abd17133c9fec12df06652fc864e6783c Mon Sep 17 00:00:00 2001
From: Jan Engelhardt <jengelh@inai.de>
Date: Tue, 17 Nov 2015 17:13:56 +0100
Subject: [PATCH] Add support for Collax build recipes

---
 set_version | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/set_version b/set_version
index 1b5cb2a..c04bce7 100755
--- a/set_version
+++ b/set_version
@@ -197,7 +197,7 @@ def _replace_tag(filename, tag, string):
     with open(filename, 'r+') as f:
         contents = f.read()
         f.seek(0)
-        if filename.endswith("PKGBUILD"):
+        if filename.endswith("PKGBUILD") or filename.endswith("build.collax"):
             contents_new, subs = re.subn(
                 r"^{tag}=.*".format(tag=tag),
                 r"{tag}={string}".format(tag=tag, string=string), contents,
@@ -337,6 +337,13 @@ if __name__ == '__main__':
         shutil.copyfile(f, filename)
         _replace_debian_changelog_version(filename, version)
 
+    # handle build.collax recipes
+    for f in filter(lambda x: x.endswith(("build.collax")), files):
+        filename = outdir + "/" + f
+        shutil.copyfile(f, filename)
+        _replace_tag(filename, "version", version)
+        _replace_tag(filename, "build", "0")
+
     # handle arch linux PKGBUILD files
     # TODO: Handle the md5sums generation!
     for f in filter(lambda x: x.endswith(("PKGBUILD")), files):
-- 
2.4.3
openSUSE Build Service is sponsored by