Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 08370113 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update build_version.py to search git and pdflatex only on the localhost.

parent 35110733
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
> ./build_version -h > ./build_version -h
AUTHOR AUTHOR
R. Le Gac, renaud.legac@cppm.in2p3.fr R. Le Gac, legac@cppm.in2p3.fr
Copyright (c) 2012-2016 R. Le Gac Copyright (c) 2012-2016 R. Le Gac
...@@ -83,7 +83,7 @@ JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src") ...@@ -83,7 +83,7 @@ JSLIBSRC_CNT = opj(APP_STATIC_CNT, APP, "src")
def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin): def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"""Build javascript libraries when the sencha command is located """Build javascript libraries when the sencha command is located
on hte local host or run behind a docker container. on the local host or run behind a docker container.
Args: Args:
sencha (list): sencha command sencha (list): sencha command
...@@ -101,7 +101,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin): ...@@ -101,7 +101,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"exclude", "--namespace", "Ext,App", "exclude", "--namespace", "Ext,App",
"and", "concat", jslibdebug]) "and", "concat", jslibdebug])
call(cmd) check_output(cmd)
cmd = list(sencha) cmd = list(sencha)
cmd.extend([ cmd.extend([
...@@ -110,7 +110,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin): ...@@ -110,7 +110,7 @@ def _do_sencha(sencha, extjssrc, jslibsrc, dbuisrc, jslibdebug, jslibmin):
"exclude", "--namespace", "Ext,App", "exclude", "--namespace", "Ext,App",
"and", "concat", "--yui", jslibmin]) "and", "concat", "--yui", jslibmin])
call(cmd) check_output(cmd)
def build(): def build():
...@@ -121,10 +121,7 @@ def build(): ...@@ -121,10 +121,7 @@ def build():
build_html() build_html()
for doc in (USER,): for doc in (USER,):
docsrc = opj(DOCSRC, doc) build_pdf(doc)
if os.path.exists(docsrc):
build_pdf(doc)
def build_html(): def build_html():
...@@ -154,7 +151,7 @@ def build_pdf(doc): ...@@ -154,7 +151,7 @@ def build_pdf(doc):
""" """
print "\n\tBuild the PDF documentations..." print "\n\tBuild the PDF documentations..."
if not which("pdflatex"): if not which("pdflatex", localhost=True):
print '\n\tThe application pdflatex is missing !' print '\n\tThe application pdflatex is missing !'
print '\tSkip this step.\n' print '\tSkip this step.\n'
return return
...@@ -214,7 +211,7 @@ def change_log(): ...@@ -214,7 +211,7 @@ def change_log():
""" """
print "\n\tCommit CHANGELOG..." print "\n\tCommit CHANGELOG..."
if not which("git"): if not which("git", localhost=True):
print '\n\tThe application git is missing !' print '\n\tThe application git is missing !'
print '\tSkip this step.\n' print '\tSkip this step.\n'
return return
...@@ -345,7 +342,7 @@ def git(*args, **kwargs): ...@@ -345,7 +342,7 @@ def git(*args, **kwargs):
git("commit", stdout=fi) git("commit", stdout=fi)
""" """
if not which("git"): if not which("git", localhost=True):
print '\n\tThe application git is missing !' print '\n\tThe application git is missing !'
print '\tSkip this step.\n' print '\tSkip this step.\n'
return return
...@@ -670,12 +667,14 @@ def start_release(): ...@@ -670,12 +667,14 @@ def start_release():
build() build()
def which(cmd): def which(cmd, localhost=False):
"""Test if the command exists on the localhost or on a docker container. """Test if the command exists on the localhost or on a docker container.
Return the sequence to execute it. Priority is given to the localhost. Return the sequence to execute it. Priority is given to the localhost.
Args: Args:
cmd (str): name of the command cmd (str): name of the command
localhost (bool): force the command to be on localhost even if
the option force_container is true.
Returns: Returns:
list: command to be executed. The list is empty when the command is list: command to be executed. The list is empty when the command is
...@@ -683,13 +682,15 @@ def which(cmd): ...@@ -683,13 +682,15 @@ def which(cmd):
""" """
# local host # local host
if not ARGS.force_container: if not ARGS.force_container or localhost:
try: try:
out = check_output(["which", cmd]) out = check_output(["which", cmd])
print "\n\tCommand", cmd, "found on the localhost"
return [out.strip("\n")] return [out.strip("\n")]
except CalledProcessError: except CalledProcessError:
print "\n\tCommand", cmd, "not found on the localhost" if localhost:
return []
# docker container is running ? # docker container is running ?
container = ARGS.docker_container container = ARGS.docker_container
...@@ -711,10 +712,12 @@ def which(cmd): ...@@ -711,10 +712,12 @@ def which(cmd):
try: try:
out = check_output(["docker", "exec", container, "which", cmd]) out = check_output(["docker", "exec", container, "which", cmd])
path = out.strip("\n") path = out.strip("\n")
print "\n\tCommand", cmd, "found on the container", container
return ["docker", "exec", container, path] return ["docker", "exec", container, path]
except CalledProcessError: except CalledProcessError:
print "\n\tCommand", cmd, "not found on the %s container" % container print "\n\tCommand", cmd, \
"not found on the localhost nor in the container %s" % container
return [] return []
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment