diff --git a/.gitignore b/.gitignore index 54898a7..bf7dd24 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ gitpoller-workdir/ *.pyproject.user.* *~ +*.autosave diff --git a/BuildBotLib/BuildBot.pyproject b/BuildBotLib/BuildBot.pyproject index 0fa7d00..a0753bd 100644 --- a/BuildBotLib/BuildBot.pyproject +++ b/BuildBotLib/BuildBot.pyproject @@ -20,9 +20,7 @@ "buildBotChangeSource.py", "qtUpdater.py", "secretManager.py", - "NPM.py", "git/gitBin.sh", - "asssetsinstaller.py", "qifRepogen.py", "docs.py" ] diff --git a/BuildBotLib/NPM.py b/BuildBotLib/NPM.py deleted file mode 100644 index 5464145..0000000 --- a/BuildBotLib/NPM.py +++ /dev/null @@ -1,9 +0,0 @@ -# This Python file uses the following encoding: utf-8 - -from BuildBotLib.basemodule import BaseModule - - -class NPM(BaseModule): - - def __init__(self): - BaseModule.__init__(self) diff --git a/BuildBotLib/asssetsinstaller.py b/BuildBotLib/asssetsinstaller.py deleted file mode 100644 index 6e741ef..0000000 --- a/BuildBotLib/asssetsinstaller.py +++ /dev/null @@ -1,150 +0,0 @@ -# This Python file uses the following encoding: utf-8 - -from BuildBotLib.basemodule import BaseModule -from buildbot.plugins import util, steps -import os -from pathlib import Path - - -class AsssetsInstaller(BaseModule): - def __init__(self): - BaseModule.__init__(self) - - format = "" - - AndroidBaseDir = str(Path.home()) + "/Android" - - def isInit(self, step): - return step.getProperty('module') == 'init' - - def RemoveOldData(self, props): - - cmd = "mkdir -p " + self.AndroidBaseDir - - if os.path.exists(self.AndroidBaseDir): - cmd = "rm -rdf " + self.AndroidBaseDir + " ; " + cmd - - return self.generateCmd(cmd) - - def NDKDownloadCMD(self, props): - link = props.getProperty("link") - - self.format = link[link.rfind('.'):].lower() - - return ["curl", - link, - "--output", - self.AndroidBaseDir + "/temp" + self.format] - - def ExtractCMD(self, props): - - res = ["echo", "format '" + self.format + "' not supported"] - - if self.format == ".zip": - res = ["unzip", self.AndroidBaseDir + "/temp" + self.format, - "-d", self.AndroidBaseDir] - - return res - - def InstallCMD(self, props): - - module = props.getProperty("module") - version = props.getProperty("version") - - unit_to_multiplier = { - 'SDK': ["platform-tools", "tools", "platforms;android-"+version], - 'NDK': ['ndk-bundle'] - } - - return ["sdkmanager"] + unit_to_multiplier.get(module, "--list") - - def ConfigureCMD(self, props): - - res = ["echo", "Configure failed"] - - if self.format == ".zip": - - all_subdirs = self.allSubdirsOf(self.AndroidBaseDir) - latest_subdir = max(all_subdirs, key=os.path.getmtime) - res = "mv " + latest_subdir + " " + self.AndroidBaseDir + "/tools" - res += " ; ln -sf " - res += self.AndroidBaseDir + "/tools/bin/sdkmanager " - res += self.home + "/.local/bin/sdkmanager" - res += " ; yes | sdkmanager --licenses" - - return self.generateCmd(res) - - def getFactory(self): - factory = super().getFactory() - - factory.addStep( - steps.ShellCommand( - command=self.getWraper(self.RemoveOldData), - name='rm old item', - doStepIf=self.getWraper(self.isInit), - description='rm old', - haltOnFailure=True, - ) - ) - - factory.addStep( - steps.ShellCommand( - command=self.getWraper(self.NDKDownloadCMD), - name='download new item', - doStepIf=self.getWraper(self.isInit), - description='download new item', - haltOnFailure=True, - ) - ) - - factory.addStep( - steps.ShellCommand( - command=self.getWraper(self.ExtractCMD), - name='extract new item', - doStepIf=self.getWraper(self.isInit), - description='extract new item', - haltOnFailure=True, - ) - ) - - factory.addStep( - steps.ShellCommand( - command=self.getWraper(self.ConfigureCMD), - name='configure new item', - doStepIf=self.getWraper(self.isInit), - description='configure new item', - haltOnFailure=True, - ) - ) - - factory.addStep( - steps.ShellCommand( - command=self.getWraper(self.InstallCMD), - name='install module', - doStepIf=lambda step: not self.isInit(step), - description='configure new item', - haltOnFailure=True, - ) - ) - - return factory - - def getPropertyes(self): - return [ - util.ChoiceStringParameter( - name='module', - choices=["init", "SDK", "NDK"], - default="init" - ), - - util.StringParameter( - name='link', - label="url to download item", - default="" - ), - util.StringParameter( - name='version', - label="Version", - default="" - ), - ] diff --git a/BuildBotLib/buildBotChangeSource.py b/BuildBotLib/buildBotChangeSource.py index 6b4347e..10622df 100644 --- a/BuildBotLib/buildBotChangeSource.py +++ b/BuildBotLib/buildBotChangeSource.py @@ -1,13 +1,14 @@ # This Python file uses the following encoding: utf-8 from BuildBotLib.buildBotModule import BuildBotModule from BuildBotLib.secretManager import SecretManager +from pathlib import Path class BuildBotChangeSource(BuildBotModule): def __init__(self, masterConf): BuildBotModule.__init__(self, masterConf) - secret = SecretManager("/home/andrei/buildBotSecret/secret.json") + secret = SecretManager(str(Path.home()) + "/buildBotSecret/secret.json") self.masterConf['www']['change_hook_dialects'] = { 'github':