-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify build and install for CCF #468
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,6 +115,13 @@ try cp ${XFER_DIR}/ccf/keys/networkcert.pem ${PDO_LEDGER_KEY_ROOT}/ | |
yell register the enclave if necessary | ||
# ----------------------------------------------------------------- | ||
if [ "${F_REGISTER,,}" == 'yes' ]; then | ||
if [ ! -f ${XFER}/ccf/keys/memberccf_privk.pem ] ; then | ||
die unable to locate CCF policies keys | ||
fi | ||
|
||
try cp ${XFER_DIR}/ccf/keys/memberccf_cert.pem ${PDO_LEDGER_KEY_ROOT}/ | ||
try cp ${XFER_DIR}/ccf/keys/memberccf_privk.pem ${PDO_LEDGER_KEY_ROOT}/ | ||
Comment on lines
+122
to
+123
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (same as above) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
|
||
try make -C ${PDO_SOURCE_ROOT}/build register | ||
fi | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,72 +28,99 @@ ifndef PDO_SOURCE_ROOT | |
$(error Incomplete configuration, PDO_SOURCE_ROOT is not defined) | ||
endif | ||
|
||
CCF_COMPILE_TARGET ?= virtual | ||
CCF_VERSION ?= 4.0.1 | ||
CCF_LEDGER_DIR ?= $(PDO_INSTALL_ROOT)/opt/pdo/ccf | ||
|
||
NINJA ?= ninja $(NINJA_OPTIONS) | ||
|
||
SCRIPTDIR ?= $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
CCFDSTDIR ?= $(PDO_INSTALL_ROOT)/opt/pdo/ccf | ||
SRCDIR ?= $(PDO_SOURCE_ROOT) | ||
WORKSPACEDIR := $(CCFDSTDIR)/workspace | ||
BINDIR := $(CCFDSTDIR)/bin/ | ||
BLDDIR := $(SCRIPTDIR)/build | ||
|
||
PYTHON_DIR=$(CCFDSTDIR)/lib/python3.8 | ||
|
||
COMPILE_TARGET=virtual | ||
|
||
all: environment install | ||
|
||
build: build-pdo-tp | ||
# ----------------------------------------------------------------- | ||
# There are two environments that need to be created: the PDO | ||
# environment and the ledger environment. This is necessitated by | ||
# the incompatibilities between the client requirements (which requires | ||
# ccf 1.0.19 which is the last python package with the ccf client modules) | ||
# and the ledger requirements (which installs the python modules from | ||
# our current verson of CCF). The client environment may be useful on | ||
# any pdo installation (e.g. ledger ping test makes sense on any client) | ||
# while the ledger environment is only useful where ccf nodes are run | ||
# ----------------------------------------------------------------- | ||
environment: pdo-environment ledger-environment | ||
|
||
pdo-environment : $(PDO_INSTALL_ROOT) | ||
|
||
ledger-environment : $(CCF_LEDGER_DIR)/lib/python3.8 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth declaring the python version as a variable to prepare for the maybe-case that ccf starts supporting also ubuntu >20.04? In any case, maybe having it close to CCF_VERSION and commenting that this comes from the current intrinsic 20.04-implying-python-3.8 invariant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. possibly. although in this case the python version is completely determined by ccf. |
||
|
||
# This directory indicates whether the pdo python virtual | ||
# environment has been created | ||
$(PDO_INSTALL_ROOT) : | ||
make -C $(PDO_SOURCE_ROOT)/build environment | ||
make -C $(PDO_SOURCE_ROOT)/bin install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. installing all of PDO environment inside the CCF container seems to be an overkill. Doesn't hurt, I guess all that we want is ccf 1.0.19, do we need anything else ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think you have a misunderstanding of how your code worked in the past. you were already installing everything in python_requirements.txt which is all this does (except cleaner). AND... I absolutely think we should be installing pdo client packages (and all of these scripts should be installed in every pdo client). there is a separate issue to track that discussion (#469 ) |
||
|
||
# This directory indicates whether the ccf ledger python | ||
# virtual environment has been created | ||
$(CCF_LEDGER_DIR)/lib/python3.8 : | ||
mkdir -p $(CCF_LEDGER_DIR) | ||
mkdir -p $(CCF_LEDGER_DIR)/workspace | ||
virtualenv -p python3.8 --no-download $(PDO_HOME)/ccf | ||
$(CCF_LEDGER_DIR)/bin/pip install --upgrade pip | ||
$(CCF_LEDGER_DIR)/bin/pip install --upgrade -r $(CCF_BASE)/bin/requirements.txt | ||
$(CCF_LEDGER_DIR)/bin/pip install ccf==$(CCF_VERSION) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious, the pre-reqs installed in the prior step do not depend on the ccf version? BTW: this target in principle is also cacheable and takes even with docker-cached packages one minute but will be re-executed after a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well... (and i think this is in one of the comments) for the MOMENT we require ccf 1.0.19 for the PDO installation and for the ccf pdo scripts. HOWEVER, the actual ccf nodes require a different version. i tried to get the version out of the CCF_BASE (something like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one more note continuing the python version discussion... all of the ccf scripts have the python version hardcoded in them. there is no place i could find where the python dependency is expressed in a way i can automate configuration. so 1) i don't think hard coding it is such a problem right now and 2) i don't think there is an easy way to derive it from the ccf version |
||
|
||
# ----------------------------------------------------------------- | ||
# build it | ||
# ----------------------------------------------------------------- | ||
build : build-pdo-tp | ||
|
||
build-pdo-tp : $(BLDDIR) | ||
cd $(BLDDIR) && cmake .. -GNinja \ | ||
-DCCF_DIR=$(CCF_BASE) \ | ||
-DCOMPILE_TARGET=$(COMPILE_TARGET) \ | ||
-DCMAKE_INSTALL_PREFIX=$(CCFDSTDIR) | ||
cd $(BLDDIR) && $(NINJA) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't that somewhat cleaner with newer cmake as 'cmake --build $(BLDDIR) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. i'm getting there. there are several other modern cmake improvements that can be made. in this case i also don't know the best way to build with ninja in cmake. all things queued up for later investigation. |
||
|
||
clean : clean-build clean-install | ||
$(BLDDIR) : | ||
cmake -S . -B $(BLDDIR) -GNinja \ | ||
-DCCF_DIR=$(CCF_BASE) \ | ||
-DCOMPILE_TARGET=$(CCF_COMPILE_TARGET) \ | ||
-DCMAKE_INSTALL_PREFIX=$(CCF_LEDGER_DIR) | ||
|
||
# ----------------------------------------------------------------- | ||
# clean up | ||
# ----------------------------------------------------------------- | ||
clean : clean-build clean-ledger | ||
|
||
clean-build: | ||
rm -rf $(BLDDIR) | ||
|
||
clean-install : | ||
rm -rf $(CCFDSTDIR) | ||
clean-ledger : | ||
rm -rf $(CCF_LEDGER_DIR) | ||
|
||
environment : $(CCFDSTDIR) $(PYTHON_DIR) | ||
# ----------------------------------------------------------------- | ||
# install the pdo tp library and scripts in the appropriate | ||
# directories; the library and bash scripts are only necessary | ||
# for running the ledger and go in the ledger directory; the | ||
# python scripts may be useful on any client so they are installed | ||
# in the pdo install root directory where the rest of the pdo | ||
# scripts are installed. future work to move the python scripts | ||
# to an installable wheel file | ||
# ----------------------------------------------------------------- | ||
|
||
$(BLDDIR) : | ||
@echo CREATE BUILD DIRECTORY $(BLDDIR) | ||
mkdir -p $(BLDDIR) | ||
|
||
# build out the entire pdo directory tree since | ||
# we may use it for placement of the ledger keys | ||
$(CCFDSTDIR) : | ||
@echo CREATE INSTALLATION DIRECTORY $(CCFDSTDIR) | ||
@make -C $(PDO_SOURCE_ROOT)/build $(PDO_INSTALL_ROOT) | ||
@mkdir -p $(CCFDSTDIR) | ||
@mkdir -p $(WORKSPACEDIR) | ||
|
||
$(PYTHON_DIR) : | ||
echo ${PYTHON_DIR} | ||
virtualenv -p python3.8 --no-download $(CCFDSTDIR) | ||
. $(abspath $(CCFDSTDIR)/bin/activate) && pip install --upgrade pip | ||
. $(abspath $(CCFDSTDIR)/bin/activate) && pip install --upgrade setuptools | ||
. $(abspath $(CCFDSTDIR)/bin/activate) && pip install --upgrade -r $(CCF_BASE)/bin/requirements.txt | ||
. $(abspath $(CCFDSTDIR)/bin/activate) && pip install --upgrade ccf==1.0.19 toml | ||
|
||
install : install-pdo-tp | ||
|
||
PDO_BASH_SCRIPTS=start_ccf_network.sh stop_cchost.sh | ||
PDO_PYTHON_SCRIPTS=configure_ccf_network.py generate_ledger_authority.py fetch_ledger_authority.py register_enclave_attestation_verification_policy.py | ||
PDO_BASH_SCRIPTS = $(wildcard scripts/*.sh) | ||
PDO_PYTHON_SCRIPTS = $(wildcard scripts/*.py) | ||
|
||
install : install-pdo-tp install-pdo-scripts | ||
|
||
install-pdo-tp : build-pdo-tp | ||
@ cd $(BLDDIR) && $(NINJA) install | ||
@ cp $(addprefix scripts/,$(PDO_BASH_SCRIPTS)) $(BINDIR) | ||
@ cp $(addprefix scripts/,$(PDO_PYTHON_SCRIPTS)) $(BINDIR) | ||
@ make -C ${PDO_SOURCE_ROOT}/bin install | ||
|
||
.PHONY : all build build-pdo-tp | ||
.PHONY : clean clean-build clean-install | ||
.PHONY : environment | ||
.PHONY : install install-pdo-tp | ||
cd $(BLDDIR) && $(NINJA) install | ||
cp $(PDO_BASH_SCRIPTS) $(CCF_LEDGER_DIR)/bin | ||
|
||
install-pdo-scripts : | ||
cp $(PDO_PYTHON_SCRIPTS) $(PDO_INSTALL_ROOT)/bin | ||
|
||
# ----------------------------------------------------------------- | ||
.PHONY : all | ||
.PHONY : environment pdo-environment ledger-environment | ||
.PHONY : build build-pdo-tp | ||
.PHONY : clean clean-build clean-ledger | ||
.PHONY : install install-pdo-tp install-pdo-scripts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these should make
PDO_LEDGER_KEY_ROOT
the authoritative place where to look for the ledger keys -- to be double checked with HW mode tests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
umm... it already was (and it is pretty well documented):
and: