Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: cipd/client/cipd/client.go

Issue 2653843003: Move arch+plat logic to common. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cipd/client/cipd/common/common.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cipd/client/cipd/client.go
diff --git a/cipd/client/cipd/client.go b/cipd/client/cipd/client.go
index 9df889c5a8ac494f3ada014b21b04564eb247cba..b9036a4aec386d649a5274835a70ffe8740ce5d3 100644
--- a/cipd/client/cipd/client.go
+++ b/cipd/client/cipd/client.go
@@ -42,7 +42,6 @@ import (
"os"
"path/filepath"
"regexp"
- "runtime"
"sort"
"strings"
"sync"
@@ -774,27 +773,14 @@ const clientPackageBase = "infra/tools/cipd"
var clientPackage = ""
var clientFileName = ""
-var platformExpansion = ""
-var archExpansion = ""
-
func init() {
- // TODO(iannucci): rationalize these to just be exactly GOOS and GOARCH.
- platformExpansion = runtime.GOOS
- if platformExpansion == "darwin" {
- platformExpansion = "mac"
- }
-
clientFileName = "cipd"
- if platformExpansion == "windows" {
+ if common.CurrentPlatform() == "windows" {
clientFileName = "cipd.exe"
}
- archExpansion = runtime.GOARCH
- if archExpansion == "arm" {
- archExpansion = "armv6l"
- }
- clientPackage = fmt.Sprintf("%s/%s-%s", clientPackageBase, platformExpansion,
- archExpansion)
+ clientPackage = fmt.Sprintf("%s/%s-%s", clientPackageBase,
+ common.CurrentPlatform(), common.CurrentArchitecture())
}
func (client *clientImpl) ensureClientVersionInfo(ctx context.Context, fs local.FileSystem, pin common.Pin, exePath string) {
@@ -1254,7 +1240,7 @@ func (client *clientImpl) ProcessEnsureFile(ctx context.Context, r io.Reader) ([
}
logging.Debugf(ctx, "scanning ensure file with platform=%q, arch=%q",
- platformExpansion, archExpansion)
+ common.CurrentPlatform(), common.CurrentArchitecture())
out := []common.Pin{}
scanner := bufio.NewScanner(r)
@@ -1280,7 +1266,8 @@ func (client *clientImpl) ProcessEnsureFile(ctx context.Context, r io.Reader) ([
return nil, makeError("expecting '<package template> <version>' line")
}
- pkg, err := expandTemplate(tokens[0], platformExpansion, archExpansion)
+ pkg, err := expandTemplate(tokens[0], common.CurrentPlatform(),
+ common.CurrentArchitecture())
switch err {
case nil:
case errSkipTemplate:
« no previous file with comments | « no previous file | cipd/client/cipd/common/common.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698