buildbot_multibuild/lib/renderers.py

80 lines
2.4 KiB
Python
Raw Permalink Normal View History

2021-12-23 08:01:52 +00:00
from buildbot.plugins import util
import re
def _is_build_script_available(props):
return props.getProperty("build_script_available", default=False)
2021-12-23 08:01:52 +00:00
@util.renderer
2021-12-25 06:57:44 +00:00
def is_build_script_available(props):
return _is_build_script_available(props)
2021-12-23 08:01:52 +00:00
@util.renderer
2021-12-25 06:57:44 +00:00
def isnt_build_script_available(props):
return not _is_build_script_available(props)
2021-12-23 08:01:52 +00:00
def _is_test_script_available(props):
return props.getProperty("test_script_available", default=False)
2021-12-23 08:01:52 +00:00
@util.renderer
2021-12-25 06:57:44 +00:00
def is_test_script_available(props):
return _is_test_script_available(props)
2021-12-23 08:01:52 +00:00
@util.renderer
2021-12-25 06:57:44 +00:00
def isnt_test_script_available(props):
return not _is_test_script_available(props)
2022-08-08 03:21:33 +00:00
def _files_to_upload(props):
2022-08-08 08:20:14 +00:00
try:
return ','.join(props.getProperty("files_to_upload", default="").rstrip().split("\n"))
except AttributeError:
return ""
2022-08-08 03:21:33 +00:00
2022-08-08 03:40:59 +00:00
@util.renderer
2022-08-08 03:21:33 +00:00
def files_to_upload(props):
2022-08-08 08:20:14 +00:00
return _files_to_upload(props)
@util.renderer
def has_files_to_upload(props):
return bool(_files_to_upload(props))
2022-08-08 03:21:33 +00:00
2022-08-08 03:40:59 +00:00
@util.renderer
2022-08-08 03:21:33 +00:00
def no_files_to_upload(props):
return not _files_to_upload(props)
2024-03-29 08:46:07 +00:00
def _should_build_sign(props):
if props.getProperty('branch') == 'v0.6' \
and props.getProperty('jobname') == 'android' \
and props.getProperty('repository') in (
'git@github.com:Bitmessage/PyBitmessage.git',
'https://github.com/Bitmessage/PyBitmessage'
):
return True
return False
@util.renderer
def should_build_sign(props):
return _is_build_script_available(props) and _should_build_sign(props)
@util.renderer
def shouldnt_build_sign(props):
return _is_build_script_available(props) and not _should_build_sign(props)
@util.renderer
def build_env(props):
default_envs = {
2024-03-29 10:09:58 +00:00
"BUILDBOT_REPOSITORY": props.getProperty("repository"),
"BUILDBOT_BRANCH": props.getProperty("branch"),
2024-03-29 10:14:27 +00:00
"BUILDBOT_JOBNAME": props.getProperty("jobname")
2024-03-29 08:46:07 +00:00
}
new_envs = {}
if props.getProperty("jobname", default="") == "android":
new_envs = {
"P4A_RELEASE_KEYSTORE": "/var/lib/buildbot/keystore",
"P4A_RELEASE_KEYSTORE_PASSWD": util.Secret("bitmessage-keystore"),
"P4A_RELEASE_KEYALIAS_PASSWD": util.Secret("bitmessage-keystore"),
"P4A_RELEASE_KEYALIAS": "bitmessagetest"
}
if _should_build_sign(props):
return {**default_envs, **new_envs}
return default_envs