Merge pull request #1712 from galexrt/1664
Make sed usage compatible with GNU and BSD
This commit is contained in:
3 files changed
+20
-7
No files matched your search
@@ -12,6 +12,7 @@
|
||||
- Rook-Operator no longer creates the resources CRD's or TPR's at the runtime. Instead, those resources are provisioned during deployment via `helm` or `kubectl`.
|
||||
- The 'rook' image is now based on the ceph-container project's 'daemon-base' image so that Rook no
|
||||
longer has to manage installs of Ceph in image.
|
||||
- Rook CRD code generation is now working with BSD (Mac) and GNU sed.
|
||||
|
||||
## Breaking Changes
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Copyright 2016 The Rook Authors. All rights reserved.
|
||||
# Copyright 2018 The Rook Authors. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -14,9 +14,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# shellcheck disable=SC2086,SC2089,SC2090
|
||||
# Disables quote checks, which is needed because of the SED variable here.
|
||||
|
||||
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd ${scriptdir}/../../vendor/k8s.io/code-generator && ./generate-groups.sh \
|
||||
cd "${scriptdir}/../../vendor/k8s.io/code-generator" && ./generate-groups.sh \
|
||||
all \
|
||||
github.com/rook/rook/pkg/client \
|
||||
github.com/rook/rook/pkg/apis \
|
||||
@@ -24,9 +27,18 @@ cd ${scriptdir}/../../vendor/k8s.io/code-generator && ./generate-groups.sh \
|
||||
# this seems busted in the release-1.8 branch
|
||||
# --go-header-file ${SCRIPT_ROOT}/build/codegen/header.txt
|
||||
|
||||
SED="sed -i.bak"
|
||||
|
||||
# workaround https://github.com/openshift/origin/issues/10357
|
||||
find ${scriptdir}/../../pkg/client -name "clientset_generated.go" -exec sed -i '' 's/fakePtr := testing.Fake{}/cs := \&Clientset{}/g' {} +
|
||||
find ${scriptdir}/../../pkg/client -name "clientset_generated.go" -exec sed -i '' 's/fakePtr.AddReactor/cs.Fake.AddReactor/g' {} +
|
||||
find ${scriptdir}/../../pkg/client -name "clientset_generated.go" -exec sed -i '' 's/fakePtr.AddWatchReactor/cs.Fake.AddWatchReactor/g' {} +
|
||||
find ${scriptdir}/../../pkg/client -name "clientset_generated.go" -exec sed -i '' 's/return &Clientset{fakePtr, \&fakediscovery.FakeDiscovery{Fake: &fakePtr}}/cs.discovery = \&fakediscovery.FakeDiscovery{Fake: \&cs.Fake}\
|
||||
find "${scriptdir}/../../pkg/client" -name "clientset_generated.go" -exec \
|
||||
$SED 's/fakePtr := testing.Fake\([{]\)}/cs := \&Clientset\1}/g' {} +
|
||||
find "${scriptdir}/../../pkg/client" -name "clientset_generated.go" -exec \
|
||||
$SED 's/fakePtr.AddReactor/cs.Fake.AddReactor/g' {} +
|
||||
find "${scriptdir}/../../pkg/client" -name "clientset_generated.go" -exec \
|
||||
$SED 's/fakePtr.AddWatchReactor/cs.Fake.AddWatchReactor/g' {} +
|
||||
# shellcheck disable=SC1004
|
||||
# Disables backslash+linefeed is literal check.
|
||||
find "${scriptdir}/../../pkg/client" -name "clientset_generated.go" -exec \
|
||||
$SED 's/return \&Clientset{fakePtr, \&fakediscovery.FakeDiscovery{Fake: \&fakePtr}}/cs.discovery = \&fakediscovery.FakeDiscovery{Fake: \&cs.Fake}\
|
||||
return cs/g' {} +
|
||||
find "${scriptdir}/../../pkg/client" -name "clientset_generated.go.bak" -delete
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2017 The Rook Authors. All rights reserved.
|
||||
Copyright 2018 The Rook Authors. All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
Reference in new issue
Block a user