Skip to content

Commit

Permalink
[FAB-9485] Replace nopkcs11 build tag with pkcs11
Browse files Browse the repository at this point in the history
Building binaries with pkcs11 support now requires the pkcs11 build tag.

Change-Id: Ib9e28a9088515e8b42dd3812b528e7786cfcc012
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Apr 12, 2018
1 parent 5d5ed4c commit cd7f70a
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 18 deletions.
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ orderer: $(BUILD_DIR)/bin/orderer
orderer-docker: $(BUILD_DIR)/image/orderer/$(DUMMY)

.PHONY: configtxgen
configtxgen: GO_TAGS+= nopkcs11
configtxgen: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)
configtxgen: $(BUILD_DIR)/bin/configtxgen

Expand Down Expand Up @@ -325,15 +324,12 @@ release-all: $(patsubst %,release/%, $(RELEASE_PLATFORMS))
release/%: GO_LDFLAGS=-X $(pkgmap.$(@F))/metadata.Version=$(PROJECT_VERSION)

release/windows-amd64: GOOS=windows
release/windows-amd64: GO_TAGS+= nopkcs11
release/windows-amd64: $(patsubst %,release/windows-amd64/bin/%, $(RELEASE_PKGS)) release/windows-amd64/install

release/darwin-amd64: GOOS=darwin
release/darwin-amd64: GO_TAGS+= nopkcs11
release/darwin-amd64: $(patsubst %,release/darwin-amd64/bin/%, $(RELEASE_PKGS)) release/darwin-amd64/install

release/linux-amd64: GOOS=linux
release/linux-amd64: GO_TAGS+= nopkcs11
release/linux-amd64: $(patsubst %,release/linux-amd64/bin/%, $(RELEASE_PKGS)) release/linux-amd64/install

release/%-amd64: DOCKER_ARCH=x86_64
Expand All @@ -342,12 +338,10 @@ release/linux-%: GOOS=linux

release/linux-ppc64le: GOARCH=ppc64le
release/linux-ppc64le: DOCKER_ARCH=ppc64le
release/linux-ppc64le: GO_TAGS+= nopkcs11
release/linux-ppc64le: $(patsubst %,release/linux-ppc64le/bin/%, $(RELEASE_PKGS)) release/linux-ppc64le/install

release/linux-s390x: GOARCH=s390x
release/linux-s390x: DOCKER_ARCH=s390x
release/linux-s390x: GO_TAGS+= nopkcs11
release/linux-s390x: $(patsubst %,release/linux-s390x/bin/%, $(RELEASE_PKGS)) release/linux-s390x/install

release/%/bin/configtxlator: $(PROJECT_FILES)
Expand Down
2 changes: 1 addition & 1 deletion bccsp/factory/nopkcs11.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build nopkcs11
// +build !pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/factory/pkcs11.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/factory/pkcs11_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/factory/pkcs11factory.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2016 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/factory/pkcs11factory_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/pkcs11/ecdsakey_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/pkcs11/impl_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2016 All Rights Reserved.
Expand Down
2 changes: 1 addition & 1 deletion bccsp/pkcs11/pkcs11_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build !nopkcs11
// +build pkcs11

/*
Copyright IBM Corp. 2017 All Rights Reserved.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/chaincode4ade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ Now let's compile your chaincode.

.. code:: bash
go get -u --tags nopkcs11 github.com/hyperledger/fabric/core/chaincode/shim
go build --tags nopkcs11
go get -u github.com/hyperledger/fabric/core/chaincode/shim
go build
Assuming there are no errors, now we can proceed to the next step, testing
your chaincode.
Expand Down
4 changes: 2 additions & 2 deletions examples/configtxupdate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Then, in another window, build the `configtxgen` tool.
```
$ make configtxgen
build/bin/configtxgen
CGO_CFLAGS=" " GOBIN=/home/yellickj/go/src/github.com/hyperledger/fabric/build/bin go install -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-alpha3-snapshot-63e0dc80f -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
CGO_CFLAGS=" " GOBIN=/home/yellickj/go/src/github.com/hyperledger/fabric/build/bin go install -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-alpha3-snapshot-63e0dc80f -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
Binary available as build/bin/configtxgen
```

Expand Down Expand Up @@ -261,7 +261,7 @@ Then, in another window, build the `configtxgen` tool.
```
$ make configtxgen
build/bin/configtxgen
CGO_CFLAGS=" " GOBIN=/home/yellickj/go/src/github.com/hyperledger/fabric/build/bin go install -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-alpha3-snapshot-63e0dc80f -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
CGO_CFLAGS=" " GOBIN=/home/yellickj/go/src/github.com/hyperledger/fabric/build/bin go install -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0-alpha3-snapshot-63e0dc80f -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
Binary available as build/bin/configtxgen
```

Expand Down
7 changes: 7 additions & 0 deletions unit-test/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ plugin_packages=(
"github.com/hyperledger/fabric/core/scc"
)

# packages which need to be tested with build tag pkcs11
pkcs11_packages=(
"github.com/hyperledger/fabric/bccsp"
)

# obtain packages changed since some git refspec
packages_diff() {
git -C "${GOPATH}/src/github.com/hyperledger/fabric" diff --no-commit-id --name-only -r "${1:-HEAD}" |
Expand Down Expand Up @@ -111,10 +116,12 @@ main() {
echo "mode: set" > profile.cov
run_tests_with_coverage "${packages[@]}"
GO_TAGS="${GO_TAGS} pluginsenabled" run_tests_with_coverage "${plugin_packages[@]}"
GO_TAGS="${GO_TAGS} pkcs11" run_tests_with_coverage "${pkcs11_packages[@]}"
gocov convert profile.cov | gocov-xml > report.xml
else
run_tests "${packages[@]}"
GO_TAGS="${GO_TAGS} pluginsenabled" run_tests "${plugin_packages[@]}"
GO_TAGS="${GO_TAGS} pkcs11" run_tests "${pkcs11_packages[@]}"
fi
}

Expand Down

0 comments on commit cd7f70a

Please sign in to comment.