Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao Xu committed Sep 23, 2016
1 parent f231e12 commit 0ba3d7d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions staging/src/k8s.io/client-go/copy.sh
Expand Up @@ -115,6 +115,8 @@ find "${CLIENT_REPO}" -type f -name "generated.pb.go" -print0 | xargs -0 sed -i
echo "rearranging directory layout"
# $1 and $2 are relative to ${CLIENT_REPO}
function mvfolder {
echo "CHAO: ${1}"
echo ""
local src=${1%/#/}
local dst=${2%/#/}
# create the parent directory of dst
Expand All @@ -128,19 +130,17 @@ function mvfolder {
local dst_package="${dst##*/}"
find "${CLIENT_REPO}" -type f -name "*.go" -print0 | xargs -0 sed -i "s,package ${src_package},package ${dst_package},g"

set -x
grep -Rl "\"${CLIENT_REPO_FROM_SRC}/${src}\"" "${CLIENT_REPO}" | while read target ; do
{ grep -Rl "\"${CLIENT_REPO_FROM_SRC}/${src}" "${CLIENT_REPO}" || true ; } | while read target ; do
# rewrite imports
# the first rule is to convert import lines like `restclient "k8s.io/client-go/pkg/client/restclient"`,
# where a package alias is the same the package name.
sed -i "s,\^${src_package} \"${CLIENT_REPO_FROM_SRC}/${src},${dst_package} \"${CLIENT_REPO_FROM_SRC}/${dst},g" ${target}
sed -i "s,\<${src_package} \"${CLIENT_REPO_FROM_SRC}/${src},${dst_package} \"${CLIENT_REPO_FROM_SRC}/${dst},g" ${target}
sed -i "s,\"${CLIENT_REPO_FROM_SRC}/${src},\"${CLIENT_REPO_FROM_SRC}/${dst},g" ${target}
# rewrite import invocation
if [ "${src_package}" != "${dst_package}" ]; then
sed -i "s,\<${src_package}\.\([a-zA-Z]\),${dst_package}\.\1,g" ${target}
fi
done
set +x
}

mvfolder pkg/client/clientset_generated/release_1_4 kubernetes
Expand Down

0 comments on commit 0ba3d7d

Please sign in to comment.