Skip to content

Commit

Permalink
Copy over .git folder to make both pre-commit and git describe work
Browse files Browse the repository at this point in the history
git describe needed to build the VitePress documentation.

Ideally we would only include a shallow copy in the Debian package and the gisnav container but currently we copy over the entire .git folder
  • Loading branch information
hmakelin committed Aug 8, 2024
1 parent 12fa60d commit fa3281e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 9 additions & 5 deletions debian/gisnav/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ $(BUILD_DIR)/etc/systemd:
@mkdir -p $@
@cp -r etc/systemd/ $@

# We need to copy .git to make git describe work for the docs (docs are built
# with git version string). pre-commit might also need the .git folder.
# TODO: only copy over a shallow copy of git repo - we do not need entire history
# nor all branches
$(BUILD_DIR)/etc/gisnav: $(BUILD_DIR)/etc/gisnav/ros $(BUILD_DIR)/etc/gisnav/docker $(BUILD_DIR)/etc/gisnav/docs
@dest=debian/gisnav/$@ && \
mkdir -p $@ && \
touch $(BUILD_DIR)/COLCON_IGNORE && \
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml $$dest
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml .git $$dest

$(BUILD_DIR)/etc/gisnav/ros:
@dest=debian/gisnav/$@ && \
Expand All @@ -97,8 +101,8 @@ $(BUILD_DIR)/etc/gisnav/docker:
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' docker/ $$dest
@echo -e "\033[1;33;40mWarning! Check the file list above that no unintended files were copied over to the distributable.\033[0m"

# TODO package.json needed for gisnav image build to go through - try to
# refactor it out (need better defined gisnav image)
$(BUILD_DIR)/etc/gisnav/docs:
@mkdir -p $@/vitepress
@echo "{}" > $@/vitepress/package.json
@dest=debian/gisnav/$@ && \
mkdir -p $@ && \
touch $(BUILD_DIR)/COLCON_IGNORE && \
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' docs/ $$dest
6 changes: 4 additions & 2 deletions docker/mavros/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | b

COPY Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml /opt/colcon_ws/src/gisnav/

# .git needed to make pre-commit work -> initialize a blank repo
RUN git init
# .git needed to make pre-commit and git describe work
# TODO: solve this in a better way - we have an unnecessarily large git
# history in the container
COPY .git /opt/colcon_ws/src/gisnav/.git

ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit fa3281e

Please sign in to comment.