You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

fix-k8s-import.sh 1.1 kB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. # Copyright 2021 The KubeEdge Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # fix these invalid 0.0.0 version requires of k8s.io/kubernetes
  16. # modified the script from https://github.com/kubernetes/kubernetes/issues/79384#issuecomment-521493597
  17. VERSION=${1#"v"}
  18. if [ -z "$VERSION" ]; then
  19. echo "Must specify version!"
  20. exit 1
  21. fi
  22. MODS=($(
  23. curl -sS https://raw.githubusercontent.com/kubernetes/kubernetes/v${VERSION}/go.mod |
  24. sed -n 's|.*\(k8s.io/.*\) => ./staging/src/k8s.io/.*|\1|p'
  25. ))
  26. for MOD in "${MODS[@]}"; do
  27. echo fixing $MOD
  28. V=v${VERSION/1/0}
  29. go mod edit "-replace=${MOD}=${MOD}@${V}"
  30. done