Browse code

Merge pull request #3857 from creack/remove_darwin_files

Remove all darwin specific files and use more generic _unsupported with build tags.

Victor Vieux authored on 2014/02/01 04:48:10
Showing 41 changed files
... ...
@@ -68,8 +68,9 @@ ENV	GOPATH	/go:/go/src/github.com/dotcloud/docker/vendor
68 68
 RUN	cd /usr/local/go/src && ./make.bash --no-clean 2>&1
69 69
 
70 70
 # Compile Go for cross compilation
71
-ENV	DOCKER_CROSSPLATFORMS	darwin/amd64 darwin/386
72
-# TODO add linux/386 and linux/arm
71
+ENV	DOCKER_CROSSPLATFORMS	linux/386 linux/arm darwin/amd64 darwin/386
72
+# (set an explicit GOARM of 5 for maximum compatibility)
73
+ENV	GOARM	5
73 74
 RUN	cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'
74 75
 
75 76
 # Grab Go's cover tool for dead-simple code coverage testing
... ...
@@ -1,3 +1,5 @@
1
+// +build !linux !amd64
2
+
1 3
 package archive
2 4
 
3 5
 import "syscall"
4 6
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-package lxc
2
-
3
-func setHostname(hostname string) error {
4
-	panic("Not supported on darwin")
5
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package lxc
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+// +build !linux !amd64
1
+
2
+package lxc
3
+
4
+func setHostname(hostname string) error {
5
+	panic("Not supported on darwin")
6
+}
0 7
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-package aufs
2
-
3
-import "errors"
4
-
5
-const MsRemount = 0
6
-
7
-func mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
8
-	return errors.New("mount is not implemented on darwin")
9
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package aufs
2 4
 
3 5
 import "syscall"
4 6
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+// +build !linux !amd64
1
+
2
+package aufs
3
+
4
+import "errors"
5
+
6
+const MsRemount = 0
7
+
8
+func mount(source string, target string, fstype string, flags uintptr, data string) (err error) {
9
+	return errors.New("mount is not implemented on darwin")
10
+}
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package btrfs
4 4
 
... ...
@@ -1,3 +1,3 @@
1
-// +build !linux
1
+// +build !linux !amd64
2 2
 
3 3
 package btrfs
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -1,4 +1,4 @@
1
-// +build linux
1
+// +build linux,amd64
2 2
 
3 3
 package devmapper
4 4
 
... ...
@@ -151,7 +151,8 @@ release_build() {
151 151
 			S3ARCH=i386
152 152
 			;;
153 153
 		arm)
154
-			# GOARCH is fine
154
+			S3ARCH=armel
155
+			# someday, we might potentially support mutliple GOARM values, in which case we might get armhf here too
155 156
 			;;
156 157
 		*)
157 158
 			echo >&2 "error: can't convert $S3ARCH to an appropriate value for 'uname -m'"
