Browse code

Tidy platform common bits in diff

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

John Howard authored on 2015/07/31 05:04:36
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+package chrootarchive
1
+
2
+import "github.com/docker/docker/pkg/archive"
3
+
4
+// ApplyLayer parses a diff in the standard layer format from `layer`,
5
+// and applies it to the directory `dest`. The stream `layer` can only be
6
+// uncompressed.
7
+// Returns the size in bytes of the contents of the layer.
8
+func ApplyLayer(dest string, layer archive.ArchiveReader) (size int64, err error) {
9
+	return applyLayerHandler(dest, layer, true)
10
+}
11
+
12
+// ApplyUncompressedLayer parses a diff in the standard layer format from
13
+// `layer`, and applies it to the directory `dest`. The stream `layer`
14
+// can only be uncompressed.
15
+// Returns the size in bytes of the contents of the layer.
16
+func ApplyUncompressedLayer(dest string, layer archive.ArchiveReader) (int64, error) {
17
+	return applyLayerHandler(dest, layer, false)
18
+}
... ...
@@ -65,22 +65,9 @@ func applyLayer() {
65 65
 	os.Exit(0)
66 66
 }
67 67
 
68
-// ApplyLayer parses a diff in the standard layer format from `layer`,
69
-// and applies it to the directory `dest`. The stream `layer` can only be
70
-// uncompressed.
71
-// Returns the size in bytes of the contents of the layer.
72
-func ApplyLayer(dest string, layer archive.ArchiveReader) (size int64, err error) {
73
-	return applyLayerHandler(dest, layer, true)
74
-}
75
-
76
-// ApplyUncompressedLayer parses a diff in the standard layer format from
77
-// `layer`, and applies it to the directory `dest`. The stream `layer`
78
-// can only be uncompressed.
79
-// Returns the size in bytes of the contents of the layer.
80
-func ApplyUncompressedLayer(dest string, layer archive.ArchiveReader) (int64, error) {
81
-	return applyLayerHandler(dest, layer, false)
82
-}
83
-
68
+// applyLayerHandler parses a diff in the standard layer format from `layer`, and
69
+// applies it to the directory `dest`. Returns the size in bytes of the
70
+// contents of the layer.
84 71
 func applyLayerHandler(dest string, layer archive.ArchiveReader, decompress bool) (size int64, err error) {
85 72
 	dest = filepath.Clean(dest)
86 73
 	if decompress {
... ...
@@ -9,23 +9,7 @@ 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
-
28
-// ApplyLayer parses a diff in the standard layer format from `layer`, and
12
+// applyLayerHandler parses a diff in the standard layer format from `layer`, and
29 13
 // applies it to the directory `dest`. Returns the size in bytes of the
30 14
 // contents of the layer.
31 15
 func applyLayerHandler(dest string, layer archive.ArchiveReader, decompress bool) (size int64, err error) {