Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
Hdlmake
Manage
Activity
Members
Labels
Plan
Issues
20
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Hdlmake
Commits
94927fc0
Commit
94927fc0
authored
13 years ago
by
Pawel Szostek
Browse files
Options
Downloads
Patches
Plain Diff
Add branch specification to repos' urls
parent
2ccf38b3
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hdlmake
+0
-0
0 additions, 0 deletions
hdlmake
src/fetch.py
+11
-29
11 additions, 29 deletions
src/fetch.py
src/module.py
+5
-1
5 additions, 1 deletion
src/module.py
src/path.py
+27
-0
27 additions, 0 deletions
src/path.py
with
43 additions
and
30 deletions
hdlmake
+
0
−
0
View file @
94927fc0
No preview for this file type
This diff is collapsed.
Click to expand it.
src/fetch.py
+
11
−
29
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
...
...
This diff is collapsed.
Click to expand it.
src/module.py
+
5
−
1
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
)
...
...
This diff is collapsed.
Click to expand it.
src/path.py
+
27
−
0
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
]
==
'
/
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment