Browse code

Windows: Daemon build is broken

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2015/07/30 12:08:51
Showing 2 changed files
... ...
@@ -19,7 +19,7 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
19 19
 	)
20 20
 	switch proto {
21 21
 	case "tcp":
22
-		l, err := s.initTcpSocket(addr)
22
+		l, err := s.initTCPSocket(addr)
23 23
 		if err != nil {
24 24
 			return nil, err
25 25
 		}
... ...
@@ -31,7 +31,7 @@ func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
31 31
 
32 32
 	var res []serverCloser
33 33
 	for _, l := range ls {
34
-		res = append(res, &HttpServer{
34
+		res = append(res, &HTTPServer{
35 35
 			&http.Server{
36 36
 				Addr:    addr,
37 37
 				Handler: s.router,
... ...
@@ -9,23 +9,43 @@ import (
9 9
 	"github.com/docker/docker/pkg/archive"
10 10
 )
11 11
 
12
+// ApplyLayer parses a diff in the standard layer format from `layer`,
13
+// and applies it to the directory `dest`. The stream `layer` can only be
14
+// uncompressed.
15
+// Returns the size in bytes of the contents of the layer.
16
+func ApplyLayer(dest string, layer archive.ArchiveReader) (size int64, err error) {
17
+	return applyLayerHandler(dest, layer, true)
18
+}
19
+
20
+// ApplyUncompressedLayer parses a diff in the standard layer format from
21
+// `layer`, and applies it to the directory `dest`. The stream `layer`
22
+// can only be uncompressed.
23
+// Returns the size in bytes of the contents of the layer.
24
+func ApplyUncompressedLayer(dest string, layer archive.ArchiveReader) (int64, error) {
25
+	return applyLayerHandler(dest, layer, false)
26
+}
27
+
12 28
 // ApplyLayer parses a diff in the standard layer format from `layer`, and
13 29
 // applies it to the directory `dest`. Returns the size in bytes of the
14 30
 // contents of the layer.
15
-func ApplyLayer(dest string, layer archive.ArchiveReader) (size int64, err error) {
31
+func applyLayerHandler(dest string, layer archive.ArchiveReader, decompress bool) (size int64, err error) {
16 32
 	dest = filepath.Clean(dest)
17
-	decompressed, err := archive.DecompressStream(layer)
18
-	if err != nil {
19
-		return 0, err
33
+	if decompress {
34
+		decompressed, err := archive.DecompressStream(layer)
35
+		if err != nil {
36
+			return 0, err
37
+		}
38
+		defer decompressed.Close()
39
+
40
+		layer = decompressed
20 41
 	}
21
-	defer decompressed.Close()
22 42
 
23 43
 	tmpDir, err := ioutil.TempDir(os.Getenv("temp"), "temp-docker-extract")
24 44
 	if err != nil {
25 45
 		return 0, fmt.Errorf("ApplyLayer failed to create temp-docker-extract under %s. %s", dest, err)
26 46
 	}
27 47
 
28
-	s, err := archive.UnpackLayer(dest, decompressed)
48
+	s, err := archive.UnpackLayer(dest, layer)
29 49
 	os.RemoveAll(tmpDir)
30 50
 	if err != nil {
31 51
 		return 0, fmt.Errorf("ApplyLayer %s failed UnpackLayer to %s", err, dest)