Salome HOME
evite de dater avec touch, si le git clone a échoué
authorcrouzet <nicolas.crouzet@cea.fr>
Mon, 5 Jul 2021 12:52:19 +0000 (14:52 +0200)
committerCROUZET Nicolas <crouzet@is243948.intra.cea.fr>
Mon, 23 Aug 2021 09:03:36 +0000 (11:03 +0200)
src/system.py

index b7cc6c2a483caf3193b9310fd85ed02461913995..c54452b4343efdadb1742d26ce59687418b4785d 100644 (file)
@@ -98,7 +98,9 @@ def git_extract(from_what, tag, git_options, where, logger, environment=None):
       cmd = r"""
 set -x
 git clone %(git_options)s %(remote)s %(where)s
-touch -d "$(git --git-dir=%(where_git)s  log -1 --format=date_format)" %(where)s
+res=$?
+if [ $res -eq 0 ]; then   touch -d "$(git --git-dir=%(where_git)s  log -1 --format=date_format)" %(where)s;fi
+exit $res
 """
     cmd = cmd % {'git_options': git_options, 'remote': from_what, 'tag': tag, 'where': str(where), 'where_git': where_git}
   else:
@@ -115,7 +117,7 @@ git clone %(git_options)s %(remote)s %(where)s && \
 git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s
 res=$?
 git --git-dir=%(where_git)s status|grep HEAD
-if [ $? -ne 0 ]; then   touch -d "$(git --git-dir=%(where_git)s  log -1 --format=date_format)" %(where)s;fi
+if [ $res -eq 0 -a $? -ne 0 ]; then   touch -d "$(git --git-dir=%(where_git)s  log -1 --format=date_format)" %(where)s;fi
 exit $res
 """
     cmd = cmd % {'git_options': git_options,