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
Eric Zheng
slapos.recipe.build
Commits
6e4779da
Commit
6e4779da
authored
Aug 10, 2021
by
Eric Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitclone: add depth option
parent
6d809e51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+17
-6
No files found.
slapos/recipe/gitclone.py
View file @
6e4779da
...
...
@@ -134,7 +134,7 @@ class Recipe(object):
options
.
setdefault
(
'location'
,
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
name
))
self
.
name
=
name
for
option
in
(
'branch'
,
'revision'
,
'location'
,
'repository'
):
for
option
in
(
'branch'
,
'revision'
,
'location'
,
'repository'
,
'depth'
):
value
=
options
.
get
(
option
,
''
).
strip
()
if
value
==
''
:
setattr
(
self
,
option
,
None
)
...
...
@@ -172,6 +172,14 @@ class Recipe(object):
command
.
append
(
revision
)
check_call
(
command
,
cwd
=
self
.
location
)
def
gitSubmoduleUpdate
(
self
):
"""Updates submodules recursively."""
command
=
[
self
.
git_command
,
'submodule'
,
'update'
,
'--init'
,
'--force'
,
'--recursive'
]
if
self
.
depth
!=
None
:
command
+=
'--depth'
,
self
.
depth
check_call
(
command
,
cwd
=
self
.
location
)
def
install
(
self
):
"""
Do a git clone.
...
...
@@ -208,6 +216,8 @@ class Recipe(object):
config
.
append
(
'core.sparseCheckout=true'
)
if
self
.
branch
:
git_clone_command
+=
'--branch'
,
self
.
branch
if
self
.
depth
!=
None
:
git_clone_command
+=
'--depth'
,
self
.
depth
if
self
.
ignore_ssl_certificate
:
config
.
append
(
'http.sslVerify=false'
)
...
...
@@ -240,8 +250,7 @@ class Recipe(object):
if
not
self
.
ignore_cloning_submodules
:
# Update submodule repository to the commit which is being pointed to
# in main repo
check_call
([
self
.
git_command
,
'submodule'
,
'update'
,
'--init'
,
'--recursive'
],
cwd
=
self
.
location
)
self
.
gitSubmoduleUpdate
()
except
CalledProcessError
:
print
(
"Unable to download from git repository."
" Trying from network cache..."
)
...
...
@@ -285,7 +294,10 @@ class Recipe(object):
self
.
deletePycFiles
(
self
.
location
)
# Fetch and reset to the upstream
check_call
([
self
.
git_command
,
'fetch'
,
'--all'
],
cwd
=
self
.
location
)
update_commend
=
[
self
.
git_command
,
'fetch'
,
'--all'
]
if
self
.
depth
!=
None
:
update_command
+=
'--depth'
,
self
.
depth
check_call
(
update_command
,
cwd
=
self
.
location
)
self
.
gitReset
(
'@{upstream}'
)
if
not
self
.
ignore_cloning_submodules
:
...
...
@@ -297,8 +309,7 @@ class Recipe(object):
# repo being checked out to the desired one.
# It will also init a submodule if required
# NOTE: This will put the submodule repo in a `Detached` state.
check_call
([
self
.
git_command
,
'submodule'
,
'update'
,
'--init'
,
'-f'
,
'--recursive'
],
cwd
=
self
.
location
)
self
.
gitSubmoduleUpdate
()
def
uninstall
(
name
,
options
):
"""Keep the working copy, unless develop is set to false.
...
...
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