Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"bytes" |
| 6 | 6 |
"compress/bzip2" |
| 7 | 7 |
"compress/gzip" |
| 8 |
+ "errors" |
|
| 8 | 9 |
"fmt" |
| 9 | 10 |
"github.com/dotcloud/docker/utils" |
| 10 | 11 |
"io" |
| ... | ... |
@@ -17,14 +18,18 @@ import ( |
| 17 | 17 |
"syscall" |
| 18 | 18 |
) |
| 19 | 19 |
|
| 20 |
-type Archive io.Reader |
|
| 21 |
- |
|
| 22 |
-type Compression int |
|
| 20 |
+type ( |
|
| 21 |
+ Archive io.Reader |
|
| 22 |
+ Compression int |
|
| 23 |
+ TarOptions struct {
|
|
| 24 |
+ Includes []string |
|
| 25 |
+ Compression Compression |
|
| 26 |
+ } |
|
| 27 |
+) |
|
| 23 | 28 |
|
| 24 |
-type TarOptions struct {
|
|
| 25 |
- Includes []string |
|
| 26 |
- Compression Compression |
|
| 27 |
-} |
|
| 29 |
+var ( |
|
| 30 |
+ ErrNotImplemented = errors.New("Function not implemented")
|
|
| 31 |
+) |
|
| 28 | 32 |
|
| 29 | 33 |
const ( |
| 30 | 34 |
Uncompressed Compression = iota |
| ... | ... |
@@ -236,14 +241,14 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader) |
| 236 | 236 |
return fmt.Errorf("Unhandled tar header type %d\n", hdr.Typeflag)
|
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 |
- if err := syscall.Lchown(path, hdr.Uid, hdr.Gid); err != nil {
|
|
| 239 |
+ if err := os.Lchown(path, hdr.Uid, hdr.Gid); err != nil {
|
|
| 240 | 240 |
return err |
| 241 | 241 |
} |
| 242 | 242 |
|
| 243 | 243 |
// There is no LChmod, so ignore mode for symlink. Also, this |
| 244 | 244 |
// must happen after chown, as that can modify the file mode |
| 245 | 245 |
if hdr.Typeflag != tar.TypeSymlink {
|
| 246 |
- if err := syscall.Chmod(path, uint32(hdr.Mode&07777)); err != nil {
|
|
| 246 |
+ if err := os.Chmod(path, os.FileMode(hdr.Mode&07777)); err != nil {
|
|
| 247 | 247 |
return err |
| 248 | 248 |
} |
| 249 | 249 |
} |
| ... | ... |
@@ -251,7 +256,7 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader *tar.Reader) |
| 251 | 251 |
ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)}
|
| 252 | 252 |
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and |
| 253 | 253 |
if hdr.Typeflag != tar.TypeSymlink {
|
| 254 |
- if err := syscall.UtimesNano(path, ts); err != nil {
|
|
| 254 |
+ if err := UtimesNano(path, ts); err != nil {
|
|
| 255 | 255 |
return err |
| 256 | 256 |
} |
| 257 | 257 |
} else {
|
| 258 | 258 |
deleted file mode 100644 |
| ... | ... |
@@ -1,17 +0,0 @@ |
| 1 |
-// +build !linux !amd64 |
|
| 2 |
- |
|
| 3 |
-package archive |
|
| 4 |
- |
|
| 5 |
-import "syscall" |
|
| 6 |
- |
|
| 7 |
-func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
|
|
| 8 |
- return stat.Atimespec |
|
| 9 |
-} |
|
| 10 |
- |
|
| 11 |
-func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
|
|
| 12 |
- return stat.Mtimespec |
|
| 13 |
-} |
|
| 14 |
- |
|
| 15 |
-func LUtimesNano(path string, ts []syscall.Timespec) error {
|
|
| 16 |
- return nil |
|
| 17 |
-} |
| 33 | 40 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,21 @@ |
| 0 |
+// +build !linux |
|
| 1 |
+ |
|
| 2 |
+package archive |
|
| 3 |
+ |
|
| 4 |
+import "syscall" |
|
| 5 |
+ |
|
| 6 |
+func getLastAccess(stat *syscall.Stat_t) syscall.Timespec {
|
|
| 7 |
+ return stat.Atimespec |
|
| 8 |
+} |
|
| 9 |
+ |
|
| 10 |
+func getLastModification(stat *syscall.Stat_t) syscall.Timespec {
|
|
| 11 |
+ return stat.Mtimespec |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+func LUtimesNano(path string, ts []syscall.Timespec) error {
|
|
| 15 |
+ return ErrNotImplemented |
|
| 16 |
+} |
|
| 17 |
+ |
|
| 18 |
+func UtimesNano(path string, ts []syscall.Timespec) error {
|
|
| 19 |
+ return ErrNotImplemented |
|
| 20 |
+} |