Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linuxbin
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
linuxbin
Commits
3bb872ec
Commit
3bb872ec
authored
5 years ago
by
Boman Romain
Browse files
Options
Downloads
Patches
Plain Diff
add GIT_FULLCLONE option
parent
30118b5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
comp.py
+28
-6
28 additions, 6 deletions
comp.py
with
28 additions
and
6 deletions
comp.py
+
28
−
6
View file @
3bb872ec
...
...
@@ -6,6 +6,7 @@
# - lancement automatique de la batterie
from
parametricJob
import
*
import
re
# -- repository classes --------------------------------------------------------
...
...
@@ -14,15 +15,33 @@ class Repo(object):
self
.
name
=
name
self
.
url
=
url
class
GitRepo
(
Repo
):
def
__init__
(
self
,
name
,
url
):
super
(
GitRepo
,
self
).
__init__
(
name
,
url
)
def
co_cmd
(
self
,
pars
):
cmd
=
"
git clone --branch %s --depth %s --quiet %s %s
"
%
\
(
pars
[
'
GIT_BRANCH
'
].
val
,
pars
[
'
GIT_DEPTH
'
].
val
,
depth
=
''
if
not
pars
[
'
GIT_FULLCLONE
'
].
val
:
depth
=
'
--depth %s
'
%
pars
[
'
GIT_DEPTH
'
].
val
branch
=
pars
[
'
GIT_BRANCH
'
].
val
if
not
self
.
doesBranchExist
(
branch
):
print
'
INFO: branch %s does not exist on %s
'
%
(
branch
,
self
.
url
)
branch
=
'
master
'
print
'
INFO: checking out %s
'
%
branch
cmd
=
"
git clone --branch %s %s --quiet %s %s
"
%
\
(
branch
,
depth
,
self
.
url
,
self
.
name
)
return
cmd
def
doesBranchExist
(
self
,
name
):
cmd
=
[
'
git
'
,
'
ls-remote
'
,
'
--heads
'
,
self
.
url
,
name
]
out
=
subprocess
.
check_output
(
cmd
)
out
=
out
.
decode
()
# python 3 returns bytes
m
=
re
.
search
(
name
,
out
)
return
(
m
!=
None
)
class
SVNRepo
(
Repo
):
def
__init__
(
self
,
name
,
url
):
super
(
SVNRepo
,
self
).
__init__
(
name
,
url
)
...
...
@@ -30,6 +49,7 @@ class SVNRepo(Repo):
cmd
=
"
svn co --quiet %s %s
"
%
(
self
.
url
,
self
.
name
)
return
cmd
# -- CompJob class -------------------------------------------------------------
class
CompJob
(
ParametricJob
):
...
...
@@ -65,13 +85,14 @@ class CompJob(ParametricJob):
TextPRM
(
self
.
pars
,
'
NB_TASKS
'
,
'
nb of tasks launched in parallel
'
,
"
1
"
)
TextPRM
(
self
.
pars
,
'
NB_THREADS
'
,
'
nb of threads by task
'
,
"
1
"
)
YesNoPRM
(
self
.
pars
,
'
GIT_FULLCLONE
'
,
'
clone the whole repository
'
,
False
)
TextPRM
(
self
.
pars
,
'
GIT_DEPTH
'
,
'
git clone depth
'
,
'
10
'
)
TextPRM
(
self
.
pars
,
'
GIT_BRANCH
'
,
'
git branch name
'
,
'
master
'
)
MultiPRM
(
self
.
pars
,
'
RUNMETHOD
'
,
'
Run Method
'
,
[
"
interactive
"
,
"
at
"
,
"
batch
"
],
"
batch
"
)
TextPRM
(
self
.
pars
,
'
AT_TIME
'
,
'
Delay for at launch (no syntax check, use with care)
'
,
"
now
"
)
MultiPRM
(
self
.
pars
,
'
UNZIP
'
,
'
source
'
,
[
"
zip
"
,
"
checkout
"
,
"
present
"
],
"
zip
"
)
MultiPRM
(
self
.
pars
,
'
UNZIP
'
,
'
source
'
,
[
"
zip
"
,
"
checkout
"
,
"
present
"
],
"
checkout
"
)
YesNoPRM
(
self
.
pars
,
'
COMPILE
'
,
'
compile
'
,
True
)
MultiPRM
(
self
.
pars
,
'
BATTERY
'
,
'
battery
'
,
[
True
,
False
,
"
continue
"
],
True
)
...
...
@@ -80,8 +101,9 @@ class CompJob(ParametricJob):
PRMAction
(
self
.
actions
,
'
c
'
,
self
.
pars
[
'
CMAKELIST
'
])
PRMAction
(
self
.
actions
,
'
d
'
,
self
.
pars
[
'
DEBUG_MODE
'
])
PRMAction
(
self
.
actions
,
'
e
'
,
self
.
pars
[
'
GIT_DEPTH
'
])
PRMAction
(
self
.
actions
,
'
f
'
,
self
.
pars
[
'
GIT_BRANCH
'
])
PRMAction
(
self
.
actions
,
'
e
'
,
self
.
pars
[
'
GIT_FULLCLONE
'
])
PRMAction
(
self
.
actions
,
'
f
'
,
self
.
pars
[
'
GIT_DEPTH
'
])
PRMAction
(
self
.
actions
,
'
g
'
,
self
.
pars
[
'
GIT_BRANCH
'
])
PRMAction
(
self
.
actions
,
'
h
'
,
self
.
pars
[
'
NICE_VALUE
'
])
PRMAction
(
self
.
actions
,
'
j
'
,
self
.
pars
[
'
NB_TASKS
'
])
...
...
@@ -108,7 +130,7 @@ class CompJob(ParametricJob):
self
.
pars
[
'
CMAKELIST
'
].
enable
(
self
.
pars
[
'
COMPILE
'
].
val
==
True
)
self
.
pars
[
'
DEBUG_MODE
'
].
enable
(
self
.
pars
[
'
COMPILE
'
].
val
==
True
)
self
.
pars
[
'
NICE_VALUE
'
].
enable
(
self
.
pars
[
'
BATTERY
'
].
val
!=
False
and
self
.
pars
[
'
RUNMETHOD
'
].
val
!=
'
sge
'
)
self
.
pars
[
'
GIT_DEPTH
'
].
enable
(
self
.
pars
[
'
UNZIP
'
].
val
==
"
checkout
"
)
self
.
pars
[
'
GIT_DEPTH
'
].
enable
(
self
.
pars
[
'
UNZIP
'
].
val
==
"
checkout
"
and
not
self
.
pars
[
'
GIT_FULLCLONE
'
].
val
)
self
.
pars
[
'
GIT_BRANCH
'
].
enable
(
self
.
pars
[
'
UNZIP
'
].
val
==
"
checkout
"
)
# Batch
self
.
pars
[
'
AT_TIME
'
].
enable
(
self
.
pars
[
'
RUNMETHOD
'
].
val
==
'
at
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment