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
7b6ae833
Commit
7b6ae833
authored
Jul 31, 2013
by
Paweł Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add revision checking in SVN and GIT
parent
0b196b78
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
10 deletions
+43
-10
git.py
src/fetch/git.py
+13
-0
svn.py
src/fetch/svn.py
+13
-0
module.py
src/module.py
+17
-10
No files found.
src/fetch/git.py
View file @
7b6ae833
...
...
@@ -3,6 +3,7 @@
import
os
import
path
import
logging
from
subprocess
import
Popen
,
PIPE
class
Git
(
object
):
...
...
@@ -61,3 +62,15 @@ class Git(object):
module
.
isfetched
=
True
module
.
path
=
mod_path
return
success
@
staticmethod
def
check_commit_id
(
path
):
cur_dir
=
os
.
getcwd
()
try
:
os
.
chdir
(
path
)
git_cmd
=
'git log -1 --format="
%
H" | cut -c1-32'
git_out
=
Popen
(
git_cmd
,
shell
=
True
,
stdin
=
PIPE
,
stdout
=
PIPE
,
close_fds
=
True
)
commit
=
git_out
.
stdout
.
readlines
()[
0
]
.
strip
()
finally
:
os
.
chdir
(
cur_dir
)
return
commit
src/fetch/svn.py
View file @
7b6ae833
...
...
@@ -3,6 +3,7 @@
import
os
import
logging
import
path
from
subprocess
import
Popen
,
PIPE
class
Svn
(
object
):
...
...
@@ -36,3 +37,15 @@ class Svn(object):
module
.
isfetched
=
True
module
.
path
=
os
.
path
.
join
(
module
.
fetchto
,
module
.
basename
)
return
success
@
staticmethod
def
check_revision_number
(
path
):
cur_dir
=
os
.
getcwd
()
try
:
os
.
chdir
(
path
)
svn_cmd
=
"svn info | awk '{if(NR == 5) {print $2}}'"
svn_out
=
Popen
(
svn_cmd
,
shell
=
True
,
stdin
=
PIPE
,
stdout
=
PIPE
,
close_fds
=
True
)
revision
=
svn_out
.
stdout
.
readlines
()[
0
]
.
strip
()
finally
:
os
.
chdir
(
cur_dir
)
return
revision
src/module.py
View file @
7b6ae833
...
...
@@ -10,6 +10,8 @@ import path as path_mod
import
os
import
global_mod
import
logging
import
fetch
import
sys
class
Module
(
object
):
...
...
@@ -72,8 +74,9 @@ class Module(object):
self
.
syn_post_script
=
None
self
.
sim_only_files
=
None
self
.
sim_pre_script
=
None
self
.
sim_post_scri
tp
=
None
self
.
sim_post_scri
pt
=
None
self
.
top_module
=
None
self
.
commit_id
=
None
if
source
!=
"local"
:
self
.
url
,
self
.
branch
,
self
.
revision
=
path
.
url_parse
(
url
)
...
...
@@ -172,6 +175,10 @@ class Module(object):
self
.
manifest
=
self
.
__search_for_manifest
()
if
self
.
path
is
None
:
raise
RuntimeError
()
if
self
.
source
==
"svn"
:
self
.
revision
=
fetch
.
svn
.
check_revision_number
(
self
.
path
)
elif
self
.
source
==
"git"
:
self
.
revision
=
fetch
.
git
.
check_commit_id
(
self
.
path
)
manifest_parser
=
ManifestParser
()
# For non-top modules
...
...
@@ -360,17 +367,17 @@ class Module(object):
if
filepath
:
if
path_mod
.
is_abs_path
(
filepath
):
logging
.
warning
(
"Specified path seems to be an absolute path:
%
s
\n
Omitting."
%
filepath
)
#return False
return
True
filepath
=
path_mod
.
rel2abs
(
filepath
,
self
.
path
)
return
False
filepath
=
os
.
path
.
join
(
self
.
path
,
filepath
)
if
not
os
.
path
.
exists
(
filepath
):
logging
.
error
(
"Specified path doesn't exist:
%
s"
%
filepath
)
quit
()
logging
.
error
(
"Path specified in
%
s doesn't exist:
%
s"
%
(
self
.
path
,
filepath
))
sys
.
exit
(
"Exiting"
)
filepath
=
path_mod
.
rel2abs
(
filepath
,
self
.
path
)
if
not
os
.
path
.
isfile
(
filepath
):
logging
.
warning
(
"Specified path is not a normal file:
%
s
\n
Omitting."
%
filepath
)
#return False
return
True
if
os
.
path
.
isdir
(
filepath
):
logging
.
warning
(
"Path specified in
%
s is a directory:
%
s"
%
(
self
.
path
,
filepath
))
return
True
def
is_fetched_recursively
(
self
):
...
...
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