Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
581bd378
Commit
581bd378
authored
Jun 01, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gobuilder: include file missing from change, fix build
R=golang-dev CC=golang-dev
https://golang.org/cl/4539099
parent
9f0cabfa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
8 deletions
+21
-8
download.go
src/cmd/goinstall/download.go
+21
-8
No files found.
src/cmd/goinstall/download.go
View file @
581bd378
...
...
@@ -31,23 +31,36 @@ func maybeReportToDashboard(path string) {
}
}
var
googlecode
=
regexp
.
MustCompile
(
`^([a-z0-9\-]+\.googlecode\.com/(svn|hg))(/[a-z0-9A-Z_.\-/]*)?$`
)
var
github
=
regexp
.
MustCompile
(
`^(github\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`
)
var
bitbucket
=
regexp
.
MustCompile
(
`^(bitbucket\.org/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`
)
var
launchpad
=
regexp
.
MustCompile
(
`^(launchpad\.net/([a-z0-9A-Z_.\-]+(/[a-z0-9A-Z_.\-]+)?|~[a-z0-9A-Z_.\-]+/(\+junk|[a-z0-9A-Z_.\-]+)/[a-z0-9A-Z_.\-]+))(/[a-z0-9A-Z_.\-/]+)?$`
)
var
vcsPatterns
=
map
[
string
]
*
regexp
.
Regexp
{
"googlecode"
:
regexp
.
MustCompile
(
`^([a-z0-9\-]+\.googlecode\.com/(svn|hg))(/[a-z0-9A-Z_.\-/]*)?$`
),
"github"
:
regexp
.
MustCompile
(
`^(github\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`
),
"bitbucket"
:
regexp
.
MustCompile
(
`^(bitbucket\.org/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`
),
"launchpad"
:
regexp
.
MustCompile
(
`^(launchpad\.net/([a-z0-9A-Z_.\-]+(/[a-z0-9A-Z_.\-]+)?|~[a-z0-9A-Z_.\-]+/(\+junk|[a-z0-9A-Z_.\-]+)/[a-z0-9A-Z_.\-]+))(/[a-z0-9A-Z_.\-/]+)?$`
),
}
// isRemote returns true if the provided package path
// matches one of the supported remote repositories.
func
isRemote
(
pkg
string
)
bool
{
for
_
,
r
:=
range
vcsPatterns
{
if
r
.
MatchString
(
pkg
)
{
return
true
}
}
return
false
}
// download checks out or updates pkg from the remote server.
func
download
(
pkg
,
srcDir
string
)
os
.
Error
{
if
strings
.
Contains
(
pkg
,
".."
)
{
return
os
.
ErrorString
(
"invalid path (contains ..)"
)
}
if
m
:=
bitbucket
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
m
:=
vcsPatterns
[
"bitbucket"
]
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
err
:=
vcsCheckout
(
&
hg
,
srcDir
,
m
[
1
],
"http://"
+
m
[
1
],
m
[
1
]);
err
!=
nil
{
return
err
}
return
nil
}
if
m
:=
googlecode
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
m
:=
vcsPatterns
[
"googlecode"
]
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
var
v
*
vcs
switch
m
[
2
]
{
case
"hg"
:
...
...
@@ -63,7 +76,7 @@ func download(pkg, srcDir string) os.Error {
}
return
nil
}
if
m
:=
github
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
m
:=
vcsPatterns
[
"github"
]
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
strings
.
HasSuffix
(
m
[
1
],
".git"
)
{
return
os
.
ErrorString
(
"repository "
+
pkg
+
" should not have .git suffix"
)
}
...
...
@@ -72,7 +85,7 @@ func download(pkg, srcDir string) os.Error {
}
return
nil
}
if
m
:=
launchpad
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
if
m
:=
vcsPatterns
[
"launchpad"
]
.
FindStringSubmatch
(
pkg
);
m
!=
nil
{
// Either lp.net/<project>[/<series>[/<path>]]
// or lp.net/~<user or team>/<project>/<branch>[/<path>]
if
err
:=
vcsCheckout
(
&
bzr
,
srcDir
,
m
[
1
],
"https://"
+
m
[
1
],
m
[
1
]);
err
!=
nil
{
...
...
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