diff --git a/docker/updater.go b/docker/updater.go index 3280a16..ce315e8 100644 --- a/docker/updater.go +++ b/docker/updater.go @@ -24,6 +24,8 @@ func NewUpdater(root string, opts ...UpdaterOpt) *Updater { return u } +func (u *Updater) Name() string { return "docker" } + type UpdaterOpt func(*Updater) func WithTagsLister(tags TagLister) UpdaterOpt { diff --git a/go.mod b/go.mod index ceebadf..ba0375a 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/sirupsen/logrus v1.7.0 github.com/spf13/viper v1.7.1 // indirect github.com/stretchr/testify v1.6.1 - github.com/thepwagner/action-update v0.0.30 + github.com/thepwagner/action-update v0.0.31 github.com/theupdateframework/notary v0.6.1 // indirect golang.org/x/mod v0.4.0 gopkg.in/dancannon/gorethink.v3 v3.0.5 // indirect diff --git a/go.sum b/go.sum index 8513e62..7f6f437 100644 --- a/go.sum +++ b/go.sum @@ -172,8 +172,8 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/bmatcuk/doublestar/v2 v2.0.4 h1:6I6oUiT/sU27eE2OFcWqBhL1SwjyvQuOssxT4a1yidI= -github.com/bmatcuk/doublestar/v2 v2.0.4/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQmTZRptLie8RgRw= +github.com/bmatcuk/doublestar/v3 v3.0.0 h1:TQtVPlDnAYwcrVNB2JiGuMc++H5qzWZd9PhkNo5WyHI= +github.com/bmatcuk/doublestar/v3 v3.0.0/go.mod h1:6PcTVMw80pCY1RVuoqu3V++99uQB3vsSYKPTd8AWA0k= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTKY95VwV8U= @@ -799,14 +799,14 @@ github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYr github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.3/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= -github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= -github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= +github.com/otiai10/copy v1.4.2 h1:RTiz2sol3eoXPLF4o+YWqEybwfUa/Q2Nkc4ZIUs3fwI= +github.com/otiai10/copy v1.4.2/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= @@ -967,8 +967,8 @@ github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0 github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tetafro/godot v0.3.7/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= github.com/tetafro/godot v0.4.2/go.mod h1:/7NLHhv08H1+8DNj0MElpAACw1ajsCuf3TKNQxA5S+0= -github.com/thepwagner/action-update v0.0.30 h1:gWntaL9NvQ5R6+WOxusk3zOjmhg+2Lj/OKIh1AqRwSs= -github.com/thepwagner/action-update v0.0.30/go.mod h1:azD1FomnIOFqZ2f1OFzmEvEIMz5p3rkxtkQvQRWDFRA= +github.com/thepwagner/action-update v0.0.31 h1:bCRbzpKEJ0o01YcA2n74pj+MY1FGNS3a3VSIEYdwgek= +github.com/thepwagner/action-update v0.0.31/go.mod h1:6FCNUGnul4Flbg9OiQYeOlHlKky9TK5Pfl9u0nc0/Ww= github.com/theupdateframework/notary v0.6.1 h1:7wshjstgS9x9F5LuB1L5mBI2xNMObWqjz+cjWoom6l0= github.com/theupdateframework/notary v0.6.1/go.mod h1:MOfgIfmox8s7/7fduvB2xyPPMJCrjRLRizA8OFwpnKY= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= diff --git a/vendor/github.com/bmatcuk/doublestar/v2/go.mod b/vendor/github.com/bmatcuk/doublestar/v2/go.mod deleted file mode 100644 index f0fa6bc..0000000 --- a/vendor/github.com/bmatcuk/doublestar/v2/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/bmatcuk/doublestar/v2 - -go 1.12 diff --git a/vendor/github.com/bmatcuk/doublestar/v2/.gitignore b/vendor/github.com/bmatcuk/doublestar/v3/.gitignore similarity index 100% rename from vendor/github.com/bmatcuk/doublestar/v2/.gitignore rename to vendor/github.com/bmatcuk/doublestar/v3/.gitignore diff --git a/vendor/github.com/bmatcuk/doublestar/v2/.travis.yml b/vendor/github.com/bmatcuk/doublestar/v3/.travis.yml similarity index 96% rename from vendor/github.com/bmatcuk/doublestar/v2/.travis.yml rename to vendor/github.com/bmatcuk/doublestar/v3/.travis.yml index 78a90e7..51cf057 100644 --- a/vendor/github.com/bmatcuk/doublestar/v2/.travis.yml +++ b/vendor/github.com/bmatcuk/doublestar/v3/.travis.yml @@ -1,9 +1,9 @@ language: go go: - - 1.12 - 1.13 - 1.14 + - 1.15 os: - linux diff --git a/vendor/github.com/bmatcuk/doublestar/v2/LICENSE b/vendor/github.com/bmatcuk/doublestar/v3/LICENSE similarity index 100% rename from vendor/github.com/bmatcuk/doublestar/v2/LICENSE rename to vendor/github.com/bmatcuk/doublestar/v3/LICENSE diff --git a/vendor/github.com/bmatcuk/doublestar/v2/README.md b/vendor/github.com/bmatcuk/doublestar/v3/README.md similarity index 99% rename from vendor/github.com/bmatcuk/doublestar/v2/README.md rename to vendor/github.com/bmatcuk/doublestar/v3/README.md index 2f6781c..5d95352 100644 --- a/vendor/github.com/bmatcuk/doublestar/v2/README.md +++ b/vendor/github.com/bmatcuk/doublestar/v3/README.md @@ -9,7 +9,7 @@ Path pattern matching and globbing supporting `doublestar` (`**`) patterns. ## About -#### [Updating from v1 to v2?](UPGRADING.md) +#### [Upgrading to v2? To v3?](UPGRADING.md) **doublestar** is a [golang](http://golang.org/) implementation of path pattern matching and globbing with support for "doublestar" (aka globstar: `**`) diff --git a/vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md b/vendor/github.com/bmatcuk/doublestar/v3/UPGRADING.md similarity index 64% rename from vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md rename to vendor/github.com/bmatcuk/doublestar/v3/UPGRADING.md index 8193544..9a3b82d 100644 --- a/vendor/github.com/bmatcuk/doublestar/v2/UPGRADING.md +++ b/vendor/github.com/bmatcuk/doublestar/v3/UPGRADING.md @@ -1,3 +1,11 @@ +# Upgrading from v2 to v3 + +v3 introduced using `!` to negate character classes, in addition to `^`. If any +of your patterns include a character class that starts with an exclamation mark +(ie, `[!...]`), you'll need to update the pattern to escape or move the +exclamation mark. Note that, like the caret (`^`), it only negates the +character class if it is the first character in the character class. + # Upgrading from v1 to v2 The change from v1 to v2 was fairly minor: the return type of the `Open` method diff --git a/vendor/github.com/bmatcuk/doublestar/v2/doublestar.go b/vendor/github.com/bmatcuk/doublestar/v3/doublestar.go similarity index 99% rename from vendor/github.com/bmatcuk/doublestar/v2/doublestar.go rename to vendor/github.com/bmatcuk/doublestar/v3/doublestar.go index aacff06..36919e5 100644 --- a/vendor/github.com/bmatcuk/doublestar/v2/doublestar.go +++ b/vendor/github.com/bmatcuk/doublestar/v3/doublestar.go @@ -163,7 +163,7 @@ func isZeroLengthPattern(pattern string) (ret bool, err error) { // '**' matches any sequence of characters, including // path separators. // '?' matches any single non-path-separator character -// '[' [ '^' ] { character-range } ']' +// '[' [ '^' '!' ] { character-range } ']' // character class (must be non-empty) // '{' { term } [ ',' { term } ... ] '}' // c matches character c (c != '*', '?', '\\', '[') @@ -515,7 +515,8 @@ func matchComponent(pattern, name string) ([]string, error) { if classRunesLen > 0 { classIdx := 0 matchClass := false - if classRunes[0] == '^' { + negate := classRunes[0] == '^' || classRunes[0] == '!' + if negate { classIdx++ } for classIdx < classRunesLen { @@ -556,7 +557,7 @@ func matchComponent(pattern, name string) ([]string, error) { matchClass = true } } - if matchClass == (classRunes[0] == '^') { + if matchClass == negate { return nil, nil } } else { diff --git a/vendor/github.com/bmatcuk/doublestar/v3/go.mod b/vendor/github.com/bmatcuk/doublestar/v3/go.mod new file mode 100644 index 0000000..cf77e57 --- /dev/null +++ b/vendor/github.com/bmatcuk/doublestar/v3/go.mod @@ -0,0 +1,3 @@ +module github.com/bmatcuk/doublestar/v3 + +go 1.12 diff --git a/vendor/github.com/otiai10/copy/README.md b/vendor/github.com/otiai10/copy/README.md index 5ad7c57..c2a2fd8 100644 --- a/vendor/github.com/otiai10/copy/README.md +++ b/vendor/github.com/otiai10/copy/README.md @@ -1,14 +1,62 @@ # copy +[![Go Reference](https://pkg.go.dev/badge/github.com/otiai10/copy.svg)](https://pkg.go.dev/github.com/otiai10/copy) [![Actions Status](https://github.com/otiai10/copy/workflows/Go/badge.svg)](https://github.com/otiai10/copy/actions) -[![codecov](https://codecov.io/gh/otiai10/copy/branch/master/graph/badge.svg)](https://codecov.io/gh/otiai10/copy) -[![GoDoc](https://godoc.org/github.com/otiai10/copy?status.svg)](https://godoc.org/github.com/otiai10/copy) +[![codecov](https://codecov.io/gh/otiai10/copy/branch/main/graph/badge.svg)](https://codecov.io/gh/otiai10/copy) +[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/otiai10/copy/blob/main/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/otiai10/copy)](https://goreportcard.com/report/github.com/otiai10/copy) +[![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/otiai10/copy?sort=semver)](https://pkg.go.dev/github.com/otiai10/copy) `copy` copies directories recursively. -Example: +# Example Usage ```go err := Copy("your/directory", "your/directory.copy") ``` + +# Advanced Usage + +```go +// Options specifies optional actions on copying. +type Options struct { + + // OnSymlink can specify what to do on symlink + OnSymlink func(src string) SymlinkAction + + // OnDirExists can specify what to do when there is a directory already existing in destination. + OnDirExists func(src, dest string) DirExistsAction + + // Skip can specify which files should be skipped + Skip func(src string) (bool, error) + + // AddPermission to every entities, + // NO MORE THAN 0777 + AddPermission os.FileMode + + // Sync file after copy. + // Useful in case when file must be on the disk + // (in case crash happens, for example), + // at the expense of some performance penalty + Sync bool + + // Preserve the atime and the mtime of the entries + // On linux we can preserve only up to 1 millisecond accuracy + PreserveTimes bool + +} +``` + +```go +// For example... +opt := Options{ + Skip: func(src string) { + return strings.HasSuffix(src, ".git") + }, +} +err := Copy("your/directory", "your/directory.copy", opt) +``` + +# Issues + +- https://github.com/otiai10/copy/issues diff --git a/vendor/github.com/otiai10/copy/copy.go b/vendor/github.com/otiai10/copy/copy.go index 0ff0e5b..f2a6e12 100644 --- a/vendor/github.com/otiai10/copy/copy.go +++ b/vendor/github.com/otiai10/copy/copy.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" "path/filepath" + "time" ) const ( @@ -14,26 +15,45 @@ const ( tmpPermissionForDirectory = os.FileMode(0755) ) +type timespec struct { + Mtime time.Time + Atime time.Time + Ctime time.Time +} + // Copy copies src to dest, doesn't matter if src is a directory or a file. func Copy(src, dest string, opt ...Options) error { info, err := os.Lstat(src) if err != nil { return err } - return switchboard(src, dest, info, assure(opt...)) + return switchboard(src, dest, info, assure(src, dest, opt...)) } // switchboard switches proper copy functions regarding file type, etc... // If there would be anything else here, add a case to this switchboard. -func switchboard(src, dest string, info os.FileInfo, opt Options) error { +func switchboard(src, dest string, info os.FileInfo, opt Options) (err error) { switch { case info.Mode()&os.ModeSymlink != 0: - return onsymlink(src, dest, info, opt) + err = onsymlink(src, dest, info, opt) case info.IsDir(): - return dcopy(src, dest, info, opt) + err = dcopy(src, dest, info, opt) default: - return fcopy(src, dest, info, opt) + err = fcopy(src, dest, info, opt) + } + + if err != nil { + return err + } + + if opt.PreserveTimes { + spec := getTimeSpec(info) + if err := os.Chtimes(dest, spec.Atime, spec.Mtime); err != nil { + return err + } } + + return err } // copy decide if this src should be copied or not. @@ -47,6 +67,7 @@ func copy(src, dest string, info os.FileInfo, opt Options) error { if skip { return nil } + return switchboard(src, dest, info, opt) } @@ -91,6 +112,17 @@ func fcopy(src, dest string, info os.FileInfo, opt Options) (err error) { // and pass everything to "copy" recursively. func dcopy(srcdir, destdir string, info os.FileInfo, opt Options) (err error) { + if opt.OnDirExists != nil && destdir != opt.intent.dest { + switch opt.OnDirExists(srcdir, destdir) { + case Replace: + if err := os.RemoveAll(destdir); err != nil { + return err + } + case Untouchable: + return nil + } + } + originalMode := info.Mode() // Make dest dir with 0755 so that everything writable. @@ -118,7 +150,6 @@ func dcopy(srcdir, destdir string, info os.FileInfo, opt Options) (err error) { } func onsymlink(src, dest string, info os.FileInfo, opt Options) error { - switch opt.OnSymlink(src) { case Shallow: return lcopy(src, dest) @@ -169,16 +200,18 @@ func chmod(dir string, mode os.FileMode, reported *error) { // assure Options struct, should be called only once. // All optional values MUST NOT BE nil/zero after assured. -func assure(opts ...Options) Options { +func assure(src, dest string, opts ...Options) Options { + defopt := getDefaultOptions(src, dest) if len(opts) == 0 { - return getDefaultOptions() + return defopt } - defopt := getDefaultOptions() if opts[0].OnSymlink == nil { opts[0].OnSymlink = defopt.OnSymlink } if opts[0].Skip == nil { opts[0].Skip = defopt.Skip } + opts[0].intent.src = defopt.intent.src + opts[0].intent.dest = defopt.intent.dest return opts[0] } diff --git a/vendor/github.com/otiai10/copy/go.mod b/vendor/github.com/otiai10/copy/go.mod index eecb26d..e985ebe 100644 --- a/vendor/github.com/otiai10/copy/go.mod +++ b/vendor/github.com/otiai10/copy/go.mod @@ -1,5 +1,5 @@ module github.com/otiai10/copy -go 1.12 +go 1.14 -require github.com/otiai10/mint v1.3.1 +require github.com/otiai10/mint v1.3.2 diff --git a/vendor/github.com/otiai10/copy/go.sum b/vendor/github.com/otiai10/copy/go.sum index 952304a..6d78681 100644 --- a/vendor/github.com/otiai10/copy/go.sum +++ b/vendor/github.com/otiai10/copy/go.sum @@ -1,5 +1,6 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= -github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc= -github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/otiai10/mint v1.3.2 h1:VYWnrP5fXmz1MXvjuUvcBrXSjGE6xjON+axB/UrpO3E= +github.com/otiai10/mint v1.3.2/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= diff --git a/vendor/github.com/otiai10/copy/options.go b/vendor/github.com/otiai10/copy/options.go index 21504cd..88b9f5d 100644 --- a/vendor/github.com/otiai10/copy/options.go +++ b/vendor/github.com/otiai10/copy/options.go @@ -4,18 +4,34 @@ import "os" // Options specifies optional actions on copying. type Options struct { + // OnSymlink can specify what to do on symlink OnSymlink func(src string) SymlinkAction + + // OnDirExists can specify what to do when there is a directory already existing in destination. + OnDirExists func(src, dest string) DirExistsAction + // Skip can specify which files should be skipped Skip func(src string) (bool, error) + // AddPermission to every entities, // NO MORE THAN 0777 AddPermission os.FileMode + // Sync file after copy. // Useful in case when file must be on the disk // (in case crash happens, for example), // at the expense of some performance penalty Sync bool + + // Preserve the atime and the mtime of the entries + // On linux we can preserve only up to 1 millisecond accuracy + PreserveTimes bool + + intent struct { + src string + dest string + } } // SymlinkAction represents what to do on symlink. @@ -30,17 +46,35 @@ const ( Skip ) +// DirExistsAction represents what to do on dest dir. +type DirExistsAction int + +const ( + // Merge preserves or overwrites existing files under the dir (default behavior). + Merge DirExistsAction = iota + // Replace deletes all contents under the dir and copy src files. + Replace + // Untouchable does nothing for the dir, and leaves it as it is. + Untouchable +) + // getDefaultOptions provides default options, // which would be modified by usage-side. -func getDefaultOptions() Options { +func getDefaultOptions(src, dest string) Options { return Options{ OnSymlink: func(string) SymlinkAction { return Shallow // Do shallow copy }, + OnDirExists: nil, // Default behavior is "Merge". Skip: func(string) (bool, error) { return false, nil // Don't skip }, AddPermission: 0, // Add nothing Sync: false, // Do not sync + PreserveTimes: false, // Do not preserve the modification time + intent: struct { + src string + dest string + }{src, dest}, } } diff --git a/vendor/github.com/otiai10/copy/stat_times.go b/vendor/github.com/otiai10/copy/stat_times.go new file mode 100644 index 0000000..7d8ac6b --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times.go @@ -0,0 +1,21 @@ +// +build !windows,!darwin,!freebsd + +// TODO: add more runtimes + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)), + Ctime: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_darwin.go b/vendor/github.com/otiai10/copy/stat_times_darwin.go new file mode 100644 index 0000000..ce7a7fb --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_darwin.go @@ -0,0 +1,19 @@ +// +build darwin + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(stat.Atimespec.Sec, stat.Atimespec.Nsec), + Ctime: time.Unix(stat.Ctimespec.Sec, stat.Ctimespec.Nsec), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_freebsd.go b/vendor/github.com/otiai10/copy/stat_times_freebsd.go new file mode 100644 index 0000000..115f138 --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_freebsd.go @@ -0,0 +1,19 @@ +// +build freebsd + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Stat_t) + times := timespec{ + Mtime: info.ModTime(), + Atime: time.Unix(int64(stat.Atimespec.Sec), int64(stat.Atimespec.Nsec)), + Ctime: time.Unix(int64(stat.Ctimespec.Sec), int64(stat.Ctimespec.Nsec)), + } + return times +} diff --git a/vendor/github.com/otiai10/copy/stat_times_windows.go b/vendor/github.com/otiai10/copy/stat_times_windows.go new file mode 100644 index 0000000..113a2ec --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times_windows.go @@ -0,0 +1,18 @@ +// +build windows + +package copy + +import ( + "os" + "syscall" + "time" +) + +func getTimeSpec(info os.FileInfo) timespec { + stat := info.Sys().(*syscall.Win32FileAttributeData) + return timespec{ + Mtime: time.Unix(0, stat.LastWriteTime.Nanoseconds()), + Atime: time.Unix(0, stat.LastAccessTime.Nanoseconds()), + Ctime: time.Unix(0, stat.CreationTime.Nanoseconds()), + } +} diff --git a/vendor/github.com/thepwagner/action-update/actions/updateaction/env.go b/vendor/github.com/thepwagner/action-update/actions/updateaction/env.go index b8869b4..50c9e8b 100644 --- a/vendor/github.com/thepwagner/action-update/actions/updateaction/env.go +++ b/vendor/github.com/thepwagner/action-update/actions/updateaction/env.go @@ -6,7 +6,7 @@ import ( "fmt" "strings" - "github.com/bmatcuk/doublestar/v2" + "github.com/bmatcuk/doublestar/v3" "github.com/thepwagner/action-update/actions" ) diff --git a/vendor/github.com/thepwagner/action-update/actions/updateaction/release.go b/vendor/github.com/thepwagner/action-update/actions/updateaction/release.go index 7193bcc..f73edee 100644 --- a/vendor/github.com/thepwagner/action-update/actions/updateaction/release.go +++ b/vendor/github.com/thepwagner/action-update/actions/updateaction/release.go @@ -11,6 +11,9 @@ import ( "github.com/thepwagner/action-update/repo" ) +// Release emits a `repository_dispatch` events to a list of repositories when a release is published. +// The dispatched event should be handled by RepositoryDispatch(), to update the triggered repositories +// to the release that was just made. func (h *handler) Release(ctx context.Context, evt *github.ReleaseEvent) error { if evt.GetAction() != "released" { logrus.WithField("action", evt.GetAction()).Info("ignoring release event") @@ -29,7 +32,7 @@ func (h *handler) Release(ctx context.Context, evt *github.ReleaseEvent) error { } logrus.WithField("issue_number", feedbackIssue.Number).Debug("created feedback issue") - dispatchOpts, err := releaseDispatchOptions(evt, feedbackIssue) + dispatchOpts, err := h.releaseDispatchOptions(evt, feedbackIssue) if err != nil { return err } @@ -66,10 +69,11 @@ func releaseFeedbackIssue(ctx context.Context, gh *github.Client, evt *github.Re return issue, err } -func releaseDispatchOptions(evt *github.ReleaseEvent, feedbackIssue *github.Issue) (github.DispatchRequestOptions, error) { +func (h *handler) releaseDispatchOptions(evt *github.ReleaseEvent, feedbackIssue *github.Issue) (github.DispatchRequestOptions, error) { payload, err := json.Marshal(&RepoDispatchActionUpdatePayload{ - Path: fmt.Sprintf("github.com/%s", evt.GetRepo().GetFullName()), - Next: evt.GetRelease().GetTagName(), + Updater: h.updaterFactory.NewUpdater("").Name(), + Path: fmt.Sprintf("github.com/%s", evt.GetRepo().GetFullName()), + Next: evt.GetRelease().GetTagName(), Feedback: RepoDispatchActionUpdatePayloadFeedback{ Owner: evt.GetRepo().GetOwner().GetLogin(), Name: evt.GetRepo().GetName(), diff --git a/vendor/github.com/thepwagner/action-update/actions/updateaction/repositorydispatch.go b/vendor/github.com/thepwagner/action-update/actions/updateaction/repositorydispatch.go index f6d3010..678a47c 100644 --- a/vendor/github.com/thepwagner/action-update/actions/updateaction/repositorydispatch.go +++ b/vendor/github.com/thepwagner/action-update/actions/updateaction/repositorydispatch.go @@ -88,6 +88,10 @@ func (h *handler) repoDispatchActionUpdate(ctx context.Context, evt *github.Repo if err != nil { return fmt.Errorf("getting RepoUpdater: %w", err) } + if payload.Updater != "" && repoUpdater.Updater.Name() != payload.Updater { + logrus.WithField("updater", payload.Updater).Info("skipping event for other updaters") + return nil + } ug := updater.NewUpdateGroup("", update) if err := repoUpdater.Update(ctx, baseBranch, branchName, ug); err != nil { @@ -98,6 +102,7 @@ func (h *handler) repoDispatchActionUpdate(ctx context.Context, evt *github.Repo } type RepoDispatchActionUpdatePayload struct { + Updater string `json:"updater"` Path string `json:"path"` Next string `json:"next"` Feedback RepoDispatchActionUpdatePayloadFeedback `json:"feedback"` diff --git a/vendor/github.com/thepwagner/action-update/updater/updater.go b/vendor/github.com/thepwagner/action-update/updater/updater.go index 849635e..48ac498 100644 --- a/vendor/github.com/thepwagner/action-update/updater/updater.go +++ b/vendor/github.com/thepwagner/action-update/updater/updater.go @@ -13,7 +13,7 @@ import ( // RepoUpdater creates branches proposing all available updates for a Go module. type RepoUpdater struct { repo Repo - updater Updater + Updater Updater groups Groups branchNamer UpdateBranchNamer } @@ -39,6 +39,7 @@ type Repo interface { } type Updater interface { + Name() string Dependencies(context.Context) ([]Dependency, error) Check(ctx context.Context, dep Dependency, filter func(string) bool) (*Update, error) ApplyUpdate(context.Context, Update) error @@ -53,7 +54,7 @@ type Factory interface { func NewRepoUpdater(repo Repo, updater Updater, opts ...RepoUpdaterOpt) *RepoUpdater { u := &RepoUpdater{ repo: repo, - updater: updater, + Updater: updater, branchNamer: DefaultUpdateBranchNamer{}, } for _, opt := range opts { @@ -82,7 +83,7 @@ func (u *RepoUpdater) Update(ctx context.Context, baseBranch, branchName string, return fmt.Errorf("switching to target branch: %w", err) } for _, update := range updates.Updates { - if err := u.updater.ApplyUpdate(ctx, update); err != nil { + if err := u.Updater.ApplyUpdate(ctx, update); err != nil { return fmt.Errorf("applying update: %w", err) } } @@ -117,7 +118,7 @@ func (u *RepoUpdater) updateBranch(ctx context.Context, log logrus.FieldLogger, } // List dependencies while on this branch: - deps, err := u.updater.Dependencies(ctx) + deps, err := u.Updater.Dependencies(ctx) if err != nil { return fmt.Errorf("getting dependencies: %w", err) } @@ -183,7 +184,7 @@ func (u *RepoUpdater) updateBranch(ctx context.Context, log logrus.FieldLogger, } func (u *RepoUpdater) checkForUpdate(ctx context.Context, log logrus.FieldLogger, dep Dependency, filter func(string) bool) *Update { - update, err := u.updater.Check(ctx, dep, filter) + update, err := u.Updater.Check(ctx, dep, filter) if err != nil { log.WithError(err).Warn("error checking for updates") return nil @@ -209,7 +210,7 @@ func (u *RepoUpdater) singleUpdate(ctx context.Context, log logrus.FieldLogger, if err := u.repo.NewBranch(baseBranch, branch); err != nil { return false, fmt.Errorf("switching to target branch: %w", err) } - if err := u.updater.ApplyUpdate(ctx, *update); err != nil { + if err := u.Updater.ApplyUpdate(ctx, *update); err != nil { return false, fmt.Errorf("applying batched update: %w", err) } @@ -254,7 +255,7 @@ func (u *RepoUpdater) groupedUpdate(ctx context.Context, log logrus.FieldLogger, } for _, update := range updates { - if err := u.updater.ApplyUpdate(ctx, update); err != nil { + if err := u.Updater.ApplyUpdate(ctx, update); err != nil { return 0, fmt.Errorf("applying batched update: %w", err) } } diff --git a/vendor/modules.txt b/vendor/modules.txt index f0ba9df..9a13c32 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -14,8 +14,8 @@ github.com/agl/ed25519/edwards25519 github.com/beorn7/perks/quantile # github.com/bitly/go-hostpool v0.1.0 ## explicit -# github.com/bmatcuk/doublestar/v2 v2.0.4 -github.com/bmatcuk/doublestar/v2 +# github.com/bmatcuk/doublestar/v3 v3.0.0 +github.com/bmatcuk/doublestar/v3 # github.com/caarlos0/env/v6 v6.4.0 github.com/caarlos0/env/v6 # github.com/cenkalti/backoff v2.2.1+incompatible @@ -239,7 +239,7 @@ github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 # github.com/opencontainers/runc v1.0.0-rc92 github.com/opencontainers/runc/libcontainer/user -# github.com/otiai10/copy v1.2.0 +# github.com/otiai10/copy v1.4.2 github.com/otiai10/copy # github.com/pkg/errors v0.9.1 github.com/pkg/errors @@ -277,7 +277,7 @@ github.com/stretchr/objx github.com/stretchr/testify/assert github.com/stretchr/testify/mock github.com/stretchr/testify/require -# github.com/thepwagner/action-update v0.0.30 +# github.com/thepwagner/action-update v0.0.31 ## explicit github.com/thepwagner/action-update/actions github.com/thepwagner/action-update/actions/updateaction