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
Boxiang Sun
slapos.recipe.build
Commits
dfc62f9d
Commit
dfc62f9d
authored
May 31, 2019
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gitclone: allow to create symlink in repository after clone or pull
parent
5e95d882
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+18
-2
No files found.
slapos/recipe/gitclone.py
View file @
dfc62f9d
...
...
@@ -140,6 +140,10 @@ class Recipe(object):
setattr
(
self
,
option
,
None
)
else
:
setattr
(
self
,
option
,
value
)
self
.
path_list
=
[
self
.
location
]
self
.
link_list
=
[
link
.
strip
()
for
link
in
options
.
get
(
'link-list'
,
''
).
split
(
'
\
n
'
)
if
link
.
strip
()]
self
.
git_command
=
options
.
get
(
'git-executable'
,
''
)
if
self
.
git_command
==
''
:
self
.
git_command
=
'git'
...
...
@@ -172,6 +176,16 @@ class Recipe(object):
command
.
append
(
revision
)
check_call
(
command
,
cwd
=
self
.
location
)
def
configureSymlink
(
self
):
for
link
in
self
.
link_list
:
source
,
dest
=
link
.
split
(
' '
)
source_path
=
os
.
path
.
join
(
self
.
location
,
source
.
strip
())
link_path
=
os
.
path
.
join
(
self
.
location
,
dest
.
strip
())
if
os
.
path
.
islink
(
link_path
):
os
.
unlink
(
link_path
)
os
.
symlink
(
source_path
,
link_path
)
self
.
path_list
.
append
(
link_path
)
def
install
(
self
):
"""
Do a git clone.
...
...
@@ -188,7 +202,7 @@ class Recipe(object):
shutil
.
rmtree
(
self
.
location
)
else
:
# If develop is set, assume that this is a valid working copy
return
[
self
.
location
]
return
self
.
path_list
if
getattr
(
self
,
'branch_overrided'
,
None
):
print
(
'Warning: "branch" parameter with value "%s" is ignored. '
...
...
@@ -242,6 +256,7 @@ class Recipe(object):
# in main repo
check_call
([
self
.
git_command
,
'submodule'
,
'update'
,
'--init'
,
'--recursive'
],
cwd
=
self
.
location
)
self
.
configureSymlink
()
except
CalledProcessError
:
print
(
"Unable to download from git repository."
" Trying from network cache..."
)
...
...
@@ -255,7 +270,7 @@ class Recipe(object):
raise
UserError
(
GIT_CLONE_CACHE_ERROR_MESSAGE
)
self
.
gitReset
()
return
[
self
.
location
]
return
self
.
path_list
def
deletePycFiles
(
self
,
path
):
"""Delete *.pyc files so that deleted/moved files can not be imported"""
...
...
@@ -299,6 +314,7 @@ class Recipe(object):
# 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
.
configureSymlink
()
except
:
# Buildout will remove the installed location and mark the part as not
...
...
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