You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
2.5 KiB

Index: src/github.com/docker/docker/pkg/archive/archive_unix.go
--- src/github.com/docker/docker/pkg/archive/archive_unix.go.orig 2017-11-25 19:54:31.000000000 +0100
+++ src/github.com/docker/docker/pkg/archive/archive_unix.go 2017-11-25 23:34:41.428155000 +0100
@@ -62,7 +62,7 @@
s, ok := stat.(*syscall.Stat_t)
if ok {
- inode = s.Ino
+ inode = uint64(s.Ino)
}
return
Index: src/github.com/docker/docker/pkg/archive/changes_unix.go
--- src/github.com/docker/docker/pkg/archive/changes_unix.go.orig 2017-11-25 19:54:31.000000000 +0100
+++ src/github.com/docker/docker/pkg/archive/changes_unix.go 2017-11-25 23:34:41.428280000 +0100
@@ -29,7 +29,7 @@
}
func getIno(fi os.FileInfo) uint64 {
- return fi.Sys().(*syscall.Stat_t).Ino
+ return uint64(fi.Sys().(*syscall.Stat_t).Ino)
}
func hasHardlinks(fi os.FileInfo) bool {
Index: src/github.com/jwilder/docker-gen/template.go
--- src/github.com/jwilder/docker-gen/template.go.orig 2017-11-25 19:53:49.000000000 +0100
+++ src/github.com/jwilder/docker-gen/template.go 2017-11-26 00:00:54.533302000 +0100
@@ -16,6 +16,7 @@
"regexp"
"strconv"
"strings"
+ "sort"
"syscall"
"text/template"
)
@@ -402,6 +403,30 @@
return strings.TrimSpace(s)
}
+// sortStrings returns a sorted array of strings
+func sortStrings(values []string) []string {
+ sort.Strings(values)
+ return values
+}
+
+// sortObjects returns a sorted array of objects (sorted by object key field)
+func sortObjects(objs interface{}, key string) (interface{}, error) {
+ objsVal, err := getArrayValues("sortObj", objs)
+ if err != nil {
+ return nil, err
+ }
+ data := make([]interface{}, objsVal.Len())
+ for i := 0; i < objsVal.Len(); i++ {
+ data[i] = objsVal.Index(i).Interface()
+ }
+ sort.Slice(data, func(i, j int) bool {
+ a := reflect.ValueOf(deepGet(data[i], key)).Interface().(string)
+ b := reflect.ValueOf(deepGet(data[j], key)).Interface().(string)
+ return a < b
+ })
+ return data, nil
+}
+
// when returns the trueValue when the condition is true and the falseValue otherwise
func when(condition bool, trueValue, falseValue interface{}) interface{} {
if condition {
@@ -440,6 +465,8 @@
"trimPrefix": trimPrefix,
"trimSuffix": trimSuffix,
"trim": trim,
+ "sortStrings": sortStrings,
+ "sortObjects": sortObjects,
"when": when,
"where": where,
"whereExist": whereExist,