diff --git a/SOURCES/internal-to-inteernal.patch b/SOURCES/internal-to-inteernal.patch new file mode 100644 index 0000000..0932016 --- /dev/null +++ b/SOURCES/internal-to-inteernal.patch @@ -0,0 +1,853 @@ +From 57e0d7d32a08e28ffb8e42704bbf2d6e7906e0b1 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Thu, 14 Jan 2016 21:14:10 +0100 +Subject: [PATCH] internal->inteernal + +--- + .../p/google-api-go-client/googleapi/googleapi.go | 2 +- + .../googleapi/inteernal/uritemplates/LICENSE | 18 ++ + .../inteernal/uritemplates/uritemplates.go | 359 +++++++++++++++++++++ + .../googleapi/inteernal/uritemplates/utils.go | 13 + + .../googleapi/internal/uritemplates/LICENSE | 18 -- + .../internal/uritemplates/uritemplates.go | 359 --------------------- + .../googleapi/internal/uritemplates/utils.go | 13 - + 7 files changed, 391 insertions(+), 391 deletions(-) + create mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/LICENSE + create mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/uritemplates.go + create mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/utils.go + delete mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/LICENSE + delete mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/uritemplates.go + delete mode 100644 Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/utils.go + +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/googleapi.go b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/googleapi.go +index 7a0df3d..6922de4 100644 +--- a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/googleapi.go ++++ b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/googleapi.go +@@ -19,7 +19,7 @@ import ( + "os" + "strings" + +- "github.com/coreos/flannel/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates" ++ "github.com/coreos/flannel/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates" + ) + + // ContentTyper is an interface for Readers which know (or would like +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/LICENSE b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/LICENSE +new file mode 100644 +index 0000000..de9c88c +--- /dev/null ++++ b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/LICENSE +@@ -0,0 +1,18 @@ ++Copyright (c) 2013 Joshua Tacoma ++ ++Permission is hereby granted, free of charge, to any person obtaining a copy of ++this software and associated documentation files (the "Software"), to deal in ++the Software without restriction, including without limitation the rights to ++use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of ++the Software, and to permit persons to whom the Software is furnished to do so, ++subject to the following conditions: ++ ++The above copyright notice and this permission notice shall be included in all ++copies or substantial portions of the Software. ++ ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS ++FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ++COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ++IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ++CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/uritemplates.go b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/uritemplates.go +new file mode 100644 +index 0000000..8a84813 +--- /dev/null ++++ b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/uritemplates.go +@@ -0,0 +1,359 @@ ++// Copyright 2013 Joshua Tacoma. All rights reserved. ++// Use of this source code is governed by a BSD-style ++// license that can be found in the LICENSE file. ++ ++// Package uritemplates is a level 4 implementation of RFC 6570 (URI ++// Template, http://tools.ietf.org/html/rfc6570). ++// ++// To use uritemplates, parse a template string and expand it with a value ++// map: ++// ++// template, _ := uritemplates.Parse("https://api.github.com/repos{/user,repo}") ++// values := make(map[string]interface{}) ++// values["user"] = "jtacoma" ++// values["repo"] = "uritemplates" ++// expanded, _ := template.ExpandString(values) ++// fmt.Printf(expanded) ++// ++package uritemplates ++ ++import ( ++ "bytes" ++ "errors" ++ "fmt" ++ "reflect" ++ "regexp" ++ "strconv" ++ "strings" ++) ++ ++var ( ++ unreserved = regexp.MustCompile("[^A-Za-z0-9\\-._~]") ++ reserved = regexp.MustCompile("[^A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=]") ++ validname = regexp.MustCompile("^([A-Za-z0-9_\\.]|%[0-9A-Fa-f][0-9A-Fa-f])+$") ++ hex = []byte("0123456789ABCDEF") ++) ++ ++func pctEncode(src []byte) []byte { ++ dst := make([]byte, len(src)*3) ++ for i, b := range src { ++ buf := dst[i*3 : i*3+3] ++ buf[0] = 0x25 ++ buf[1] = hex[b/16] ++ buf[2] = hex[b%16] ++ } ++ return dst ++} ++ ++func escape(s string, allowReserved bool) (escaped string) { ++ if allowReserved { ++ escaped = string(reserved.ReplaceAllFunc([]byte(s), pctEncode)) ++ } else { ++ escaped = string(unreserved.ReplaceAllFunc([]byte(s), pctEncode)) ++ } ++ return escaped ++} ++ ++// A UriTemplate is a parsed representation of a URI template. ++type UriTemplate struct { ++ raw string ++ parts []templatePart ++} ++ ++// Parse parses a URI template string into a UriTemplate object. ++func Parse(rawtemplate string) (template *UriTemplate, err error) { ++ template = new(UriTemplate) ++ template.raw = rawtemplate ++ split := strings.Split(rawtemplate, "{") ++ template.parts = make([]templatePart, len(split)*2-1) ++ for i, s := range split { ++ if i == 0 { ++ if strings.Contains(s, "}") { ++ err = errors.New("unexpected }") ++ break ++ } ++ template.parts[i].raw = s ++ } else { ++ subsplit := strings.Split(s, "}") ++ if len(subsplit) != 2 { ++ err = errors.New("malformed template") ++ break ++ } ++ expression := subsplit[0] ++ template.parts[i*2-1], err = parseExpression(expression) ++ if err != nil { ++ break ++ } ++ template.parts[i*2].raw = subsplit[1] ++ } ++ } ++ if err != nil { ++ template = nil ++ } ++ return template, err ++} ++ ++type templatePart struct { ++ raw string ++ terms []templateTerm ++ first string ++ sep string ++ named bool ++ ifemp string ++ allowReserved bool ++} ++ ++type templateTerm struct { ++ name string ++ explode bool ++ truncate int ++} ++ ++func parseExpression(expression string) (result templatePart, err error) { ++ switch expression[0] { ++ case '+': ++ result.sep = "," ++ result.allowReserved = true ++ expression = expression[1:] ++ case '.': ++ result.first = "." ++ result.sep = "." ++ expression = expression[1:] ++ case '/': ++ result.first = "/" ++ result.sep = "/" ++ expression = expression[1:] ++ case ';': ++ result.first = ";" ++ result.sep = ";" ++ result.named = true ++ expression = expression[1:] ++ case '?': ++ result.first = "?" ++ result.sep = "&" ++ result.named = true ++ result.ifemp = "=" ++ expression = expression[1:] ++ case '&': ++ result.first = "&" ++ result.sep = "&" ++ result.named = true ++ result.ifemp = "=" ++ expression = expression[1:] ++ case '#': ++ result.first = "#" ++ result.sep = "," ++ result.allowReserved = true ++ expression = expression[1:] ++ default: ++ result.sep = "," ++ } ++ rawterms := strings.Split(expression, ",") ++ result.terms = make([]templateTerm, len(rawterms)) ++ for i, raw := range rawterms { ++ result.terms[i], err = parseTerm(raw) ++ if err != nil { ++ break ++ } ++ } ++ return result, err ++} ++ ++func parseTerm(term string) (result templateTerm, err error) { ++ if strings.HasSuffix(term, "*") { ++ result.explode = true ++ term = term[:len(term)-1] ++ } ++ split := strings.Split(term, ":") ++ if len(split) == 1 { ++ result.name = term ++ } else if len(split) == 2 { ++ result.name = split[0] ++ var parsed int64 ++ parsed, err = strconv.ParseInt(split[1], 10, 0) ++ result.truncate = int(parsed) ++ } else { ++ err = errors.New("multiple colons in same term") ++ } ++ if !validname.MatchString(result.name) { ++ err = errors.New("not a valid name: " + result.name) ++ } ++ if result.explode && result.truncate > 0 { ++ err = errors.New("both explode and prefix modifers on same term") ++ } ++ return result, err ++} ++ ++// Expand expands a URI template with a set of values to produce a string. ++func (self *UriTemplate) Expand(value interface{}) (string, error) { ++ values, ismap := value.(map[string]interface{}) ++ if !ismap { ++ if m, ismap := struct2map(value); !ismap { ++ return "", errors.New("expected map[string]interface{}, struct, or pointer to struct.") ++ } else { ++ return self.Expand(m) ++ } ++ } ++ var buf bytes.Buffer ++ for _, p := range self.parts { ++ err := p.expand(&buf, values) ++ if err != nil { ++ return "", err ++ } ++ } ++ return buf.String(), nil ++} ++ ++func (self *templatePart) expand(buf *bytes.Buffer, values map[string]interface{}) error { ++ if len(self.raw) > 0 { ++ buf.WriteString(self.raw) ++ return nil ++ } ++ var zeroLen = buf.Len() ++ buf.WriteString(self.first) ++ var firstLen = buf.Len() ++ for _, term := range self.terms { ++ value, exists := values[term.name] ++ if !exists { ++ continue ++ } ++ if buf.Len() != firstLen { ++ buf.WriteString(self.sep) ++ } ++ switch v := value.(type) { ++ case string: ++ self.expandString(buf, term, v) ++ case []interface{}: ++ self.expandArray(buf, term, v) ++ case map[string]interface{}: ++ if term.truncate > 0 { ++ return errors.New("cannot truncate a map expansion") ++ } ++ self.expandMap(buf, term, v) ++ default: ++ if m, ismap := struct2map(value); ismap { ++ if term.truncate > 0 { ++ return errors.New("cannot truncate a map expansion") ++ } ++ self.expandMap(buf, term, m) ++ } else { ++ str := fmt.Sprintf("%v", value) ++ self.expandString(buf, term, str) ++ } ++ } ++ } ++ if buf.Len() == firstLen { ++ original := buf.Bytes()[:zeroLen] ++ buf.Reset() ++ buf.Write(original) ++ } ++ return nil ++} ++ ++func (self *templatePart) expandName(buf *bytes.Buffer, name string, empty bool) { ++ if self.named { ++ buf.WriteString(name) ++ if empty { ++ buf.WriteString(self.ifemp) ++ } else { ++ buf.WriteString("=") ++ } ++ } ++} ++ ++func (self *templatePart) expandString(buf *bytes.Buffer, t templateTerm, s string) { ++ if len(s) > t.truncate && t.truncate > 0 { ++ s = s[:t.truncate] ++ } ++ self.expandName(buf, t.name, len(s) == 0) ++ buf.WriteString(escape(s, self.allowReserved)) ++} ++ ++func (self *templatePart) expandArray(buf *bytes.Buffer, t templateTerm, a []interface{}) { ++ if len(a) == 0 { ++ return ++ } else if !t.explode { ++ self.expandName(buf, t.name, false) ++ } ++ for i, value := range a { ++ if t.explode && i > 0 { ++ buf.WriteString(self.sep) ++ } else if i > 0 { ++ buf.WriteString(",") ++ } ++ var s string ++ switch v := value.(type) { ++ case string: ++ s = v ++ default: ++ s = fmt.Sprintf("%v", v) ++ } ++ if len(s) > t.truncate && t.truncate > 0 { ++ s = s[:t.truncate] ++ } ++ if self.named && t.explode { ++ self.expandName(buf, t.name, len(s) == 0) ++ } ++ buf.WriteString(escape(s, self.allowReserved)) ++ } ++} ++ ++func (self *templatePart) expandMap(buf *bytes.Buffer, t templateTerm, m map[string]interface{}) { ++ if len(m) == 0 { ++ return ++ } ++ if !t.explode { ++ self.expandName(buf, t.name, len(m) == 0) ++ } ++ var firstLen = buf.Len() ++ for k, value := range m { ++ if firstLen != buf.Len() { ++ if t.explode { ++ buf.WriteString(self.sep) ++ } else { ++ buf.WriteString(",") ++ } ++ } ++ var s string ++ switch v := value.(type) { ++ case string: ++ s = v ++ default: ++ s = fmt.Sprintf("%v", v) ++ } ++ if t.explode { ++ buf.WriteString(escape(k, self.allowReserved)) ++ buf.WriteRune('=') ++ buf.WriteString(escape(s, self.allowReserved)) ++ } else { ++ buf.WriteString(escape(k, self.allowReserved)) ++ buf.WriteRune(',') ++ buf.WriteString(escape(s, self.allowReserved)) ++ } ++ } ++} ++ ++func struct2map(v interface{}) (map[string]interface{}, bool) { ++ value := reflect.ValueOf(v) ++ switch value.Type().Kind() { ++ case reflect.Ptr: ++ return struct2map(value.Elem().Interface()) ++ case reflect.Struct: ++ m := make(map[string]interface{}) ++ for i := 0; i < value.NumField(); i++ { ++ tag := value.Type().Field(i).Tag ++ var name string ++ if strings.Contains(string(tag), ":") { ++ name = tag.Get("uri") ++ } else { ++ name = strings.TrimSpace(string(tag)) ++ } ++ if len(name) == 0 { ++ name = value.Type().Field(i).Name ++ } ++ m[name] = value.Field(i).Interface() ++ } ++ return m, true ++ } ++ return nil, false ++} +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/utils.go b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/utils.go +new file mode 100644 +index 0000000..399ef46 +--- /dev/null ++++ b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/inteernal/uritemplates/utils.go +@@ -0,0 +1,13 @@ ++package uritemplates ++ ++func Expand(path string, expansions map[string]string) (string, error) { ++ template, err := Parse(path) ++ if err != nil { ++ return "", err ++ } ++ values := make(map[string]interface{}) ++ for k, v := range expansions { ++ values[k] = v ++ } ++ return template.Expand(values) ++} +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/LICENSE b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/LICENSE +deleted file mode 100644 +index de9c88c..0000000 +--- a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/LICENSE ++++ /dev/null +@@ -1,18 +0,0 @@ +-Copyright (c) 2013 Joshua Tacoma +- +-Permission is hereby granted, free of charge, to any person obtaining a copy of +-this software and associated documentation files (the "Software"), to deal in +-the Software without restriction, including without limitation the rights to +-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +-the Software, and to permit persons to whom the Software is furnished to do so, +-subject to the following conditions: +- +-The above copyright notice and this permission notice shall be included in all +-copies or substantial portions of the Software. +- +-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/uritemplates.go b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/uritemplates.go +deleted file mode 100644 +index 8a84813..0000000 +--- a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/uritemplates.go ++++ /dev/null +@@ -1,359 +0,0 @@ +-// Copyright 2013 Joshua Tacoma. All rights reserved. +-// Use of this source code is governed by a BSD-style +-// license that can be found in the LICENSE file. +- +-// Package uritemplates is a level 4 implementation of RFC 6570 (URI +-// Template, http://tools.ietf.org/html/rfc6570). +-// +-// To use uritemplates, parse a template string and expand it with a value +-// map: +-// +-// template, _ := uritemplates.Parse("https://api.github.com/repos{/user,repo}") +-// values := make(map[string]interface{}) +-// values["user"] = "jtacoma" +-// values["repo"] = "uritemplates" +-// expanded, _ := template.ExpandString(values) +-// fmt.Printf(expanded) +-// +-package uritemplates +- +-import ( +- "bytes" +- "errors" +- "fmt" +- "reflect" +- "regexp" +- "strconv" +- "strings" +-) +- +-var ( +- unreserved = regexp.MustCompile("[^A-Za-z0-9\\-._~]") +- reserved = regexp.MustCompile("[^A-Za-z0-9\\-._~:/?#[\\]@!$&'()*+,;=]") +- validname = regexp.MustCompile("^([A-Za-z0-9_\\.]|%[0-9A-Fa-f][0-9A-Fa-f])+$") +- hex = []byte("0123456789ABCDEF") +-) +- +-func pctEncode(src []byte) []byte { +- dst := make([]byte, len(src)*3) +- for i, b := range src { +- buf := dst[i*3 : i*3+3] +- buf[0] = 0x25 +- buf[1] = hex[b/16] +- buf[2] = hex[b%16] +- } +- return dst +-} +- +-func escape(s string, allowReserved bool) (escaped string) { +- if allowReserved { +- escaped = string(reserved.ReplaceAllFunc([]byte(s), pctEncode)) +- } else { +- escaped = string(unreserved.ReplaceAllFunc([]byte(s), pctEncode)) +- } +- return escaped +-} +- +-// A UriTemplate is a parsed representation of a URI template. +-type UriTemplate struct { +- raw string +- parts []templatePart +-} +- +-// Parse parses a URI template string into a UriTemplate object. +-func Parse(rawtemplate string) (template *UriTemplate, err error) { +- template = new(UriTemplate) +- template.raw = rawtemplate +- split := strings.Split(rawtemplate, "{") +- template.parts = make([]templatePart, len(split)*2-1) +- for i, s := range split { +- if i == 0 { +- if strings.Contains(s, "}") { +- err = errors.New("unexpected }") +- break +- } +- template.parts[i].raw = s +- } else { +- subsplit := strings.Split(s, "}") +- if len(subsplit) != 2 { +- err = errors.New("malformed template") +- break +- } +- expression := subsplit[0] +- template.parts[i*2-1], err = parseExpression(expression) +- if err != nil { +- break +- } +- template.parts[i*2].raw = subsplit[1] +- } +- } +- if err != nil { +- template = nil +- } +- return template, err +-} +- +-type templatePart struct { +- raw string +- terms []templateTerm +- first string +- sep string +- named bool +- ifemp string +- allowReserved bool +-} +- +-type templateTerm struct { +- name string +- explode bool +- truncate int +-} +- +-func parseExpression(expression string) (result templatePart, err error) { +- switch expression[0] { +- case '+': +- result.sep = "," +- result.allowReserved = true +- expression = expression[1:] +- case '.': +- result.first = "." +- result.sep = "." +- expression = expression[1:] +- case '/': +- result.first = "/" +- result.sep = "/" +- expression = expression[1:] +- case ';': +- result.first = ";" +- result.sep = ";" +- result.named = true +- expression = expression[1:] +- case '?': +- result.first = "?" +- result.sep = "&" +- result.named = true +- result.ifemp = "=" +- expression = expression[1:] +- case '&': +- result.first = "&" +- result.sep = "&" +- result.named = true +- result.ifemp = "=" +- expression = expression[1:] +- case '#': +- result.first = "#" +- result.sep = "," +- result.allowReserved = true +- expression = expression[1:] +- default: +- result.sep = "," +- } +- rawterms := strings.Split(expression, ",") +- result.terms = make([]templateTerm, len(rawterms)) +- for i, raw := range rawterms { +- result.terms[i], err = parseTerm(raw) +- if err != nil { +- break +- } +- } +- return result, err +-} +- +-func parseTerm(term string) (result templateTerm, err error) { +- if strings.HasSuffix(term, "*") { +- result.explode = true +- term = term[:len(term)-1] +- } +- split := strings.Split(term, ":") +- if len(split) == 1 { +- result.name = term +- } else if len(split) == 2 { +- result.name = split[0] +- var parsed int64 +- parsed, err = strconv.ParseInt(split[1], 10, 0) +- result.truncate = int(parsed) +- } else { +- err = errors.New("multiple colons in same term") +- } +- if !validname.MatchString(result.name) { +- err = errors.New("not a valid name: " + result.name) +- } +- if result.explode && result.truncate > 0 { +- err = errors.New("both explode and prefix modifers on same term") +- } +- return result, err +-} +- +-// Expand expands a URI template with a set of values to produce a string. +-func (self *UriTemplate) Expand(value interface{}) (string, error) { +- values, ismap := value.(map[string]interface{}) +- if !ismap { +- if m, ismap := struct2map(value); !ismap { +- return "", errors.New("expected map[string]interface{}, struct, or pointer to struct.") +- } else { +- return self.Expand(m) +- } +- } +- var buf bytes.Buffer +- for _, p := range self.parts { +- err := p.expand(&buf, values) +- if err != nil { +- return "", err +- } +- } +- return buf.String(), nil +-} +- +-func (self *templatePart) expand(buf *bytes.Buffer, values map[string]interface{}) error { +- if len(self.raw) > 0 { +- buf.WriteString(self.raw) +- return nil +- } +- var zeroLen = buf.Len() +- buf.WriteString(self.first) +- var firstLen = buf.Len() +- for _, term := range self.terms { +- value, exists := values[term.name] +- if !exists { +- continue +- } +- if buf.Len() != firstLen { +- buf.WriteString(self.sep) +- } +- switch v := value.(type) { +- case string: +- self.expandString(buf, term, v) +- case []interface{}: +- self.expandArray(buf, term, v) +- case map[string]interface{}: +- if term.truncate > 0 { +- return errors.New("cannot truncate a map expansion") +- } +- self.expandMap(buf, term, v) +- default: +- if m, ismap := struct2map(value); ismap { +- if term.truncate > 0 { +- return errors.New("cannot truncate a map expansion") +- } +- self.expandMap(buf, term, m) +- } else { +- str := fmt.Sprintf("%v", value) +- self.expandString(buf, term, str) +- } +- } +- } +- if buf.Len() == firstLen { +- original := buf.Bytes()[:zeroLen] +- buf.Reset() +- buf.Write(original) +- } +- return nil +-} +- +-func (self *templatePart) expandName(buf *bytes.Buffer, name string, empty bool) { +- if self.named { +- buf.WriteString(name) +- if empty { +- buf.WriteString(self.ifemp) +- } else { +- buf.WriteString("=") +- } +- } +-} +- +-func (self *templatePart) expandString(buf *bytes.Buffer, t templateTerm, s string) { +- if len(s) > t.truncate && t.truncate > 0 { +- s = s[:t.truncate] +- } +- self.expandName(buf, t.name, len(s) == 0) +- buf.WriteString(escape(s, self.allowReserved)) +-} +- +-func (self *templatePart) expandArray(buf *bytes.Buffer, t templateTerm, a []interface{}) { +- if len(a) == 0 { +- return +- } else if !t.explode { +- self.expandName(buf, t.name, false) +- } +- for i, value := range a { +- if t.explode && i > 0 { +- buf.WriteString(self.sep) +- } else if i > 0 { +- buf.WriteString(",") +- } +- var s string +- switch v := value.(type) { +- case string: +- s = v +- default: +- s = fmt.Sprintf("%v", v) +- } +- if len(s) > t.truncate && t.truncate > 0 { +- s = s[:t.truncate] +- } +- if self.named && t.explode { +- self.expandName(buf, t.name, len(s) == 0) +- } +- buf.WriteString(escape(s, self.allowReserved)) +- } +-} +- +-func (self *templatePart) expandMap(buf *bytes.Buffer, t templateTerm, m map[string]interface{}) { +- if len(m) == 0 { +- return +- } +- if !t.explode { +- self.expandName(buf, t.name, len(m) == 0) +- } +- var firstLen = buf.Len() +- for k, value := range m { +- if firstLen != buf.Len() { +- if t.explode { +- buf.WriteString(self.sep) +- } else { +- buf.WriteString(",") +- } +- } +- var s string +- switch v := value.(type) { +- case string: +- s = v +- default: +- s = fmt.Sprintf("%v", v) +- } +- if t.explode { +- buf.WriteString(escape(k, self.allowReserved)) +- buf.WriteRune('=') +- buf.WriteString(escape(s, self.allowReserved)) +- } else { +- buf.WriteString(escape(k, self.allowReserved)) +- buf.WriteRune(',') +- buf.WriteString(escape(s, self.allowReserved)) +- } +- } +-} +- +-func struct2map(v interface{}) (map[string]interface{}, bool) { +- value := reflect.ValueOf(v) +- switch value.Type().Kind() { +- case reflect.Ptr: +- return struct2map(value.Elem().Interface()) +- case reflect.Struct: +- m := make(map[string]interface{}) +- for i := 0; i < value.NumField(); i++ { +- tag := value.Type().Field(i).Tag +- var name string +- if strings.Contains(string(tag), ":") { +- name = tag.Get("uri") +- } else { +- name = strings.TrimSpace(string(tag)) +- } +- if len(name) == 0 { +- name = value.Type().Field(i).Name +- } +- m[name] = value.Field(i).Interface() +- } +- return m, true +- } +- return nil, false +-} +diff --git a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/utils.go b/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/utils.go +deleted file mode 100644 +index 399ef46..0000000 +--- a/Godeps/_workspace/src/code.google.com/p/google-api-go-client/googleapi/internal/uritemplates/utils.go ++++ /dev/null +@@ -1,13 +0,0 @@ +-package uritemplates +- +-func Expand(path string, expansions map[string]string) (string, error) { +- template, err := Parse(path) +- if err != nil { +- return "", err +- } +- values := make(map[string]interface{}) +- for k, v := range expansions { +- values[k] = v +- } +- return template.Expand(values) +-} +-- +1.9.3 + diff --git a/SPECS/flannel.spec b/SPECS/flannel.spec index 49e0f6e..942f3c3 100644 --- a/SPECS/flannel.spec +++ b/SPECS/flannel.spec @@ -1,9 +1,14 @@ %global with_devel 0 %global with_bundled 1 -%global with_debug 0 +%global with_debug 1 %global with_check 0 +%if 0%{?with_debug} +# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12 +%global _dwz_low_mem_die_limit 0 +%else %global debug_package %{nil} +%endif %global provider github %global provider_tld com %global project coreos @@ -16,7 +21,7 @@ Name: flannel Version: 0.5.3 -Release: 8%{?dist} +Release: 9%{?dist} Summary: Etcd address management agent for overlay networks License: ASL 2.0 URL: https://%{import_path} @@ -30,6 +35,7 @@ Source4: flannel-tmpfiles.conf Patch0: change-4001-to-2379-in-help-and-README.patch Patch1: change-coreos.com-network-to-atomic.io-network-in-he.patch Patch2: Notify-systemd-service-when-server-is-ready-to-liste.patch +Patch3: internal-to-inteernal.patch ExclusiveArch: %{ix86} x86_64 %{arm} @@ -124,6 +130,7 @@ building other packages which use %{project}/%{repo}. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %if ! 0%{?with_bundled} find . -name "*.go" \ @@ -132,26 +139,18 @@ find . -name "*.go" \ %endif %build -%if ! 0%{?with_bundled} -rm -rf Godeps -mkdir _build -pushd _build - mkdir -p src/github.com/coreos - ln -s $(dirs +1 -l) src/github.com/coreos/flannel -popd +mkdir -p src/github.com/coreos +ln -s ../../../ src/github.com/coreos/flannel -%if 0%{?with_debug} -function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; } +%if ! 0%{?with_bundled} +export GOPATH=$(pwd):%{gopath} %else -function gobuild { go build -a -v -x "$@"; } +export GOPATH=$(pwd):%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace %endif -mkdir bin -export GOPATH=${PWD}/_build:%{gopath} +function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; } + gobuild -o bin/flanneld . -%else -./build -%endif %install # package with binary @@ -208,6 +207,10 @@ go test %{import_path}/subnet %endif %changelog +* Thu Jan 14 2016 jchaloup - 0.5.3-9 +- Build with debug-info support + resolves: #1298728 + * Fri Oct 30 2015 jchaloup - 0.5.3-8 - Add After=network-online.target and Wants=network-online.target to actively wait for network to get on