]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/opentelemetry-cpp/third_party/prometheus-cpp/3rdparty/civetweb/conan/build.py
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / third_party / prometheus-cpp / 3rdparty / civetweb / conan / build.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import os
5 import re
6 from cpt.packager import ConanMultiPackager
7 from cpt.ci_manager import CIManager
8 from cpt.printer import Printer
9
10
11 class BuilderSettings(object):
12
13 @property
14 def branch(self):
15 """ Get branch name
16 """
17 printer = Printer(None)
18 ci_manager = CIManager(printer)
19 return ci_manager.get_branch()
20
21 @property
22 def username(self):
23 """ Set civetweb as package's owner
24 """
25 return os.getenv("CONAN_USERNAME", "civetweb")
26
27 @property
28 def upload(self):
29 """ Set civetweb repository to be used on upload.
30 The upload server address could be customized by env var
31 CONAN_UPLOAD. If not defined, the method will check the branch name.
32 Only master or CONAN_STABLE_BRANCH_PATTERN will be accepted.
33 The master branch will be pushed to testing channel, because it does
34 not match the stable pattern. Otherwise it will upload to stable
35 channel.
36 """
37 if os.getenv("CONAN_UPLOAD", None) is not None:
38 return os.getenv("CONAN_UPLOAD")
39
40 prog = re.compile(self.stable_branch_pattern)
41 if self.branch and prog.match(self.branch):
42 return "https://api.bintray.com/conan/civetweb/conan"
43
44 return None
45
46 @property
47 def upload_only_when_stable(self):
48 """ Force to upload when match stable pattern branch
49 """
50 return os.getenv("CONAN_UPLOAD_ONLY_WHEN_STABLE", True)
51
52 @property
53 def stable_branch_pattern(self):
54 """ Only upload the package the branch name is like a tag
55 """
56 return os.getenv("CONAN_STABLE_BRANCH_PATTERN", r"v(\d+\.\d+)")
57
58 @property
59 def version(self):
60 regex = re.compile(self.stable_branch_pattern)
61 match = regex.match(self.branch)
62 if match:
63 return match.group(1)
64 return "latest"
65
66 @property
67 def reference(self):
68 """ Read project version from branch name to create Conan referece
69 """
70 return os.getenv("CONAN_REFERENCE", "civetweb/{}".format(self.version))
71
72 if __name__ == "__main__":
73 settings = BuilderSettings()
74 builder = ConanMultiPackager(
75 reference=settings.reference,
76 username=settings.username,
77 upload=settings.upload,
78 upload_only_when_stable=settings.upload_only_when_stable,
79 stable_branch_pattern=settings.stable_branch_pattern,
80 test_folder=os.path.join("conan", "test_package"))
81 builder.add_common_builds(pure_c=False)
82 builder.run()