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
169f89d1
Commit
169f89d1
authored
Jan 16, 2019
by
Ayush Tiwari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup gitclone and remove useless --recurse-submodule while fetching
parent
a968e4bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
README.rst
README.rst
+1
-1
slapos/recipe/build/tests.py
slapos/recipe/build/tests.py
+5
-5
slapos/recipe/gitclone.py
slapos/recipe/gitclone.py
+2
-5
No files found.
README.rst
View file @
169f89d1
...
...
@@ -391,7 +391,7 @@ Then, when update occurs, nothing is done::
Unable to update:
Traceback (most recent call last):
...
...CalledProcessError: Command '['git', 'fetch', '--
recurse-submodules', '--
all']' returned non-zero exit status 1
...CalledProcessError: Command '['git', 'fetch', '--all']' returned non-zero exit status 1
<BLANKLINE>
...
fatal: unable to access 'http://git.erp5.org/repos/nowhere/': The requested URL returned error: 500
...
...
slapos/recipe/build/tests.py
View file @
169f89d1
...
...
@@ -87,12 +87,10 @@ class GitCloneNonInformativeTests(unittest.TestCase):
check_call
([
'git'
,
'config'
,
'user.email'
,
'test@example.com'
],
cwd
=
proj_dir
)
check_call
([
'git'
,
'config'
,
'user.name'
,
'Test'
],
cwd
=
proj_dir
)
def
gitAdd
(
self
,
proj_dir
,
update
=
False
):
def
gitAdd
(
self
,
proj_dir
):
"""runs a 'git add .' in the provided git repo
:param proj_dir: path to a git repo
:update: if True, will run 'git add -u'
"""
cmd
=
'git add '
+
'-u'
if
update
else
'.'
try
:
check_call
([
'git'
,
'add'
,
'.'
],
cwd
=
proj_dir
)
except
CalledProcessError
as
e
:
...
...
@@ -112,7 +110,8 @@ class GitCloneNonInformativeTests(unittest.TestCase):
Returns the sha of HEAD of a git repo
"""
try
:
output
=
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
],
cwd
=
proj_dir
).
decode
(
"utf-8"
)
output
=
check_output
([
'git'
,
'rev-parse'
,
'HEAD'
],
cwd
=
proj_dir
).
decode
(
"utf-8"
)
return
output
.
rstrip
()
except
CalledProcessError
:
logging
.
error
(
"failed to call 'git rev-parse'"
)
...
...
@@ -228,7 +227,8 @@ class GitCloneNonInformativeTests(unittest.TestCase):
submodule_repo_path
)
# Update main repo with changes of submodule
submodule_dir_main_repo
=
os
.
path
.
join
(
self
.
project_dir
,
'dir1'
,
'submodule_repo'
)
submodule_dir_main_repo
=
os
.
path
.
join
(
self
.
project_dir
,
'dir1'
,
'submodule_repo'
)
check_call
([
'git'
,
'checkout'
,
'master'
],
cwd
=
submodule_dir_main_repo
)
check_call
([
'git'
,
'pull'
,
'--ff'
],
cwd
=
submodule_dir_main_repo
)
self
.
gitAdd
(
self
.
project_dir
)
...
...
slapos/recipe/gitclone.py
View file @
169f89d1
...
...
@@ -172,7 +172,6 @@ class Recipe(object):
command
.
append
(
revision
)
check_call
(
command
,
cwd
=
self
.
location
)
def
install
(
self
):
"""
Do a git clone.
...
...
@@ -287,15 +286,13 @@ class Recipe(object):
# but, to save time, only if we don't have the revision already
revision_already_fetched
=
\
self
.
revision
and
\
call
([
self
.
git_command
,
'rev-parse'
,
'--verify'
,
self
.
revision
],
cwd
=
self
.
location
)
==
0
and
\
check_output
([
self
.
git_command
,
'rev-parse'
,
'HEAD'
],
cwd
=
self
.
location
).
strip
()
==
self
.
revision
if
not
revision_already_fetched
:
# With --recurse-submodules, it will fetch the updated branches of the
# submodules as well as of the main repo.
check_call
([
self
.
git_command
,
'fetch'
,
'--
recurse-submodules'
,
'--
all'
],
check_call
([
self
.
git_command
,
'fetch'
,
'--all'
],
cwd
=
self
.
location
)
# If develop parameter is set, don't reset/update.
...
...
@@ -306,7 +303,7 @@ class Recipe(object):
else
:
self
.
gitReset
(
'@{upstream}'
)
if
not
revision_already_fetched
:
if
not
revision_already_fetched
and
not
self
.
ignore_cloning_submodules
:
# Also update the submodule directory to the commit which parent
# repository is pointing to.
# NOTE: This will put the submodule repo in a `Detached` state.
...
...
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