mirror of
https://github.com/containers/skopeo.git
synced 2025-09-19 17:15:32 +00:00
Update c/image and c/common to latest
... to include https://github.com/containers/image/pull/2173 and https://github.com/containers/common/pull/1731 . Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
33
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
33
vendor/github.com/vbauerster/mpb/v8/bar.go
generated
vendored
@@ -61,7 +61,6 @@ type renderFrame struct {
|
||||
shutdown int
|
||||
rmOnComplete bool
|
||||
noPop bool
|
||||
done bool
|
||||
err error
|
||||
}
|
||||
|
||||
@@ -82,10 +81,10 @@ func newBar(ctx context.Context, container *Progress, bs *bState) *Bar {
|
||||
return bar
|
||||
}
|
||||
|
||||
// ProxyReader wraps io.Reader with metrics required for progress tracking.
|
||||
// If `r` is 'unknown total/size' reader it's mandatory to call
|
||||
// (*Bar).SetTotal(-1, true) method after (io.Reader).Read returns io.EOF.
|
||||
// If bar is already completed or aborted, returns nil.
|
||||
// ProxyReader wraps io.Reader with metrics required for progress
|
||||
// tracking. If `r` is 'unknown total/size' reader it's mandatory
|
||||
// to call `(*Bar).SetTotal(-1, true)` after the wrapper returns
|
||||
// `io.EOF`. If bar is already completed or aborted, returns nil.
|
||||
// Panics if `r` is nil.
|
||||
func (b *Bar) ProxyReader(r io.Reader) io.ReadCloser {
|
||||
if r == nil {
|
||||
@@ -177,11 +176,10 @@ func (b *Bar) TraverseDecorators(cb func(decor.Decorator)) {
|
||||
}
|
||||
}
|
||||
|
||||
// EnableTriggerComplete enables triggering complete event. It's
|
||||
// effective only for bars which were constructed with `total <= 0` and
|
||||
// after total has been set with (*Bar).SetTotal(int64, false). If bar
|
||||
// has been incremented to the total, complete event is triggered right
|
||||
// away.
|
||||
// EnableTriggerComplete enables triggering complete event. It's effective
|
||||
// only for bars which were constructed with `total <= 0` and after total
|
||||
// has been set with `(*Bar).SetTotal(int64, false)`. If `curren >= total`
|
||||
// at the moment of call, complete event is triggered right away.
|
||||
func (b *Bar) EnableTriggerComplete() {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
@@ -200,11 +198,11 @@ func (b *Bar) EnableTriggerComplete() {
|
||||
}
|
||||
}
|
||||
|
||||
// SetTotal sets total to an arbitrary value. It's effective only for
|
||||
// bar which was constructed with `total <= 0`. Setting total to negative
|
||||
// value is equivalent to (*Bar).SetTotal((*Bar).Current(), bool) but faster.
|
||||
// If triggerCompletion is true, total value is set to current and
|
||||
// complete event is triggered right away.
|
||||
// SetTotal sets total to an arbitrary value. It's effective only for bar
|
||||
// which was constructed with `total <= 0`. Setting total to negative value
|
||||
// is equivalent to `(*Bar).SetTotal((*Bar).Current(), bool)` but faster. If
|
||||
// triggerCompletion is true, total value is set to current and complete
|
||||
// event is triggered right away.
|
||||
func (b *Bar) SetTotal(total int64, triggerCompletion bool) {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
@@ -344,7 +342,7 @@ func (b *Bar) SetPriority(priority int) {
|
||||
// Abort interrupts bar's running goroutine. Abort won't be engaged
|
||||
// if bar is already in complete state. If drop is true bar will be
|
||||
// removed as well. To make sure that bar has been removed call
|
||||
// (*Bar).Wait method.
|
||||
// `(*Bar).Wait()` method.
|
||||
func (b *Bar) Abort(drop bool) {
|
||||
select {
|
||||
case b.operateState <- func(s *bState) {
|
||||
@@ -415,7 +413,6 @@ func (b *Bar) serve(ctx context.Context, bs *bState) {
|
||||
}
|
||||
|
||||
func (b *Bar) render(tw int) {
|
||||
var done bool
|
||||
fn := func(s *bState) {
|
||||
var rows []io.Reader
|
||||
stat := newStatistics(tw, s)
|
||||
@@ -437,7 +434,6 @@ func (b *Bar) render(tw int) {
|
||||
shutdown: s.shutdown,
|
||||
rmOnComplete: s.rmOnComplete,
|
||||
noPop: s.noPop,
|
||||
done: done,
|
||||
}
|
||||
if s.completed || s.aborted {
|
||||
// post increment makes sure OnComplete decorators are rendered
|
||||
@@ -448,7 +444,6 @@ func (b *Bar) render(tw int) {
|
||||
select {
|
||||
case b.operateState <- fn:
|
||||
case <-b.done:
|
||||
done = true
|
||||
fn(b.bs)
|
||||
}
|
||||
}
|
||||
|
6
vendor/github.com/vbauerster/mpb/v8/container_option.go
generated
vendored
6
vendor/github.com/vbauerster/mpb/v8/container_option.go
generated
vendored
@@ -93,9 +93,9 @@ func WithAutoRefresh() ContainerOption {
|
||||
}
|
||||
}
|
||||
|
||||
// PopCompletedMode will pop completed bars to the top.
|
||||
// To stop rendering bar after it has been popped, use
|
||||
// mpb.BarRemoveOnComplete() option on that bar.
|
||||
// PopCompletedMode pop completed bars out of progress container.
|
||||
// In this mode completed bars get moved to the top and stop
|
||||
// participating in rendering cycle.
|
||||
func PopCompletedMode() ContainerOption {
|
||||
return func(s *pState) {
|
||||
s.popCompleted = true
|
||||
|
78
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
78
vendor/github.com/vbauerster/mpb/v8/progress.go
generated
vendored
@@ -18,8 +18,8 @@ const (
|
||||
defaultRefreshRate = 150 * time.Millisecond
|
||||
)
|
||||
|
||||
// DoneError represents an error when `*mpb.Progress` is done but its functionality is requested.
|
||||
var DoneError = fmt.Errorf("%T instance can't be reused after it's done", (*Progress)(nil))
|
||||
// DoneError represents use after `(*Progress).Wait()` error.
|
||||
var DoneError = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
|
||||
|
||||
// Progress represents a container that renders one or more progress bars.
|
||||
type Progress struct {
|
||||
@@ -55,13 +55,13 @@ type pState struct {
|
||||
}
|
||||
|
||||
// New creates new Progress container instance. It's not possible to
|
||||
// reuse instance after (*Progress).Wait method has been called.
|
||||
// reuse instance after `(*Progress).Wait` method has been called.
|
||||
func New(options ...ContainerOption) *Progress {
|
||||
return NewWithContext(context.Background(), options...)
|
||||
}
|
||||
|
||||
// NewWithContext creates new Progress container instance with provided
|
||||
// context. It's not possible to reuse instance after (*Progress).Wait
|
||||
// context. It's not possible to reuse instance after `(*Progress).Wait`
|
||||
// method has been called.
|
||||
func NewWithContext(ctx context.Context, options ...ContainerOption) *Progress {
|
||||
if ctx == nil {
|
||||
@@ -133,8 +133,7 @@ func (p *Progress) New(total int64, builder BarFillerBuilder, options ...BarOpti
|
||||
|
||||
// MustAdd creates a bar which renders itself by provided BarFiller.
|
||||
// If `total <= 0` triggering complete event by increment methods is
|
||||
// disabled. Panics if *Progress instance is done, i.e. called after
|
||||
// (*Progress).Wait().
|
||||
// disabled. Panics if called after `(*Progress).Wait()`.
|
||||
func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption) *Bar {
|
||||
bar, err := p.Add(total, filler, options...)
|
||||
if err != nil {
|
||||
@@ -145,8 +144,8 @@ func (p *Progress) MustAdd(total int64, filler BarFiller, options ...BarOption)
|
||||
|
||||
// Add creates a bar which renders itself by provided BarFiller.
|
||||
// If `total <= 0` triggering complete event by increment methods
|
||||
// is disabled. If *Progress instance is done, i.e. called after
|
||||
// (*Progress).Wait(), return error == DoneError.
|
||||
// is disabled. If called after `(*Progress).Wait()` then
|
||||
// `(nil, DoneError)` is returned.
|
||||
func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Bar, error) {
|
||||
if filler == nil {
|
||||
filler = NopStyle().Build()
|
||||
@@ -203,7 +202,7 @@ func (p *Progress) traverseBars(cb func(b *Bar) bool) {
|
||||
|
||||
// UpdateBarPriority either immediately or lazy.
|
||||
// With lazy flag order is updated after the next refresh cycle.
|
||||
// If you don't care about laziness just use *Bar.SetPriority(int).
|
||||
// If you don't care about laziness just use `(*Bar).SetPriority(int)`.
|
||||
func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
|
||||
if b == nil {
|
||||
return
|
||||
@@ -215,9 +214,9 @@ func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
|
||||
}
|
||||
|
||||
// Write is implementation of io.Writer.
|
||||
// Writing to `*mpb.Progress` will print lines above a running bar.
|
||||
// Writing to `*Progress` will print lines above a running bar.
|
||||
// Writes aren't flushed immediately, but at next refresh cycle.
|
||||
// If Write is called after `*mpb.Progress` is done, `mpb.DoneError`
|
||||
// If called after `(*Progress).Wait()` then `(0, DoneError)`
|
||||
// is returned.
|
||||
func (p *Progress) Write(b []byte) (int, error) {
|
||||
type result struct {
|
||||
@@ -238,7 +237,7 @@ func (p *Progress) Write(b []byte) (int, error) {
|
||||
}
|
||||
|
||||
// Wait waits for all bars to complete and finally shutdowns container. After
|
||||
// this method has been called, there is no way to reuse (*Progress) instance.
|
||||
// this method has been called, there is no way to reuse `*Progress` instance.
|
||||
func (p *Progress) Wait() {
|
||||
// wait for user wg, if any
|
||||
if p.uwg != nil {
|
||||
@@ -249,9 +248,9 @@ func (p *Progress) Wait() {
|
||||
p.Shutdown()
|
||||
}
|
||||
|
||||
// Shutdown cancels any running bar immediately and then shutdowns (*Progress)
|
||||
// Shutdown cancels any running bar immediately and then shutdowns `*Progress`
|
||||
// instance. Normally this method shouldn't be called unless you know what you
|
||||
// are doing. Proper way to shutdown is to call (*Progress).Wait() instead.
|
||||
// are doing. Proper way to shutdown is to call `(*Progress).Wait()` instead.
|
||||
func (p *Progress) Shutdown() {
|
||||
p.cancel()
|
||||
p.pwg.Wait()
|
||||
@@ -357,7 +356,7 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
|
||||
|
||||
func (s *pState) flush(cw *cwriter.Writer, height int) error {
|
||||
var wg sync.WaitGroup
|
||||
defer wg.Wait() // waiting for all s.hm.push to complete
|
||||
defer wg.Wait() // waiting for all s.push to complete
|
||||
|
||||
var popCount int
|
||||
var rows []io.Reader
|
||||
@@ -381,40 +380,34 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
|
||||
_, _ = io.Copy(io.Discard, row)
|
||||
}
|
||||
}
|
||||
if frame.shutdown != 0 && !frame.done {
|
||||
|
||||
switch frame.shutdown {
|
||||
case 1:
|
||||
b.cancel()
|
||||
if qb, ok := s.queueBars[b]; ok {
|
||||
b.cancel()
|
||||
delete(s.queueBars, b)
|
||||
qb.priority = b.priority
|
||||
wg.Add(1)
|
||||
go func(b *Bar) {
|
||||
s.hm.push(b, true)
|
||||
wg.Done()
|
||||
}(qb)
|
||||
continue
|
||||
go s.push(&wg, qb, true)
|
||||
} else if s.popCompleted && !frame.noPop {
|
||||
b.priority = s.popPriority
|
||||
s.popPriority++
|
||||
wg.Add(1)
|
||||
go s.push(&wg, b, false)
|
||||
} else if !frame.rmOnComplete {
|
||||
wg.Add(1)
|
||||
go s.push(&wg, b, false)
|
||||
}
|
||||
case 2:
|
||||
if s.popCompleted && !frame.noPop {
|
||||
switch frame.shutdown {
|
||||
case 1:
|
||||
b.priority = s.popPriority
|
||||
s.popPriority++
|
||||
default:
|
||||
b.cancel()
|
||||
popCount += usedRows
|
||||
continue
|
||||
}
|
||||
} else if frame.rmOnComplete {
|
||||
b.cancel()
|
||||
popCount += usedRows
|
||||
continue
|
||||
} else {
|
||||
b.cancel()
|
||||
}
|
||||
fallthrough
|
||||
default:
|
||||
wg.Add(1)
|
||||
go s.push(&wg, b, false)
|
||||
}
|
||||
wg.Add(1)
|
||||
go func(b *Bar) {
|
||||
s.hm.push(b, false)
|
||||
wg.Done()
|
||||
}(b)
|
||||
}
|
||||
|
||||
for i := len(rows) - 1; i >= 0; i-- {
|
||||
@@ -427,6 +420,11 @@ func (s *pState) flush(cw *cwriter.Writer, height int) error {
|
||||
return cw.Flush(len(rows) - popCount)
|
||||
}
|
||||
|
||||
func (s pState) push(wg *sync.WaitGroup, b *Bar, sync bool) {
|
||||
s.hm.push(b, sync)
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState {
|
||||
bs := &bState{
|
||||
id: s.idCount,
|
||||
|
Reference in New Issue
Block a user