Skip to content

Commit

Permalink
chore: db-tools Make target for MDBX debugging tools (paradigmxyz#3245
Browse files Browse the repository at this point in the history
)
  • Loading branch information
shekhirin authored Jun 19, 2023
1 parent d3d23b4 commit 6f854dc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ proptest-regressions/
# Release artifacts
dist/

# Database debugging tools
db-tools/

# VSCode
.vscode
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Heavily inspired by Lighthouse: https://github.com/sigp/lighthouse/blob/693886b94176faa4cb450f024696cb69cda2fe58/Makefile

GIT_TAG := $(shell git describe --tags --abbrev=0)
GIT_TAG ?= $(shell git describe --tags --abbrev=0)
BIN_DIR = "dist/bin"

MDBX_PATH = "crates/storage/libmdbx-rs/mdbx-sys/libmdbx"
DB_TOOLS_DIR = "db-tools"
FULL_DB_TOOLS_DIR := $(shell pwd)/$(DB_TOOLS_DIR)/

BUILD_PATH = "target"

# List of features to use when building. Can be overriden via the environment.
Expand Down Expand Up @@ -147,4 +151,23 @@ endef
clean:
cargo clean
rm -rf $(BIN_DIR)
rm -rf $(EF_TESTS_DIR)
rm -rf $(EF_TESTS_DIR)

# Compile MDBX debugging tools
.PHONY: db-tools
db-tools:
@echo "Building MDBX debugging tools..."
# `IOARENA=1` silences benchmarking info message that is printed to stderr
@$(MAKE) -C $(MDBX_PATH) IOARENA=1 tools > /dev/null
@mkdir -p $(DB_TOOLS_DIR)
@cd $(MDBX_PATH) && \
mv mdbx_chk $(FULL_DB_TOOLS_DIR) && \
mv mdbx_copy $(FULL_DB_TOOLS_DIR) && \
mv mdbx_dump $(FULL_DB_TOOLS_DIR) && \
mv mdbx_drop $(FULL_DB_TOOLS_DIR) && \
mv mdbx_load $(FULL_DB_TOOLS_DIR) && \
mv mdbx_stat $(FULL_DB_TOOLS_DIR)
# `IOARENA=1` silences benchmarking info message that is printed to stderr
@$(MAKE) -C $(MDBX_PATH) IOARENA=1 clean > /dev/null
@echo "Run \"$(DB_TOOLS_DIR)/mdbx_stat\" for the info about MDBX db file."
@echo "Run \"$(DB_TOOLS_DIR)/mdbx_chk\" for the MDBX db file integrity check."

0 comments on commit 6f854dc

Please sign in to comment.