Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
23777aa
temp save
mbykhovtsev-ms Jan 20, 2026
f10faba
Merge remote-tracking branch 'origin/3.0-dev' into mbykhovtsev/modify…
mbykhovtsev-ms Jan 20, 2026
f5bb9a8
use chroot enviroment instead of modifying specs directly
mbykhovtsev-ms Jan 22, 2026
c1661e2
pass down macro files to the rest of the build flow
mbykhovtsev-ms Jan 22, 2026
a8108f0
create large macro file of all the specs instead
mbykhovtsev-ms Jan 26, 2026
5e5351b
fixing the spec
mbykhovtsev-ms Jan 26, 2026
cfeb421
renaming tool from kernel to generic
mbykhovtsev-ms Jan 26, 2026
9352633
missed renaming
mbykhovtsev-ms Jan 26, 2026
944a67d
missed renaming
mbykhovtsev-ms Jan 26, 2026
6a1e2c1
allow adding extra macro files
mbykhovtsev-ms Jan 26, 2026
432266e
update comment
mbykhovtsev-ms Jan 26, 2026
8227663
make sure we package the macros file
mbykhovtsev-ms Jan 26, 2026
295a5ba
renaming
mbykhovtsev-ms Jan 26, 2026
df0b9e6
move the copy command
mbykhovtsev-ms Jan 26, 2026
2814687
finish renaming the files
mbykhovtsev-ms Jan 26, 2026
3b55211
remove unused var
mbykhovtsev-ms Jan 26, 2026
c948fb9
parse version files within a chroot environment
mbykhovtsev-ms Jan 26, 2026
e5f6989
fix processing of release
mbykhovtsev-ms Jan 26, 2026
d66402e
fix spec
mbykhovtsev-ms Jan 26, 2026
f19cda1
officially modify spec and make a changelog entry
mbykhovtsev-ms Jan 26, 2026
7a30b7f
Merge branch '3.0-dev' into mbykhovtsev/kernel-macros-file
mbykhovtsev-ms Jan 27, 2026
41bb870
add comment for the naming convention
mbykhovtsev-ms Jan 27, 2026
0e1dfe3
Merge branch '3.0-dev' of https://github.com/microsoft/CBL-Mariner in…
mbykhovtsev-ms Jan 28, 2026
52a6d00
create new target to just generate macros file, use it during validat…
mbykhovtsev-ms Jan 28, 2026
66eb8d6
make sure to run command within the toolkit dir
mbykhovtsev-ms Jan 28, 2026
2b38194
move generating the macros file to the check
mbykhovtsev-ms Jan 28, 2026
667a29d
set rebuild tools
mbykhovtsev-ms Jan 28, 2026
e7e51da
build macros files outside
mbykhovtsev-ms Jan 28, 2026
d21204a
try different path for the macros file
mbykhovtsev-ms Jan 28, 2026
c5ce02f
try finding the macros file
mbykhovtsev-ms Jan 28, 2026
c674759
fixing indentation
mbykhovtsev-ms Jan 28, 2026
29d14ea
tweak info log to not output too much information
mbykhovtsev-ms Jan 28, 2026
66bbdfe
make sure entagled check cat use macros file
mbykhovtsev-ms Jan 28, 2026
81bd406
tweak tangled specs script to use rpmspec instead of pyrpm
mbykhovtsev-ms Jan 28, 2026
895d5f1
update requirements
mbykhovtsev-ms Jan 28, 2026
4b89e49
remove dep
mbykhovtsev-ms Jan 28, 2026
38eb3b2
drop the --parse
mbykhovtsev-ms Jan 28, 2026
dd395a4
revert back to use pyrpm
mbykhovtsev-ms Jan 28, 2026
99c603c
ignore errors?
mbykhovtsev-ms Jan 28, 2026
09a5adb
handle regular defines, not only global
mbykhovtsev-ms Jan 28, 2026
de6682b
debug statement
mbykhovtsev-ms Jan 29, 2026
1ebad82
fix number of values to unpack
mbykhovtsev-ms Jan 29, 2026
4c52fbf
Merge branch '3.0-dev' of https://github.com/microsoft/CBL-Mariner in…
mbykhovtsev-ms Jan 29, 2026
3d6a74a
remove wrong line
mbykhovtsev-ms Jan 29, 2026
4d9a73e
stop toolchain packing from using macros file
mbykhovtsev-ms Jan 29, 2026
b3150b0
remove unused deps
mbykhovtsev-ms Jan 29, 2026
f400d13
tweak target deps again
mbykhovtsev-ms Jan 29, 2026
5ed5609
fix source reference
mbykhovtsev-ms Jan 30, 2026
d65240c
modify signed isert-hwe as well
mbykhovtsev-ms Jan 30, 2026
42ded23
make sure the macro file is included
mbykhovtsev-ms Feb 2, 2026
460a91a
Merge branch '3.0-dev' of https://github.com/microsoft/CBL-Mariner in…
mbykhovtsev-ms Feb 2, 2026
9490339
remove the target
mbykhovtsev-ms Feb 2, 2026
0105cc9
modify iser-hwe to use new versioning
mbykhovtsev-ms Feb 2, 2026
134f24b
modify mft_kernel_hwe to use new versioning
mbykhovtsev-ms Feb 2, 2026
41b86e5
modify knem-hwe and sign to use dynamic versioning
mbykhovtsev-ms Feb 2, 2026
576d0be
modify srp-hwe to use dynamic kernel versioning
mbykhovtsev-ms Feb 2, 2026
8ed9853
fix srp
mbykhovtsev-ms Feb 2, 2026
d9e86a9
modify mlnx-nfsrdma to use dynamic kernel versioning
mbykhovtsev-ms Feb 2, 2026
f78053c
modif mlnx-ofa to use dynamic kernel versioning
mbykhovtsev-ms Feb 2, 2026
1037f7c
fix the signed mlnx-nfsrdma
mbykhovtsev-ms Feb 2, 2026
be79d6d
modify xpmem to use kernel dynamic versioning
mbykhovtsev-ms Feb 2, 2026
49f01fb
not forget missing versions
mbykhovtsev-ms Feb 2, 2026
3702885
fix remaining missing signed specs
mbykhovtsev-ms Feb 2, 2026
e78d029
remove bug's comment
mbykhovtsev-ms Feb 2, 2026
1e275c7
Merge branch '3.0-dev' of https://github.com/microsoft/CBL-Mariner in…
mbykhovtsev-ms Feb 6, 2026
f877afb
don't package macros.releaseversions into the toolkit
mbykhovtsev-ms Feb 10, 2026
c877741
Merge branch 'mbykhovtsev/kernel-macros-file' of github.com:microsoft…
mbykhovtsev-ms Feb 10, 2026
a6a7a71
Merge branch '3.0-dev' of github.com:microsoft/azurelinux into mbykho…
mbykhovtsev-ms Feb 10, 2026
99943d9
revert the entagled changes
mbykhovtsev-ms Feb 10, 2026
911b1b8
revert back generating macros file for check entangled specs
mbykhovtsev-ms Feb 10, 2026
684172b
Merge branch '3.0-dev' of github.com:microsoft/azurelinux into kernel…
mbykhovtsev-ms Feb 19, 2026
0daa5eb
fix the date
mbykhovtsev-ms Feb 19, 2026
d4644d1
update to PR's feedback
mbykhovtsev-ms Feb 20, 2026
56f7a12
adjusting to more pr's feedback
mbykhovtsev-ms Feb 20, 2026
3f038cf
renaming input
mbykhovtsev-ms Feb 20, 2026
d7d83c4
renaming
mbykhovtsev-ms Feb 20, 2026
274df4a
pass the macros file to other places that might use it
mbykhovtsev-ms Feb 20, 2026
044adaf
make public function
mbykhovtsev-ms Feb 20, 2026
4677b8f
update regular specs to also use the new mechanism
mbykhovtsev-ms Feb 20, 2026
dfdc340
Merge branch '3.0-dev' of github.com:microsoft/azurelinux into kernel…
mbykhovtsev-ms Feb 21, 2026
97bf04d
Merge branch '3.0-dev' of github.com:microsoft/azurelinux into kernel…
mbykhovtsev-ms Feb 23, 2026
0119042
fix mlnx-ofa_kernel
mbykhovtsev-ms Feb 23, 2026
478ece9
use the right kernel package for the version and mlnx
mbykhovtsev-ms Feb 24, 2026
696301a
update the PR checks
mbykhovtsev-ms Feb 24, 2026
c79a3fd
add more documentation
mbykhovtsev-ms Feb 24, 2026
4314c17
refactor by splitting up the main function into subfunctions
mbykhovtsev-ms Feb 24, 2026
4d1aec8
make sure to shift again
mbykhovtsev-ms Feb 24, 2026
d9e0bd0
add unit tests to versionsprocessor and split it a bit more
mbykhovtsev-ms Feb 26, 2026
b835db9
misc tweaks
mbykhovtsev-ms Feb 26, 2026
055369b
Remove SPECS and SPECS-SIGNED changes (moved to mbykhovtsev/kernel-ma…
mbykhovtsev-ms Feb 27, 2026
ef9ca66
Remove .github/workflows changes (moved to mbykhovtsev/kernel-macros-…
mbykhovtsev-ms Feb 27, 2026
69e7bc8
fix the assertions
mbykhovtsev-ms Feb 27, 2026
e8e4a10
adjusting to PR's feedback
mbykhovtsev-ms Mar 3, 2026
4711adc
more tweaks
mbykhovtsev-ms Mar 3, 2026
dba804c
fix formatting
mbykhovtsev-ms Mar 3, 2026
45a96fa
adjust to PRs feedback
mbykhovtsev-ms Mar 4, 2026
4a39863
add as build dep
mbykhovtsev-ms Mar 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion toolkit/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TEST_RUN_LIST ?=
TEST_RERUN_LIST ?=
##help:var:TEST_IGNORE_LIST:<spec_list>=List of space-separated spec folders to ignore for package tests. Must not overlap with "TEST_RERUN_LIST", may overlap with "TEST_RUN_LIST". Example: TEST_IGNORE_LIST="acl".
TEST_IGNORE_LIST ?=
##help:var:EXTRA_MACROS_FILES:<file1> <file2>=Space separated list of additional files whose contents will be appended to the versions macro file used during package builds. Example: EXTRA_MACROS_FILES="file1 file2".
EXTRA_MACROS_FILES ?=
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you also add docs for this argument into toolkit/docs/building/building.md?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added

Comment thread
mbykhovtsev-ms marked this conversation as resolved.

######## SET INCREMENTAL BUILD FLAGS ########

Expand Down Expand Up @@ -168,7 +170,7 @@ endif
VALIDATE_IMAGE_GPG ?= n

# Default GPG keys for package GPG validation, used with VALIDATE_TOOLCHAIN_GPG and VALIDATE_IMAGE_GPG
default_gpg_keys := $(wildcard $(PROJECT_ROOT)/SPECS/azurelinux-repos/MICROSOFT-*-GPG-KEY) $(wildcard $(toolkit_root)/repos/MICROSOFT-*-GPG-KEY)
default_gpg_keys := $(strip $(wildcard $(PROJECT_ROOT)/SPECS/azurelinux-repos/MICROSOFT-*-GPG-KEY) $(wildcard $(toolkit_root)/repos/MICROSOFT-*-GPG-KEY))
Comment thread
mbykhovtsev-ms marked this conversation as resolved.
TOOLCHAIN_GPG_VALIDATION_KEYS ?= $(default_gpg_keys)
IMAGE_GPG_VALIDATION_KEYS ?= $(default_gpg_keys)

Expand Down
1 change: 1 addition & 0 deletions toolkit/docs/building/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ To reproduce an ISO build, run the same make invocation as before, but set:
| TEST_RUN_LIST | | Explicit list of packages to test. The package test will be skipped if the build system thinks it is already up-to-date. The argument accepts both spec and package names. Example: for `python-werkzeug.spec`, which builds the `python3-werkzeug` package both `python-werkzeug` and `python3-werkzeug` are correct.
| TEST_RERUN_LIST | | Always test these package, even if it its corresponding package is up-to-date. The argument accepts both spec and package names. Example: for `python-werkzeug.spec`, which builds the `python3-werkzeug` package both `python-werkzeug` and `python3-werkzeug` are correct.
| TEST_IGNORE_LIST | | Ignore testing these packages. Ignoring and forcing the same test re-run is invalid and will fail the build. The argument accepts both spec and package names. Example: for `python-werkzeug.spec`, which builds the `python3-werkzeug` package both `python-werkzeug` and `python3-werkzeug` are correct.
| EXTRA_MACROS_FILES | | Space separated list of additional `<macros.name>` containing additional RPM macros, which will be available to the build. Used to resolve versions of kernel Out of Tree Module packages.

---

Expand Down
4 changes: 4 additions & 0 deletions toolkit/docs/how_it_works/3_package_building.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ The files can be ingested into the `graphviz` tools to visualize them, although
dot -Tpng -o visualized.png < graph.dot
```

### Dynamic versioning
We have a versionsprocessor tool that iterates over all Specs and writes their release and versions into a macro file in a format of
`azl_<package_name>_release`, `azl_<package_name>_version`, note that the `<package_name>` needs any `-` replaced with `_` due to macros not allowing `-`.

### Stage 1: Grapher

The `grapher` tool reads the `specs.json` file and converts it into an acyclic directed graph. Inter-package dependencies are represented by directed edges in the graph.
Expand Down
28 changes: 26 additions & 2 deletions toolkit/scripts/pkggen.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ validate-pkggen-config = $(STATUS_FLAGS_DIR)/validate-image-config-pkggen.flag

# Outputs
specs_file = $(PKGBUILD_DIR)/specs.json
rel_versions_macro_file = $(PKGBUILD_DIR)/macros.releaseversions
graph_file = $(PKGBUILD_DIR)/graph.dot
cached_file = $(PKGBUILD_DIR)/cached_graph.dot
preprocessed_file = $(PKGBUILD_DIR)/preprocessed_graph.dot
Expand All @@ -50,6 +51,8 @@ $(call create_folder,$(rpmbuilding_logs_dir))
parse-specs: $(specs_file)
##help:target:graph-cache=Resolve package dependencies and cache the results.
graph-cache: $(cached_file)
##help:target:generate-versions-macros-file=Generate a macros file containing version and release macros for all specs.
generate-versions-macros-file: $(rel_versions_macro_file)
##help:target:graph=Create the initial package build graph.
workplan graph: $(graph_file)
graph-preprocessed: $(preprocessed_file)
Expand Down Expand Up @@ -89,10 +92,29 @@ analyze-built-graph: $(go-graphanalytics)
exit 1; \
fi

# Parse all SPECS in $(SPECS_DIR) and generate a release versions macros file containing macros of spec file versions and release.
$(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-versionsprocessor)
$(go-versionsprocessor) \
--dir $(SPECS_DIR) \
--dist-tag $(DIST_TAG) \
$(logging_command) \
--build-dir $(parse_working_dir) \
--worker-tar $(chroot_worker) \
--cpu-prof-file=$(PROFILE_DIR)/versionsprocessor.cpu.pprof \
--mem-prof-file=$(PROFILE_DIR)/versionsprocessor.mem.pprof \
--trace-file=$(PROFILE_DIR)/versionsprocessor.trace \
$(if $(EXTRA_MACROS_FILES),$(foreach file,$(EXTRA_MACROS_FILES),--extra-macros-file=$(file))) \
$(if $(filter y,$(ENABLE_CPU_PROFILE)),--enable-cpu-prof) \
$(if $(filter y,$(ENABLE_MEM_PROFILE)),--enable-mem-prof) \
$(if $(filter y,$(ENABLE_TRACE)),--enable-trace) \
--timestamp-file=$(TIMESTAMP_DIR)/versionsprocessor.jsonl \
$(if $(TARGET_ARCH),--target-arch="$(TARGET_ARCH)") \
--output $@

# Parse specs in $(SPECS_DIR) and generate a specs.json file encoding all dependency information
# We look at the same pack list as the srpmpacker tool via the target $(SRPM_PACK_LIST) if it is set.
# We only parse the spec files we will actually pack.
$(specs_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-specreader) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK)
$(specs_file): $(rel_versions_macro_file) $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-specreader) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK)
$(go-specreader) \
--dir $(SPECS_DIR) \
$(if $(SRPM_PACK_LIST),--spec-list="$(SRPM_PACK_LIST)") \
Expand All @@ -103,6 +125,7 @@ $(specs_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $
--toolchain-rpms-dir="$(TOOLCHAIN_RPMS_DIR)" \
--dist-tag $(DIST_TAG) \
--worker-tar $(chroot_worker) \
--versions-macro-file $(rel_versions_macro_file) \
$(if $(filter y,$(RUN_CHECK)),--run-check) \
$(logging_command) \
--cpu-prof-file=$(PROFILE_DIR)/specreader.cpu.pprof \
Expand Down Expand Up @@ -297,7 +320,7 @@ $(RPMS_DIR):
@touch $@
endif

$(STATUS_FLAGS_DIR)/build-rpms.flag: $(no_repo_acl) $(preprocessed_file) $(chroot_worker) $(go-scheduler) $(go-pkgworker) $(depend_STOP_ON_PKG_FAIL) $(CONFIG_FILE) $(depend_CONFIG_FILE) $(depend_PACKAGE_BUILD_LIST) $(depend_PACKAGE_REBUILD_LIST) $(depend_PACKAGE_IGNORE_LIST) $(depend_MAX_CASCADING_REBUILDS) $(depend_TEST_RUN_LIST) $(depend_TEST_RERUN_LIST) $(depend_TEST_IGNORE_LIST) $(pkggen_rpms) $(srpms) $(BUILD_SRPMS_DIR) $(depend_EXTRA_BUILD_LAYERS) $(depend_LICENSE_CHECK_MODE)
$(STATUS_FLAGS_DIR)/build-rpms.flag: $(rel_versions_macro_file) $(no_repo_acl) $(preprocessed_file) $(chroot_worker) $(go-scheduler) $(go-pkgworker) $(depend_STOP_ON_PKG_FAIL) $(CONFIG_FILE) $(depend_CONFIG_FILE) $(depend_PACKAGE_BUILD_LIST) $(depend_PACKAGE_REBUILD_LIST) $(depend_PACKAGE_IGNORE_LIST) $(depend_MAX_CASCADING_REBUILDS) $(depend_TEST_RUN_LIST) $(depend_TEST_RERUN_LIST) $(depend_TEST_IGNORE_LIST) $(pkggen_rpms) $(srpms) $(BUILD_SRPMS_DIR) $(depend_EXTRA_BUILD_LAYERS) $(depend_LICENSE_CHECK_MODE)
$(go-scheduler) \
--input="$(preprocessed_file)" \
--output="$(built_file)" \
Expand All @@ -315,6 +338,7 @@ $(STATUS_FLAGS_DIR)/build-rpms.flag: $(no_repo_acl) $(preprocessed_file) $(chroo
--distro-release-version="$(RELEASE_VERSION)" \
--distro-build-number="$(BUILD_NUMBER)" \
--rpmmacros-file="$(TOOLCHAIN_MANIFESTS_DIR)/macros.override" \
--versions-macro-file="$(rel_versions_macro_file)" \
--build-attempts="$$(($(PACKAGE_BUILD_RETRIES)+1))" \
--check-attempts="$$(($(CHECK_BUILD_RETRIES)+1))" \
$(if $(MAX_CASCADING_REBUILDS),--max-cascading-rebuilds="$(MAX_CASCADING_REBUILDS)") \
Expand Down
9 changes: 5 additions & 4 deletions toolkit/scripts/srpm_pack.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# update - Check signatures and updating any mismatches in the signatures file
SRPM_FILE_SIGNATURE_HANDLING ?= enforce

SRPM_BUILD_CHROOT_DIR = $(BUILD_DIR)/SRPM_packaging
SRPM_BUILD_LOGS_DIR = $(LOGS_DIR)/pkggen/srpms

SRPM_BUILD_CHROOT_DIR = $(BUILD_DIR)/SRPM_packaging
SRPM_BUILD_LOGS_DIR = $(LOGS_DIR)/pkggen/srpms
rel_versions_macro_file = $(PKGBUILD_DIR)/macros.releaseversions
# Configure the list of packages we want to process into SRPMs
# Strip any whitespace from user input and reasign using override so we can compare it with the empty string
override SRPM_PACK_LIST := $(strip $(SRPM_PACK_LIST))
Expand Down Expand Up @@ -77,7 +77,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(local_specs) $(local_spec_dirs) $(local_
$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(STATUS_FLAGS_DIR)/build_srpms.flag
@touch $@
else
$(STATUS_FLAGS_DIR)/build_srpms.flag: $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) $(go-srpmpacker) $(depend_SRPM_PACK_LIST) $(local_spec_sources)
$(STATUS_FLAGS_DIR)/build_srpms.flag: $(rel_versions_macro_file) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) $(go-srpmpacker) $(depend_SRPM_PACK_LIST) $(local_spec_sources)
GODEBUG=netdns=go $(go-srpmpacker) \
--dir=$(SPECS_DIR) \
--output-dir=$(BUILD_SRPMS_DIR) \
Expand All @@ -88,6 +88,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(chroot_worker) $(local_specs) $(local_sp
--tls-cert=$(TLS_CERT) \
--tls-key=$(TLS_KEY) \
--build-dir=$(SRPM_BUILD_CHROOT_DIR) \
--versions-macro-file=$(rel_versions_macro_file) \
--signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \
--worker-tar=$(chroot_worker) \
$(if $(filter y,$(RUN_CHECK)),--run-check) \
Expand Down
10 changes: 7 additions & 3 deletions toolkit/scripts/toolkit.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ rpms_snapshot_dir_name = rpms_snapshots
rpms_snapshot_build_dir = $(BUILD_DIR)/$(rpms_snapshot_dir_name)
rpms_snapshot_logs_path = $(LOGS_DIR)/$(rpms_snapshot_dir_name)/rpms_snapshot.log
rpms_snapshot_per_specs = $(rpms_snapshot_build_dir)/$(specs_dir_name)_$(rpms_snapshot_name)
rel_versions_macro_file = $(PKGBUILD_DIR)/macros.releaseversions
Comment thread
mbykhovtsev-ms marked this conversation as resolved.

valid_arch_spec_names_build_dir = $(BUILD_DIR)/valid_arch_spec_names
valid_arch_spec_names = $(valid_arch_spec_names_build_dir)/valid_arch_spec_names.txt
Expand Down Expand Up @@ -75,14 +76,15 @@ $(toolkit_archive_versioned_compressed): $(toolkit_archive) $(rpms_snapshot) $(d
tar --update -f $(toolkit_archive_versioned) -C $(toolkit_build_dir) $(toolkit_release_file_relative_path) $(toolkit_rpms_snapshot_file_relative_path) && \
$(ARCHIVE_TOOL) --best -c $(toolkit_archive_versioned) > $(toolkit_archive_versioned_compressed)

$(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_component_extra_files) $(toolkit_root_files)
$(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_component_extra_files) $(toolkit_root_files) $(rel_versions_macro_file)
rm -rf $(toolkit_prep_dir) && \
mkdir -p $(toolkit_prep_dir) && \
mkdir -p $(toolkit_repos_dir) && \
mkdir -p $(toolkit_tools_dir) && \
cp -r $(toolkit_root_files) $(toolkit_prep_dir) && \
cp $(mariner_repos_files) $(toolkit_repos_dir) && \
cp $(toolkit_component_extra_files) $(toolkit_prep_dir) && \
cp $(rel_versions_macro_file) $(toolkit_prep_dir) && \
Comment thread
mbykhovtsev-ms marked this conversation as resolved.
cp $(go_tool_targets) $(toolkit_tools_dir) && \
rm -rf $(toolkit_prep_dir)/out && \
tar -cvp -f $(toolkit_archive) -C $(dir $(toolkit_prep_dir)) $(notdir $(toolkit_prep_dir))
Expand All @@ -93,12 +95,13 @@ rpms-snapshot: $(rpms_snapshot)
$(rpms_snapshot): $(rpms_snapshot_per_specs) $(depend_SPECS_DIR)
cp $(rpms_snapshot_per_specs) $(rpms_snapshot)

$(rpms_snapshot_per_specs): $(go-rpmssnapshot) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR)
$(rpms_snapshot_per_specs): $(go-rpmssnapshot) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) $(rel_versions_macro_file)
@mkdir -p "$(rpms_snapshot_build_dir)"
$(go-rpmssnapshot) \
--input="$(SPECS_DIR)" \
--output="$(rpms_snapshot_per_specs)" \
--build-dir="$(rpms_snapshot_build_dir)" \
--versions-macro-file $(rel_versions_macro_file) \
--dist-tag=$(DIST_TAG) \
--worker-tar="$(chroot_worker)" \
--log-level=$(LOG_LEVEL) \
Expand All @@ -114,13 +117,14 @@ run-specarchchecker: $(valid_arch_spec_names)
@cat $(valid_arch_spec_names) && echo "" # File doesn't have a newline at the end, so add one via echo.
@echo "Valid arch spec names generated under '$(valid_arch_spec_names)'."

$(valid_arch_spec_names): $(go-specarchchecker) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) $(depend_PACKAGE_BUILD_LIST) $(depend_PACKAGE_REBUILD_LIST)
$(valid_arch_spec_names): $(go-specarchchecker) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) $(depend_PACKAGE_BUILD_LIST) $(depend_PACKAGE_REBUILD_LIST) $(rel_versions_macro_file)
$(go-specarchchecker) \
--input="$(SPECS_DIR)" \
--output="$@" \
--packages="$(PACKAGE_BUILD_LIST)" \
--rebuild-packages="$(PACKAGE_REBUILD_LIST)" \
--build-dir="$(valid_arch_spec_names_build_dir)" \
--versions-macro-file $(rel_versions_macro_file) \
$(if $(filter y,$(RUN_CHECK)),--test-only) \
--dist-tag=$(DIST_TAG) \
--worker-tar="$(chroot_worker)" \
Expand Down
1 change: 1 addition & 0 deletions toolkit/scripts/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ go_tool_list = \
scheduler \
specarchchecker \
specreader \
versionsprocessor \
Copy link
Copy Markdown
Contributor

@PawelWMS PawelWMS Feb 17, 2026

Choose a reason for hiding this comment

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

Can you also add info about this new step in packages generation and what the new macros inside the specs are for into toolkit/docs/how_it_works/3_package_building.md?

One thing I'd make sure to mentioned in the docs: the azl_<package_name>_release macro does NOT contain the distro suffix. I understand this is by design, it's just something that we should be explicit about, since we're very inconsistent with what "release" means across our tooling and specs.

Copy link
Copy Markdown
Contributor

@PawelWMS PawelWMS Feb 17, 2026

Choose a reason for hiding this comment

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

Please also update the specs using the default kernel to use the new approach. The way of querying the kernel-headers for the kernel version is one of the workarounds we want to remove with this change and I'd prefer not to keep it around, since we have a better way now (prevents confusion). Also, some of the specs for default kernel OOTs also have a dependency on the default kernel mlnx-ofa_kernel and right now that's a hard-coded version inside these specs, so we should clean that up as well.

Examples:

  • mlnx-ofa_kernel.spec (queries kernel-headers),
  • iser.spec (queries kernel-headers AND has a hard-coded version of mlnx-ofa_kernel).

If you search for --whatprovides kernel-headers and _mofed_full_version %{_version} you should find all of them.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have talked with Jon about this. We agree to add this, but as separate PR

srpmpacker \
validatechroot \

Expand Down
1 change: 1 addition & 0 deletions toolkit/tools/internal/safechroot/chrootinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ type ChrootInterface interface {
Run(toRun func() error) error
UnsafeRun(toRun func() error) error
AddFiles(filesToCopy ...FileToCopy) error
AddRPMMacrosFile(macrosFilePath string) error
}
4 changes: 4 additions & 0 deletions toolkit/tools/internal/safechroot/dummychroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ func (d *DummyChroot) UnsafeRun(toRun func() error) (err error) {
func (d *DummyChroot) AddFiles(filesToCopy ...FileToCopy) (err error) {
return AddFilesToDestination(d.RootDir(), filesToCopy...)
}

func (d *DummyChroot) AddRPMMacrosFile(macrosFilePath string) error {
return AddRPMMacrosFile(d, macrosFilePath)
}
Comment thread
mbykhovtsev-ms marked this conversation as resolved.
68 changes: 67 additions & 1 deletion toolkit/tools/internal/safechroot/safechroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import (
"time"

"github.com/microsoft/azurelinux/toolkit/tools/internal/buildpipeline"
"github.com/microsoft/azurelinux/toolkit/tools/internal/directory"
"github.com/microsoft/azurelinux/toolkit/tools/internal/file"
"github.com/microsoft/azurelinux/toolkit/tools/internal/logger"
"github.com/microsoft/azurelinux/toolkit/tools/internal/retry"
"github.com/microsoft/azurelinux/toolkit/tools/internal/rpm"
"github.com/microsoft/azurelinux/toolkit/tools/internal/shell"
"github.com/microsoft/azurelinux/toolkit/tools/internal/systemdependency"

Expand Down Expand Up @@ -160,6 +162,60 @@ func NewOverlayMountPoint(chrootDir, source, target, lowerDir, upperDir, workDir
return
}

func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) error {
return AddRPMMacrosFile(c, macrosFilePath)
}

func AddRPMMacrosFile(c ChrootInterface, macrosFilePath string) (err error) {
Comment thread
dmcilvaney marked this conversation as resolved.
var macroDir string

doGetMacroDir := func() error {
var macroErr error

macroDir, macroErr = rpm.GetMacroDir()
if macroErr != nil {
logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr)
return macroErr
}

return macroErr
}

c.Run(doGetMacroDir)

// Destination path inside the chroot (same path as on the host).
macrosDestDir := filepath.Join(c.RootDir(), macroDir)
macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(macrosFilePath))

exists, existsErr := file.PathExists(macrosDestFile)
if existsErr != nil {
logger.Log.Errorf("Failed to check if macros file exists (%s): %s", macrosDestFile, existsErr)
return existsErr
}

if exists {
logger.Log.Warningf("Macros file (%s) already exists, skipping copy", macrosDestFile)
return nil
}

// Ensure destination directory exists and copy the file.
mkdirErr := directory.EnsureDirExists(macrosDestDir)
if mkdirErr != nil {
logger.Log.Errorf("Failed to create macros directory inside chroot (%s): %s", macrosDestDir, mkdirErr)
return mkdirErr
}

copyErr := file.Copy(macrosFilePath, macrosDestFile)
if copyErr != nil {
logger.Log.Errorf("Failed to copy release version macros file into chroot (%s -> %s): %s", macrosFilePath, macrosDestFile, copyErr)
return copyErr
}

logger.Log.Infof("Copied release version macros file into chroot (%s -> %s)", macrosFilePath, macrosDestFile)

return
}

// GetSource gets the source device of the mount.
func (m *MountPoint) GetSource() string {
return m.source
Expand Down Expand Up @@ -209,7 +265,7 @@ func NewChroot(rootDir string, isExistingDir bool) *Chroot {
// This call will block until the chroot initializes successfully.
// Only one Chroot will initialize at a given time.
func (c *Chroot) Initialize(tarPath string, extraDirectories []string, extraMountPoints []*MountPoint,
includeDefaultMounts bool,
includeDefaultMounts bool, releaseVersionMacrosFile ...string,
) (err error) {
// On failed initialization, cleanup all chroot files
const leaveChrootOnDisk = false
Expand Down Expand Up @@ -319,6 +375,16 @@ func (c *Chroot) Initialize(tarPath string, extraDirectories []string, extraMoun
activeChroots = append(activeChroots, c)
}

// If a release version macros file is provided, copy it into the default RPM macros directory
// inside the chroot so rpmspec/rpmbuild pick it up automatically.
if len(releaseVersionMacrosFile) > 0 && releaseVersionMacrosFile[0] != "" {
err = c.AddRPMMacrosFile(releaseVersionMacrosFile[0])
if err != nil {
err = fmt.Errorf("failed to add release version macros file to chroot:\n%w", err)
return
}
}

return
}

Expand Down
4 changes: 3 additions & 1 deletion toolkit/tools/pkg/licensecheck/licensecheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ func New(buildDirPath, workerTarPath, rpmDirPath, nameFilePath, exceptionFilePat
jobSemaphore: make(chan struct{}, runtime.NumCPU()*2),
}

err = newLicenseChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, rpmDirPath)
noExtraMacrosFile := ""

err = newLicenseChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, rpmDirPath, noExtraMacrosFile)
Comment thread
mbykhovtsev-ms marked this conversation as resolved.
if err != nil {
err = fmt.Errorf("failed to initialize chroot:\n%w", err)
return newLicenseChecker, err
Expand Down
4 changes: 2 additions & 2 deletions toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ type SnapshotGenerator struct {
}

// New creates a new snapshot generator. If the chroot is created successfully, the caller is responsible for calling CleanUp().
func New(buildDirPath, workerTarPath, specsDirPath string) (newSnapshotGenerator *SnapshotGenerator, err error) {
func New(buildDirPath, workerTarPath, specsDirPath, releaseVersionMacrosFile string) (newSnapshotGenerator *SnapshotGenerator, err error) {
const chrootName = "rpmssnapshot_chroot"
newSnapshotGenerator = &SnapshotGenerator{}
err = newSnapshotGenerator.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, specsDirPath)
err = newSnapshotGenerator.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, specsDirPath, releaseVersionMacrosFile)

return newSnapshotGenerator, err
}
Expand Down
4 changes: 2 additions & 2 deletions toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *SimpleToolChroot) ChrootRelativeMountDir() string {
// - chrootName: The name of the chroot to create
// - workerTarPath: The path to the tar file containing the worker files
// - mountDirPath: The path to the directory to mount, will be mounted to s.ChrootRelativeMountDir() inside the chroot
func (s *SimpleToolChroot) InitializeChroot(buildDir, chrootName, workerTarPath, mountDirPath string) (err error) {
func (s *SimpleToolChroot) InitializeChroot(buildDir, chrootName, workerTarPath, mountDirPath, releaseVersionMacrosFile string) (err error) {
const (
existingDir = false
)
Expand All @@ -57,7 +57,7 @@ func (s *SimpleToolChroot) InitializeChroot(buildDir, chrootName, workerTarPath,
extraMountPoints := []*safechroot.MountPoint{
safechroot.NewMountPoint(mountDirPath, chrootMountDirPath, "", safechroot.BindMountPointFlags, ""),
}
err = s.chroot.Initialize(workerTarPath, extraDirectories, extraMountPoints, true)
err = s.chroot.Initialize(workerTarPath, extraDirectories, extraMountPoints, true, releaseVersionMacrosFile)
if err != nil {
err = fmt.Errorf("failed to initialize chroot (%s) inside (%s):\n%w", workerTarPath, chrootDirPath, err)
return
Expand Down
Loading
Loading