From 55c9b9ceb42ea94ce5ccbc47a1b9ca94d504ffbc Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz Date: Fri, 20 Mar 2026 16:12:00 +0100 Subject: [PATCH 1/6] add error on thrift version mismatch, add rebuild script --- Makefile | 21 ++++++++++- web/api/completly-rebuild-thrift.sh | 58 +++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 web/api/completly-rebuild-thrift.sh diff --git a/Makefile b/Makefile index 697f5da6a6..0849bc7952 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,16 @@ CURRENT_DIR = ${CURDIR} BUILD_DIR ?= $(CURRENT_DIR)/build PYTHON_BIN ?= python3 +API_VERSION := $(shell grep "^api_version" $(CURRENT_DIR)/web/api/py/codechecker_api/setup.py | cut -d"'" -f2) +VENV_API_VERSION := $(shell \ + if [ -f $(CURRENT_DIR)/venv_dev/bin/pip ]; then \ + $(CURRENT_DIR)/venv_dev/bin/pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2; \ + elif [ -f $(CURRENT_DIR)/venv/bin/pip ]; then \ + $(CURRENT_DIR)/venv/bin/pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2; \ + else \ + echo "no venv found"; \ + fi) + CC_BUILD_DIR = $(BUILD_DIR)/CodeChecker CC_BUILD_BIN_DIR = $(CC_BUILD_DIR)/bin CC_BUILD_WEB_DIR = $(CC_BUILD_DIR)/www @@ -41,7 +51,7 @@ mkdocs_build: package_gerrit_skiplist: package_dir_structure cp -p scripts/gerrit_changed_files_to_skipfile.py $(CC_BUILD_BIN_DIR) -package: package_dir_structure set_git_commit_template package_gerrit_skiplist +package: package_dir_structure set_git_commit_template package_gerrit_skiplist check_api_version BUILD_DIR=$(BUILD_DIR) BUILD_LOGGER_64_BIT_ONLY=$(BUILD_LOGGER_64_BIT_ONLY) $(MAKE) -C $(CC_ANALYZER) package_analyzer BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) package_web @@ -245,3 +255,12 @@ test_functional_in_env: set_git_commit_template: if [ -d "$(CURRENT_DIR)/.git" ]; then git config --local commit.template .gitmessage; fi + +check_api_version: + @if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ]; then \ + echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION)"; \ + echo "Please run 'web/api/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ + exit 1; \ + else \ + echo "API versions match: $(API_VERSION)"; \ + fi diff --git a/web/api/completly-rebuild-thrift.sh b/web/api/completly-rebuild-thrift.sh new file mode 100644 index 0000000000..342184d2a7 --- /dev/null +++ b/web/api/completly-rebuild-thrift.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +set -e # Exit on any error + +echo "Starting CodeChecker Thrift rebuild process..." + +# Resolve the repository root from the script's location. +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" + +# check if which enviroment to create is passed as an argument. +if [[ "$1" == "venv" || "$1" == "venv_dev" ]]; then + ENV_TYPE="$1" +else + echo "Error: You must specify 'venv' or 'venv_dev' as the first argument." + echo "Usage: $0 " + exit 1 +fi + +# Step 1: Build the API +echo "Step 1: Building API..." +cd "$REPO_ROOT/web/api" +make build + +# Step 2: Execute the main rebuild process +echo "Step 2: Executing main rebuild..." +cd "$REPO_ROOT" + +# Deactivation of virtual enviroment +echo "Deactivating current environment..." +if command -v deactivate &> /dev/null; then + deactivate 2>/dev/null || true +fi + +# Resetting the package-lock.json just in case +echo "Resetting package-lock.json..." +git checkout master -- "$REPO_ROOT/web/server/vue-cli/package-lock.json" +git reset HEAD "$REPO_ROOT/web/server/vue-cli/package-lock.json" + +# Cleaning +echo "Cleaning previous builds..." +make clean +make "clean_${ENV_TYPE}" + +# Creating new virtual environment +echo "Creating new virtual environment ($ENV_TYPE)..." +make "$ENV_TYPE" + +echo "Building package..." +make package + +# Again just in case +echo "Activating virtual environment and setting PATH..." +source "$REPO_ROOT/${ENV_TYPE}/bin/activate" +export PATH="$REPO_ROOT/build/CodeChecker/bin:$PATH" + +echo "CodeChecker rebuild completed successfully!" +echo "You can now use CodeChecker commands." From e6592032bd752238a03e5f695b3dee29cbee59d9 Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz Date: Fri, 20 Mar 2026 16:32:03 +0100 Subject: [PATCH 2/6] change source of truth to version.py --- Makefile | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0849bc7952..c479578205 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,8 @@ CURRENT_DIR = ${CURDIR} BUILD_DIR ?= $(CURRENT_DIR)/build PYTHON_BIN ?= python3 -API_VERSION := $(shell grep "^api_version" $(CURRENT_DIR)/web/api/py/codechecker_api/setup.py | cut -d"'" -f2) -VENV_API_VERSION := $(shell \ - if [ -f $(CURRENT_DIR)/venv_dev/bin/pip ]; then \ - $(CURRENT_DIR)/venv_dev/bin/pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2; \ - elif [ -f $(CURRENT_DIR)/venv/bin/pip ]; then \ - $(CURRENT_DIR)/venv/bin/pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2; \ - else \ - echo "no venv found"; \ - fi) +API_VERSION := $(shell python3 -c "exec(open('$(CURRENT_DIR)/web/codechecker_web/shared/version.py').read()); print(f'{max(SUPPORTED_VERSIONS)}.{SUPPORTED_VERSIONS[max(SUPPORTED_VERSIONS)]}.0')") +VENV_API_VERSION := $(shell pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2) CC_BUILD_DIR = $(BUILD_DIR)/CodeChecker CC_BUILD_BIN_DIR = $(CC_BUILD_DIR)/bin From ce701b749fc643147f763050a21019efd3afa0d1 Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz Date: Thu, 26 Mar 2026 10:37:14 +0100 Subject: [PATCH 3/6] fix wrong script calling prompt --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c479578205..81df9cd90a 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ set_git_commit_template: check_api_version: @if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ]; then \ echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION)"; \ - echo "Please run 'web/api/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ + echo "Please run './web/api/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ exit 1; \ else \ echo "API versions match: $(API_VERSION)"; \ From 53cfd7587fea9c2dc3b48f891cd6a719a0912005 Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz <113597150+feyruzb@users.noreply.github.com> Date: Tue, 7 Apr 2026 14:18:08 +0200 Subject: [PATCH 4/6] fix: move script to appropriate locaiton --- Makefile | 2 +- {web/api => scripts/thrift}/completly-rebuild-thrift.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {web/api => scripts/thrift}/completly-rebuild-thrift.sh (100%) diff --git a/Makefile b/Makefile index 81df9cd90a..8649b86eb4 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ set_git_commit_template: check_api_version: @if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ]; then \ echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION)"; \ - echo "Please run './web/api/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ + echo "Please run './scripts/thrift/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ exit 1; \ else \ echo "API versions match: $(API_VERSION)"; \ diff --git a/web/api/completly-rebuild-thrift.sh b/scripts/thrift/completly-rebuild-thrift.sh similarity index 100% rename from web/api/completly-rebuild-thrift.sh rename to scripts/thrift/completly-rebuild-thrift.sh From f2bc11dcb91589f0f0282b3c5ab8fec81cd733b2 Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz <113597150+feyruzb@users.noreply.github.com> Date: Tue, 7 Apr 2026 15:49:59 +0200 Subject: [PATCH 5/6] fix: add another source of api comparison, remove build of package --- Makefile | 5 +++-- scripts/thrift/completly-rebuild-thrift.sh | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 100644 => 100755 scripts/thrift/completly-rebuild-thrift.sh diff --git a/Makefile b/Makefile index 8649b86eb4..b0d8c78817 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ PYTHON_BIN ?= python3 API_VERSION := $(shell python3 -c "exec(open('$(CURRENT_DIR)/web/codechecker_web/shared/version.py').read()); print(f'{max(SUPPORTED_VERSIONS)}.{SUPPORTED_VERSIONS[max(SUPPORTED_VERSIONS)]}.0')") VENV_API_VERSION := $(shell pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2) +PACKAGE_JSON_VERSION := $(shell python3 -c "exec(open('$(CURRENT_DIR)/web/api/js/codechecker-api-node/package.json').read()); print(__import__('json').loads(open('$(CURRENT_DIR)/web/api/js/codechecker-api-node/package.json').read())['version'])") CC_BUILD_DIR = $(BUILD_DIR)/CodeChecker CC_BUILD_BIN_DIR = $(CC_BUILD_DIR)/bin @@ -250,8 +251,8 @@ set_git_commit_template: if [ -d "$(CURRENT_DIR)/.git" ]; then git config --local commit.template .gitmessage; fi check_api_version: - @if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ]; then \ - echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION)"; \ + @if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ] || [ "$(API_VERSION)" != "$(PACKAGE_JSON_VERSION)" ]; then \ + echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION), package.json: $(PACKAGE_JSON_VERSION)"; \ echo "Please run './scripts/thrift/completly-rebuild-thrift.sh ' to rebuild the Thrift API."; \ exit 1; \ else \ diff --git a/scripts/thrift/completly-rebuild-thrift.sh b/scripts/thrift/completly-rebuild-thrift.sh old mode 100644 new mode 100755 index 342184d2a7..8a7b4f0065 --- a/scripts/thrift/completly-rebuild-thrift.sh +++ b/scripts/thrift/completly-rebuild-thrift.sh @@ -46,9 +46,6 @@ make "clean_${ENV_TYPE}" echo "Creating new virtual environment ($ENV_TYPE)..." make "$ENV_TYPE" -echo "Building package..." -make package - # Again just in case echo "Activating virtual environment and setting PATH..." source "$REPO_ROOT/${ENV_TYPE}/bin/activate" From 53e10aa0141a99df92e0ebce73115cb8a6db44cd Mon Sep 17 00:00:00 2001 From: Baghirov Feyruz <113597150+feyruzb@users.noreply.github.com> Date: Tue, 7 Apr 2026 17:57:57 +0200 Subject: [PATCH 6/6] chore: add .sh to pylint ignore-patterns --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 41e217477a..9465843dee 100644 --- a/.pylintrc +++ b/.pylintrc @@ -57,7 +57,7 @@ ignore-paths= # Files or directories matching the regular expression patterns are skipped. # The regex matches against base names, not paths. The default value ignores # Emacs file locks -ignore-patterns=^\.# +ignore-patterns=^\.#,.*\.sh$ # List of module names for which member attributes should not be checked and # will not be imported (useful for modules/projects where namespaces are