mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-06 02:52:47 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Refactoring ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description In this pull request, update the Makefile.versions and scripts/generate_extension_version.sh to avoid build failures when using a tarball from tags. In release tarball there is no .git/index file, so we need to check if the file exists before using it. If the file does not exist, we will set some variables to unknown and use the version from the control file. ---- #### AI description (iteration 1) #### PR Classification Bug fix to avoid build failure with tarball from tags. #### PR Summary This pull request updates the build scripts to handle cases where the build is performed from a tarball without a Git repository. - `oss/scripts/generate_extension_version.sh`: Added checks to handle builds outside a Git repository by using version information from a control file. - `oss/Makefile.versions`: Modified to pass the Git index directory to the version generation script and removed dependency on the Git index file. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
18 lines
670 B
Makefile
18 lines
670 B
Makefile
INSIDE_GIT_REPO = $(shell git rev-parse --is-inside-work-tree 2>/dev/null || echo "false")
|
|
|
|
ifeq ($(INSIDE_GIT_REPO), false)
|
|
GIT_INDEX_DIR_VALUE :=
|
|
else
|
|
GIT_INDEX_DIR_VALUE := $(shell git rev-parse --git-dir)
|
|
endif
|
|
|
|
ifeq (, $(GIT_INDEX_DIR_VALUE))
|
|
GIT_INDEX_FILE =
|
|
else
|
|
GIT_INDEX_FILE = $(GIT_INDEX_DIR_VALUE)/index
|
|
endif
|
|
|
|
build/include/metadata/$(EXTENSION_OBJECT_PREFIX)_extension_version.h: $(version_file_inputs) $(GIT_INDEX_FILE)
|
|
mkdir -p build/include/metadata
|
|
$(BUILD_SCRIPT_DIR)scripts/generate_extension_version.sh build/include/metadata/$(EXTENSION_OBJECT_PREFIX)_extension_version.h $(EXTENSION) $(MODULE_big) $(GIT_INDEX_FILE) || exit 1
|