"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
bin/get-github-release.go: automatically choose the right os/arch
Nick Craig-Woodcacefb9a828c
diff --git a/Makefile b/Makefileindex b3e29ae30..89a02b7dc 100644--- a/Makefile+++ b/Makefile@@ -77,7 +77,7 @@ endif# Get the build dependenciesbuild_dep:ifdef FULL_TESTS- go run bin/get-github-release.go -extract golangci-lint golangci/golangci-lint 'golangci-lint-.*-linux-amd64.tar.gz'+ go run bin/get-github-release.go -extract golangci-lint golangci/golangci-lint 'golangci-lint-.*\.tar\.gz'endif# Get the release dependencies@@ -189,7 +189,7 @@ endiftravis_beta:ifeq ($(TRAVIS_OS_NAME),linux)- go run bin/get-github-release.go -extract nfpm goreleaser/nfpm 'nfpm_.*_Linux_x86_64.tar.gz'+ go run bin/get-github-release.go -extract nfpm goreleaser/nfpm 'nfpm_.*\.tar.gz'endifgit log $(LAST_TAG).. > /tmp/git-log.txtgo run bin/cross-compile.go -release beta-latest -git-log /tmp/git-log.txt $(BUILD_FLAGS) -parallel 8 $(BUILDTAGS) $(TAG)diff --git a/bin/get-github-release.go b/bin/get-github-release.goindex 820f94486..02b66a9b0 100644--- a/bin/get-github-release.go+++ b/bin/get-github-release.go@@ -21,6 +21,7 @@ import ("os/exec""path/filepath""regexp"+ "runtime""strings""time"@@ -34,6 +35,12 @@ var (bindir = flag.String("bindir", defaultBinDir(), "Directory to install files downloaded with -extract.")// GlobalsmatchProject = regexp.MustCompile(`^([\w-]+)/([\w-]+)$`)+ osAliases = map[string][]string{+ "darwin": []string{"macos", "osx"},+ }+ archAliases = map[string][]string{+ "amd64": []string{"x86_64"},+ })// A github release@@ -177,7 +184,8 @@ func getAsset(project string, matchName *regexp.Regexp) (string, string) {}for _, asset := range release.Assets {- if matchName.MatchString(asset.Name) {+ //log.Printf("Finding %s", asset.Name)+ if matchName.MatchString(asset.Name) && isOurOsArch(asset.Name) {return asset.BrowserDownloadURL, asset.Name}}@@ -185,6 +193,22 @@ func getAsset(project string, matchName *regexp.Regexp) (string, string) {return "", ""}+// isOurOsArch returns true if s contains our OS and our Arch+func isOurOsArch(s string) bool {+ s = strings.ToLower(s)+ check := func(base string, aliases map[string][]string) bool {+ names := []string{base}+ names = append(names, aliases[base]...)+ for _, name := range names {+ if strings.Contains(s, name) {+ return true+ }+ }+ return false+ }+ return check(runtime.GOARCH, archAliases) && check(runtime.GOOS, osAliases)+}+// get a file for downloadfunc getFile(url, fileName string) {log.Printf("Downloading %q from %q", fileName, url)