Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
0f601ebf
Commit
0f601ebf
authored
Oct 19, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitclone: new 'sparse-checkout' option
parent
1b26856b
Pipeline
#2865
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+18
-4
No files found.
slapos/recipe/gitclone.py
View file @
0f601ebf
...
@@ -138,6 +138,7 @@ class Recipe(object):
...
@@ -138,6 +138,7 @@ class Recipe(object):
self
.
git_command
=
options
.
get
(
'git-executable'
,
''
)
self
.
git_command
=
options
.
get
(
'git-executable'
,
''
)
if
self
.
git_command
==
''
:
if
self
.
git_command
==
''
:
self
.
git_command
=
'git'
self
.
git_command
=
'git'
self
.
sparse
=
options
.
get
(
'sparse-checkout'
,
''
).
strip
()
# Set boolean values
# Set boolean values
for
key
in
(
'develop'
,
'use-cache'
,
'ignore-ssl-certificate'
):
for
key
in
(
'develop'
,
'use-cache'
,
'ignore-ssl-certificate'
):
setattr
(
self
,
key
.
replace
(
'-'
,
'_'
),
options
.
get
(
key
,
''
).
lower
()
in
TRUE_VALUES
)
setattr
(
self
,
key
.
replace
(
'-'
,
'_'
),
options
.
get
(
key
,
''
).
lower
()
in
TRUE_VALUES
)
...
@@ -192,17 +193,30 @@ class Recipe(object):
...
@@ -192,17 +193,30 @@ class Recipe(object):
git_clone_command
=
[
self
.
git_command
,
'clone'
,
git_clone_command
=
[
self
.
git_command
,
'clone'
,
self
.
repository
,
self
.
repository
,
self
.
location
]
self
.
location
]
config
=
[]
if
self
.
sparse
:
git_clone_command
.
append
(
'--no-checkout'
)
config
.
append
(
'core.sparseCheckout=true'
)
if
self
.
branch
:
if
self
.
branch
:
git_clone_command
.
extend
([
'--branch'
,
self
.
branch
])
git_clone_command
+=
'--branch'
,
self
.
branch
if
self
.
ignore_ssl_certificate
:
if
self
.
ignore_ssl_certificate
:
git_clone_command
.
extend
([
'--config'
,
'http.sslVerify=false'
])
config
.
append
(
'http.sslVerify=false'
)
if
config
and
self
.
use_cache
:
raise
NotImplementedError
for
config
in
config
:
git_clone_command
+=
'--config'
,
config
try
:
try
:
check_call
(
git_clone_command
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stdout
)
check_call
(
git_clone_command
,
stdout
=
sys
.
stdout
,
stderr
=
sys
.
stdout
)
if
not
os
.
path
.
exists
(
self
.
location
):
if
not
os
.
path
.
exists
(
self
.
location
):
raise
UserError
(
"Unknown error while cloning repository."
)
raise
UserError
(
"Unknown error while cloning repository."
)
if
self
.
revision
:
if
self
.
sparse
:
with
open
(
os
.
path
.
join
(
self
.
location
,
'.git'
,
'info'
,
'sparse-checkout'
),
'w'
)
as
f
:
f
.
write
(
self
.
sparse
+
'
\
n
'
)
self
.
gitReset
(
self
.
revision
)
elif
self
.
revision
:
self
.
gitReset
(
self
.
revision
)
self
.
gitReset
(
self
.
revision
)
if
self
.
use_cache
:
if
self
.
use_cache
:
upload_network_cached
(
os
.
path
.
join
(
self
.
location
,
'.git'
),
upload_network_cached
(
os
.
path
.
join
(
self
.
location
,
'.git'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment