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
94927fc0
Commit
94927fc0
authored
Oct 06, 2011
by
Pawel Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add branch specification to repos' urls
parent
2ccf38b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
30 deletions
+43
-30
hdlmake
hdlmake
+0
-0
fetch.py
src/fetch.py
+11
-29
module.py
src/module.py
+5
-1
path.py
src/path.py
+27
-0
No files found.
hdlmake
View file @
94927fc0
No preview for this file type
src/fetch.py
View file @
94927fc0
...
...
@@ -55,13 +55,12 @@ class ModulePool(list):
cur_dir
=
os
.
getcwd
()
os
.
chdir
(
module
.
fetchto
)
url
,
rev
=
self
.
__parse_repo_url
(
module
.
url
)
cmd
=
"svn checkout {0} "
+
module
.
basename
if
rev
:
cmd
=
cmd
.
format
(
url
+
'@'
+
rev
)
cmd
=
cmd
.
format
(
module
.
url
+
'@'
+
module
.
revision
)
else
:
cmd
=
cmd
.
format
(
url
)
cmd
=
cmd
.
format
(
module
.
url
)
rval
=
True
...
...
@@ -71,7 +70,6 @@ class ModulePool(list):
os
.
chdir
(
cur_dir
)
module
.
isfetched
=
True
module
.
revision
=
rev
module
.
path
=
os
.
path
.
join
(
module
.
fetchto
,
module
.
basename
)
return
rval
...
...
@@ -80,9 +78,10 @@ class ModulePool(list):
os
.
mkdir
(
module
.
fetchto
)
cur_dir
=
os
.
getcwd
()
url
,
rev
=
self
.
__parse_repo_url
(
module
.
url
)
if
module
.
branch
==
None
:
module
.
branch
=
"master"
basename
=
path
.
url_basename
(
url
)
basename
=
path
.
url_basename
(
module
.
url
)
mod_path
=
os
.
path
.
join
(
module
.
fetchto
,
basename
)
if
basename
.
endswith
(
".git"
):
...
...
@@ -94,11 +93,11 @@ class ModulePool(list):
update_only
=
False
if
update_only
:
cmd
=
"(cd {0} && git
pull
)"
cmd
=
cmd
.
format
(
mod_path
)
cmd
=
"(cd {0} && git
checkout {1}
)"
cmd
=
cmd
.
format
(
mod_path
,
module
.
branch
)
else
:
cmd
=
"(cd {0} && git clone {1})"
cmd
=
cmd
.
format
(
module
.
fetchto
,
url
)
cmd
=
"(cd {0} && git clone
-b {2}
{1})"
cmd
=
cmd
.
format
(
module
.
fetchto
,
module
.
url
,
module
.
branch
)
rval
=
True
...
...
@@ -106,35 +105,18 @@ class ModulePool(list):
if
os
.
system
(
cmd
)
!=
0
:
rval
=
False
if
rev
and
rval
:
if
module
.
revision
and
rval
:
os
.
chdir
(
mod_path
)
cmd
=
"git checkout "
+
rev
cmd
=
"git checkout "
+
module
.
revision
p
.
vprint
(
cmd
)
if
os
.
system
(
cmd
)
!=
0
:
rval
=
False
os
.
chdir
(
cur_dir
)
module
.
isfetched
=
True
module
.
revision
=
rev
module
.
path
=
mod_path
return
rval
def
__parse_repo_url
(
self
,
url
)
:
"""
Check if link to a repo seems to be correct. Filter revision number
"""
import
re
url_pat
=
re
.
compile
(
"[
\t
]*([^
\t
]+)[
\t
]*(@[
\t
]*(.+))?[
\t
]*"
)
url_match
=
re
.
match
(
url_pat
,
url
)
if
url_match
==
None
:
p
.
echo
(
"Not a correct repo url: {0}. Skipping"
.
format
(
url
))
if
url_match
.
group
(
3
)
!=
None
:
#there is a revision given
ret
=
(
url_match
.
group
(
1
),
url_match
.
group
(
3
))
else
:
ret
=
(
url_match
.
group
(
1
),
None
)
return
ret
#end class ModuleFetcher
def
__init__
(
self
):
self
.
top_module
=
None
...
...
src/module.py
View file @
94927fc0
...
...
@@ -47,6 +47,7 @@ class Module(object):
return
path
.
url_basename
(
self
.
url
)
def
__init__
(
self
,
parent
,
url
,
source
,
fetchto
,
pool
):
import
path
self
.
fetchto
=
fetchto
self
.
pool
=
pool
self
.
source
=
source
...
...
@@ -65,7 +66,10 @@ class Module(object):
self
.
revision
=
None
self
.
_files
=
None
self
.
manifest
=
None
self
.
url
=
url
if
source
!=
"local"
:
self
.
url
,
self
.
branch
,
self
.
revision
=
path
.
url_parse
(
url
)
else
:
self
.
url
,
self
.
branch
,
self
.
revision
=
url
,
None
,
None
if
source
==
"local"
and
not
os
.
path
.
exists
(
url
):
p
.
rawprint
(
"Path to the local module doesn't exist:
\n
"
+
url
)
...
...
src/path.py
View file @
94927fc0
...
...
@@ -20,6 +20,7 @@
#
import
os
import
msg
as
p
ise_path_64
=
{
"10.0"
:
"/opt/Xilinx/10.0/ISE/bin/lin"
,
...
...
@@ -37,11 +38,37 @@ ise_path_32 = {"10.0":"/opt/Xilinx/10.0/ISE/bin/lin",
"12.4"
:
"/opt/Xilinx/12.4/ISE_DS/ISE/bin/lin64"
,
"13.1"
:
"/opt/Xilinx/13.1/ISE_DS/ISE/bin/lin64"
}
def
url_parse
(
url
):
"""
Check if link to a repo seems to be correct. Filter revision number and branch
"""
import
re
print
"<<<"
+
url
"""url_pat = re.compile("[
\t
]*([^
\t
]+?)[
\t
]*(::)?([^
\t
@]+)?(@[
\t
]*(.+))?[
\t
]*")
url_match = re.match(url_pat, url)
if url_match == None:
p.echo("Not a correct repo url: {0}. Skipping".format(url))
url_clean = url_match.group(1)
if url_match.group(3) != None: #there is a branch
branch = url_match.group(3)
if url_match.group(5) != None: #there is a revision given
rev = url_match.group(5)"""
url_clean
,
branch
,
rev
=
None
,
None
,
None
if
"@@"
in
url
:
url_clean
,
rev
=
url
.
split
(
"@@"
)
elif
"::"
in
url
:
url_clean
,
branch
=
url
.
split
(
"::"
)
else
:
url_clean
=
url
print
url_clean
,
branch
,
rev
return
(
url_clean
,
branch
,
rev
)
def
url_basename
(
url
):
"""
Get basename from an url
"""
if
url
.
endswith
(
".git"
):
ret
=
os
.
path
.
basename
(
url
[:
-
4
])
elif
url
[
-
1
]
==
'/'
:
...
...
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