mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
vendor: update buildkit to v0.19.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
15
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/directives.go
generated
vendored
15
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/directives.go
generated
vendored
@ -112,10 +112,15 @@ func (d *DirectiveParser) ParseAll(data []byte) ([]*Directive, error) {
|
||||
// This allows for a flexible range of input formats, and appropriate syntax
|
||||
// selection.
|
||||
func DetectSyntax(dt []byte) (string, string, []Range, bool) {
|
||||
return ParseDirective(keySyntax, dt)
|
||||
return parseDirective(keySyntax, dt, true)
|
||||
}
|
||||
|
||||
func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
|
||||
return parseDirective(key, dt, false)
|
||||
}
|
||||
|
||||
func parseDirective(key string, dt []byte, anyFormat bool) (string, string, []Range, bool) {
|
||||
dt = discardBOM(dt)
|
||||
dt, hadShebang, err := discardShebang(dt)
|
||||
if err != nil {
|
||||
return "", "", nil, false
|
||||
@ -131,6 +136,10 @@ func ParseDirective(key string, dt []byte) (string, string, []Range, bool) {
|
||||
return syntax, cmdline, loc, true
|
||||
}
|
||||
|
||||
if !anyFormat {
|
||||
return "", "", nil, false
|
||||
}
|
||||
|
||||
// use directive with different comment prefix, and search for //key=
|
||||
directiveParser = DirectiveParser{line: line}
|
||||
directiveParser.setComment("//")
|
||||
@ -171,3 +180,7 @@ func discardShebang(dt []byte) ([]byte, bool, error) {
|
||||
}
|
||||
return dt, false, nil
|
||||
}
|
||||
|
||||
func discardBOM(dt []byte) []byte {
|
||||
return bytes.TrimPrefix(dt, []byte{0xEF, 0xBB, 0xBF})
|
||||
}
|
||||
|
4
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go
generated
vendored
4
vendor/github.com/moby/buildkit/frontend/dockerfile/parser/parser.go
generated
vendored
@ -291,7 +291,7 @@ func Parse(rwc io.Reader) (*Result, error) {
|
||||
bytesRead := scanner.Bytes()
|
||||
if currentLine == 0 {
|
||||
// First line, strip the byte-order-marker if present
|
||||
bytesRead = bytes.TrimPrefix(bytesRead, utf8bom)
|
||||
bytesRead = discardBOM(bytesRead)
|
||||
}
|
||||
if isComment(bytesRead) {
|
||||
comment := strings.TrimSpace(string(bytesRead[1:]))
|
||||
@ -522,8 +522,6 @@ func isEmptyContinuationLine(line []byte) bool {
|
||||
return len(trimLeadingWhitespace(trimNewline(line))) == 0
|
||||
}
|
||||
|
||||
var utf8bom = []byte{0xEF, 0xBB, 0xBF}
|
||||
|
||||
func trimContinuationCharacter(line []byte, d *directives) ([]byte, bool) {
|
||||
if d.lineContinuationRegex.Match(line) {
|
||||
line = d.lineContinuationRegex.ReplaceAll(line, []byte("$1"))
|
||||
|
Reference in New Issue
Block a user