From 5607df30aba17bb832df1c69c04ed488496bdd21 Mon Sep 17 00:00:00 2001 From: "a.yankovich" Date: Fri, 13 Dec 2019 16:09:43 +0300 Subject: [PATCH] added module for installer assets --- .gitignore | 3 ++ BuildBotLib/BuildBot.pyproject | 4 +- BuildBotLib/asssetsinstaller.py | 76 +++++++++++++++++++++++++++++++++ BuildBotLib/buildBotWorkers.py | 3 +- master.cfg | 1 + 5 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 BuildBotLib/asssetsinstaller.py diff --git a/.gitignore b/.gitignore index 6bb50a5..854715a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ gitpoller-workdir/ *.user *__pycache__* *.pyc + +*.pyproject.user.* +*~ diff --git a/BuildBotLib/BuildBot.pyproject b/BuildBotLib/BuildBot.pyproject index 5ffc9f2..370b36e 100644 --- a/BuildBotLib/BuildBot.pyproject +++ b/BuildBotLib/BuildBot.pyproject @@ -18,7 +18,7 @@ "qtUpdater.py", "secretManager.py", "NPM.py", - "git/gitBin.sh" - + "git/gitBin.sh", + "asssetsinstaller.py" ] } diff --git a/BuildBotLib/asssetsinstaller.py b/BuildBotLib/asssetsinstaller.py new file mode 100644 index 0000000..8b3fa80 --- /dev/null +++ b/BuildBotLib/asssetsinstaller.py @@ -0,0 +1,76 @@ +# This Python file uses the following encoding: utf-8 + +import BuildBotLib.basemodule as base +from buildbot.plugins import util, steps +import os +import shutil + + +@util.renderer +def NDKDownloadCMD(props): + link = props.getProperty("revision") + module = props.getProperty("module") + + shutil.rmtree(module) + + res = [] + format = link[link.rfind('.'):] + + if module == "AndroidNDK": + res = ["curl", link, "--output", "temp." + format] + return res + + +@util.renderer +def ExtractCMD(props): + + arr = os.listdir() + format = "" + module = props.getProperty("module") + + for file in arr: + ix = file.find("temp.") + if ix == 0: + format = file[file.rfind('.'):] + + res = [] + + if format == "zip": + res = ["unsip", "-d", module] + return res + + +def getFactory(): + factory = base.getFactory(); + + factory.addStep( + steps.ShellCommand( + command = NDKDownloadCMD, + name = 'download new item', + description = 'download new item', + ) + ); + + factory.addStep( + steps.ShellCommand( + command = ExtractCMD, + name = 'extract new item', + description = 'extract new item', + ) + ); + + return factory + + +def getRepo(): + return ""; + + +def getPropertyes(): + return [ + util.ChoiceStringParameter( + name = 'module', + choices=["AndroidNDK", "AndroidSDK"], + default = "AndroidNDK" + ), + ] diff --git a/BuildBotLib/buildBotWorkers.py b/BuildBotLib/buildBotWorkers.py index e6ddbe7..ebc7ec1 100644 --- a/BuildBotLib/buildBotWorkers.py +++ b/BuildBotLib/buildBotWorkers.py @@ -16,7 +16,8 @@ class buildBotWorkers(BuildBotModule): worker.Worker("github-worker", "pass"), worker.Worker("Tester", "pass"), worker.Worker("qtBuilder", "pass"), - worker.Worker("NPM", "pass") + worker.Worker("NPM", "pass"), + worker.Worker("AssetsInstaller", "pass") ] diff --git a/master.cfg b/master.cfg index 1ba0274..b94c14a 100644 --- a/master.cfg +++ b/master.cfg @@ -17,6 +17,7 @@ bot.addBuilder("github-worker", "qmake"); bot.addBuilder("Tester", "qmake"); bot.addBuilder("qtBuilder", "qtUpdater"); bot.addBuilder("NPM", "NPM"); +bot.addBuilder("AssetsInstaller", "asssetsinstaller"); c = BuildmasterConfig = bot.getMaster()