158 159
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-package graphdb
2
-
3
-func NewSqliteConn(root string) (*Database, error) {
4
-	panic("Not implemented")
5
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package graphdb
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+// +build !linux !amd64
1
+
2
+package graphdb
3
+
4
+func NewSqliteConn(root string) (*Database, error) {
5
+	panic("Not implemented")
6
+}
0 7
deleted file mode 100644
... ...
@@ -1,5 +0,0 @@
1
-package mount
2
-
3
-func parseOptions(options string) (int, string) {
4
-	panic("Not implemented")
5
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package mount
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+// +build !linux !amd64
1
+
2
+package mount
3
+
4
+func parseOptions(options string) (int, string) {
5
+	panic("Not implemented")
6
+}
0 7
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-package mount
2
-
3
-func mount(device, target, mType string, flag uintptr, data string) error {
4
-	panic("Not implemented")
5
-}
6
-
7
-func unmount(target string, flag int) error {
8
-	panic("Not implemented")
9
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package mount
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,11 @@
0
+// +build !linux !amd64
1
+
2
+package mount
3
+
4
+func mount(device, target, mType string, flag uintptr, data string) error {
5
+	panic("Not implemented")
6
+}
7
+
8
+func unmount(target string, flag int) error {
9
+	panic("Not implemented")
10
+}
0 11
deleted file mode 100644
... ...
@@ -1,31 +0,0 @@
1
-package netlink
2
-
3
-import (
4
-	"fmt"
5
-	"net"
6
-)
7
-
8
-func NetworkGetRoutes() ([]Route, error) {
9
-	return nil, fmt.Errorf("Not implemented")
10
-}
11
-
12
-func NetworkLinkAdd(name string, linkType string) error {
13
-	return fmt.Errorf("Not implemented")
14
-}
15
-
16
-func NetworkLinkUp(iface *net.Interface) error {
17
-	return fmt.Errorf("Not implemented")
18
-}
19
-
20
-func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error {
21
-	return fmt.Errorf("Not implemented")
22
-}
23
-
24
-func AddDefaultGw(ip net.IP) error {
25
-	return fmt.Errorf("Not implemented")
26
-
27
-}
28
-
29
-func NetworkSetMTU(iface *net.Interface, mtu int) error {
30
-	return fmt.Errorf("Not implemented")
31
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package netlink
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+// +build !linux !amd64
1
+
2
+package netlink
3
+
4
+import (
5
+	"fmt"
6
+	"net"
7
+)
8
+
9
+func NetworkGetRoutes() ([]Route, error) {
10
+	return nil, fmt.Errorf("Not implemented")
11
+}
12
+
13
+func NetworkLinkAdd(name string, linkType string) error {
14
+	return fmt.Errorf("Not implemented")
15
+}
16
+
17
+func NetworkLinkUp(iface *net.Interface) error {
18
+	return fmt.Errorf("Not implemented")
19
+}
20
+
21
+func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error {
22
+	return fmt.Errorf("Not implemented")
23
+}
24
+
25
+func AddDefaultGw(ip net.IP) error {
26
+	return fmt.Errorf("Not implemented")
27
+
28
+}
29
+
30
+func NetworkSetMTU(iface *net.Interface, mtu int) error {
31
+	return fmt.Errorf("Not implemented")
32
+}
0 33
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-package docker
2
-
3
-import (
4
-	"io"
5
-	"os"
6
-)
7
-
8
-func CopyFile(dstFile, srcFile *os.File) error {
9
-	// No BTRFS reflink suppport, Fall back to normal copy
10
-
11
-	// FIXME: Check the return of Copy and compare with dstFile.Stat().Size
12
-	_, err := io.Copy(dstFile, srcFile)
13
-	return err
14
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package docker
2 4
 
3 5
 // FIXME: This could be easily rewritten in pure Go
4 6
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+// +build !linux !amd64
1
+
2
+package docker
3
+
4
+import (
5
+	"io"
6
+	"os"
7
+)
8
+
9
+func CopyFile(dstFile, srcFile *os.File) error {
10
+	// No BTRFS reflink suppport, Fall back to normal copy
11
+
12
+	// FIXME: Check the return of Copy and compare with dstFile.Stat().Size
13
+	_, err := io.Copy(dstFile, srcFile)
14
+	return err
15
+}
... ...
@@ -24,10 +24,12 @@ func TreeSize(dir string) (size int64, err error) {
24 24
 
25 25
 		// Check inode to handle hard links correctly
26 26
 		inode := fileInfo.Sys().(*syscall.Stat_t).Ino
27
-		if _, exists := data[inode]; exists {
27
+		// inode is not a uint64 on all platforms. Cast it to avoid issues.
28
+		if _, exists := data[uint64(inode)]; exists {
28 29
 			return nil
29 30
 		}
30
-		data[inode] = false
31
+		// inode is not a uint64 on all platforms. Cast it to avoid issues.
32
+		data[uint64(inode)] = false
31 33
 
32 34
 		size += s
33 35
 
34 36
deleted file mode 100644
... ...
@@ -1,13 +0,0 @@
1
-package utils
2
-
3
-import (
4
-	"errors"
5
-)
6
-
7
-type Utsname struct {
8
-	Release [65]byte
9
-}
10
-
11
-func uname() (*Utsname, error) {
12
-	return nil, errors.New("Kernel version detection is not available on darwin")
13
-}
... ...
@@ -1,3 +1,5 @@
1
+// +build amd64
2
+
1 3
 package utils
2 4
 
3 5
 import (
4 6
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+// +build !linux !amd64
1
+
2
+package utils
3
+
4
+import (
5
+	"errors"
6
+)
7
+
8
+type Utsname struct {
9
+	Release [65]byte
10
+}
11
+
12
+func uname() (*Utsname, error) {
13
+	return nil, errors.New("Kernel version detection is available only on linux")
14
+}