2019-12-13 16:09:43 +03:00
|
|
|
# This Python file uses the following encoding: utf-8
|
|
|
|
|
|
|
|
import BuildBotLib.basemodule as base
|
|
|
|
from buildbot.plugins import util, steps
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2019-12-13 17:05:49 +03:00
|
|
|
LAST_FORMAT = [""]
|
|
|
|
|
2019-12-13 16:09:43 +03:00
|
|
|
|
|
|
|
@util.renderer
|
|
|
|
def NDKDownloadCMD(props):
|
|
|
|
link = props.getProperty("revision")
|
|
|
|
module = props.getProperty("module")
|
|
|
|
|
2019-12-13 16:32:18 +03:00
|
|
|
if os.path.isfile(module):
|
|
|
|
shutil.rmtree(module)
|
2019-12-13 16:09:43 +03:00
|
|
|
|
|
|
|
res = []
|
2019-12-13 17:00:59 +03:00
|
|
|
format = link[link.rfind('.'):].lower()
|
2019-12-13 17:05:49 +03:00
|
|
|
LAST_FORMAT[0] = format
|
2019-12-13 16:09:43 +03:00
|
|
|
|
|
|
|
if module == "AndroidNDK":
|
2019-12-13 16:44:16 +03:00
|
|
|
if os.path.isfile(module):
|
|
|
|
os.remove("temp" + format)
|
2019-12-13 16:42:47 +03:00
|
|
|
res = ["curl", link, "--output", "temp" + format]
|
2019-12-13 16:37:22 +03:00
|
|
|
|
2019-12-13 16:09:43 +03:00
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
|
|
@util.renderer
|
|
|
|
def ExtractCMD(props):
|
|
|
|
|
2019-12-13 17:05:49 +03:00
|
|
|
format = LAST_FORMAT[0]
|
2019-12-13 16:09:43 +03:00
|
|
|
module = props.getProperty("module")
|
|
|
|
|
2019-12-13 16:39:15 +03:00
|
|
|
res = ["echo", "format '" + format + "' not supported"]
|
2019-12-13 16:09:43 +03:00
|
|
|
|
2019-12-13 16:48:52 +03:00
|
|
|
if format == ".zip":
|
2019-12-13 17:15:39 +03:00
|
|
|
res = ["unzip", "temp" + format, "-d", module]
|
2019-12-13 16:39:15 +03:00
|
|
|
|
2019-12-13 16:09:43 +03:00
|
|
|
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"
|
|
|
|
),
|
|
|
|
]
|