Merge pull request #56231 from ericchiang/update-godep-license-fix-gopkgin

Automatic merge from submit-queue (batch tested with PRs 54410, 56184, 56199, 56191, 56231). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

hack: fix godep license parsing for gopkg.in packages

The script incorrectly thinks that `gopkg.in/square/go-jose.v2/cipher`
doesn't have a license because it parses `gopkg.in/square` as the
root of the repo, even though `gopkg.in/square/go-jose.v2` is the
root.

Add special handling for gopkg.in packages by grep'ing for the
version that gopkg.in appends to the package name.

Extracted from https://github.com/kubernetes/kubernetes/pull/56161

cc @thockin 

```release-note
NONE
```
pull/6/head
Kubernetes Submit Queue 2017-12-14 05:33:20 -08:00 committed by GitHub
commit e34a00afce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,14 @@ process_content () {
go4.org/*)
package_root=$(echo ${package} |awk -F/ '{ print $1 }')
;;
gopkg.in/*)
# Root of gopkg.in package always ends with '.v(number)' and my contain
# more than two path elements. For example:
# - gopkg.in/yaml.v2
# - gopkg.in/inf.v0
# - gopkg.in/square/go-jose.v2
package_root=$(echo ${package} |grep -oh '.*\.v[0-9]')
;;
*)
package_root=$(echo ${package} |awk -F/ '{ print $1"/"$2 }')
;;