1
0
mirror of https://github.com/golang/go synced 2024-11-25 03:57:56 -07:00

gobuilder: include file missing from change, fix build

R=golang-dev
CC=golang-dev
https://golang.org/cl/4539099
This commit is contained in:
Andrew Gerrand 2011-06-01 11:56:46 +10:00
parent 9f0cabfab9
commit 581bd378ec

View File

@ -31,23 +31,36 @@ func maybeReportToDashboard(path string) {
} }
} }
var googlecode = regexp.MustCompile(`^([a-z0-9\-]+\.googlecode\.com/(svn|hg))(/[a-z0-9A-Z_.\-/]*)?$`) var vcsPatterns = map[string]*regexp.Regexp{
var github = regexp.MustCompile(`^(github\.com/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`) "googlecode": regexp.MustCompile(`^([a-z0-9\-]+\.googlecode\.com/(svn|hg))(/[a-z0-9A-Z_.\-/]*)?$`),
var bitbucket = regexp.MustCompile(`^(bitbucket\.org/[a-z0-9A-Z_.\-]+/[a-z0-9A-Z_.\-]+)(/[a-z0-9A-Z_.\-/]*)?$`) "github": regexp.MustCompile(`^(github\.com/[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_.\-/]+)?$`) "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. // download checks out or updates pkg from the remote server.
func download(pkg, srcDir string) os.Error { func download(pkg, srcDir string) os.Error {
if strings.Contains(pkg, "..") { if strings.Contains(pkg, "..") {
return os.ErrorString("invalid path (contains ..)") 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 { if err := vcsCheckout(&hg, srcDir, m[1], "http://"+m[1], m[1]); err != nil {
return err return err
} }
return nil return nil
} }
if m := googlecode.FindStringSubmatch(pkg); m != nil { if m := vcsPatterns["googlecode"].FindStringSubmatch(pkg); m != nil {
var v *vcs var v *vcs
switch m[2] { switch m[2] {
case "hg": case "hg":
@ -63,7 +76,7 @@ func download(pkg, srcDir string) os.Error {
} }
return nil return nil
} }
if m := github.FindStringSubmatch(pkg); m != nil { if m := vcsPatterns["github"].FindStringSubmatch(pkg); m != nil {
if strings.HasSuffix(m[1], ".git") { if strings.HasSuffix(m[1], ".git") {
return os.ErrorString("repository " + pkg + " should not have .git suffix") return os.ErrorString("repository " + pkg + " should not have .git suffix")
} }
@ -72,7 +85,7 @@ func download(pkg, srcDir string) os.Error {
} }
return nil return nil
} }
if m := launchpad.FindStringSubmatch(pkg); m != nil { if m := vcsPatterns["launchpad"].FindStringSubmatch(pkg); m != nil {
// Either lp.net/<project>[/<series>[/<path>]] // Either lp.net/<project>[/<series>[/<path>]]
// or lp.net/~<user or team>/<project>/<branch>[/<path>] // or lp.net/~<user or team>/<project>/<branch>[/<path>]
if err := vcsCheckout(&bzr, srcDir, m[1], "https://"+m[1], m[1]); err != nil { if err := vcsCheckout(&bzr, srcDir, m[1], "https://"+m[1], m[1]); err != nil {