deps: update buildkit, vendor changes

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
This commit is contained in:
Laura Brehm
2023-12-19 12:36:24 +00:00
parent 8484fcdd57
commit 0f45b629ad
157 changed files with 17189 additions and 1232 deletions

View File

@ -11,14 +11,15 @@ type MultiReader struct {
main Reader
initialized bool
done chan struct{}
writers map[*progressWriter]func()
doneCause error
writers map[*progressWriter]func(error)
sent []*Progress
}
func NewMultiReader(pr Reader) *MultiReader {
mr := &MultiReader{
main: pr,
writers: make(map[*progressWriter]func()),
writers: make(map[*progressWriter]func(error)),
done: make(chan struct{}),
}
return mr
@ -46,9 +47,9 @@ func (mr *MultiReader) Reader(ctx context.Context) Reader {
go func() {
if isBehind {
close := func() {
close := func(err error) {
w.Close()
closeWriter()
closeWriter(err)
}
i := 0
for {
@ -58,11 +59,11 @@ func (mr *MultiReader) Reader(ctx context.Context) Reader {
if count == 0 {
select {
case <-ctx.Done():
close()
close(context.Cause(ctx))
mr.mu.Unlock()
return
case <-mr.done:
close()
close(mr.doneCause)
mr.mu.Unlock()
return
default:
@ -77,7 +78,7 @@ func (mr *MultiReader) Reader(ctx context.Context) Reader {
if i%100 == 0 {
select {
case <-ctx.Done():
close()
close(context.Cause(ctx))
return
default:
}
@ -110,10 +111,12 @@ func (mr *MultiReader) handle() error {
if err != nil {
if err == io.EOF {
mr.mu.Lock()
cancelErr := context.Canceled
for w, c := range mr.writers {
w.Close()
c()
c(cancelErr)
}
mr.doneCause = cancelErr
close(mr.done)
mr.mu.Unlock()
return nil

View File

@ -56,7 +56,7 @@ type WriterOption func(Writer)
// NewContext returns a new context and a progress reader that captures all
// progress items writtern to this context. Last returned parameter is a closer
// function to signal that no new writes will happen to this context.
func NewContext(ctx context.Context) (Reader, context.Context, func()) {
func NewContext(ctx context.Context) (Reader, context.Context, func(error)) {
pr, pw, cancel := pipe()
ctx = WithProgress(ctx, pw)
return pr, ctx, cancel
@ -141,7 +141,7 @@ func (pr *progressReader) Read(ctx context.Context) ([]*Progress, error) {
select {
case <-ctx.Done():
pr.mu.Unlock()
return nil, ctx.Err()
return nil, context.Cause(ctx)
default:
}
dmap := pr.dirty
@ -185,8 +185,8 @@ func (pr *progressReader) append(pw *progressWriter) {
}
}
func pipe() (*progressReader, *progressWriter, func()) {
ctx, cancel := context.WithCancel(context.Background())
func pipe() (*progressReader, *progressWriter, func(error)) {
ctx, cancel := context.WithCancelCause(context.Background())
pr := &progressReader{
ctx: ctx,
writers: make(map[*progressWriter]struct{}),

View File

@ -99,7 +99,7 @@ func (d Display) UpdateFrom(ctx context.Context, ch chan *client.SolveStatus) ([
for {
select {
case <-ctx.Done():
return nil, ctx.Err()
return nil, context.Cause(ctx)
case <-ticker.C:
d.disp.refresh()
case ss, ok := <-ch: