From 12eda0449a571e501527d6266a8079e6d0a3e20c Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 16 Jun 2014 09:52:14 +0200 Subject: [PATCH] Build and memSize impl for Solaris --- build.sh | 2 +- cmd/syncthing/memsize_solaris.go | 20 ++++++++++++++++++ cmd/syncthing/memsize_unimpl.go | 2 +- .../{upgrade.go => upgrade_supported.go} | 2 ++ cmd/syncthing/upgrade_unsupp.go | 9 ++++++++ files/testdata/index.db | Bin 0 -> 32768 bytes 6 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 cmd/syncthing/memsize_solaris.go rename cmd/syncthing/{upgrade.go => upgrade_supported.go} (99%) create mode 100644 cmd/syncthing/upgrade_unsupp.go create mode 100644 files/testdata/index.db diff --git a/build.sh b/build.sh index 9d7ca8579..341858abc 100755 --- a/build.sh +++ b/build.sh @@ -142,7 +142,7 @@ case "$1" in godep go build ./cmd/stpidx godep go build ./cmd/stcli - for os in darwin-amd64 linux-386 linux-amd64 freebsd-amd64 windows-amd64 windows-386 ; do + for os in darwin-amd64 linux-386 linux-amd64 freebsd-amd64 windows-amd64 windows-386 solaris-amd64 ; do export GOOS=${os%-*} export GOARCH=${os#*-} diff --git a/cmd/syncthing/memsize_solaris.go b/cmd/syncthing/memsize_solaris.go new file mode 100644 index 000000000..360b5e1ad --- /dev/null +++ b/cmd/syncthing/memsize_solaris.go @@ -0,0 +1,20 @@ +package main + +import ( + "os/exec" + "strconv" +) + +func memorySize() (uint64, error) { + cmd := exec.Command("prtconf", "-m") + out, err := cmd.CombinedOutput() + if err != nil { + return 0, err + } + + mb, err := strconv.ParseUint(string(out), 10, 64) + if err != nil { + return 0, err + } + return mb * 1024 * 1024, nil +} diff --git a/cmd/syncthing/memsize_unimpl.go b/cmd/syncthing/memsize_unimpl.go index 63c4223dd..b896f895b 100644 --- a/cmd/syncthing/memsize_unimpl.go +++ b/cmd/syncthing/memsize_unimpl.go @@ -1,4 +1,4 @@ -// +build freebsd solaris +// +build freebsd package main diff --git a/cmd/syncthing/upgrade.go b/cmd/syncthing/upgrade_supported.go similarity index 99% rename from cmd/syncthing/upgrade.go rename to cmd/syncthing/upgrade_supported.go index 2ac2843b5..6b09f8533 100644 --- a/cmd/syncthing/upgrade.go +++ b/cmd/syncthing/upgrade_supported.go @@ -2,6 +2,8 @@ // Use of this source code is governed by an MIT-style license that can be // found in the LICENSE file. +// +build !solaris + package main import ( diff --git a/cmd/syncthing/upgrade_unsupp.go b/cmd/syncthing/upgrade_unsupp.go new file mode 100644 index 000000000..777c5f1de --- /dev/null +++ b/cmd/syncthing/upgrade_unsupp.go @@ -0,0 +1,9 @@ +// +build windows solaris + +package main + +import "errors" + +func upgrade() error { + return errors.New("Upgrade currently unsupported on Windows") +} diff --git a/files/testdata/index.db b/files/testdata/index.db new file mode 100644 index 0000000000000000000000000000000000000000..2d4afe20105c1b497ecd1eff06e23614afeb0c0e GIT binary patch literal 32768 zcmeI)y-fo#6ae76guj9!Lr_p4!3c~1Y!FD0kdP?I2n@g!Y=G#(3e-%1BBf#h?A$#m z_@GF4kv@8kJf5w1&s009C7 z2oNAZfB*pk1PJs%V3q4n^B7dkPC%}6>OZ%~sX9yTpJhRksYk%CXfQH)*uaRk!?e$0SA8x$2hTq8wX&$25)Bx$2hgcXVTn z5FkK+009C72oNAZfB=Es2t@wAT>s~D|9Kza_U?ZA7@GvWnYD=!AV7cs0RjXF5FkK+ z009D<2t*RUT>s1e&raq4H~A-tB|v}x0RjXF5FkK+0D(RW(