Skip to content

Commit

Permalink
Small fixes to address PR feedback
Browse files Browse the repository at this point in the history
* add dependency checking to remove parallel make issues
* add secp256k1 to PDO CCF docker
* more use of cmake, add clean_config to test_no_reset
* wrap makefiles with check for failure

Signed-off-by: Mic Bowman <[email protected]>
  • Loading branch information
cmickeyb committed Feb 15, 2024
1 parent 6b1d6cd commit 27ea18b
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 28 deletions.
14 changes: 7 additions & 7 deletions bin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

PDO_HOME ?= /opt/pdo
BIN_DIR=${PDO_HOME}/bin
BIN_LIB_DIR=${PDO_HOME}/bin/lib

ifndef PDO_INSTALL_ROOT
$(error Incomplete configuration, PDO_INSTALL_ROOT is not defined)
endif

DSTDIR ?= $(PDO_INSTALL_ROOT)/opt/pdo
BIN_LIB_DIR=$(DSTDIR)/bin/lib

all : install

build :

install : build
mkdir -p ${BIN_DIR} ${BIN_LIB_DIR}
cp lib/*.sh ${BIN_LIB_DIR}

mkdir -p $(BIN_LIB_DIR)
cp lib/*.sh $(BIN_LIB_DIR)

clean:

Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ clean-build : $(PYTHON_DIR)

environment : $(DSTDIR) $(PYTHON_DIR)

$(PYTHON_DIR) :
$(PYTHON_DIR) : $(DSTDIR)
virtualenv -p python3 --no-download $(DSTDIR)
. $(abspath $(DSTDIR)/bin/activate) && pip install --upgrade pip
. $(abspath $(DSTDIR)/bin/activate) && pip install --upgrade setuptools
Expand Down
4 changes: 2 additions & 2 deletions docker/make.dev
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ PIP_CACHE_DIR ?= $(DOCKER_DIR)/cache/pip
DOCKER_DEV_ARGS += -v $(PIP_CACHE_DIR):/project/pdo/.cache/pip

# Docker runtime args specific to client
DOCKER_CLIENT_DEV_ARGS ?=
DOCKER_CLIENT_DEV_ARGS ?=
# - if you want pdo-contracts mounted in client dev image, define (e.g., in make.loc)
# variable 'DOCKER_CLIENT_WITH_PDO_CONTRACTS'
ifdef DOCKER_CLIENT_WITH_PDO_CONTRACTS
Expand Down Expand Up @@ -64,7 +64,7 @@ stop_services_dev :
stop_client_dev :
- docker rm -f client_container_dev

test_no_reset : build_test stop_all
test_no_reset : clean_config build_test stop_all
PDO_VERSION=$(PDO_VERSION) docker-compose $(TEST_FILES) up --abort-on-container-exit
PDO_VERSION=$(PDO_VERSION) docker-compose $(TEST_FILES) down

Expand Down
1 change: 1 addition & 0 deletions docker/pdo_ccf_base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ARG ADD_APT_PKGS=
ENV DEBIAN_FRONTEND "noninteractive"
RUN apt-get update \
&& apt-get install -y -q \
libsecp256k1-dev \
lsof \
python \
python3-dev \
Expand Down
13 changes: 7 additions & 6 deletions docker/tools/build_ccf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

source /project/pdo/tools/environment.sh

# these variables should be unused during build
export PDO_HOSTNAME=
export PDO_LEDGER_URL=

source /project/pdo/tools/environment.sh
source ${PDO_SOURCE_ROOT}/bin/lib/common.sh
check_pdo_build_env

# -----------------------------------------------------------------
# set up the basic structure in ${PDO_INSTALL_ROOT}
yell Build and install CCF into ${PDO_INSTALL_ROOT}
# -----------------------------------------------------------------
make -C ${PDO_SOURCE_ROOT}/ledgers/ccf environment
make -C ${PDO_SOURCE_ROOT}/ledgers/ccf install
try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf environment
try make -C ${PDO_SOURCE_ROOT}/ledgers/ccf install
8 changes: 5 additions & 3 deletions docker/tools/build_client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
# limitations under the License.

source /project/pdo/tools/environment.sh
source ${PDO_SOURCE_ROOT}/bin/lib/common.sh
check_pdo_build_env

# to get build without (ignored) errors
export PDO_HOSTNAME=localhost
export PDO_LEDGER_URL=https://127.0.0.1:6600

make -C ${PDO_SOURCE_ROOT}/build environment
make -C ${PDO_SOURCE_ROOT}/build template
make -C ${PDO_SOURCE_ROOT}/build build-client
try make -C ${PDO_SOURCE_ROOT}/build environment
try make -C ${PDO_SOURCE_ROOT}/build template
try make -C ${PDO_SOURCE_ROOT}/build build-client
14 changes: 10 additions & 4 deletions docker/tools/build_services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ export PDO_LEDGER_URL=https://127.0.0.1:6600
source /opt/intel/sgxsdk/environment
source /project/pdo/tools/environment.sh

make -C ${PDO_SOURCE_ROOT}/build environment
make -C ${PDO_SOURCE_ROOT}/build template
make -C ${PDO_SOURCE_ROOT}/build system-keys
make -C ${PDO_SOURCE_ROOT}/build verified-build
source ${PDO_SOURCE_ROOT}/bin/lib/common.sh
check_pdo_build_env

# -----------------------------------------------------------------
yell Build and install services into ${PDO_INSTALL_ROOT}
# -----------------------------------------------------------------
try make -C ${PDO_SOURCE_ROOT}/build environment
try make -C ${PDO_SOURCE_ROOT}/build template
try make -C ${PDO_SOURCE_ROOT}/build system-keys
try make -C ${PDO_SOURCE_ROOT}/build verified-build
11 changes: 6 additions & 5 deletions ledgers/ccf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ $(PDO_INSTALL_ROOT) :

# This directory indicates whether the ccf ledger python
# virtual environment has been created
$(CCF_LEDGER_DIR)/lib/python3.8 :
$(CCF_LEDGER_DIR)/lib/python3.8 : pdo-environment
mkdir -p $(CCF_LEDGER_DIR)
mkdir -p $(CCF_LEDGER_DIR)/workspace
virtualenv -p python3.8 --no-download $(PDO_HOME)/ccf
Expand All @@ -77,7 +77,7 @@ $(CCF_LEDGER_DIR)/lib/python3.8 :
build : build-pdo-tp

build-pdo-tp : $(BLDDIR)
cd $(BLDDIR) && $(NINJA)
cmake --build $(BLDDIR)

$(BLDDIR) :
cmake -S . -B $(BLDDIR) -GNinja \
Expand Down Expand Up @@ -111,11 +111,12 @@ PDO_PYTHON_SCRIPTS = $(wildcard scripts/*.py)

install : install-pdo-tp install-pdo-scripts

install-pdo-tp : build-pdo-tp
cd $(BLDDIR) && $(NINJA) install
# cd $(BLDDIR) && $(NINJA) install
install-pdo-tp : ledger-environment build-pdo-tp
cmake --install $(BLDDIR)
cp $(PDO_BASH_SCRIPTS) $(CCF_LEDGER_DIR)/bin

install-pdo-scripts :
install-pdo-scripts : pdo-environment
cp $(PDO_PYTHON_SCRIPTS) $(PDO_INSTALL_ROOT)/bin

# -----------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions ledgers/ccf/scripts/start_ccf_network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ yell start ccf network with "local://${F_INTERFACE_ADDRESS}:${F_PORT}"
say attempt to start ccf node

source ${F_CCF_LEDGER_DIR}/bin/activate
# Note below is adopted from (the end of ) CCF's tests/sandbox/sandbox.sh ..
CURL_CLIENT=ON INITIAL_MEMBER_COUNT=1 \
${F_CCF_LEDGER_DIR}/bin/python ${CCF_BASE}/bin/start_network.py \
--binary-dir ${CCF_BASE}/bin \
Expand Down

0 comments on commit 27ea18b

Please sign in to comment.