Skip to content

Makefile: track version using p-r-project VERSION file#782

Draft
oI0ck wants to merge 1 commit into
masterfrom
michal.lach/next_version_tag
Draft

Makefile: track version using p-r-project VERSION file#782
oI0ck wants to merge 1 commit into
masterfrom
michal.lach/next_version_tag

Conversation

@oI0ck
Copy link
Copy Markdown
Member

@oI0ck oI0ck commented May 18, 2026

JIRA: RTOS-1318

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the versioning logic in the Makefile by replacing complex git description parsing with a short git hash and reading the release version from an external file. Feedback identifies a shell syntax error in the dummy revision string, suggests handling missing version files to prevent build noise, and recommends restoring the 'dirty' tree flag to aid in debugging kernel issues.

Comment thread Makefile
VERSION := $(VERSION)\ $(word 4,$(DESC))
endif
RELEASE := $(subst v,,$(word 1,$(DESC)))
DUMMY_REVISION := \"(unknown)\"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The escaped quotes in DUMMY_REVISION will cause a shell syntax error when the fallback echo "$(DUMMY_REVISION)" is executed (e.g., echo ""(unknown)"" results in bash: syntax error near unexpected token '('). Additionally, since VERSION is wrapped in escaped quotes in CPPFLAGS (line 23), this would lead to incorrect double-quoting in the C macro definition (e.g., ""(unknown)"") compared to the git-based version which lacks internal quotes.

DUMMY_REVISION := (unknown)

Comment thread Makefile
endif
RELEASE := $(subst v,,$(word 1,$(DESC)))
DUMMY_REVISION := \"(unknown)\"
RELEASE := $(shell cat ../VERSION)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Reading ../VERSION directly will produce an error message on stderr if the file is missing (e.g., in standalone builds or non-standard directory structures). It is better to suppress this error and provide a sensible default value to ensure the build output remains clean.

RELEASE := $(shell cat ../VERSION 2>/dev/null || echo "unknown")

Comment thread Makefile
RELEASE := $(subst v,,$(word 1,$(DESC)))
DUMMY_REVISION := \"(unknown)\"
RELEASE := $(shell cat ../VERSION)
GIT_REVISION := $(shell git rev-parse --short HEAD || echo "$(DUMMY_REVISION)")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The change from git describe --dirty to git rev-parse --short HEAD loses the information about whether the build was performed on a dirty git tree. This information is often crucial for debugging kernel issues. Using git describe --always --dirty allows you to keep the dirty flag while still falling back to the hash if no tags are present.

GIT_REVISION := $(shell git describe --always --dirty --abbrev=8 2>/dev/null || echo "$(DUMMY_REVISION)")

@oI0ck oI0ck requested review from Darchiv, agkaminski and nalajcie and removed request for Darchiv, agkaminski and nalajcie May 18, 2026 13:41
@oI0ck oI0ck marked this pull request as draft May 18, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant