From 9488696814f481d2b0dce03d77657ec6860b9701 Mon Sep 17 00:00:00 2001 From: Ken Cochrane Date: Thu, 10 Mar 2016 13:47:26 -0500 Subject: [PATCH 1/2] Fix the vendoring script on MacOS X The version of sed on MacOS X is different then the one on linux. The mac version requires a parameter for the inline (-i) flag, where this isn't required on linux. On the mac it thinks the -e flag is the parameter, and it causes the vendoring script to fail. This fix adds an empty string '' as a parameter to sed, which works fine on both the mac and linux versions. Signed-off-by: Ken Cochrane --- hack/.vendor-helpers.sh | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hack/.vendor-helpers.sh b/hack/.vendor-helpers.sh index a90df0496c..a509f6e720 100755 --- a/hack/.vendor-helpers.sh +++ b/hack/.vendor-helpers.sh @@ -118,13 +118,6 @@ clean() { -path vendor/src/github.com/mattn/go-sqlite3/code ) - # This package is required to build the Etcd client, - # but Etcd hard codes a local Godep full path. - # FIXME: fix_rewritten_imports fixes this problem in most platforms - # but it fails in very small corner cases where it makes the vendor - # script to remove this package. - # See: https://github.com/docker/docker/issues/19231 - findArgs+=( -or -path vendor/src/github.com/ugorji/go/codec ) for import in "${imports[@]}"; do [ "${#findArgs[@]}" -eq 0 ] || findArgs+=( -or ) findArgs+=( -path "vendor/src/$import" ) @@ -141,6 +134,10 @@ clean() { echo -n 'pruning unused files, ' $find vendor -type f -name '*_test.go' -exec rm -v '{}' ';' + # These are the files that are left over after fix_rewritten_imports is run. + echo -n 'pruning .orig files, ' + $find vendor -type f -name '*.orig' -exec rm -v '{}' ';' + echo done } @@ -151,5 +148,5 @@ fix_rewritten_imports () { local target="vendor/src/$pkg" echo "$pkg: fixing rewritten imports" - $find "$target" -name \*.go -exec sed -i -e "s|\"${remove}|\"|g" {} \; + $find "$target" -name \*.go -exec sed -i'.orig' -e "s|\"${remove}|\"|g" {} \; } From 94445b2fea906df1bedec40284591d752def18e2 Mon Sep 17 00:00:00 2001 From: Ken Cochrane Date: Thu, 10 Mar 2016 20:27:44 -0500 Subject: [PATCH 2/2] Put back the hack that was originally in place. Signed-off-by: Ken Cochrane --- hack/.vendor-helpers.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hack/.vendor-helpers.sh b/hack/.vendor-helpers.sh index a509f6e720..d07182b514 100755 --- a/hack/.vendor-helpers.sh +++ b/hack/.vendor-helpers.sh @@ -118,6 +118,13 @@ clean() { -path vendor/src/github.com/mattn/go-sqlite3/code ) + # This package is required to build the Etcd client, + # but Etcd hard codes a local Godep full path. + # FIXME: fix_rewritten_imports fixes this problem in most platforms + # but it fails in very small corner cases where it makes the vendor + # script to remove this package. + # See: https://github.com/docker/docker/issues/19231 + findArgs+=( -or -path vendor/src/github.com/ugorji/go/codec ) for import in "${imports[@]}"; do [ "${#findArgs[@]}" -eq 0 ] || findArgs+=( -or ) findArgs+=( -path "vendor/src/$import" )