get last changes of master

This commit is contained in:
Andrei Yankovich 2019-12-26 17:08:56 +03:00
parent 201e18ce1c
commit 43faebf752
4 changed files with 127 additions and 139 deletions

View File

@ -1,57 +1,56 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import BuildBotLib.basemodule as base from BuildBotLib.basemodule import BaseModule
from buildbot.plugins import util, steps from buildbot.plugins import util, steps
import os import os
from pathlib import Path from pathlib import Path
LAST_FORMAT = [""]
AndroidBaseDir = str(Path.home()) + "/Android" class AsssetsInstaller(BaseModule):
MULTIPLE_SH_COMMAND = ["/bin/bash", "-c"] def __init__(self):
BaseModule.__init__(self)
format = ""
def isInit(step): AndroidBaseDir = str(Path.home()) + "/Android"
def isInit(self, step):
return step.getProperty('module') == 'init' return step.getProperty('module') == 'init'
@util.renderer
def RemoveOldData(self, props):
@util.renderer cmd = "mkdir -p " + self.AndroidBaseDir
def RemoveOldData(props):
cmd = "mkdir -p " + AndroidBaseDir if os.path.exists(self.AndroidBaseDir):
cmd = "rm -rdf " + self.AndroidBaseDir + " ; " + cmd
if os.path.exists(AndroidBaseDir): return self.generateCmd(cmd)
cmd = "rm -rdf " + AndroidBaseDir + " ; " + cmd
return MULTIPLE_SH_COMMAND + [cmd] @util.renderer
def NDKDownloadCMD(self, props):
@util.renderer
def NDKDownloadCMD(props):
link = props.getProperty("link") link = props.getProperty("link")
format = link[link.rfind('.'):].lower() self.format = link[link.rfind('.'):].lower()
LAST_FORMAT[0] = format
return ["curl", link, "--output", AndroidBaseDir + "/temp" + format] return ["curl",
link,
"--output",
self.AndroidBaseDir + "/temp" + self.format]
@util.renderer
@util.renderer def ExtractCMD(self, props):
def ExtractCMD(props):
format = LAST_FORMAT[0]
res = ["echo", "format '" + format + "' not supported"] res = ["echo", "format '" + format + "' not supported"]
if format == ".zip": if format == ".zip":
res = ["unzip", AndroidBaseDir + "/temp" + format, res = ["unzip", self.AndroidBaseDir + "/temp" + self.format,
"-d", AndroidBaseDir] "-d", self.AndroidBaseDir]
return res return res
@util.renderer
@util.renderer def InstallCMD(self, props):
def InstallCMD(props):
module = props.getProperty("module") module = props.getProperty("module")
version = props.getProperty("version") version = props.getProperty("version")
@ -63,34 +62,31 @@ def InstallCMD(props):
return ["sdkmanager", unit_to_multiplier.get(module, "--list")] return ["sdkmanager", unit_to_multiplier.get(module, "--list")]
@util.renderer
@util.renderer def ConfigureCMD(self, props):
def ConfigureCMD(props):
format = LAST_FORMAT[0]
res = ["echo", "Configure failed"] res = ["echo", "Configure failed"]
if format == ".zip": if format == ".zip":
all_subdirs = base.allSubdirsOf(AndroidBaseDir) all_subdirs = self.allSubdirsOf(self.AndroidBaseDir)
latest_subdir = max(all_subdirs, key=os.path.getmtime) latest_subdir = max(all_subdirs, key=os.path.getmtime)
res = "mv " + latest_subdir + " " + AndroidBaseDir + "/tools" res = "mv " + latest_subdir + " " + self.AndroidBaseDir + "/tools"
res += " ; ln -sf " + AndroidBaseDir + "/tools/bin/sdkmanager " res += " ; ln -sf "
res += str(Path.home()) + "/.local/bin/sdkmanager" res += self.AndroidBaseDir + "/tools/bin/sdkmanager "
res += self.home + "/.local/bin/sdkmanager"
res += " ; yes | sdkmanager --licenses" res += " ; yes | sdkmanager --licenses"
return MULTIPLE_SH_COMMAND + [res] return self.generateCmd(res)
def getFactory(self):
def getFactory(): factory = super().getFactory()
factory = base.getFactory()
factory.addStep( factory.addStep(
steps.ShellCommand( steps.ShellCommand(
command=RemoveOldData, command=self.RemoveOldData,
name='rm old item', name='rm old item',
doStepIf=isInit, doStepIf=self.isInit,
description='rm old', description='rm old',
haltOnFailure=True, haltOnFailure=True,
) )
@ -98,9 +94,9 @@ def getFactory():
factory.addStep( factory.addStep(
steps.ShellCommand( steps.ShellCommand(
command=NDKDownloadCMD, command=self.NDKDownloadCMD,
name='download new item', name='download new item',
doStepIf=isInit, doStepIf=self.isInit,
description='download new item', description='download new item',
haltOnFailure=True, haltOnFailure=True,
) )
@ -108,9 +104,9 @@ def getFactory():
factory.addStep( factory.addStep(
steps.ShellCommand( steps.ShellCommand(
command=ExtractCMD, command=self.ExtractCMD,
name='extract new item', name='extract new item',
doStepIf=isInit, doStepIf=self.isInit,
description='extract new item', description='extract new item',
haltOnFailure=True, haltOnFailure=True,
) )
@ -118,9 +114,9 @@ def getFactory():
factory.addStep( factory.addStep(
steps.ShellCommand( steps.ShellCommand(
command=ConfigureCMD, command=self.ConfigureCMD,
name='configure new item', name='configure new item',
doStepIf=isInit, doStepIf=self.isInit,
description='configure new item', description='configure new item',
haltOnFailure=True, haltOnFailure=True,
) )
@ -128,9 +124,9 @@ def getFactory():
factory.addStep( factory.addStep(
steps.ShellCommand( steps.ShellCommand(
command=InstallCMD, command=self.InstallCMD,
name='install module', name='install module',
doStepIf=lambda step: not isInit(step), doStepIf=lambda step: not self.isInit(step),
description='configure new item', description='configure new item',
haltOnFailure=True, haltOnFailure=True,
) )
@ -138,12 +134,7 @@ def getFactory():
return factory return factory
def getPropertyes(self):
def getRepo():
return ""
def getPropertyes():
return [ return [
util.ChoiceStringParameter( util.ChoiceStringParameter(
name='module', name='module',

View File

@ -63,14 +63,14 @@ class BaseModule:
return res return res
def allSubdirsOf(b='.'): def allSubdirsOf(self, b='.'):
result = [] result = []
for d in os.listdir(b): for d in os.listdir(b):
bd = os.path.join(b, d) bd = os.path.join(b, d)
if os.path.isdir(bd): if os.path.isdir(bd):
result.append(bd) result.append(bd)
return result return result
@util.renderer @util.renderer
def makeCommand(self, props): def makeCommand(self, props):

View File

@ -284,7 +284,4 @@ class QtUpdater(Make):
label='disable build and install qt (confugure only)', label='disable build and install qt (confugure only)',
default=False default=False
) )
return list;
] ]

View File

@ -6,7 +6,7 @@ from BuildBotLib.buildbot import *
from buildbot.www import authz, auth from buildbot.www import authz, auth
from BuildBotLib.cmake import CMake from BuildBotLib.cmake import CMake
from BuildBotLib.qmake import QMake from BuildBotLib.qmake import QMake
from BuildBotLib.NPM import NPM from BuildBotLib.asssetsinstaller import AsssetsInstaller
from BuildBotLib.qtUpdater import QtUpdater from BuildBotLib.qtUpdater import QtUpdater
# This is a sample buildmaster config file. It must be installed as # This is a sample buildmaster config file. It must be installed as
@ -16,16 +16,16 @@ from BuildBotLib.qtUpdater import QtUpdater
# a shorter alias to save typing. # a shorter alias to save typing.
bot = BuildBot(); bot = BuildBot()
qmake = QMake(); qmake = QMake()
asssetsinstaller = Asssetsinstaller(); asssetsinstaller = AsssetsInstaller()
qtUpdater = QtUpdater(); qtUpdater = QtUpdater()
bot.addBuilder("github-worker", qmake); bot.addBuilder("github-worker", qmake)
bot.addBuilder("Tester", qmake); bot.addBuilder("Tester", qmake)
bot.addBuilder("qtBuilder", qtUpdater); bot.addBuilder("qtBuilder", qtUpdater)
bot.addBuilder("assets-builder", asssetsinstaller); bot.addBuilder("assets-builder", asssetsinstaller)
c = BuildmasterConfig = bot.getMaster() c = BuildmasterConfig = bot.getMaster()