Merge pull request #26286 from containers/renovate/github.com-vbauerster-mpb-v8-8.x

fix(deps): update module github.com/vbauerster/mpb/v8 to v8.10.2
This commit is contained in:
openshift-merge-bot[bot] 2025-06-06 20:58:59 +00:00 committed by GitHub
commit d5d9cf3013
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 43 additions and 44 deletions

2
go.mod
View File

@ -65,7 +65,7 @@ require (
github.com/spf13/cobra v1.9.1
github.com/spf13/pflag v1.0.6
github.com/stretchr/testify v1.10.0
github.com/vbauerster/mpb/v8 v8.10.1
github.com/vbauerster/mpb/v8 v8.10.2
github.com/vishvananda/netlink v1.3.1
go.etcd.io/bbolt v1.4.0
golang.org/x/crypto v0.39.0

4
go.sum
View File

@ -477,8 +477,8 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/vbatts/tar-split v0.12.1 h1:CqKoORW7BUWBe7UL/iqTVvkTBOF8UvOMKOIZykxnnbo=
github.com/vbatts/tar-split v0.12.1/go.mod h1:eF6B6i6ftWQcDqEn3/iGFRFRo8cBIMSJVOpnNdfTMFA=
github.com/vbauerster/mpb/v8 v8.10.1 h1:t/ZFv/NYgoBUy2LrmkD5Vc25r+JhoS4+gRkjVbolO2Y=
github.com/vbauerster/mpb/v8 v8.10.1/go.mod h1:+Ja4P92E3/CorSZgfDtK46D7AVbDqmBQRTmyTqPElo0=
github.com/vbauerster/mpb/v8 v8.10.2 h1:2uBykSHAYHekE11YvJhKxYmLATKHAGorZwFlyNw4hHM=
github.com/vbauerster/mpb/v8 v8.10.2/go.mod h1:+Ja4P92E3/CorSZgfDtK46D7AVbDqmBQRTmyTqPElo0=
github.com/vishvananda/netlink v1.3.1 h1:3AEMt62VKqz90r0tmNhog0r/PpWKmrEShJU0wJW6bV0=
github.com/vishvananda/netlink v1.3.1/go.mod h1:ARtKouGSTGchR8aMwmkzC0qiNPrrWO5JS/XMVl45+b4=
github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=

View File

@ -145,13 +145,7 @@ func (b *Bar) Current() int64 {
// operation for example.
func (b *Bar) SetRefill(amount int64) {
select {
case b.operateState <- func(s *bState) {
if amount < s.current {
s.refill = amount
} else {
s.refill = s.current
}
}:
case b.operateState <- func(s *bState) { s.refill = min(amount, s.current) }:
case <-b.ctx.Done():
}
}
@ -275,10 +269,10 @@ func (b *Bar) EwmaIncrInt64(n int64, iterDur time.Duration) {
var wg sync.WaitGroup
wg.Add(len(s.ewmaDecorators))
for _, d := range s.ewmaDecorators {
d := d
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
go func() {
defer wg.Done()
d.EwmaUpdate(n, iterDur)
wg.Done()
}()
}
s.current += n
@ -304,10 +298,10 @@ func (b *Bar) EwmaSetCurrent(current int64, iterDur time.Duration) {
var wg sync.WaitGroup
wg.Add(len(s.ewmaDecorators))
for _, d := range s.ewmaDecorators {
d := d
// d := d // NOTE: uncomment for Go < 1.22, see /doc/faq#closures_and_goroutines
go func() {
defer wg.Done()
d.EwmaUpdate(n, iterDur)
wg.Done()
}()
}
s.current = current
@ -394,13 +388,14 @@ func (b *Bar) Wait() {
}
func (b *Bar) serve(bs *bState) {
defer b.container.bwg.Done()
decoratorsOnShutdown := func(group []decor.Decorator) {
for _, d := range group {
if d, ok := unwrap(d).(decor.ShutdownListener); ok {
b.container.bwg.Add(1)
go func() {
defer b.container.bwg.Done()
d.OnShutdown()
b.container.bwg.Done()
}()
}
}
@ -416,7 +411,6 @@ func (b *Bar) serve(bs *bState) {
bs.aborted = !bs.completed()
b.bs = bs
close(b.bsOk)
b.container.bwg.Done()
return
}
}

View File

@ -175,12 +175,12 @@ func (s barStyle) Build() BarFiller {
bytes: []byte(s.style[iPadding]),
}
bf.tip.onComplete = s.tipOnComplete
bf.tip.frames = make([]component, len(s.tipFrames))
for i, t := range s.tipFrames {
bf.tip.frames[i] = component{
bf.tip.frames = make([]component, 0, len(s.tipFrames))
for _, t := range s.tipFrames {
bf.tip.frames = append(bf.tip.frames, component{
width: runewidth.StringWidth(t),
bytes: []byte(t),
}
})
}
if s.rev {
bf.flushOp = barSections.flushRev

View File

@ -21,17 +21,17 @@ func (pq priorityQueue) Swap(i, j int) {
func (pq *priorityQueue) Push(x interface{}) {
s := *pq
bar := x.(*Bar)
bar.index = len(s)
*pq = append(s, bar)
b := x.(*Bar)
b.index = len(s)
*pq = append(s, b)
}
func (pq *priorityQueue) Pop() interface{} {
var b *Bar
s := *pq
l := len(s)
bar := s[l-1]
bar.index = -1 // for safety
s[l-1] = nil // avoid memory leak
*pq = s[:l-1]
return bar
i := len(s) - 1
b, s[i] = s[i], nil // nil to avoid memory leak
b.index = -1 // for safety
*pq = s[:i]
return b
}

View File

@ -355,16 +355,18 @@ func (s *pState) render(cw *cwriter.Writer) (err error) {
height = width
}
var barCount int
for b := range iter {
barCount++
go b.render(width)
}
return s.flush(cw, height, iterPop)
return s.flush(cw, height, barCount, iterPop)
}
func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
var popCount int
var rows []io.Reader
func (s *pState) flush(cw *cwriter.Writer, height, barCount int, iter <-chan *Bar) error {
var total, popCount int
rows := make([][]io.Reader, 0, barCount)
for b := range iter {
frame := <-b.frameCh
@ -373,15 +375,16 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
b.cancel()
return frame.err // b.frameCh is buffered it's ok to return here
}
var usedRows int
var discarded int
for i := len(frame.rows) - 1; i >= 0; i-- {
if row := frame.rows[i]; len(rows) < height {
rows = append(rows, row)
usedRows++
if total < height {
total++
} else {
_, _ = io.Copy(io.Discard, row)
_, _ = io.Copy(io.Discard, frame.rows[i]) // Found IsInBounds
discarded++
}
}
rows = append(rows, frame.rows)
switch frame.shutdown {
case 1:
@ -399,7 +402,7 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
}
case 2:
if s.popCompleted && !frame.noPop {
popCount += usedRows
popCount += len(frame.rows) - discarded
continue
}
fallthrough
@ -409,13 +412,15 @@ func (s *pState) flush(cw *cwriter.Writer, height int, iter <-chan *Bar) error {
}
for i := len(rows) - 1; i >= 0; i-- {
_, err := cw.ReadFrom(rows[i])
if err != nil {
return err
for _, r := range rows[i] {
_, err := cw.ReadFrom(r)
if err != nil {
return err
}
}
}
return cw.Flush(len(rows) - popCount)
return cw.Flush(total - popCount)
}
func (s pState) makeBarState(total int64, filler BarFiller, options ...BarOption) *bState {

2
vendor/modules.txt vendored
View File

@ -987,7 +987,7 @@ github.com/ulikunitz/xz/lzma
github.com/vbatts/tar-split/archive/tar
github.com/vbatts/tar-split/tar/asm
github.com/vbatts/tar-split/tar/storage
# github.com/vbauerster/mpb/v8 v8.10.1
# github.com/vbauerster/mpb/v8 v8.10.2
## explicit; go 1.23.0
github.com/vbauerster/mpb/v8
github.com/vbauerster/mpb/v8/cwriter