Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
8ce032de
Commit
8ce032de
authored
May 25, 2020
by
William Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an update action to pull (fast forward) git modules.
parent
947c5452
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
commands.py
hdlmake/action/commands.py
+12
-1
git.py
hdlmake/fetch/git.py
+19
-3
main.py
hdlmake/main.py
+5
-0
No files found.
hdlmake/action/commands.py
View file @
8ce032de
...
...
@@ -83,7 +83,7 @@ class ActionCore(Action):
logging
.
debug
(
"Fetching module:
%
s"
,
str
(
module
))
if
module
.
source
==
'svn'
:
result
=
self
.
svn_backend
.
fetch
(
module
)
elif
module
.
source
==
'git'
:
elif
module
.
source
==
'git'
:
result
=
self
.
git_backend
.
fetch
(
module
)
else
:
assert
module
.
source
==
'gitsm'
...
...
@@ -234,3 +234,14 @@ class ActionCore(Action):
self
.
_print_file_list
(
mod_aux
.
files
)
self
.
_print_comment
(
"# MODULE END ->
%
s"
%
mod_aux
.
url
)
self
.
_print_comment
(
""
)
def
update
(
self
):
"""Pull updates to modules"""
for
mod_aux
in
self
.
manifests
:
if
not
mod_aux
.
isfetched
:
logging
.
warning
(
"Module not fetched:
%
s"
,
mod_aux
.
url
)
self
.
_print_comment
(
"# MODULE UNFETCHED! ->
%
s"
%
mod_aux
.
url
)
else
:
if
mod_aux
.
source
==
'git'
:
self
.
git_backend
.
update
(
mod_aux
)
\ No newline at end of file
hdlmake/fetch/git.py
View file @
8ce032de
...
...
@@ -66,6 +66,12 @@ class Git(Fetcher):
return
None
def
fetch
(
self
,
module
):
return
self
.
_fetch_or_fastforward
(
module
,
pull
=
False
)
def
update
(
self
,
module
):
return
self
.
_fetch_or_fastforward
(
module
,
pull
=
True
)
def
_fetch_or_fastforward
(
self
,
module
,
pull
):
"""Get the code from the remote Git repository"""
fetchto
=
module
.
fetchto
()
logging
.
debug
(
"Fetchto = '{}'"
.
format
(
fetchto
))
...
...
@@ -73,9 +79,11 @@ class Git(Fetcher):
os
.
mkdir
(
fetchto
)
basename
=
path_utils
.
url_basename
(
module
.
url
)
mod_path
=
os
.
path
.
join
(
fetchto
,
basename
)
assert
not
module
.
isfetched
logging
.
info
(
"Fetching git module
%
s"
,
mod_path
)
shell
.
run
(
"(cd {0} && git clone {1})"
.
format
(
fetchto
,
module
.
url
))
if
not
pull
:
assert
not
module
.
isfetched
logging
.
info
(
"Fetching git module
%
s"
,
mod_path
)
shell
.
run
(
"(cd {0} && git clone {1})"
.
format
(
fetchto
,
module
.
url
))
checkout_id
=
None
if
module
.
branch
is
not
None
:
checkout_id
=
module
.
branch
...
...
@@ -94,6 +102,14 @@ class Git(Fetcher):
if
os
.
system
(
cmd
)
!=
0
:
return
False
if
pull
:
logging
.
info
(
"Fetching git module {}"
.
format
(
mod_path
))
cmd
=
"(cd {0} && git pull --ff-only)"
cmd
=
cmd
.
format
(
module
.
path
,
checkout_id
)
logging
.
info
((
"Executing {}"
.
format
(
cmd
))
if
os
.
system
(
cmd
)
!=
0
:
return
False
if
self
.
submodule
and
not
module
.
isfetched
:
cmd
=
(
"(cd {0} && git submodule init &&"
"git submodule update --recursive)"
)
...
...
hdlmake/main.py
View file @
8ce032de
...
...
@@ -75,6 +75,8 @@ def _action_runner(modules_pool):
modules_pool
.
makefile
()
elif
options
.
command
==
"fetch"
:
modules_pool
.
fetch
()
elif
options
.
command
==
"update"
:
modules_pool
.
update
()
elif
options
.
command
==
"clean"
:
modules_pool
.
clean
()
elif
options
.
command
==
"list-mods"
:
...
...
@@ -105,6 +107,9 @@ def _get_parser():
subparsers
.
add_parser
(
"fetch"
,
help
=
"fetch and/or update all of the remote modules"
)
subparsers
.
add_parser
(
"update"
,
help
=
"update all of the remote modules"
)
subparsers
.
add_parser
(
"clean"
,
help
=
"clean all of the already fetched remote modules"
)
...
...
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