Move the protobuf source into its own dir in the repo root

The protobuf source file is used by more than just the C++ code,
so let's move it into its own location for consistency and discoverability
This commit is contained in:
Daniel Markstedt
2025-11-25 22:56:12 +01:00
parent 402760bb00
commit a99e1c51b9
8 changed files with 12 additions and 11 deletions
+3 -2
View File
@@ -4,10 +4,11 @@
# Paths to include
!/docker/backend/piscsi_wrapper.sh
!/docker/web/web_start_wrapper.sh
!/doc
!/python
!/cpp
!/doc
!/os_integration
!/proto
!/python
!/test
!/easyinstall.sh
!/LICENCE
+1 -1
View File
@@ -55,7 +55,7 @@ jobs:
- name: Set backend container image name
run: |
REPO_LOWER=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
IMAGE_TAG=$(git ls-files -s cpp python .github/workflows/web.yml | git hash-object --stdin)
IMAGE_TAG=$(git ls-files -s cpp proto .github/workflows/web.yml | git hash-object --stdin)
echo "GHCR_IMAGE=ghcr.io/${REPO_LOWER}/backend-standalone:${IMAGE_TAG}" >> $GITHUB_ENV
- name: Login to container registry
+2 -2
View File
@@ -74,7 +74,7 @@ ifeq ($(CONNECT_TYPE), FULLSPEC)
BIN_ALL += $(BINDIR)/$(SCSIDUMP)
endif
SRC_PROTOC = piscsi_interface.proto
SRC_PROTOC = ../proto/piscsi_interface.proto
SRC_GENERATED = $(GENERATED_DIR)/piscsi_interface.pb.cpp
@@ -170,7 +170,7 @@ $(OBJDIR)/%.o: %.cpp | $(OBJDIR)
$(SRC_GENERATED) : $(SRC_PROTOC)
@echo "-- Generating protobuf-based source files"
mkdir -p $(GENERATED_DIR)
protoc --cpp_out=$(GENERATED_DIR) $(SRC_PROTOC)
protoc --cpp_out=$(GENERATED_DIR) --proto_path=../proto $(SRC_PROTOC)
mv $(GENERATED_DIR)/piscsi_interface.pb.cc $@
$(OBJ_GENERATED) : $(SRC_GENERATED) | $(OBJDIR)
+1
View File
@@ -12,6 +12,7 @@ WORKDIR /home/pi/piscsi
COPY --chown=pi:pi easyinstall.sh .
COPY --chown=pi:pi cpp cpp
COPY --chown=pi:pi doc doc
COPY --chown=pi:pi proto proto
RUN ./easyinstall.sh --run_choice=16 --cores=`nproc`
FROM debian:bullseye-slim AS runner
+1 -1
View File
@@ -26,7 +26,7 @@ WORKDIR /home/pi/piscsi
COPY --chown=pi:pi easyinstall.sh .
COPY --chown=pi:pi os_integration os_integration
COPY --chown=pi:pi cpp/piscsi_interface.proto cpp/piscsi_interface.proto
COPY --chown=pi:pi proto proto
COPY --chown=pi:pi python/web python/web
COPY --chown=pi:pi python/common python/common
+2 -2
View File
@@ -3,9 +3,9 @@
if ! [[ -f "/home/pi/piscsi/python/common/src/piscsi_interface_pb2.py" ]]; then
# Build piscsi_interface_pb2.py with the protobuf compiler
protoc \
-I=/home/pi/piscsi/cpp \
--python_out=/home/pi/piscsi/python/common/src \
piscsi_interface.proto
--proto_path=/home/pi/piscsi/proto \
/home/pi/piscsi/proto/piscsi_interface.proto
fi
# Start Nginx service
+2 -3
View File
@@ -57,7 +57,6 @@ elif [ $CORES -lt 1 ]; then
fi
USER=$(whoami)
BASE=$(dirname "$(readlink -f "${0}")")
CPP_PATH="$BASE/cpp"
VIRTUAL_DRIVER_PATH="$HOME/images"
CFG_PATH="$HOME/.config/piscsi"
WEB_INSTALL_PATH="$BASE/python/web"
@@ -161,7 +160,7 @@ function installPackagesWeb() {
# compile the PiSCSI binaries
function compilePiscsi() {
cd "$CPP_PATH" || exit 1
cd "$BASE/cpp" || exit 1
echo "Compiling $CONNECT_TYPE with $COMPILER on $CORES simultaneous cores..."
if [[ $SKIP_MAKE_CLEAN ]]; then
@@ -197,7 +196,7 @@ function preparePythonCommon() {
deleteFile "$PYTHON_COMMON_PATH/src" "$PISCSI_PYTHON_PROTO"
echo "Compiling the Python protobuf library $PISCSI_PYTHON_PROTO..."
protoc -I="$CPP_PATH" --python_out="$PYTHON_COMMON_PATH/src" piscsi_interface.proto
protoc --python_out="$PYTHON_COMMON_PATH/src" --proto_path="$BASE/proto" "$BASE/proto/piscsi_interface.proto"
}
# install everything required to run an HTTP server (Nginx + Python Flask App)