|
@@ -207,23 +207,26 @@ func adjust(s []string) []string {
|
|
|
// return the given absolute path as an absolute path rooted at the harvey tree.
|
|
|
func fromRoot(p string) string {
|
|
|
expandedPath := os.ExpandEnv(p)
|
|
|
- if path.IsAbs(p) {
|
|
|
+ if path.IsAbs(expandedPath) {
|
|
|
expandedPath = path.Join(harvey, expandedPath)
|
|
|
}
|
|
|
|
|
|
- // Travis has versioned CCs of the form clang-X.Y. We don't want to have
|
|
|
- // a file for each version of the compilers, so check if the versioned
|
|
|
- // file exists first. If it doesn't, fall back to the unversioned file.
|
|
|
- expandedCc := os.Getenv("CC")
|
|
|
- expandedCcTokens := strings.Split(expandedCc, "-")
|
|
|
- fallbackCc := expandedCcTokens[0]
|
|
|
- if strings.Contains(expandedPath, "$CC") && len(expandedCcTokens) > 1 {
|
|
|
- if _, err := os.Stat(expandedPath); err != nil {
|
|
|
- if os.IsNotExist(err) {
|
|
|
- oldCc := os.Getenv("CC")
|
|
|
- os.Setenv("CC", fallbackCc)
|
|
|
- expandedPath = fromRoot(p)
|
|
|
- os.Setenv("CC", oldCc)
|
|
|
+ if strings.Contains(p, "$CC") {
|
|
|
+ // Travis has versioned CCs of the form clang-X.Y. We don't want to have
|
|
|
+ // a file for each version of the compilers, so check if the versioned
|
|
|
+ // file exists first. If it doesn't, fall back to the unversioned file.
|
|
|
+ expandedCc := os.Getenv("CC")
|
|
|
+ expandedCcTokens := strings.Split(expandedCc, "-")
|
|
|
+ fallbackCc := expandedCcTokens[0]
|
|
|
+ //fmt.Printf(">>>CC=%v fallback=%v\n", expandedCc, fallbackCc)
|
|
|
+ if len(expandedCcTokens) > 1 {
|
|
|
+ if _, err := os.Stat(expandedPath); err != nil {
|
|
|
+ if os.IsNotExist(err) {
|
|
|
+ oldCc := os.Getenv("CC")
|
|
|
+ os.Setenv("CC", fallbackCc)
|
|
|
+ expandedPath = fromRoot(p)
|
|
|
+ os.Setenv("CC", oldCc)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|