fix(deps): update module github.com/containers/image/v5 to v5.35.0

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
renovate[bot]
2025-05-20 16:18:51 +00:00
committed by Miloslav Trmač
parent d0d0b7099e
commit ec3516ec89
434 changed files with 16938 additions and 14177 deletions

View File

@@ -45,7 +45,7 @@ type bState struct {
noPop bool
autoRefresh bool
buffers [3]*bytes.Buffer
decorators [2][]decor.Decorator
decorGroups [2][]decor.Decorator
ewmaDecorators []decor.EwmaDecorator
filler BarFiller
extender extenderFunc
@@ -117,7 +117,7 @@ func (b *Bar) ProxyWriter(w io.Writer) io.WriteCloser {
}
}
// ID returs id of the bar.
// ID returns id of the bar.
func (b *Bar) ID() int {
result := make(chan int)
select {
@@ -156,31 +156,23 @@ func (b *Bar) SetRefill(amount int64) {
}
}
// TraverseDecorators traverses available decorators and calls cb func
// on each in a new goroutine. Decorators implementing decor.Wrapper
// interface are unwrapped first.
// TraverseDecorators traverses available decorators and calls `cb`
// on each unwrapped one.
func (b *Bar) TraverseDecorators(cb func(decor.Decorator)) {
select {
case b.operateState <- func(s *bState) {
var wg sync.WaitGroup
for _, decorators := range s.decorators {
wg.Add(len(decorators))
for _, d := range decorators {
d := d
go func() {
cb(unwrap(d))
wg.Done()
}()
for _, group := range s.decorGroups {
for _, d := range group {
cb(unwrap(d))
}
}
wg.Wait()
}:
case <-b.ctx.Done():
}
}
// EnableTriggerComplete enables triggering complete event. It's effective
// only for bars which were constructed with `total <= 0`. If `curren >= total`
// only for bars which were constructed with `total <= 0`. If `current >= total`
// at the moment of call, complete event is triggered right away.
func (b *Bar) EnableTriggerComplete() {
select {
@@ -402,8 +394,8 @@ func (b *Bar) Wait() {
}
func (b *Bar) serve(bs *bState) {
decoratorsOnShutdown := func(decorators []decor.Decorator) {
for _, d := range decorators {
decoratorsOnShutdown := func(group []decor.Decorator) {
for _, d := range group {
if d, ok := unwrap(d).(decor.ShutdownListener); ok {
b.container.bwg.Add(1)
go func() {
@@ -418,8 +410,8 @@ func (b *Bar) serve(bs *bState) {
case op := <-b.operateState:
op(bs)
case <-b.ctx.Done():
decoratorsOnShutdown(bs.decorators[0])
decoratorsOnShutdown(bs.decorators[1])
decoratorsOnShutdown(bs.decorGroups[0])
decoratorsOnShutdown(bs.decorGroups[1])
// bar can be aborted by canceling parent ctx without calling b.Abort
bs.aborted = !bs.completed()
b.bs = bs
@@ -491,9 +483,9 @@ func (b *Bar) wSyncTable() syncTable {
}
func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
decorFiller := func(buf *bytes.Buffer, decorators []decor.Decorator) (err error) {
for _, d := range decorators {
// need to call Decor in any case becase of width synchronization
decorFiller := func(buf *bytes.Buffer, group []decor.Decorator) (err error) {
for _, d := range group {
// need to call Decor in any case because of width synchronization
str, width := d.Decor(stat)
if err != nil {
continue
@@ -511,7 +503,7 @@ func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
}
for i, buf := range s.buffers[:2] {
err = decorFiller(buf, s.decorators[i])
err = decorFiller(buf, s.decorGroups[i])
if err != nil {
return nil, err
}
@@ -545,34 +537,20 @@ func (s *bState) draw(stat decor.Statistics) (_ io.Reader, err error) {
}
func (s *bState) wSyncTable() (table syncTable) {
var count int
var start int
var row []chan int
for i, decorators := range s.decorators {
for _, d := range decorators {
for i, group := range s.decorGroups {
for _, d := range group {
if ch, ok := d.Sync(); ok {
row = append(row, ch)
count++
}
}
switch i {
case 0:
table[i] = row[0:count]
default:
table[i] = row[len(table[i-1]):count]
}
table[i], start = row[start:], len(row)
}
return table
}
func (s *bState) populateEwmaDecorators(decorators []decor.Decorator) {
for _, d := range decorators {
if d, ok := unwrap(d).(decor.EwmaDecorator); ok {
s.ewmaDecorators = append(s.ewmaDecorators, d)
}
}
}
func (s *bState) triggerCompletion(b *Bar) {
s.triggerComplete = true
if s.autoRefresh {

View File

@@ -10,31 +10,29 @@ import (
// BarOption is a func option to alter default behavior of a bar.
type BarOption func(*bState)
func inspect(decorators []decor.Decorator) (dest []decor.Decorator) {
for _, decorator := range decorators {
if decorator == nil {
continue
}
dest = append(dest, decorator)
}
return
}
// PrependDecorators let you inject decorators to the bar's left side.
func PrependDecorators(decorators ...decor.Decorator) BarOption {
decorators = inspect(decorators)
var group []decor.Decorator
for _, decorator := range decorators {
if decorator != nil {
group = append(group, decorator)
}
}
return func(s *bState) {
s.populateEwmaDecorators(decorators)
s.decorators[0] = decorators
s.decorGroups[0] = group
}
}
// AppendDecorators let you inject decorators to the bar's right side.
func AppendDecorators(decorators ...decor.Decorator) BarOption {
decorators = inspect(decorators)
var group []decor.Decorator
for _, decorator := range decorators {
if decorator != nil {
group = append(group, decorator)
}
}
return func(s *bState) {
s.populateEwmaDecorators(decorators)
s.decorators[1] = decorators
s.decorGroups[1] = group
}
}

View File

@@ -15,7 +15,7 @@ var (
_ AverageDecorator = (*averageETA)(nil)
)
// TimeNormalizer interface. Implementors could be passed into
// TimeNormalizer interface. Implementers could be passed into
// MovingAverageETA, in order to affect i.e. normalize its output.
type TimeNormalizer interface {
Normalize(time.Duration) time.Duration

View File

@@ -28,14 +28,14 @@ const (
// appropriate size marker (KiB, MiB, GiB, TiB).
type SizeB1024 int64
func (self SizeB1024) Format(st fmt.State, verb rune) {
func (s SizeB1024) Format(f fmt.State, verb rune) {
prec := -1
switch verb {
case 'f', 'e', 'E':
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
fallthrough
case 'b', 'g', 'G', 'x', 'X':
if p, ok := st.Precision(); ok {
if p, ok := f.Precision(); ok {
prec = p
}
default:
@@ -44,24 +44,24 @@ func (self SizeB1024) Format(st fmt.State, verb rune) {
var unit SizeB1024
switch {
case self < _iKiB:
case s < _iKiB:
unit = _ib
case self < _iMiB:
case s < _iMiB:
unit = _iKiB
case self < _iGiB:
case s < _iGiB:
unit = _iMiB
case self < _iTiB:
case s < _iTiB:
unit = _iGiB
default:
unit = _iTiB
}
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
if st.Flag(' ') {
b := strconv.AppendFloat(make([]byte, 0, 24), float64(s)/float64(unit), byte(verb), prec, 64)
if f.Flag(' ') {
b = append(b, ' ')
}
b = append(b, []byte(unit.String())...)
_, err := st.Write(b)
_, err := f.Write(b)
if err != nil {
panic(err)
}
@@ -80,14 +80,14 @@ const (
// appropriate size marker (KB, MB, GB, TB).
type SizeB1000 int64
func (self SizeB1000) Format(st fmt.State, verb rune) {
func (s SizeB1000) Format(f fmt.State, verb rune) {
prec := -1
switch verb {
case 'f', 'e', 'E':
prec = 6 // default prec of fmt.Printf("%f|%e|%E")
fallthrough
case 'b', 'g', 'G', 'x', 'X':
if p, ok := st.Precision(); ok {
if p, ok := f.Precision(); ok {
prec = p
}
default:
@@ -96,24 +96,24 @@ func (self SizeB1000) Format(st fmt.State, verb rune) {
var unit SizeB1000
switch {
case self < _KB:
case s < _KB:
unit = _b
case self < _MB:
case s < _MB:
unit = _KB
case self < _GB:
case s < _GB:
unit = _MB
case self < _TB:
case s < _TB:
unit = _GB
default:
unit = _TB
}
b := strconv.AppendFloat(make([]byte, 0, 24), float64(self)/float64(unit), byte(verb), prec, 64)
if st.Flag(' ') {
b := strconv.AppendFloat(make([]byte, 0, 24), float64(s)/float64(unit), byte(verb), prec, 64)
if f.Flag(' ') {
b = append(b, ' ')
}
b = append(b, []byte(unit.String())...)
_, err := st.Write(b)
_, err := f.Write(b)
if err != nil {
panic(err)
}

View File

@@ -17,8 +17,8 @@ import (
const defaultRefreshRate = 150 * time.Millisecond
const defaultHmQueueLength = 128
// DoneError represents use after `(*Progress).Wait()` error.
var DoneError = fmt.Errorf("%T instance can't be reused after %[1]T.Wait()", (*Progress)(nil))
// ErrDone represents use after `(*Progress).Wait()` error.
var ErrDone = 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 {
@@ -39,7 +39,7 @@ type pState struct {
idCount int
popPriority int
// following are provided/overrided by user
// following are provided/overrode by user
hmQueueLen int
reqWidth int
refreshRate time.Duration
@@ -149,7 +149,7 @@ 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 called after `(*Progress).Wait()` then
// `(nil, DoneError)` is returned.
// `(nil, ErrDone)` is returned.
func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Bar, error) {
if filler == nil {
filler = NopStyle().Build()
@@ -171,7 +171,7 @@ func (p *Progress) Add(total int64, filler BarFiller, options ...BarOption) (*Ba
}:
return <-ch, nil
case <-p.done:
return nil, DoneError
return nil, ErrDone
}
}
@@ -205,8 +205,7 @@ func (p *Progress) UpdateBarPriority(b *Bar, priority int, lazy bool) {
// Write is implementation of io.Writer.
// Writing to `*Progress` will print lines above a running bar.
// Writes aren't flushed immediately, but at next refresh cycle.
// If called after `(*Progress).Wait()` then `(0, DoneError)`
// is returned.
// If called after `(*Progress).Wait()` then `(0, ErrDone)` is returned.
func (p *Progress) Write(b []byte) (int, error) {
type result struct {
n int
@@ -221,7 +220,7 @@ func (p *Progress) Write(b []byte) (int, error) {
res := <-ch
return res.n, res.err
case <-p.done:
return 0, DoneError
return 0, ErrDone
}
}
@@ -443,6 +442,14 @@ func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption
}
}
for _, group := range bs.decorGroups {
for _, d := range group {
if d, ok := unwrap(d).(decor.EwmaDecorator); ok {
bs.ewmaDecorators = append(bs.ewmaDecorators, d)
}
}
}
bs.buffers[0] = bytes.NewBuffer(make([]byte, 0, 128)) // prepend
bs.buffers[1] = bytes.NewBuffer(make([]byte, 0, 128)) // append
bs.buffers[2] = bytes.NewBuffer(make([]byte, 0, 256)) // filler