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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos.recipe.build
Commits
051d8f09
Commit
051d8f09
authored
Dec 03, 2021
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitclone: new 'depth' option
parent
03a41274
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
README.rst
README.rst
+3
-0
slapos/recipe/build/tests.py
slapos/recipe/build/tests.py
+10
-0
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+8
-10
No files found.
README.rst
View file @
051d8f09
...
...
@@ -848,6 +848,9 @@ option to 'true'::
Other options
~~~~~~~~~~~~~
depth
Clone with ``--depth=<depth>`` option. See ``git-clone`` command.
shared
Clone with ``--shared`` option if true. See ``git-clone`` command.
...
...
slapos/recipe/build/tests.py
View file @
051d8f09
...
...
@@ -534,6 +534,16 @@ repository = %s
# and running buildout again succeeed
check_call
([
buildout
])
def
test_clone_depth
(
self
):
options
=
{}
self
.
makeGitCloneRecipe
(
options
).
install
()
get_depth
=
lambda
:
int
(
check_output
((
'git'
,
'rev-list'
,
'--count'
,
'@'
),
cwd
=
options
[
'location'
]))
self
.
assertLess
(
100
,
get_depth
())
options
[
'depth'
]
=
10
self
.
makeGitCloneRecipe
(
options
).
install
()
self
.
assertEqual
(
10
,
get_depth
())
class
MakeReadOnlyTests
(
unittest
.
TestCase
):
...
...
slapos/recipe/gitclone.py
View file @
051d8f09
...
...
@@ -135,20 +135,16 @@ class Recipe(object):
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
name
))
self
.
name
=
name
for
option
in
(
'branch'
,
'revision'
,
'location'
,
'repository'
):
value
=
options
.
get
(
option
,
''
).
strip
()
if
value
==
''
:
setattr
(
self
,
option
,
None
)
else
:
setattr
(
self
,
option
,
value
)
self
.
git_command
=
options
.
get
(
'git-executable'
,
''
)
if
self
.
git_command
==
''
:
self
.
git_command
=
'git'
self
.
sparse
=
options
.
get
(
'sparse-checkout'
,
''
).
strip
()
setattr
(
self
,
option
,
options
.
get
(
option
)
or
None
)
self
.
git_command
=
options
.
get
(
'git-executable'
)
or
'git'
self
.
sparse
=
options
.
get
(
'sparse-checkout'
)
depth
=
options
.
get
(
'depth'
)
self
.
depth
=
int
(
depth
)
if
depth
else
None
# Set boolean values
for
key
in
(
'develop'
,
'shared'
,
'use-cache'
,
'ignore-ssl-certificate'
,
'ignore-cloning-submodules'
):
setattr
(
self
,
key
.
replace
(
'-'
,
'_'
),
options
.
get
(
key
,
''
).
lower
()
in
TRUE_VALUES
)
if
self
.
shared
:
if
self
.
shared
or
depth
:
self
.
use_cache
=
False
self
.
networkcache
=
buildout
.
get
(
'networkcache'
,
{})
...
...
@@ -210,6 +206,8 @@ class Recipe(object):
git_clone_command
+=
'--branch'
,
self
.
branch
if
self
.
ignore_ssl_certificate
:
config
.
append
(
'http.sslVerify=false'
)
if
self
.
depth
is
not
None
:
git_clone_command
.
append
(
'--depth=%s'
%
self
.
depth
)
if
config
and
self
.
use_cache
:
raise
NotImplementedError
...
...
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