From 23777aa21b1f1d6c443805aa68e8f2343202f188 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 20 Jan 2026 14:53:29 -0800 Subject: [PATCH 01/86] temp save --- SPECS/isert-hwe/isert-hwe.spec | 4 +- toolkit/scripts/pkggen.mk | 26 +++ toolkit/scripts/tools.mk | 1 + .../kernelverprocessor/kernelverprocessor.go | 188 ++++++++++++++++++ 4 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 toolkit/tools/kernelverprocessor/kernelverprocessor.go diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 808a9f3093d..fafda48798e 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -28,8 +28,8 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 1 +%global target_azl_build_kernel_version %{KERNEL_HWE_VERSION} +%global target_kernel_release %{KERNEL_HWE_REL} %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index aaed4f211f5..3b7d24482cc 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -121,6 +121,32 @@ ifeq ($(RESOLVE_CYCLES_FROM_UPSTREAM),y) endif endif +# 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-kernelverprocessor) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) + $(go-kernelverprocessor) \ + --dir $(SPECS_DIR) \ + $(if $(SRPM_PACK_LIST),--spec-list="$(SRPM_PACK_LIST)") \ + --build-dir $(parse_working_dir) \ + --srpm-dir $(BUILD_SRPMS_DIR) \ + --rpm-dir $(RPMS_DIR) \ + --toolchain-manifest="$(TOOLCHAIN_MANIFEST)" \ + --toolchain-rpms-dir="$(TOOLCHAIN_RPMS_DIR)" \ + --dist-tag $(DIST_TAG) \ + --worker-tar $(chroot_worker) \ + $(if $(filter y,$(RUN_CHECK)),--run-check) \ + $(logging_command) \ + --cpu-prof-file=$(PROFILE_DIR)/kernelverprocessor.cpu.pprof \ + --mem-prof-file=$(PROFILE_DIR)/kernelverprocessor.mem.pprof \ + --trace-file=$(PROFILE_DIR)/kernelverprocessor.trace \ + $(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)/kernelverprocessor.jsonl \ + $(if $(TARGET_ARCH),--target-arch="$(TARGET_ARCH)") \ + --output $@ + # Convert the dependency information in the json file into a graph structure # We require all the toolchain RPMs to be available here to help resolve unfixable cyclic dependencies $(graph_file): $(specs_file) $(go-grapher) $(toolchain_rpms) $(TOOLCHAIN_MANIFEST) $(pkggen_local_repo) $(graphpkgfetcher_cloned_repo) $(chroot_worker) $(depend_REPO_LIST) $(REPO_LIST) $(depend_REPO_SNAPSHOT_TIME) diff --git a/toolkit/scripts/tools.mk b/toolkit/scripts/tools.mk index 3292d0c218e..2b8946895b4 100644 --- a/toolkit/scripts/tools.mk +++ b/toolkit/scripts/tools.mk @@ -62,6 +62,7 @@ go_tool_list = \ scheduler \ specarchchecker \ specreader \ + kernelverprocessor \ srpmpacker \ validatechroot \ diff --git a/toolkit/tools/kernelverprocessor/kernelverprocessor.go b/toolkit/tools/kernelverprocessor/kernelverprocessor.go new file mode 100644 index 00000000000..93ac24d7cb9 --- /dev/null +++ b/toolkit/tools/kernelverprocessor/kernelverprocessor.go @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +// specreader is a tool to parse spec files into a JSON structure + +package main + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" + "runtime" + "strings" + + "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" + "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" + packagelist "github.com/microsoft/azurelinux/toolkit/tools/internal/packlist" + "github.com/microsoft/azurelinux/toolkit/tools/internal/rpm" + "github.com/microsoft/azurelinux/toolkit/tools/internal/timestamp" + "github.com/microsoft/azurelinux/toolkit/tools/pkg/profile" + "github.com/microsoft/azurelinux/toolkit/tools/pkg/specreaderutils" + + "gopkg.in/alecthomas/kingpin.v2" +) + +const ( + defaultWorkerCount = "100" + kernelHWESpecName = "kernel-hwe" + kernelHWEVerMacroName = "KERNEL_HWE_VERSION" + kernelHWERelMacroName = "KERNEL_HWE_REL" +) + +var ( + app = kingpin.New("kernelverprocessor", "A tool to determine dynamic kernel version") + specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") + specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() + output = exe.OutputFlag(app, "Output file to export the JSON") + workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() + buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() + srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() + rpmsDir = app.Flag("rpm-dir", "Directory containing built RPMs.").Required().ExistingDir() + toolchainManifest = app.Flag("toolchain-manifest", "Path to a list of RPMs which are created by the toolchain. Will mark RPMs from this list as prebuilt.").ExistingFile() + existingToolchainRpmDir = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain top level directories for architecture.").Required().ExistingDir() + distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() + targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() + runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() + logFlags = exe.SetupLogFlags(app) + profFlags = exe.SetupProfileFlags(app) + timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() + extraKernelVersionsToParse = []string{kernelHWESpecName} +) + +func main() { + const ( + querySrpm = `%{NAME}-%{VERSION}-%{RELEASE}.src.rpm` + queryProvidedPackages = `rpm %{ARCH}/%{nvra}.rpm\n[provides %{PROVIDENEVRS}\n][requires %{REQUIRENEVRS}\n][arch %{ARCH}\n]` + ) + + app.Version(exe.ToolkitVersion) + kingpin.MustParse(app.Parse(os.Args[1:])) + logger.InitBestEffort(logFlags) + + prof, err := profile.StartProfiling(profFlags) + if err != nil { + logger.Log.Warnf("Could not start profiling: %s", err) + } + defer prof.StopProfiler() + + timestamp.BeginTiming("specreader", *timestampFile) + defer timestamp.CompleteTiming() + + if *workers <= 0 { + logger.Log.Panicf("Value in --workers must be greater than zero. Found %d", *workers) + } + + // A parse list may be provided, if so only parse this subset. + // If none is provided, parse all specs. + specListSet, err := packagelist.ParsePackageList(*specList) + logger.PanicOnError(err) + + // A parse list may be provided, if so only parse this subset. + // If none is provided, parse all specs. + kernelSpecListSet, err := packagelist.ParsePackageList(strings.Join(extraKernelVersionsToParse, " ")) + logger.PanicOnError(err) + + //err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) + + var buildArch string = *targetArch + + if *targetArch == "" { + buildArch, err = rpm.GetRpmArch(runtime.GOARCH) + if err != nil { + return + } + } + + kernelSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, kernelSpecListSet) + if err != nil { + logger.Log.Panicf("Error finding spec files: %s", err) + return + } + + specFiles, err := specreaderutils.FindSpecFiles(*specsDir, specListSet) + if err != nil { + logger.Log.Panicf("Error finding spec files: %s", err) + return + } + + logger.Log.Infof("Processing kernel HWE spec files: %v", kernelSpecFiles) + + // Process each kernel flavour/type + for _, specFile := range kernelSpecFiles { + + // Get kernel version-release from spec file + + specFileName := filepath.Base(specFile) + + sourceDir := filepath.Dir(specFile) + noCheckDefines := rpm.DefaultDistroDefines(false, *distTag) + + logger.Log.Infof("Processing kernel HWE spec files: %v %v", specFileName, sourceDir) + + versionRelease, err := rpm.QuerySPEC(specFile, sourceDir, `%{VERSION}-%{RELEASE}`, buildArch, noCheckDefines, rpm.QueryHeaderArgument) + if err != nil { + logger.Log.Errorf("Failed to query kernel-hwe spec file (%s). Error: %s", specFileName, err) + continue + } + + logger.Log.Infof("kernel-hwe version-release: %s", versionRelease) + logger.PanicOnError(err) + + if len(versionRelease) == 0 { + logger.Log.Errorf("Invalid version-release retrieved from kernel-hwe spec file (%s): %s", specFileName, versionRelease) + continue + } + + releaseVerSplit := strings.Split(versionRelease[0], "-") + + if len(releaseVerSplit) < 2 { + logger.Log.Errorf("Invalid version-release format retrieved from kernel-hwe spec file (%s): %s", specFileName, versionRelease[0]) + continue + + } + + version := releaseVerSplit[0] + release := releaseVerSplit[1] + releaseClean := strings.SplitN(release, ".", 2)[0] // Includes distribution tag suffixes + + logger.Log.Infof("Processed kernel-hwe version-release: %s %s", version, release) + + // TODO: Now parse all spec files and update their kernel version/release MACRO accordingly + + for _, OOTspecFile := range specFiles { + err = sedSPECFile(OOTspecFile, "%{"+kernelHWEVerMacroName+"}", version) + + if err != nil { + logger.Log.Errorf("Failed to update spec file (%s) with kernel-hwe release version (%s). Error: %s", OOTspecFile, version, err) + continue + } + + err = sedSPECFile(OOTspecFile, "%{"+kernelHWERelMacroName+"}", releaseClean) + + if err != nil { + logger.Log.Errorf("Failed to update spec file (%s) with kernel-hwe release version (%s). Error: %s", OOTspecFile, releaseClean, err) + continue + } + + logger.Log.Infof("Updated spec file (%s) with kernel-hwe release version (%s).", OOTspecFile, version) + + } + } + +} + +func sedSPECFile(filePath, pattern, replacement string) error { + expr := fmt.Sprintf("s|%s|%s|g", pattern, replacement) + + cmd := exec.Command("sed", "-i", expr, filePath) + output, err := cmd.CombinedOutput() + if err != nil { + logger.Log.Errorf("sed command failed: %s; output: %s", err, string(output)) + return fmt.Errorf("sed command failed: %w; output: %s", err, string(output)) + } + + return nil +} From f5bb9a8b025307f3a7fc9e56023baec6e51b6643 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 22 Jan 2026 10:42:04 -0800 Subject: [PATCH 02/86] use chroot enviroment instead of modifying specs directly --- SPECS/isert-hwe/isert-hwe.spec | 6 +- toolkit/scripts/pkggen.mk | 48 +++++++------- .../kernelverprocessor/kernelverprocessor.go | 63 +++++-------------- .../pkg/specreaderutils/specreaderutil.go | 37 ++++++++++- toolkit/tools/specreader/specreader.go | 3 +- 5 files changed, 74 insertions(+), 83 deletions(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index fafda48798e..914e6319486 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -28,8 +28,8 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version %{KERNEL_HWE_VERSION} -%global target_kernel_release %{KERNEL_HWE_REL} +%global target_azl_build_kernel_version %KERNEL_HWE_VERSION +%global target_kernel_release %KERNEL_HWE_REL %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -67,7 +67,7 @@ Summary: %{_name}-hwe Driver Name: isert-hwe Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 5%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 3b7d24482cc..05e3385ff0c 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -33,6 +33,7 @@ validate-pkggen-config = $(STATUS_FLAGS_DIR)/validate-image-config-pkggen.flag # Outputs specs_file = $(PKGBUILD_DIR)/specs.json +kernel_macros_file = $(PKGBUILD_DIR)/macros.kernel graph_file = $(PKGBUILD_DIR)/graph.dot cached_file = $(PKGBUILD_DIR)/cached_graph.dot preprocessed_file = $(PKGBUILD_DIR)/preprocessed_graph.dot @@ -92,40 +93,26 @@ analyze-built-graph: $(go-graphanalytics) # 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) - $(go-specreader) \ +$(kernel_macros_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-kernelverprocessor) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) + $(go-kernelverprocessor) \ --dir $(SPECS_DIR) \ - $(if $(SRPM_PACK_LIST),--spec-list="$(SRPM_PACK_LIST)") \ - --build-dir $(parse_working_dir) \ - --srpm-dir $(BUILD_SRPMS_DIR) \ - --rpm-dir $(RPMS_DIR) \ - --toolchain-manifest="$(TOOLCHAIN_MANIFEST)" \ - --toolchain-rpms-dir="$(TOOLCHAIN_RPMS_DIR)" \ --dist-tag $(DIST_TAG) \ - --worker-tar $(chroot_worker) \ - $(if $(filter y,$(RUN_CHECK)),--run-check) \ $(logging_command) \ - --cpu-prof-file=$(PROFILE_DIR)/specreader.cpu.pprof \ - --mem-prof-file=$(PROFILE_DIR)/specreader.mem.pprof \ - --trace-file=$(PROFILE_DIR)/specreader.trace \ + --cpu-prof-file=$(PROFILE_DIR)/kernelverprocessor.cpu.pprof \ + --mem-prof-file=$(PROFILE_DIR)/kernelverprocessor.mem.pprof \ + --trace-file=$(PROFILE_DIR)/kernelverprocessor.trace \ $(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)/specreader.jsonl \ + --timestamp-file=$(TIMESTAMP_DIR)/kernelverprocessor.jsonl \ $(if $(TARGET_ARCH),--target-arch="$(TARGET_ARCH)") \ --output $@ -ifeq ($(RESOLVE_CYCLES_FROM_UPSTREAM),y) - ifeq ($(DISABLE_UPSTREAM_REPOS),y) - $(error RESOLVE_CYCLES_FROM_UPSTREAM requires upstream repos to be enabled. Please set DISABLE_UPSTREAM_REPOS=n) - endif -endif - # 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-kernelverprocessor) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) - $(go-kernelverprocessor) \ +$(specs_file): $(kernel_macros_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)") \ --build-dir $(parse_working_dir) \ @@ -135,18 +122,25 @@ $(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) \ + --kernel-macros-file $(kernel_macros_file) \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ $(logging_command) \ - --cpu-prof-file=$(PROFILE_DIR)/kernelverprocessor.cpu.pprof \ - --mem-prof-file=$(PROFILE_DIR)/kernelverprocessor.mem.pprof \ - --trace-file=$(PROFILE_DIR)/kernelverprocessor.trace \ + --cpu-prof-file=$(PROFILE_DIR)/specreader.cpu.pprof \ + --mem-prof-file=$(PROFILE_DIR)/specreader.mem.pprof \ + --trace-file=$(PROFILE_DIR)/specreader.trace \ $(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)/kernelverprocessor.jsonl \ + --timestamp-file=$(TIMESTAMP_DIR)/specreader.jsonl \ $(if $(TARGET_ARCH),--target-arch="$(TARGET_ARCH)") \ --output $@ +ifeq ($(RESOLVE_CYCLES_FROM_UPSTREAM),y) + ifeq ($(DISABLE_UPSTREAM_REPOS),y) + $(error RESOLVE_CYCLES_FROM_UPSTREAM requires upstream repos to be enabled. Please set DISABLE_UPSTREAM_REPOS=n) + endif +endif + # Convert the dependency information in the json file into a graph structure # We require all the toolchain RPMs to be available here to help resolve unfixable cyclic dependencies $(graph_file): $(specs_file) $(go-grapher) $(toolchain_rpms) $(TOOLCHAIN_MANIFEST) $(pkggen_local_repo) $(graphpkgfetcher_cloned_repo) $(chroot_worker) $(depend_REPO_LIST) $(REPO_LIST) $(depend_REPO_SNAPSHOT_TIME) @@ -323,7 +317,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: $(kernel_macros_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)" \ diff --git a/toolkit/tools/kernelverprocessor/kernelverprocessor.go b/toolkit/tools/kernelverprocessor/kernelverprocessor.go index 93ac24d7cb9..d0a19c0462f 100644 --- a/toolkit/tools/kernelverprocessor/kernelverprocessor.go +++ b/toolkit/tools/kernelverprocessor/kernelverprocessor.go @@ -8,12 +8,12 @@ package main import ( "fmt" "os" - "os/exec" "path/filepath" "runtime" "strings" "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" + "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" packagelist "github.com/microsoft/azurelinux/toolkit/tools/internal/packlist" "github.com/microsoft/azurelinux/toolkit/tools/internal/rpm" @@ -34,18 +34,10 @@ const ( var ( app = kingpin.New("kernelverprocessor", "A tool to determine dynamic kernel version") specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") - specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() output = exe.OutputFlag(app, "Output file to export the JSON") workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() - buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() - srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() - rpmsDir = app.Flag("rpm-dir", "Directory containing built RPMs.").Required().ExistingDir() - toolchainManifest = app.Flag("toolchain-manifest", "Path to a list of RPMs which are created by the toolchain. Will mark RPMs from this list as prebuilt.").ExistingFile() - existingToolchainRpmDir = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain top level directories for architecture.").Required().ExistingDir() distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() - workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() - runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() logFlags = exe.SetupLogFlags(app) profFlags = exe.SetupProfileFlags(app) timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() @@ -68,16 +60,13 @@ func main() { } defer prof.StopProfiler() - timestamp.BeginTiming("specreader", *timestampFile) + timestamp.BeginTiming("kernelverprocessor", *timestampFile) defer timestamp.CompleteTiming() if *workers <= 0 { logger.Log.Panicf("Value in --workers must be greater than zero. Found %d", *workers) } - // A parse list may be provided, if so only parse this subset. - // If none is provided, parse all specs. - specListSet, err := packagelist.ParsePackageList(*specList) logger.PanicOnError(err) // A parse list may be provided, if so only parse this subset. @@ -85,7 +74,7 @@ func main() { kernelSpecListSet, err := packagelist.ParsePackageList(strings.Join(extraKernelVersionsToParse, " ")) logger.PanicOnError(err) - //err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) + //err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, "", *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) var buildArch string = *targetArch @@ -102,14 +91,10 @@ func main() { return } - specFiles, err := specreaderutils.FindSpecFiles(*specsDir, specListSet) - if err != nil { - logger.Log.Panicf("Error finding spec files: %s", err) - return - } - logger.Log.Infof("Processing kernel HWE spec files: %v", kernelSpecFiles) + macros_output := []byte{} + // Process each kernel flavour/type for _, specFile := range kernelSpecFiles { @@ -150,39 +135,19 @@ func main() { logger.Log.Infof("Processed kernel-hwe version-release: %s %s", version, release) - // TODO: Now parse all spec files and update their kernel version/release MACRO accordingly - - for _, OOTspecFile := range specFiles { - err = sedSPECFile(OOTspecFile, "%{"+kernelHWEVerMacroName+"}", version) + // Generate RPM macro definitions instead of modifying spec files directly. + macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", + kernelHWEVerMacroName, version, + kernelHWERelMacroName, releaseClean, + ) - if err != nil { - logger.Log.Errorf("Failed to update spec file (%s) with kernel-hwe release version (%s). Error: %s", OOTspecFile, version, err) - continue - } - - err = sedSPECFile(OOTspecFile, "%{"+kernelHWERelMacroName+"}", releaseClean) - - if err != nil { - logger.Log.Errorf("Failed to update spec file (%s) with kernel-hwe release version (%s). Error: %s", OOTspecFile, releaseClean, err) - continue - } - - logger.Log.Infof("Updated spec file (%s) with kernel-hwe release version (%s).", OOTspecFile, version) - - } + macros_output = append(macros_output, []byte(macros)...) } -} - -func sedSPECFile(filePath, pattern, replacement string) error { - expr := fmt.Sprintf("s|%s|%s|g", pattern, replacement) - - cmd := exec.Command("sed", "-i", expr, filePath) - output, err := cmd.CombinedOutput() + err = file.Write(string(macros_output), *output) if err != nil { - logger.Log.Errorf("sed command failed: %s; output: %s", err, string(output)) - return fmt.Errorf("sed command failed: %w; output: %s", err, string(output)) + logger.Log.Errorf("Failed to write file (%s)", *output) + return } - return nil } diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index e843bd818c7..6692394f350 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -58,7 +58,8 @@ type parseResult struct { // ParseSPECsWrapper wraps parseSPECs to conditionally run it inside a chroot. // If workerTar is non-empty, parsing will occur inside a chroot, otherwise it will run on the host system. -func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, distTag, outputFile, workerTar, targetArch string, specListSet map[string]bool, toolchainRPMs []string, workers int, runCheck bool) (err error) { +// kernelMacrosFile, if non-empty, is made available inside the chroot at the same path as on the host. +func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, distTag, outputFile, workerTar, kernelMacrosFile, targetArch string, specListSet map[string]bool, toolchainRPMs []string, workers int, runCheck bool) (err error) { var ( chroot *safechroot.Chroot packageRepo *pkgjson.PackageRepo @@ -66,7 +67,7 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist if workerTar != "" { const leaveFilesOnDisk = false - chroot, err = createChroot(workerTar, buildDir, specsDir, srpmsDir) + chroot, err = createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile) if err != nil { return } @@ -126,7 +127,8 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist } // createChroot creates a chroot to parse SPECs inside of. -func createChroot(workerTar, buildDir, specsDir, srpmsDir string) (chroot *safechroot.Chroot, err error) { +// If kernelMacrosFile is non-empty, its parent directory is also made available inside the chroot. +func createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile string) (chroot *safechroot.Chroot, err error) { const ( chrootName = "specparser_chroot" existingDir = false @@ -167,6 +169,35 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir string) (chroot *safec } } + // If a kernel macros file is provided, copy it into the default RPM macros directory + // inside the chroot so rpmspec/rpmbuild pick it up automatically. + if kernelMacrosFile != "" { + macroDir, macroErr := rpm.GetMacroDir() + if macroErr != nil { + logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) + return + } + + // Destination path inside the chroot (same path as on the host). + macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + + // 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 + } + + copyErr := file.Copy(kernelMacrosFile, macrosDestFile) + if copyErr != nil { + logger.Log.Errorf("Failed to copy kernel macros file into chroot (%s -> %s): %s", kernelMacrosFile, macrosDestFile, copyErr) + return + } + + logger.Log.Infof("Copied kernel macros file into chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + } + return } diff --git a/toolkit/tools/specreader/specreader.go b/toolkit/tools/specreader/specreader.go index e1ad389cfc6..dce469a84f0 100644 --- a/toolkit/tools/specreader/specreader.go +++ b/toolkit/tools/specreader/specreader.go @@ -29,6 +29,7 @@ var ( specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() output = exe.OutputFlag(app, "Output file to export the JSON") + kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while parsing.").ExistingFile() workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() @@ -74,6 +75,6 @@ func main() { specsAbsDir, err := filepath.Abs(*specsDir) logger.PanicOnError(err, "Unable to get absolute path for specs directory '%s': %s", *specsDir, err) - err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) + err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *kernelMacrosFile, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) logger.PanicOnError(err) } From c1661e2c3c09afd9d6de55b322252ca98857b182 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 22 Jan 2026 15:48:08 -0800 Subject: [PATCH 03/86] pass down macro files to the rest of the build flow --- toolkit/scripts/pkggen.mk | 1 + toolkit/scripts/srpm_pack.mk | 10 +++-- toolkit/tools/pkgworker/pkgworker.go | 31 ++++++++++++++- .../scheduler/buildagents/chrootagent.go | 4 ++ .../tools/scheduler/buildagents/definition.go | 1 + toolkit/tools/scheduler/scheduler.go | 2 + toolkit/tools/srpmpacker/srpmpacker.go | 38 +++++++++++++++++-- 7 files changed, 78 insertions(+), 9 deletions(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 05e3385ff0c..1031dcf74ee 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -335,6 +335,7 @@ $(STATUS_FLAGS_DIR)/build-rpms.flag: $(kernel_macros_file) $(no_repo_acl) $(prep --distro-release-version="$(RELEASE_VERSION)" \ --distro-build-number="$(BUILD_NUMBER)" \ --rpmmacros-file="$(TOOLCHAIN_MANIFESTS_DIR)/macros.override" \ + --kernel-macros-file="$(kernel_macros_file)" \ --build-attempts="$$(($(PACKAGE_BUILD_RETRIES)+1))" \ --check-attempts="$$(($(CHECK_BUILD_RETRIES)+1))" \ $(if $(MAX_CASCADING_REBUILDS),--max-cascading-rebuilds="$(MAX_CASCADING_REBUILDS)") \ diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index dca22888c7f..55875c2b7e5 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -14,7 +14,9 @@ SRPM_FILE_SIGNATURE_HANDLING ?= enforce SRPM_BUILD_CHROOT_DIR = $(BUILD_DIR)/SRPM_packaging -SRPM_BUILD_LOGS_DIR = $(LOGS_DIR)/pkggen/srpms +SRPM_BUILD_LOGS_DIR = $(LOGS_DIR)/pkggen/srpms +kernel_macros_file = $(PKGBUILD_DIR)/macros.kernel + # 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 @@ -77,7 +79,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: $(kernel_macros_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) \ @@ -88,6 +90,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) \ + --kernel-macros-file=$(kernel_macros_file) \ --signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \ --worker-tar=$(chroot_worker) \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ @@ -104,7 +107,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(chroot_worker) $(local_specs) $(local_sp --timestamp-file=$(TIMESTAMP_DIR)/srpm_packer.jsonl && \ touch $@ -$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(toolchain_files) $(go-srpmpacker) +$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(kernel_macros_file) $(toolchain_files) $(go-srpmpacker) GODEBUG=netdns=go $(go-srpmpacker) \ --dir=$(SPECS_DIR) \ --output-dir=$(BUILD_SRPMS_DIR) \ @@ -115,6 +118,7 @@ $(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(toolchain_files) $(go-srpmpack --tls-cert=$(TLS_CERT) \ --tls-key=$(TLS_KEY) \ --build-dir=$(SRPM_BUILD_CHROOT_DIR) \ + --kernel-macros-file=$(kernel_macros_file) \ --signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \ --pack-list="$(toolchain_spec_list)" \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index 62e259d754c..8b0f9e915d1 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -15,6 +15,7 @@ import ( "time" "github.com/microsoft/azurelinux/toolkit/tools/internal/ccachemanager" + "github.com/microsoft/azurelinux/toolkit/tools/internal/directory" "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" @@ -52,6 +53,7 @@ var ( distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with").Required().String() distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with").Required().String() rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use").ExistingFile() + kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while building.").ExistingFile() runCheck = app.Flag("run-check", "Run the check during package build").Bool() packagesToInstall = app.Flag("install-package", "Filepaths to RPM packages that should be installed before building.").Strings() outArch = app.Flag("out-arch", "Architecture of resulting package").String() @@ -117,7 +119,7 @@ func main() { defines[rpm.MaxCPUDefine] = *maxCPU } - builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) + builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *kernelMacrosFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) logger.FatalOnError(err, "Failed to build SRPM '%s'. For details see log file: %s .", *srpmFile, *logFlags.LogFile) // For regular (non-test) package builds: @@ -154,7 +156,7 @@ func isCCacheEnabled(ccacheManager *ccachemanager.CCacheManager) bool { return ccacheManager != nil && ccacheManager.CurrentPkgGroup.Enabled } -func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmFile, repoFile, rpmmacrosFile, outArch string, defines map[string]string, noCleanup, runCheck bool, packagesToInstall []string, ccacheManager *ccachemanager.CCacheManager, timeout time.Duration) (builtRPMs []string, err error) { +func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmFile, repoFile, rpmmacrosFile, kernelMacrosFile, outArch string, defines map[string]string, noCleanup, runCheck bool, packagesToInstall []string, ccacheManager *ccachemanager.CCacheManager, timeout time.Duration) (builtRPMs []string, err error) { const ( buildHeartbeatTimeout = 30 * time.Minute @@ -218,6 +220,31 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF err = fmt.Errorf("failed to initialize chroot:\n%w", err) return } + + if kernelMacrosFile != "" { + macroDir, macroErr := rpm.GetMacroDir() + if macroErr != nil { + err = fmt.Errorf("failed to get RPM macros directory: %w", macroErr) + return + } + + macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + + macroErr = directory.EnsureDirExists(macrosDestDir) + if macroErr != nil { + err = fmt.Errorf("failed to create macros directory in chroot: %w", macroErr) + return + } + + macroErr = file.Copy(kernelMacrosFile, macrosDestFile) + if macroErr != nil { + err = fmt.Errorf("failed to copy kernel macros file into chroot: %w", macroErr) + return + } + + logger.Log.Infof("Copied kernel macros file into pkgworker chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + } defer chroot.Close(noCleanup) // Place extra files that will be needed to build into the chroot diff --git a/toolkit/tools/scheduler/buildagents/chrootagent.go b/toolkit/tools/scheduler/buildagents/chrootagent.go index cf3a79b9a5c..2f0dfb19526 100644 --- a/toolkit/tools/scheduler/buildagents/chrootagent.go +++ b/toolkit/tools/scheduler/buildagents/chrootagent.go @@ -101,6 +101,10 @@ func serializeChrootBuildAgentConfig(config *BuildAgentConfig, basePackageName, serializedArgs = append(serializedArgs, fmt.Sprintf("--rpmmacros-file=%s", config.RpmmacrosFile)) } + if config.KernelMacrosFile != "" { + serializedArgs = append(serializedArgs, fmt.Sprintf("--kernel-macros-file=%s", config.KernelMacrosFile)) + } + if config.NoCleanup { serializedArgs = append(serializedArgs, "--no-cleanup") } diff --git a/toolkit/tools/scheduler/buildagents/definition.go b/toolkit/tools/scheduler/buildagents/definition.go index a502d660753..87cd87b7d07 100644 --- a/toolkit/tools/scheduler/buildagents/definition.go +++ b/toolkit/tools/scheduler/buildagents/definition.go @@ -26,6 +26,7 @@ type BuildAgentConfig struct { DistroReleaseVersion string DistroBuildNumber string RpmmacrosFile string + KernelMacrosFile string NoCleanup bool UseCcache bool diff --git a/toolkit/tools/scheduler/scheduler.go b/toolkit/tools/scheduler/scheduler.go index 327655caf92..6a10ba37d6f 100644 --- a/toolkit/tools/scheduler/scheduler.go +++ b/toolkit/tools/scheduler/scheduler.go @@ -76,6 +76,7 @@ var ( distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with.").Required().String() distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with.").Required().String() rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use.").ExistingFile() + kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while building packages.").ExistingFile() buildAttempts = app.Flag("build-attempts", "Sets the number of times to try building a package.").Default(defaultBuildAttempts).Int() checkAttempts = app.Flag("check-attempts", "Sets the minimum number of times to test a package if the tests fail.").Default(defaultCheckAttempts).Int() extraLayers = app.Flag("extra-layers", "Sets the number of additional layers in the graph beyond the goal packages to buid.").Default(defaultExtraLayers).Int() @@ -194,6 +195,7 @@ func main() { DistroReleaseVersion: *distroReleaseVersion, DistroBuildNumber: *distroBuildNumber, RpmmacrosFile: *rpmmacrosFile, + KernelMacrosFile: *kernelMacrosFile, NoCleanup: *noCleanup, UseCcache: *useCcache, diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 8c476f61c3b..7921520c861 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -129,6 +129,7 @@ var ( concurrentNetOps = app.Flag("concurrent-net-ops", "Number of concurrent network operations to perform.").Default(defaultNetOpsCount).Uint() repackAll = app.Flag("repack", "Rebuild all SRPMs, even if already built.").Bool() nestedSourcesDir = app.Flag("nested-sources", "Set if for a given SPEC, its sources are contained in a SOURCES directory next to the SPEC file.").Bool() + kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while packing SRPMs.").String() // Use String() and not ExistingFile() as the Makefile may pass an empty string if the user did not specify any of these options sourceURL = app.Flag("source-url", "URL to a source server to download SPEC sources from.").String() @@ -215,19 +216,20 @@ func main() { packList, err := packagelist.ParsePackageList(*srpmPackList) logger.PanicOnError(err) - err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) + err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *kernelMacrosFile, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) logger.PanicOnError(err) } // createAllSRPMsWrapper wraps createAllSRPMs to conditionally run it inside a chroot. // If workerTar is non-empty, packing will occur inside a chroot, otherwise it will run on the host system. -func createAllSRPMsWrapper(specsDir, distTag, buildDir, outDir, workerTar string, workers, concurrentNetOps uint, nestedSourcesDir, repackAll, runCheck bool, packList map[string]bool, templateSrcConfig sourceRetrievalConfiguration) (err error) { +// kernelMacrosFile, if non-empty, is made available inside the chroot so rpmbuild can use it while packing SRPMs. +func createAllSRPMsWrapper(specsDir, distTag, buildDir, outDir, workerTar, kernelMacrosFile string, workers, concurrentNetOps uint, nestedSourcesDir, repackAll, runCheck bool, packList map[string]bool, templateSrcConfig sourceRetrievalConfiguration) (err error) { var chroot *safechroot.Chroot originalOutDir := outDir if workerTar != "" { const leaveFilesOnDisk = false useAzureCliAuth := templateSrcConfig.sourceAuthMode == sourceAuthModeAzureCli - chroot, buildDir, outDir, specsDir, err = createChroot(workerTar, buildDir, outDir, specsDir, useAzureCliAuth) + chroot, buildDir, outDir, specsDir, err = createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile, useAzureCliAuth) if err != nil { return } @@ -317,7 +319,8 @@ func findSPECFiles(specsDir string, packList map[string]bool) (specFiles []strin } // createChroot creates a chroot to pack SRPMs inside of. -func createChroot(workerTar, buildDir, outDir, specsDir string, useAzureCliAuth bool) (chroot *safechroot.Chroot, newBuildDir, newOutDir, newSpecsDir string, err error) { +// If kernelMacrosFile is non-empty, it will be copied into the default RPM macros directory inside the chroot. +func createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile string, useAzureCliAuth bool) (chroot *safechroot.Chroot, newBuildDir, newOutDir, newSpecsDir string, err error) { const ( chrootName = "srpmpacker_chroot" existingDir = false @@ -385,6 +388,33 @@ func createChroot(workerTar, buildDir, outDir, specsDir string, useAzureCliAuth } } + // If a kernel macros file is provided, copy it into the default RPM macros directory + // inside the chroot so rpmbuild picks it up automatically when packing SRPMs. + if kernelMacrosFile != "" { + macroDir, macroErr := rpm.GetMacroDir() + if macroErr != nil { + logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) + return + } + + macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + + mkdirErr := directory.EnsureDirExists(macrosDestDir) + if mkdirErr != nil { + logger.Log.Errorf("Failed to create macros directory inside chroot (%s): %s", macrosDestDir, mkdirErr) + return + } + + copyErr := file.Copy(kernelMacrosFile, macrosDestFile) + if copyErr != nil { + logger.Log.Errorf("Failed to copy kernel macros file into chroot (%s -> %s): %s", kernelMacrosFile, macrosDestFile, copyErr) + return + } + + logger.Log.Infof("Copied kernel macros file into SRPM chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + } + // Networking support is needed to download sources. files := []safechroot.FileToCopy{ {Src: "/etc/resolv.conf", Dest: "/etc/resolv.conf"}, From a8108f08457fae2b6b5b65c62b23517a0ce2afa1 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 11:47:56 -0800 Subject: [PATCH 04/86] create large macro file of all the specs instead --- SPECS/isert-hwe/isert-hwe.spec | 15 ++--- .../kernelverprocessor/kernelverprocessor.go | 62 ++++++++----------- 2 files changed, 35 insertions(+), 42 deletions(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 914e6319486..3afaf251838 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -28,8 +28,10 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version %KERNEL_HWE_VERSION -%global target_kernel_release %KERNEL_HWE_REL +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -40,8 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert-hwe} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,14 +68,14 @@ Summary: %{_name}-hwe Driver Name: isert-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 6%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/isert-%{_version}.tgz +Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -166,7 +167,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n isert-%{_version} +%setup -n isert-%{target_mlnx_ofa_kernel} set -- * mkdir source mv "$@" source/ diff --git a/toolkit/tools/kernelverprocessor/kernelverprocessor.go b/toolkit/tools/kernelverprocessor/kernelverprocessor.go index d0a19c0462f..4d4164eae68 100644 --- a/toolkit/tools/kernelverprocessor/kernelverprocessor.go +++ b/toolkit/tools/kernelverprocessor/kernelverprocessor.go @@ -15,7 +15,6 @@ import ( "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" - packagelist "github.com/microsoft/azurelinux/toolkit/tools/internal/packlist" "github.com/microsoft/azurelinux/toolkit/tools/internal/rpm" "github.com/microsoft/azurelinux/toolkit/tools/internal/timestamp" "github.com/microsoft/azurelinux/toolkit/tools/pkg/profile" @@ -25,29 +24,26 @@ import ( ) const ( - defaultWorkerCount = "100" - kernelHWESpecName = "kernel-hwe" - kernelHWEVerMacroName = "KERNEL_HWE_VERSION" - kernelHWERelMacroName = "KERNEL_HWE_REL" + defaultWorkerCount = "100" ) var ( - app = kingpin.New("kernelverprocessor", "A tool to determine dynamic kernel version") - specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") - output = exe.OutputFlag(app, "Output file to export the JSON") - workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() - distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() - targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() - logFlags = exe.SetupLogFlags(app) - profFlags = exe.SetupProfileFlags(app) - timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() - extraKernelVersionsToParse = []string{kernelHWESpecName} + app = kingpin.New("kernelverprocessor", "A tool to determine dynamic kernel version") + specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") + output = exe.OutputFlag(app, "Output file to export the JSON") + workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() + distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() + targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() + logFlags = exe.SetupLogFlags(app) + profFlags = exe.SetupProfileFlags(app) + timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() ) func main() { const ( querySrpm = `%{NAME}-%{VERSION}-%{RELEASE}.src.rpm` queryProvidedPackages = `rpm %{ARCH}/%{nvra}.rpm\n[provides %{PROVIDENEVRS}\n][requires %{REQUIRENEVRS}\n][arch %{ARCH}\n]` + prefix = "azl" ) app.Version(exe.ToolkitVersion) @@ -69,13 +65,6 @@ func main() { logger.PanicOnError(err) - // A parse list may be provided, if so only parse this subset. - // If none is provided, parse all specs. - kernelSpecListSet, err := packagelist.ParsePackageList(strings.Join(extraKernelVersionsToParse, " ")) - logger.PanicOnError(err) - - //err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, "", *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) - var buildArch string = *targetArch if *targetArch == "" { @@ -85,18 +74,19 @@ func main() { } } - kernelSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, kernelSpecListSet) + // Find all spec files + allSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, nil) if err != nil { logger.Log.Panicf("Error finding spec files: %s", err) return } - logger.Log.Infof("Processing kernel HWE spec files: %v", kernelSpecFiles) + logger.Log.Infof("Processing version and release for %d spec files into %s", len(allSpecFiles), *output) macros_output := []byte{} // Process each kernel flavour/type - for _, specFile := range kernelSpecFiles { + for _, specFile := range allSpecFiles { // Get kernel version-release from spec file @@ -105,40 +95,42 @@ func main() { sourceDir := filepath.Dir(specFile) noCheckDefines := rpm.DefaultDistroDefines(false, *distTag) - logger.Log.Infof("Processing kernel HWE spec files: %v %v", specFileName, sourceDir) - versionRelease, err := rpm.QuerySPEC(specFile, sourceDir, `%{VERSION}-%{RELEASE}`, buildArch, noCheckDefines, rpm.QueryHeaderArgument) if err != nil { - logger.Log.Errorf("Failed to query kernel-hwe spec file (%s). Error: %s", specFileName, err) + logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) continue } - logger.Log.Infof("kernel-hwe version-release: %s", versionRelease) logger.PanicOnError(err) if len(versionRelease) == 0 { - logger.Log.Errorf("Invalid version-release retrieved from kernel-hwe spec file (%s): %s", specFileName, versionRelease) + logger.Log.Errorf("Invalid version-release retrieved from spec file (%s): %s", specFileName, versionRelease) continue } releaseVerSplit := strings.Split(versionRelease[0], "-") if len(releaseVerSplit) < 2 { - logger.Log.Errorf("Invalid version-release format retrieved from kernel-hwe spec file (%s): %s", specFileName, versionRelease[0]) + logger.Log.Errorf("Invalid version-release format retrieved from spec file (%s): %s", specFileName, versionRelease[0]) continue - } version := releaseVerSplit[0] release := releaseVerSplit[1] releaseClean := strings.SplitN(release, ".", 2)[0] // Includes distribution tag suffixes - logger.Log.Infof("Processed kernel-hwe version-release: %s %s", version, release) + // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' + specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) + specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") + specFileNameMacroFormat = strings.ToLower(specFileNameMacroFormat) + + versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" + releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" // Generate RPM macro definitions instead of modifying spec files directly. macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", - kernelHWEVerMacroName, version, - kernelHWERelMacroName, releaseClean, + versionMacroString, version, + releaseMacroString, releaseClean, ) macros_output = append(macros_output, []byte(macros)...) From 5e5351b693476a20063ddbed7322a41dda25bb4a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 11:57:18 -0800 Subject: [PATCH 05/86] fixing the spec --- SPECS/isert-hwe/isert-hwe.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 3afaf251838..982874aeb7e 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -42,7 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel}-1_%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default From cfeb421b5325b6df559ab3f113ddc625c22e0b98 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 13:21:18 -0800 Subject: [PATCH 06/86] renaming tool from kernel to generic --- toolkit/scripts/pkggen.mk | 22 +++++++++---------- toolkit/scripts/srpm_pack.mk | 12 +++++----- .../tools/scheduler/buildagents/definition.go | 2 +- toolkit/tools/scheduler/scheduler.go | 4 ++-- toolkit/tools/specreader/specreader.go | 4 ++-- toolkit/tools/srpmpacker/srpmpacker.go | 12 +++++----- .../versionsprocessor.go} | 16 ++++++++++++++ 7 files changed, 44 insertions(+), 28 deletions(-) rename toolkit/tools/{kernelverprocessor/kernelverprocessor.go => versionsprocessor/versionsprocessor.go} (89%) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 1031dcf74ee..9595aa32f54 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -33,7 +33,7 @@ validate-pkggen-config = $(STATUS_FLAGS_DIR)/validate-image-config-pkggen.flag # Outputs specs_file = $(PKGBUILD_DIR)/specs.json -kernel_macros_file = $(PKGBUILD_DIR)/macros.kernel +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 @@ -93,25 +93,25 @@ analyze-built-graph: $(go-graphanalytics) # 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. -$(kernel_macros_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-kernelverprocessor) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) - $(go-kernelverprocessor) \ +$(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-versionsprocessor) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) + $(go-versionsprocessor) \ --dir $(SPECS_DIR) \ --dist-tag $(DIST_TAG) \ $(logging_command) \ - --cpu-prof-file=$(PROFILE_DIR)/kernelverprocessor.cpu.pprof \ - --mem-prof-file=$(PROFILE_DIR)/kernelverprocessor.mem.pprof \ - --trace-file=$(PROFILE_DIR)/kernelverprocessor.trace \ + --cpu-prof-file=$(PROFILE_DIR)/versionsprocessor.cpu.pprof \ + --mem-prof-file=$(PROFILE_DIR)/versionsprocessor.mem.pprof \ + --trace-file=$(PROFILE_DIR)/versionsprocessor.trace \ $(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)/kernelverprocessor.jsonl \ + --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): $(kernel_macros_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)") \ @@ -122,7 +122,7 @@ $(specs_file): $(kernel_macros_file) $(chroot_worker) $(SPECS_DIR) $(build_specs --toolchain-rpms-dir="$(TOOLCHAIN_RPMS_DIR)" \ --dist-tag $(DIST_TAG) \ --worker-tar $(chroot_worker) \ - --kernel-macros-file $(kernel_macros_file) \ + --versions-macro-file $(rel_versions_macro_file) \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ $(logging_command) \ --cpu-prof-file=$(PROFILE_DIR)/specreader.cpu.pprof \ @@ -317,7 +317,7 @@ $(RPMS_DIR): @touch $@ endif -$(STATUS_FLAGS_DIR)/build-rpms.flag: $(kernel_macros_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) +$(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)" \ @@ -335,7 +335,7 @@ $(STATUS_FLAGS_DIR)/build-rpms.flag: $(kernel_macros_file) $(no_repo_acl) $(prep --distro-release-version="$(RELEASE_VERSION)" \ --distro-build-number="$(BUILD_NUMBER)" \ --rpmmacros-file="$(TOOLCHAIN_MANIFESTS_DIR)/macros.override" \ - --kernel-macros-file="$(kernel_macros_file)" \ + --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)") \ diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index 55875c2b7e5..12f61316321 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -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 -kernel_macros_file = $(PKGBUILD_DIR)/macros.kernel +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 @@ -79,7 +79,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: $(kernel_macros_file) $(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) \ @@ -90,7 +90,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(kernel_macros_file) $(chroot_worker) $(l --tls-cert=$(TLS_CERT) \ --tls-key=$(TLS_KEY) \ --build-dir=$(SRPM_BUILD_CHROOT_DIR) \ - --kernel-macros-file=$(kernel_macros_file) \ + --versions-macro-file=$(rel_versions_macro_file) \ --signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \ --worker-tar=$(chroot_worker) \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ @@ -118,7 +118,7 @@ $(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(kernel_macros_file) $(toolchai --tls-cert=$(TLS_CERT) \ --tls-key=$(TLS_KEY) \ --build-dir=$(SRPM_BUILD_CHROOT_DIR) \ - --kernel-macros-file=$(kernel_macros_file) \ + --versions-macro-file=$(kernel_macros_file) \ --signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \ --pack-list="$(toolchain_spec_list)" \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ diff --git a/toolkit/tools/scheduler/buildagents/definition.go b/toolkit/tools/scheduler/buildagents/definition.go index 87cd87b7d07..04db6a66adb 100644 --- a/toolkit/tools/scheduler/buildagents/definition.go +++ b/toolkit/tools/scheduler/buildagents/definition.go @@ -26,7 +26,7 @@ type BuildAgentConfig struct { DistroReleaseVersion string DistroBuildNumber string RpmmacrosFile string - KernelMacrosFile string + VersionsMacroFile string NoCleanup bool UseCcache bool diff --git a/toolkit/tools/scheduler/scheduler.go b/toolkit/tools/scheduler/scheduler.go index 6a10ba37d6f..1e7ce2b9508 100644 --- a/toolkit/tools/scheduler/scheduler.go +++ b/toolkit/tools/scheduler/scheduler.go @@ -76,7 +76,7 @@ var ( distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with.").Required().String() distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with.").Required().String() rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use.").ExistingFile() - kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while building packages.").ExistingFile() + versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() buildAttempts = app.Flag("build-attempts", "Sets the number of times to try building a package.").Default(defaultBuildAttempts).Int() checkAttempts = app.Flag("check-attempts", "Sets the minimum number of times to test a package if the tests fail.").Default(defaultCheckAttempts).Int() extraLayers = app.Flag("extra-layers", "Sets the number of additional layers in the graph beyond the goal packages to buid.").Default(defaultExtraLayers).Int() @@ -195,7 +195,7 @@ func main() { DistroReleaseVersion: *distroReleaseVersion, DistroBuildNumber: *distroBuildNumber, RpmmacrosFile: *rpmmacrosFile, - KernelMacrosFile: *kernelMacrosFile, + VersionsMacroFile: *versionsMacroFile, NoCleanup: *noCleanup, UseCcache: *useCcache, diff --git a/toolkit/tools/specreader/specreader.go b/toolkit/tools/specreader/specreader.go index dce469a84f0..75f9ea90403 100644 --- a/toolkit/tools/specreader/specreader.go +++ b/toolkit/tools/specreader/specreader.go @@ -29,7 +29,7 @@ var ( specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() output = exe.OutputFlag(app, "Output file to export the JSON") - kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while parsing.").ExistingFile() + versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while parsing specs.").ExistingFile() workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() @@ -75,6 +75,6 @@ func main() { specsAbsDir, err := filepath.Abs(*specsDir) logger.PanicOnError(err, "Unable to get absolute path for specs directory '%s': %s", *specsDir, err) - err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *kernelMacrosFile, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) + err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *versionsMacroFile, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) logger.PanicOnError(err) } diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 7921520c861..0288176b4ae 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -125,11 +125,11 @@ var ( srpmPackList = app.Flag("pack-list", "List of SPECs to pack. If empty will pack all SPECs.").Default("").String() runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() - workers = app.Flag("workers", "Number of concurrent goroutines to parse with.").Default(defaultWorkerCount).Uint() - concurrentNetOps = app.Flag("concurrent-net-ops", "Number of concurrent network operations to perform.").Default(defaultNetOpsCount).Uint() - repackAll = app.Flag("repack", "Rebuild all SRPMs, even if already built.").Bool() - nestedSourcesDir = app.Flag("nested-sources", "Set if for a given SPEC, its sources are contained in a SOURCES directory next to the SPEC file.").Bool() - kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while packing SRPMs.").String() + workers = app.Flag("workers", "Number of concurrent goroutines to parse with.").Default(defaultWorkerCount).Uint() + concurrentNetOps = app.Flag("concurrent-net-ops", "Number of concurrent network operations to perform.").Default(defaultNetOpsCount).Uint() + repackAll = app.Flag("repack", "Rebuild all SRPMs, even if already built.").Bool() + nestedSourcesDir = app.Flag("nested-sources", "Set if for a given SPEC, its sources are contained in a SOURCES directory next to the SPEC file.").Bool() + versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while packing SRPMs.").ExistingFile() // Use String() and not ExistingFile() as the Makefile may pass an empty string if the user did not specify any of these options sourceURL = app.Flag("source-url", "URL to a source server to download SPEC sources from.").String() @@ -216,7 +216,7 @@ func main() { packList, err := packagelist.ParsePackageList(*srpmPackList) logger.PanicOnError(err) - err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *kernelMacrosFile, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) + err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *versionsMacroFile, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) logger.PanicOnError(err) } diff --git a/toolkit/tools/kernelverprocessor/kernelverprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go similarity index 89% rename from toolkit/tools/kernelverprocessor/kernelverprocessor.go rename to toolkit/tools/versionsprocessor/versionsprocessor.go index 4d4164eae68..5ab206d7a97 100644 --- a/toolkit/tools/kernelverprocessor/kernelverprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -37,6 +37,7 @@ var ( logFlags = exe.SetupLogFlags(app) profFlags = exe.SetupProfileFlags(app) timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() + extraFiles = app.Flag("extra-macros-file", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() ) func main() { @@ -136,6 +137,21 @@ func main() { macros_output = append(macros_output, []byte(macros)...) } + // If extra files were provided, append their contents to the output as well. + for _, extraPath := range *extraFiles { + if strings.TrimSpace(extraPath) == "" { + continue + } + + contents, readErr := file.Read(extraPath) + if readErr != nil { + logger.Log.Errorf("Failed to read extra macros file (%s): %s", extraPath, readErr) + continue + } + + macros_output = append(macros_output, []byte(contents)...) + } + err = file.Write(string(macros_output), *output) if err != nil { logger.Log.Errorf("Failed to write file (%s)", *output) From 9352633113416c25efedcb2e44ef944f57b92738 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 13:40:08 -0800 Subject: [PATCH 07/86] missed renaming --- toolkit/scripts/tools.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/tools.mk b/toolkit/scripts/tools.mk index 2b8946895b4..feecf1c369e 100644 --- a/toolkit/scripts/tools.mk +++ b/toolkit/scripts/tools.mk @@ -62,7 +62,7 @@ go_tool_list = \ scheduler \ specarchchecker \ specreader \ - kernelverprocessor \ + versionsprocessor \ srpmpacker \ validatechroot \ From 944a67d84e0c243d9b076244f8021d29bc81358c Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 13:58:48 -0800 Subject: [PATCH 08/86] missed renaming --- toolkit/tools/pkgworker/pkgworker.go | 4 ++-- toolkit/tools/scheduler/buildagents/chrootagent.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index 8b0f9e915d1..340311b8919 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -53,7 +53,7 @@ var ( distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with").Required().String() distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with").Required().String() rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use").ExistingFile() - kernelMacrosFile = app.Flag("kernel-macros-file", "File containing kernel macros to use while building.").ExistingFile() + versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() runCheck = app.Flag("run-check", "Run the check during package build").Bool() packagesToInstall = app.Flag("install-package", "Filepaths to RPM packages that should be installed before building.").Strings() outArch = app.Flag("out-arch", "Architecture of resulting package").String() @@ -119,7 +119,7 @@ func main() { defines[rpm.MaxCPUDefine] = *maxCPU } - builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *kernelMacrosFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) + builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *versionsMacroFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) logger.FatalOnError(err, "Failed to build SRPM '%s'. For details see log file: %s .", *srpmFile, *logFlags.LogFile) // For regular (non-test) package builds: diff --git a/toolkit/tools/scheduler/buildagents/chrootagent.go b/toolkit/tools/scheduler/buildagents/chrootagent.go index 2f0dfb19526..6a9dac152e8 100644 --- a/toolkit/tools/scheduler/buildagents/chrootagent.go +++ b/toolkit/tools/scheduler/buildagents/chrootagent.go @@ -101,8 +101,8 @@ func serializeChrootBuildAgentConfig(config *BuildAgentConfig, basePackageName, serializedArgs = append(serializedArgs, fmt.Sprintf("--rpmmacros-file=%s", config.RpmmacrosFile)) } - if config.KernelMacrosFile != "" { - serializedArgs = append(serializedArgs, fmt.Sprintf("--kernel-macros-file=%s", config.KernelMacrosFile)) + if config.VersionsMacroFile != "" { + serializedArgs = append(serializedArgs, fmt.Sprintf("--versions-macro-file=%s", config.VersionsMacroFile)) } if config.NoCleanup { From 6a1e2c125b149d3ee18e8b231972efc6d1663524 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:09:56 -0800 Subject: [PATCH 09/86] allow adding extra macro files --- toolkit/Makefile | 2 ++ toolkit/scripts/pkggen.mk | 1 + toolkit/tools/versionsprocessor/versionsprocessor.go | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/toolkit/Makefile b/toolkit/Makefile index f65636fe78d..6690db8bca2 100644 --- a/toolkit/Makefile +++ b/toolkit/Makefile @@ -33,6 +33,8 @@ TEST_RUN_LIST ?= TEST_RERUN_LIST ?= ##help:var:TEST_IGNORE_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: =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 ?= ######## SET INCREMENTAL BUILD FLAGS ######## diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 9595aa32f54..26e6fec4332 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -101,6 +101,7 @@ $(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build --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-files=$(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) \ diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 5ab206d7a97..c4db1a3fd3a 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -37,7 +37,7 @@ var ( logFlags = exe.SetupLogFlags(app) profFlags = exe.SetupProfileFlags(app) timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() - extraFiles = app.Flag("extra-macros-file", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() + extraFiles = app.Flag("extra-macros-files", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() ) func main() { @@ -150,6 +150,7 @@ func main() { } macros_output = append(macros_output, []byte(contents)...) + logger.Log.Infof("Appended contents %s of extra macros file (%s)", contents, extraPath) } err = file.Write(string(macros_output), *output) From 432266e84d8d7bb212341ca4d81752681c7e4e00 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:11:36 -0800 Subject: [PATCH 10/86] update comment --- toolkit/scripts/pkggen.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 26e6fec4332..19a25ff3574 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -90,9 +90,7 @@ analyze-built-graph: $(go-graphanalytics) exit 1; \ fi -# 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. +# 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) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) $(go-versionsprocessor) \ --dir $(SPECS_DIR) \ From 82276639975fcd4f378424ca4d8b541047e443e2 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:16:08 -0800 Subject: [PATCH 11/86] make sure we package the macros file --- toolkit/scripts/toolkit.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index aa8fe439708..bd95c96b2dd 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -24,6 +24,7 @@ toolkit_version = $(RELEASE_VERSION)-$(build_arch) 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_macros_file = $(PKGBUILD_DIR)/macros.releaseversions rpms_snapshot_per_specs = $(rpms_snapshot_build_dir)/$(specs_dir_name)_$(rpms_snapshot_name) valid_arch_spec_names_build_dir = $(BUILD_DIR)/valid_arch_spec_names @@ -84,6 +85,7 @@ $(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_componen cp $(mariner_repos_files) $(toolkit_repos_dir) && \ cp $(toolkit_component_extra_files) $(toolkit_prep_dir) && \ cp $(go_tool_targets) $(toolkit_tools_dir) && \ + cp $(rpms_macros_file) $(toolkit_prep_dir) && \ rm -rf $(toolkit_prep_dir)/out && \ tar -cvp -f $(toolkit_archive) -C $(dir $(toolkit_prep_dir)) $(notdir $(toolkit_prep_dir)) @@ -92,6 +94,7 @@ rpms-snapshot: $(rpms_snapshot) $(rpms_snapshot): $(rpms_snapshot_per_specs) $(depend_SPECS_DIR) cp $(rpms_snapshot_per_specs) $(rpms_snapshot) + cp $(rpms_macros_file) $(rpm_snapshot) $(rpms_snapshot_per_specs): $(go-rpmssnapshot) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) @mkdir -p "$(rpms_snapshot_build_dir)" From 295a5ba54d7ec333b57a1bd27bdc5821aa0b9af5 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:17:22 -0800 Subject: [PATCH 12/86] renaming --- toolkit/scripts/toolkit.mk | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index bd95c96b2dd..304a4995547 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -24,7 +24,7 @@ toolkit_version = $(RELEASE_VERSION)-$(build_arch) 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_macros_file = $(PKGBUILD_DIR)/macros.releaseversions +rel_versions_macro_file = $(PKGBUILD_DIR)/macros.releaseversions rpms_snapshot_per_specs = $(rpms_snapshot_build_dir)/$(specs_dir_name)_$(rpms_snapshot_name) valid_arch_spec_names_build_dir = $(BUILD_DIR)/valid_arch_spec_names @@ -73,6 +73,7 @@ $(toolkit_archive_versioned_compressed): $(toolkit_archive) $(rpms_snapshot) $(d cp $(toolkit_archive) $(toolkit_archive_versioned) && \ echo "$(toolkit_version)" > $(toolkit_release_file) && \ cp $(rpms_snapshot) $(toolkit_rpms_snapshot_file) && \ + cp $(rel_versions_macro_file) $(toolkit_prep_dir) && \ 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) @@ -94,7 +95,7 @@ rpms-snapshot: $(rpms_snapshot) $(rpms_snapshot): $(rpms_snapshot_per_specs) $(depend_SPECS_DIR) cp $(rpms_snapshot_per_specs) $(rpms_snapshot) - cp $(rpms_macros_file) $(rpm_snapshot) + cp $(rel_versions_macro_file) $(rpms_snapshot) $(rpms_snapshot_per_specs): $(go-rpmssnapshot) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) @mkdir -p "$(rpms_snapshot_build_dir)" From df0b9e6aff8b1f1e93694a5b62cae83711527aed Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:19:59 -0800 Subject: [PATCH 13/86] move the copy command --- toolkit/scripts/toolkit.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 304a4995547..b31431ce5d7 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -74,6 +74,7 @@ $(toolkit_archive_versioned_compressed): $(toolkit_archive) $(rpms_snapshot) $(d echo "$(toolkit_version)" > $(toolkit_release_file) && \ cp $(rpms_snapshot) $(toolkit_rpms_snapshot_file) && \ cp $(rel_versions_macro_file) $(toolkit_prep_dir) && \ + cp $(rpms_macros_file) $(toolkit_prep_dir) && \ 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) @@ -86,7 +87,6 @@ $(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_componen cp $(mariner_repos_files) $(toolkit_repos_dir) && \ cp $(toolkit_component_extra_files) $(toolkit_prep_dir) && \ cp $(go_tool_targets) $(toolkit_tools_dir) && \ - cp $(rpms_macros_file) $(toolkit_prep_dir) && \ rm -rf $(toolkit_prep_dir)/out && \ tar -cvp -f $(toolkit_archive) -C $(dir $(toolkit_prep_dir)) $(notdir $(toolkit_prep_dir)) @@ -95,7 +95,6 @@ rpms-snapshot: $(rpms_snapshot) $(rpms_snapshot): $(rpms_snapshot_per_specs) $(depend_SPECS_DIR) cp $(rpms_snapshot_per_specs) $(rpms_snapshot) - cp $(rel_versions_macro_file) $(rpms_snapshot) $(rpms_snapshot_per_specs): $(go-rpmssnapshot) $(chroot_worker) $(local_specs) $(local_spec_dirs) $(SPECS_DIR) @mkdir -p "$(rpms_snapshot_build_dir)" From 28146874a71f58840353bbc30e5dcbd1771e7c0b Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:32:23 -0800 Subject: [PATCH 14/86] finish renaming the files --- toolkit/scripts/srpm_pack.mk | 4 ++-- .../pkg/specreaderutils/specreaderutil.go | 22 +++++++++---------- toolkit/tools/pkgworker/pkgworker.go | 12 +++++----- toolkit/tools/srpmpacker/srpmpacker.go | 22 +++++++++---------- .../versionsprocessor/versionsprocessor.go | 8 +++---- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index 12f61316321..4202a7788c5 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -107,7 +107,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(rel_versions_macro_file) $(chroot_worker --timestamp-file=$(TIMESTAMP_DIR)/srpm_packer.jsonl && \ touch $@ -$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(kernel_macros_file) $(toolchain_files) $(go-srpmpacker) +$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(rel_versions_macro_file) $(toolchain_files) $(go-srpmpacker) GODEBUG=netdns=go $(go-srpmpacker) \ --dir=$(SPECS_DIR) \ --output-dir=$(BUILD_SRPMS_DIR) \ @@ -118,7 +118,7 @@ $(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(kernel_macros_file) $(toolchai --tls-cert=$(TLS_CERT) \ --tls-key=$(TLS_KEY) \ --build-dir=$(SRPM_BUILD_CHROOT_DIR) \ - --versions-macro-file=$(kernel_macros_file) \ + --versions-macro-file=$(rel_versions_macro_file) \ --signature-handling=$(SRPM_FILE_SIGNATURE_HANDLING) \ --pack-list="$(toolchain_spec_list)" \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 6692394f350..443654a8eb2 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -58,8 +58,8 @@ type parseResult struct { // ParseSPECsWrapper wraps parseSPECs to conditionally run it inside a chroot. // If workerTar is non-empty, parsing will occur inside a chroot, otherwise it will run on the host system. -// kernelMacrosFile, if non-empty, is made available inside the chroot at the same path as on the host. -func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, distTag, outputFile, workerTar, kernelMacrosFile, targetArch string, specListSet map[string]bool, toolchainRPMs []string, workers int, runCheck bool) (err error) { +// releaseVersionMacrosFile, if non-empty, is made available inside the chroot at the same path as on the host. +func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, distTag, outputFile, workerTar, releaseVersionMacrosFile, targetArch string, specListSet map[string]bool, toolchainRPMs []string, workers int, runCheck bool) (err error) { var ( chroot *safechroot.Chroot packageRepo *pkgjson.PackageRepo @@ -67,7 +67,7 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist if workerTar != "" { const leaveFilesOnDisk = false - chroot, err = createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile) + chroot, err = createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile) if err != nil { return } @@ -127,8 +127,8 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist } // createChroot creates a chroot to parse SPECs inside of. -// If kernelMacrosFile is non-empty, its parent directory is also made available inside the chroot. -func createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile string) (chroot *safechroot.Chroot, err error) { +// If releaseVersionMacrosFile is non-empty, its parent directory is also made available inside the chroot. +func createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile string) (chroot *safechroot.Chroot, err error) { const ( chrootName = "specparser_chroot" existingDir = false @@ -169,9 +169,9 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile stri } } - // If a kernel macros file is provided, copy it into the default RPM macros directory + // 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 kernelMacrosFile != "" { + if releaseVersionMacrosFile != "" { macroDir, macroErr := rpm.GetMacroDir() if macroErr != nil { logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) @@ -180,7 +180,7 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile stri // Destination path inside the chroot (same path as on the host). macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) // Ensure destination directory exists and copy the file. mkdirErr := directory.EnsureDirExists(macrosDestDir) @@ -189,13 +189,13 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir, kernelMacrosFile stri return } - copyErr := file.Copy(kernelMacrosFile, macrosDestFile) + copyErr := file.Copy(releaseVersionMacrosFile, macrosDestFile) if copyErr != nil { - logger.Log.Errorf("Failed to copy kernel macros file into chroot (%s -> %s): %s", kernelMacrosFile, macrosDestFile, copyErr) + logger.Log.Errorf("Failed to copy release version macros file into chroot (%s -> %s): %s", releaseVersionMacrosFile, macrosDestFile, copyErr) return } - logger.Log.Infof("Copied kernel macros file into chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + logger.Log.Infof("Copied release version macros file into chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } return diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index 340311b8919..4090463ef55 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -156,7 +156,7 @@ func isCCacheEnabled(ccacheManager *ccachemanager.CCacheManager) bool { return ccacheManager != nil && ccacheManager.CurrentPkgGroup.Enabled } -func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmFile, repoFile, rpmmacrosFile, kernelMacrosFile, outArch string, defines map[string]string, noCleanup, runCheck bool, packagesToInstall []string, ccacheManager *ccachemanager.CCacheManager, timeout time.Duration) (builtRPMs []string, err error) { +func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmFile, repoFile, rpmmacrosFile, releaseVersionMacrosFile, outArch string, defines map[string]string, noCleanup, runCheck bool, packagesToInstall []string, ccacheManager *ccachemanager.CCacheManager, timeout time.Duration) (builtRPMs []string, err error) { const ( buildHeartbeatTimeout = 30 * time.Minute @@ -221,7 +221,7 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF return } - if kernelMacrosFile != "" { + if releaseVersionMacrosFile != "" { macroDir, macroErr := rpm.GetMacroDir() if macroErr != nil { err = fmt.Errorf("failed to get RPM macros directory: %w", macroErr) @@ -229,7 +229,7 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF } macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) macroErr = directory.EnsureDirExists(macrosDestDir) if macroErr != nil { @@ -237,13 +237,13 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF return } - macroErr = file.Copy(kernelMacrosFile, macrosDestFile) + macroErr = file.Copy(releaseVersionMacrosFile, macrosDestFile) if macroErr != nil { - err = fmt.Errorf("failed to copy kernel macros file into chroot: %w", macroErr) + err = fmt.Errorf("failed to copy release version macros file into chroot: %w", macroErr) return } - logger.Log.Infof("Copied kernel macros file into pkgworker chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + logger.Log.Infof("Copied release version macros file into pkgworker chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } defer chroot.Close(noCleanup) diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 0288176b4ae..0f5d5ecc743 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -222,14 +222,14 @@ func main() { // createAllSRPMsWrapper wraps createAllSRPMs to conditionally run it inside a chroot. // If workerTar is non-empty, packing will occur inside a chroot, otherwise it will run on the host system. -// kernelMacrosFile, if non-empty, is made available inside the chroot so rpmbuild can use it while packing SRPMs. -func createAllSRPMsWrapper(specsDir, distTag, buildDir, outDir, workerTar, kernelMacrosFile string, workers, concurrentNetOps uint, nestedSourcesDir, repackAll, runCheck bool, packList map[string]bool, templateSrcConfig sourceRetrievalConfiguration) (err error) { +// releaseVersionMacrosFile, if non-empty, is made available inside the chroot so rpmbuild can use it while packing SRPMs. +func createAllSRPMsWrapper(specsDir, distTag, buildDir, outDir, workerTar, releaseVersionMacrosFile string, workers, concurrentNetOps uint, nestedSourcesDir, repackAll, runCheck bool, packList map[string]bool, templateSrcConfig sourceRetrievalConfiguration) (err error) { var chroot *safechroot.Chroot originalOutDir := outDir if workerTar != "" { const leaveFilesOnDisk = false useAzureCliAuth := templateSrcConfig.sourceAuthMode == sourceAuthModeAzureCli - chroot, buildDir, outDir, specsDir, err = createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile, useAzureCliAuth) + chroot, buildDir, outDir, specsDir, err = createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFile, useAzureCliAuth) if err != nil { return } @@ -319,8 +319,8 @@ func findSPECFiles(specsDir string, packList map[string]bool) (specFiles []strin } // createChroot creates a chroot to pack SRPMs inside of. -// If kernelMacrosFile is non-empty, it will be copied into the default RPM macros directory inside the chroot. -func createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile string, useAzureCliAuth bool) (chroot *safechroot.Chroot, newBuildDir, newOutDir, newSpecsDir string, err error) { +// If releaseVersionMacrosFile is non-empty, it will be copied into the default RPM macros directory inside the chroot. +func createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFile string, useAzureCliAuth bool) (chroot *safechroot.Chroot, newBuildDir, newOutDir, newSpecsDir string, err error) { const ( chrootName = "srpmpacker_chroot" existingDir = false @@ -388,9 +388,9 @@ func createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile string } } - // If a kernel macros file is provided, copy it into the default RPM macros directory + // If a release version macros file is provided, copy it into the default RPM macros directory // inside the chroot so rpmbuild picks it up automatically when packing SRPMs. - if kernelMacrosFile != "" { + if releaseVersionMacrosFile != "" { macroDir, macroErr := rpm.GetMacroDir() if macroErr != nil { logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) @@ -398,7 +398,7 @@ func createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile string } macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(kernelMacrosFile)) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) mkdirErr := directory.EnsureDirExists(macrosDestDir) if mkdirErr != nil { @@ -406,13 +406,13 @@ func createChroot(workerTar, buildDir, outDir, specsDir, kernelMacrosFile string return } - copyErr := file.Copy(kernelMacrosFile, macrosDestFile) + copyErr := file.Copy(releaseVersionMacrosFile, macrosDestFile) if copyErr != nil { - logger.Log.Errorf("Failed to copy kernel macros file into chroot (%s -> %s): %s", kernelMacrosFile, macrosDestFile, copyErr) + logger.Log.Errorf("Failed to copy release version macros file into chroot (%s -> %s): %s", releaseVersionMacrosFile, macrosDestFile, copyErr) return } - logger.Log.Infof("Copied kernel macros file into SRPM chroot (%s -> %s)", kernelMacrosFile, macrosDestFile) + logger.Log.Infof("Copied release version macros file into SRPM chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } // Networking support is needed to download sources. diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index c4db1a3fd3a..61b26e5371d 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -28,7 +28,7 @@ const ( ) var ( - app = kingpin.New("kernelverprocessor", "A tool to determine dynamic kernel version") + app = kingpin.New("versionsprocessor", "A tool to generate a macro file of all specs version and release") specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") output = exe.OutputFlag(app, "Output file to export the JSON") workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() @@ -57,7 +57,7 @@ func main() { } defer prof.StopProfiler() - timestamp.BeginTiming("kernelverprocessor", *timestampFile) + timestamp.BeginTiming("versionsprocessor", *timestampFile) defer timestamp.CompleteTiming() if *workers <= 0 { @@ -86,10 +86,10 @@ func main() { macros_output := []byte{} - // Process each kernel flavour/type + // Process all specs files for _, specFile := range allSpecFiles { - // Get kernel version-release from spec file + // Get spec file version-release specFileName := filepath.Base(specFile) From 3b55211c98517eb345e0e773f3d86d7badcb66cb Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 14:44:58 -0800 Subject: [PATCH 15/86] remove unused var --- toolkit/tools/versionsprocessor/versionsprocessor.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 61b26e5371d..570f5ffc404 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -23,15 +23,10 @@ import ( "gopkg.in/alecthomas/kingpin.v2" ) -const ( - defaultWorkerCount = "100" -) - var ( app = kingpin.New("versionsprocessor", "A tool to generate a macro file of all specs version and release") specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") output = exe.OutputFlag(app, "Output file to export the JSON") - workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() logFlags = exe.SetupLogFlags(app) @@ -60,10 +55,6 @@ func main() { timestamp.BeginTiming("versionsprocessor", *timestampFile) defer timestamp.CompleteTiming() - if *workers <= 0 { - logger.Log.Panicf("Value in --workers must be greater than zero. Found %d", *workers) - } - logger.PanicOnError(err) var buildArch string = *targetArch From c948fb9ced4b299a44f3a688bdf8d2184d3cd8ea Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 15:13:49 -0800 Subject: [PATCH 16/86] parse version files within a chroot environment --- toolkit/scripts/pkggen.mk | 2 + .../versionsprocessor/versionsprocessor.go | 158 +++++++++++++----- 2 files changed, 117 insertions(+), 43 deletions(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 19a25ff3574..5f20e3ed456 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -96,6 +96,8 @@ $(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build --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 \ diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 570f5ffc404..f8c12dc8abc 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -12,10 +12,13 @@ import ( "runtime" "strings" + "github.com/microsoft/azurelinux/toolkit/tools/internal/buildpipeline" + "github.com/microsoft/azurelinux/toolkit/tools/internal/directory" "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" "github.com/microsoft/azurelinux/toolkit/tools/internal/rpm" + "github.com/microsoft/azurelinux/toolkit/tools/internal/safechroot" "github.com/microsoft/azurelinux/toolkit/tools/internal/timestamp" "github.com/microsoft/azurelinux/toolkit/tools/pkg/profile" "github.com/microsoft/azurelinux/toolkit/tools/pkg/specreaderutils" @@ -29,8 +32,10 @@ var ( output = exe.OutputFlag(app, "Output file to export the JSON") distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() + buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() logFlags = exe.SetupLogFlags(app) profFlags = exe.SetupProfileFlags(app) + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() extraFiles = app.Flag("extra-macros-files", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() ) @@ -42,6 +47,11 @@ func main() { prefix = "azl" ) + var ( + chroot *safechroot.Chroot + macros_output []byte + ) + app.Version(exe.ToolkitVersion) kingpin.MustParse(app.Parse(os.Args[1:])) logger.InitBestEffort(logFlags) @@ -66,66 +76,85 @@ func main() { } } - // Find all spec files - allSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, nil) - if err != nil { - logger.Log.Panicf("Error finding spec files: %s", err) - return + if *workerTar != "" { + const leaveFilesOnDisk = false + chroot, err = createChroot(*workerTar, *buildDir, *specsDir) + if err != nil { + return + } + defer chroot.Close(leaveFilesOnDisk) } - logger.Log.Infof("Processing version and release for %d spec files into %s", len(allSpecFiles), *output) + doParse := func() error { + var parseError error + + // Find all spec files + allSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, nil) + if err != nil { + logger.Log.Panicf("Error finding spec files: %s", err) + return err + } + + logger.Log.Infof("Processing version and release for %d spec files into %s", len(allSpecFiles), *output) - macros_output := []byte{} + // Process all specs files + for _, specFile := range allSpecFiles { - // Process all specs files - for _, specFile := range allSpecFiles { + // Get spec file version-release - // Get spec file version-release + specFileName := filepath.Base(specFile) - specFileName := filepath.Base(specFile) + sourceDir := filepath.Dir(specFile) + noCheckDefines := rpm.DefaultDistroDefines(false, *distTag) - sourceDir := filepath.Dir(specFile) - noCheckDefines := rpm.DefaultDistroDefines(false, *distTag) + versionRelease, err := rpm.QuerySPEC(specFile, sourceDir, `%{VERSION}-%{RELEASE}`, buildArch, noCheckDefines, rpm.QueryHeaderArgument) + if err != nil { + logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) + continue + } - versionRelease, err := rpm.QuerySPEC(specFile, sourceDir, `%{VERSION}-%{RELEASE}`, buildArch, noCheckDefines, rpm.QueryHeaderArgument) - if err != nil { - logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) - continue - } + logger.PanicOnError(err) - logger.PanicOnError(err) + if len(versionRelease) == 0 { + logger.Log.Errorf("Invalid version-release retrieved from spec file (%s): %s", specFileName, versionRelease) + continue + } - if len(versionRelease) == 0 { - logger.Log.Errorf("Invalid version-release retrieved from spec file (%s): %s", specFileName, versionRelease) - continue - } + releaseVerSplit := strings.Split(versionRelease[0], "-") - releaseVerSplit := strings.Split(versionRelease[0], "-") + if len(releaseVerSplit) < 2 { + logger.Log.Errorf("Invalid version-release format retrieved from spec file (%s): %s", specFileName, versionRelease[0]) + continue + } - if len(releaseVerSplit) < 2 { - logger.Log.Errorf("Invalid version-release format retrieved from spec file (%s): %s", specFileName, versionRelease[0]) - continue - } + version := releaseVerSplit[0] + release := releaseVerSplit[1] + releaseClean := strings.SplitN(release, ".", 2)[0] // Includes distribution tag suffixes - version := releaseVerSplit[0] - release := releaseVerSplit[1] - releaseClean := strings.SplitN(release, ".", 2)[0] // Includes distribution tag suffixes + // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' + specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) + specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") + specFileNameMacroFormat = strings.ToLower(specFileNameMacroFormat) - // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' - specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) - specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") - specFileNameMacroFormat = strings.ToLower(specFileNameMacroFormat) + versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" + releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" - versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" - releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" + // Generate RPM macro definitions instead of modifying spec files directly. + macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", + versionMacroString, version, + releaseMacroString, releaseClean, + ) - // Generate RPM macro definitions instead of modifying spec files directly. - macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", - versionMacroString, version, - releaseMacroString, releaseClean, - ) + macros_output = append(macros_output, []byte(macros)...) + } + + return parseError + } - macros_output = append(macros_output, []byte(macros)...) + if chroot != nil { + err = chroot.Run(doParse) + } else { + err = doParse() } // If extra files were provided, append their contents to the output as well. @@ -149,5 +178,48 @@ func main() { logger.Log.Errorf("Failed to write file (%s)", *output) return } +} + +// createChroot creates a chroot to parse SPECs inside of. +func createChroot(workerTar, buildDir, specsDir string) (chroot *safechroot.Chroot, err error) { + const ( + chrootName = "versionprocessor_chroot" + existingDir = false + leaveFilesOnDisk = false + ) + + // Mount the specs and srpms directories to an identical path inside the chroot. + // Since versionsprocessor saves the full paths to specs in its output that grapher will then consume, + // the pathing needs to be preserved from the host system. + var extraDirectories []string + + extraMountPoints := []*safechroot.MountPoint{ + safechroot.NewMountPoint(specsDir, specsDir, "", safechroot.BindMountPointFlags, ""), + } + + chrootDir := filepath.Join(buildDir, chrootName) + chroot = safechroot.NewChroot(chrootDir, existingDir) + + err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true) + if err != nil { + return + } + + // If this is not a regular build then copy in all of the SPECs since there are no bind mounts. + if !buildpipeline.IsRegularBuild() { + dirsToCopy := []string{specsDir} + for _, dir := range dirsToCopy { + dirInChroot := filepath.Join(chroot.RootDir(), dir) + err = directory.CopyContents(dir, dirInChroot) + if err != nil { + closeErr := chroot.Close(leaveFilesOnDisk) + if closeErr != nil { + logger.Log.Errorf("Failed to close chroot, err: %s", err) + } + return + } + } + } + return } From e5f69899d9fdd536534137c0e6685d4c0dc9a870 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 15:34:56 -0800 Subject: [PATCH 17/86] fix processing of release --- SPECS/isert-hwe/isert-hwe.spec | 6 +++--- toolkit/tools/versionsprocessor/versionsprocessor.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 982874aeb7e..b3a764b34f0 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -30,7 +30,7 @@ # hard code versions due to ADO bug:58993948 %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version %global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -42,7 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel}-1_%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -68,7 +68,7 @@ Summary: %{_name}-hwe Driver Name: isert-hwe Version: 25.07 -Release: 6%{release_suffix}%{?dist} +Release: 10%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index f8c12dc8abc..9bd3b88fb8f 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -129,7 +129,7 @@ func main() { version := releaseVerSplit[0] release := releaseVerSplit[1] - releaseClean := strings.SplitN(release, ".", 2)[0] // Includes distribution tag suffixes + releaseClean := strings.Replace(release, ".azl3", "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) From d66402e098fcc3167e2bb30ddb2af9bca2dec575 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 15:35:54 -0800 Subject: [PATCH 18/86] fix spec --- SPECS/isert-hwe/isert-hwe.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index b3a764b34f0..1f8a2bb976c 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -75,7 +75,7 @@ Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel}.tgz +Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux From f19cda1f60f1b6965584b4a4a2b6ff3e6aaa192a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 26 Jan 2026 15:42:52 -0800 Subject: [PATCH 19/86] officially modify spec and make a changelog entry --- SPECS/isert-hwe/isert-hwe.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 1f8a2bb976c..78bb0e6fc7d 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -68,7 +68,7 @@ Summary: %{_name}-hwe Driver Name: isert-hwe Version: 25.07 -Release: 10%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -252,6 +252,9 @@ fi # 1 : closed %endif %changelog +* Mon Jan 26 2026 Mykhailo Bykhovtsev - 25.07-2_6.12.57.1.1 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 18 2025 Suresh Babu Chalamalasetty - 25.07-1_6.12.57.1.1 - Upgrade version to 25.07. - Enable build on x86_64 kernel hwe. From 41bb870c1ac2f05091e8c6e1a0c9efa81b9094c2 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 27 Jan 2026 14:43:49 -0800 Subject: [PATCH 20/86] add comment for the naming convention --- SPECS/isert-hwe/isert-hwe.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 2d0bec5656d..10f53608657 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -27,6 +27,8 @@ # %if 0%{azl} +# the naming convetion is azl__version and azl__release +# the package name will convert hyphens to underscores %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version From 52a6d00ce633177bc533dc91d39985ea1eaf9521 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 13:54:29 -0800 Subject: [PATCH 21/86] create new target to just generate macros file, use it during validation of CGmanifests --- .github/workflows/validate-cg-manifest.sh | 4 ++++ toolkit/scripts/pkggen.mk | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index 9da6278ea41..1644d066eb9 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -124,6 +124,10 @@ prepare_chroot_environment() { sudo cp -v "$macro_file" "$chroot_rpm_macros_dir_path" done + make -sC generate-versions-macros-file + echo "Copying the version/release macros file to the chroot." + sudo cp -v "build/pkg_artifacts/macros.releaseversions" "$chroot_rpm_macros_dir_path" + echo } diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 5f20e3ed456..8c3129a795c 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -51,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) From 66eb8d68c6f8ff88676e53f424ad05e1148dcc6d Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 13:58:37 -0800 Subject: [PATCH 22/86] make sure to run command within the toolkit dir --- .github/workflows/validate-cg-manifest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index 1644d066eb9..a87372baf2d 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -124,7 +124,7 @@ prepare_chroot_environment() { sudo cp -v "$macro_file" "$chroot_rpm_macros_dir_path" done - make -sC generate-versions-macros-file + make -sC toolkit generate-versions-macros-file echo "Copying the version/release macros file to the chroot." sudo cp -v "build/pkg_artifacts/macros.releaseversions" "$chroot_rpm_macros_dir_path" From 2b381949a0bfdad6dc1af9d643ab8f75ff38d210 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:03:40 -0800 Subject: [PATCH 23/86] move generating the macros file to the check --- .github/workflows/check-package-cgmanifest.yml | 4 ++++ .github/workflows/validate-cg-manifest.sh | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-package-cgmanifest.yml b/.github/workflows/check-package-cgmanifest.yml index 8305138c079..6e43a5bd652 100644 --- a/.github/workflows/check-package-cgmanifest.yml +++ b/.github/workflows/check-package-cgmanifest.yml @@ -51,6 +51,10 @@ jobs: if: ${{ env.updated-specs != '' }} run: sudo make -C toolkit -j$(nproc) chroot-tools REBUILD_TOOLS=y DAILY_BUILD_ID=lkg + - name: Generate the macros file with version/release info + if: ${{ env.updated-specs != '' }} + run: sudo make -C toolkit -j$(nproc) generate-versions-macros-file DAILY_BUILD_ID=lkg + - name: Check each spec if: ${{ env.updated-specs != '' }} run: .github/workflows/validate-cg-manifest.sh build/worker/worker_chroot.tar.gz ${{ env.updated-specs }} diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index a87372baf2d..9beb048c1ff 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -124,7 +124,6 @@ prepare_chroot_environment() { sudo cp -v "$macro_file" "$chroot_rpm_macros_dir_path" done - make -sC toolkit generate-versions-macros-file echo "Copying the version/release macros file to the chroot." sudo cp -v "build/pkg_artifacts/macros.releaseversions" "$chroot_rpm_macros_dir_path" From 667a29dee0c5da72e7dc97ac3fb55e9746223065 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:07:02 -0800 Subject: [PATCH 24/86] set rebuild tools --- .github/workflows/check-package-cgmanifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-package-cgmanifest.yml b/.github/workflows/check-package-cgmanifest.yml index 6e43a5bd652..6c10be17a69 100644 --- a/.github/workflows/check-package-cgmanifest.yml +++ b/.github/workflows/check-package-cgmanifest.yml @@ -53,7 +53,7 @@ jobs: - name: Generate the macros file with version/release info if: ${{ env.updated-specs != '' }} - run: sudo make -C toolkit -j$(nproc) generate-versions-macros-file DAILY_BUILD_ID=lkg + run: sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=lkg - name: Check each spec if: ${{ env.updated-specs != '' }} From e7e51da951d1fbb29d834de7081013bacfa5ffa1 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:17:20 -0800 Subject: [PATCH 25/86] build macros files outside --- .github/workflows/check-source-signatures.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index 7d697a2b046..0c81d5f7470 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -81,6 +81,8 @@ jobs: sudo make -C toolkit -j$(nproc) chroot-tools REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} + sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} + - name: Check for invalid source signatures run: | if [ -z "${{ env.changed_pkgs }}" ]; then @@ -89,7 +91,7 @@ jobs: fi set -x - if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }}; then + if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="build/pkg_artifacts/macros.releaseversions"; then set +x printf "\n\n******************************\n" echo "Failed to check the signatures of the modified packages." From d21204ae21aa70c9e6ffb729fa3dc661096e7bf9 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:28:14 -0800 Subject: [PATCH 26/86] try different path for the macros file --- .github/workflows/check-source-signatures.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index 0c81d5f7470..d09b242cfba 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -91,7 +91,7 @@ jobs: fi set -x - if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="build/pkg_artifacts/macros.releaseversions"; then + if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="./build/pkg_artifacts/macros.releaseversions"; then set +x printf "\n\n******************************\n" echo "Failed to check the signatures of the modified packages." From c5ce02f73edcc88e9d9a7e17b2c638d05ea3f29d Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:38:29 -0800 Subject: [PATCH 27/86] try finding the macros file --- .github/workflows/check-source-signatures.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index d09b242cfba..0f8c7726010 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -90,8 +90,16 @@ jobs: exit 0 fi + MACROS_RELEASEVERSIONS_PATH=$(find . -type f -path "*/build/pkg_artifacts/macros.releaseversions" -print -quit) + if [ -z "$MACROS_RELEASEVERSIONS_PATH" ]; then + echo "build/pkg_artifacts/macros.releaseversions not found." + exit 1 + fi + MACROS_RELEASEVERSIONS_PATH=$(realpath "$MACROS_RELEASEVERSIONS_PATH") + echo "Using macros.releaseversions at: $MACROS_RELEASEVERSIONS_PATH" + set -x - if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="./build/pkg_artifacts/macros.releaseversions"; then + if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="$MACROS_RELEASEVERSIONS_PATH"; then set +x printf "\n\n******************************\n" echo "Failed to check the signatures of the modified packages." From c67475904f9b417320a4d2c3f70c5d35ea42122d Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:39:01 -0800 Subject: [PATCH 28/86] fixing indentation --- .github/workflows/check-source-signatures.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index 0f8c7726010..ad7b9c4594f 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -92,9 +92,10 @@ jobs: MACROS_RELEASEVERSIONS_PATH=$(find . -type f -path "*/build/pkg_artifacts/macros.releaseversions" -print -quit) if [ -z "$MACROS_RELEASEVERSIONS_PATH" ]; then - echo "build/pkg_artifacts/macros.releaseversions not found." - exit 1 + echo "build/pkg_artifacts/macros.releaseversions not found." + exit 1 fi + MACROS_RELEASEVERSIONS_PATH=$(realpath "$MACROS_RELEASEVERSIONS_PATH") echo "Using macros.releaseversions at: $MACROS_RELEASEVERSIONS_PATH" From 29d14ea3132cb8f6623c8f7d975f8195ba0c8b07 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:46:55 -0800 Subject: [PATCH 29/86] tweak info log to not output too much information --- toolkit/tools/versionsprocessor/versionsprocessor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 9bd3b88fb8f..46ccc448d99 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -170,7 +170,7 @@ func main() { } macros_output = append(macros_output, []byte(contents)...) - logger.Log.Infof("Appended contents %s of extra macros file (%s)", contents, extraPath) + logger.Log.Infof("Appended contents of provided extra macros file (%s) to %s", extraPath, *output) } err = file.Write(string(macros_output), *output) From 66bbdfed532a952931ee2800eff9b02254d19ba8 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 14:51:35 -0800 Subject: [PATCH 30/86] make sure entagled check cat use macros file --- .github/workflows/check-entangled-specs.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/check-entangled-specs.yml b/.github/workflows/check-entangled-specs.yml index 74beaf4a13f..0d652e05e60 100644 --- a/.github/workflows/check-entangled-specs.yml +++ b/.github/workflows/check-entangled-specs.yml @@ -35,5 +35,11 @@ jobs: - name: Unit test for spec entanglement check run: PYTHONPATH=toolkit/scripts python3 toolkit/scripts/tests/test_check_entangled_specs.py + - name: Generate the macros file with version/release info + run: | + sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=lkg + + sudo cp -v ./build/pkg_artifacts/macros.releaseversions /usr/lib/rpm/macros.d/macros.releaseversions + - name: Run spec entanglement checking script run: python3 toolkit/scripts/check_entangled_specs.py . From 81bd406b973d7b8bdbdc34a7f4cbead735d270d4 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:09:15 -0800 Subject: [PATCH 31/86] tweak tangled specs script to use rpmspec instead of pyrpm --- toolkit/scripts/check_entangled_specs.py | 62 ++++++++++++---- .../tests/test_check_entangled_specs.py | 73 +++++++++---------- 2 files changed, 82 insertions(+), 53 deletions(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index 6a6e941266d..028a2c19aeb 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -6,11 +6,10 @@ from os import path from typing import FrozenSet, List, Set import argparse -import pprint +import subprocess +import shlex import sys -from pyrpm.spec import replace_macros, Spec - # Control output verbosity, keeping this module global since we do not # have a containing top-level scope verbose=False @@ -174,6 +173,47 @@ def print_verbose(message: str): if verbose: print(message) + +def _formatted_rpmspec_command(spec_path: str) -> str: + """Return a base rpmspec command string with common macro definitions. + + We rely on rpmspec (and thus rpm) to load macros from macros.d (such as + macros.releaseversions) so that all tags are fully macro-expanded. + """ + + # Match the defines used elsewhere in the toolkit when querying specs so + # that parsing is stable and deterministic. + source_dir = path.dirname(spec_path) + return ( + "rpmspec --parse " + "-D 'forgemeta %{{nil}}' " + "-D 'py3_dist X' " + "-D 'with_check 0' " + "-D 'dist .azl3' " + "-D '__python3 python3' " + f"-D '_sourcedir {source_dir}' " + "-D 'fillup_prereq fillup'" + ) + + +def read_spec_tag(spec_path: str, tag: str) -> str: + """Read a spec header tag using rpmspec with all macros expanded. + + This relies on rpm's own macro machinery (including macros.d) so that + tags like version, release, sdkver, and mstflintver are fully resolved + before comparison. + """ + + # rpmspec is case-insensitive for tag names, but normalize for clarity. + tag_name = tag.strip() + command = _formatted_rpmspec_command(spec_path) + rpmspec_cmd = f"{command} --srpm --qf '%{{{tag_name}}}' -q {spec_path}" + + raw_output = subprocess.check_output( + shlex.split(rpmspec_cmd), stderr=subprocess.DEVNULL + ) + return raw_output.decode("utf-8", errors="strict") + def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool: """Check if spec set violates matching rules for any of given tags. Return True/False accordingly.""" has_error = False @@ -181,11 +221,11 @@ def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool print_verbose(f"Processing group: {group}") spec_tag_map = {tag: {} for tag in tags} for spec_filename in group: - parsed_spec = Spec.from_file(path.join(base_path, spec_filename)) + spec_path = path.join(base_path, spec_filename) print_verbose(f"\t{spec_filename}") for tag, tag_current in tags.items(): - tag_value = get_tag_value(parsed_spec, tag) + tag_value = read_spec_tag(spec_path, tag) spec_tag_map[tag][spec_filename] = tag_value tag_want = f" (want: {tag_current})" if tag_current else "" print_verbose(f"\t\ttag({tag}) value: {tag_value}{tag_want}") @@ -203,9 +243,9 @@ def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool return has_error def check_matches(base_path: str): - kernel_headers_spec = Spec.from_file(path.join(base_path, "SPECS/kernel-headers/kernel-headers.spec")) - kernel_headers_version = get_tag_value(kernel_headers_spec, 'version') - kernel_headers_release = get_tag_value(kernel_headers_spec, 'release') + kernel_headers_spec_path = path.join(base_path, "SPECS/kernel-headers/kernel-headers.spec") + kernel_headers_version = read_spec_tag(kernel_headers_spec_path, 'version') + kernel_headers_release = read_spec_tag(kernel_headers_spec_path, 'release') kernel_version_release = f"{kernel_headers_version}-{kernel_headers_release}" groups_to_check = [({'mstflintver':{}}, mstflintver_matching_groups), @@ -222,12 +262,6 @@ def check_matches(base_path: str): sys.exit(1) print('Repository state is consistent with spec entanglement rules.') -def get_tag_value(spec: "Spec", tag: str) -> str: - value = getattr(spec, tag) - if value: - value = replace_macros(value, spec) - return value - def main(): global verbose diff --git a/toolkit/scripts/tests/test_check_entangled_specs.py b/toolkit/scripts/tests/test_check_entangled_specs.py index a1feb922bdf..bc9d9e531a4 100644 --- a/toolkit/scripts/tests/test_check_entangled_specs.py +++ b/toolkit/scripts/tests/test_check_entangled_specs.py @@ -11,81 +11,76 @@ class TestCheckSpecTags(unittest.TestCase): - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') - def test_check_spec_tags_no_errors(self, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["v1", "r1", "v1", "r1", - "v1.1", "r1.1", "v1.1", "r1.1"] - mock_from_file.return_value = MagicMock() + @patch('check_entangled_specs.read_spec_tag') + def test_check_spec_tags_no_errors(self, mock_read_spec_tag): + mock_read_spec_tag.side_effect = [ + "v1", "r1", "v1", "r1", + "v1.1", "r1.1", "v1.1", "r1.1", + ] base_path = "/fake/path" - tags = {"version":{}, "release":{}} - groups = [frozenset(["spec1.spec", "spec2.spec"]), - frozenset(["spec3.spec", "spec4.spec"])] + tags = {"version": {}, "release": {}} + groups = [ + frozenset(["spec1.spec", "spec2.spec"]), + frozenset(["spec3.spec", "spec4.spec"]), + ] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertFalse(result) - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') - def test_check_spec_tags_with_errors(self, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["v2", "r2", "v2.1", "r2.1"] - mock_from_file.return_value = MagicMock() + @patch('check_entangled_specs.read_spec_tag') + def test_check_spec_tags_with_errors(self, mock_read_spec_tag): + mock_read_spec_tag.side_effect = ["v2", "r2", "v2.1", "r2.1"] base_path = "/fake/path" - tags = {"version":"", "release":""} + tags = {"version": "", "release": ""} groups = [frozenset(["spec5.spec", "spec6.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertTrue(result) - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') - def test_check_spec_tags_with_expected_value(self, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["v3","v3"] - mock_from_file.return_value = MagicMock() + @patch('check_entangled_specs.read_spec_tag') + def test_check_spec_tags_with_expected_value(self, mock_read_spec_tag): + mock_read_spec_tag.side_effect = ["v3", "v3"] base_path = "/fake/path" - tags = {"version":"v3"} + tags = {"version": "v3"} groups = [frozenset(["spec7.spec", "spec8.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertFalse(result) - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') - def test_check_spec_tags_with_mismatched_expected_value(self, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["v4","v4"] - mock_from_file.return_value = MagicMock() + @patch('check_entangled_specs.read_spec_tag') + def test_check_spec_tags_with_mismatched_expected_value(self, mock_read_spec_tag): + mock_read_spec_tag.side_effect = ["v4", "v4"] base_path = "/fake/path" - tags = {"version":"v5"} + tags = {"version": "v5"} groups = [frozenset(["spec1.spec", "spec2.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertTrue(result) class TestCheckMatches(unittest.TestCase): - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') + + @patch('check_entangled_specs.read_spec_tag') @patch('check_entangled_specs.check_spec_tags') @patch('sys.exit') - def test_check_matches_no_errors(self, mock_exit, mock_check_spec_tags, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["1.0", "1"] - mock_from_file.return_value = MagicMock() - mock_check_spec_tags.side_effect = [ False, False, False, False, False ] + def test_check_matches_no_errors(self, mock_exit, mock_check_spec_tags, mock_read_spec_tag): + mock_read_spec_tag.side_effect = ["1.0", "1"] + mock_check_spec_tags.side_effect = [False, False, False, False] + base_path = "/fake/path" check_entangled_specs.check_matches(base_path) mock_exit.assert_not_called() - @patch('check_entangled_specs.Spec.from_file') - @patch('check_entangled_specs.get_tag_value') + @patch('check_entangled_specs.read_spec_tag') @patch('check_entangled_specs.check_spec_tags') @patch('sys.exit') - def test_check_matches_with_errors(self, mock_exit, mock_check_spec_tags, mock_get_tag_value, mock_from_file): - mock_get_tag_value.side_effect = ["1.0", "1"] - mock_from_file.return_value = MagicMock() - mock_check_spec_tags.side_effect = [False, False, True, False, False] + def test_check_matches_with_errors(self, mock_exit, mock_check_spec_tags, mock_read_spec_tag): + mock_read_spec_tag.side_effect = ["1.0", "1"] + mock_check_spec_tags.side_effect = [False, False, True, False] + base_path = "/fake/path" check_entangled_specs.check_matches(base_path) mock_exit.assert_called_once_with(1) From 895d5f12a5d5994f9ea08ab3a0439cff1e4fc6bc Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:09:58 -0800 Subject: [PATCH 32/86] update requirements --- toolkit/scripts/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/requirements.txt b/toolkit/scripts/requirements.txt index fd236eda7f2..fd3897fb2c1 100644 --- a/toolkit/scripts/requirements.txt +++ b/toolkit/scripts/requirements.txt @@ -6,7 +6,7 @@ # decorator==5.1.1 # via validators -pyrpm==0.4 +rpmspec # via -r requirements.in python-rpm-spec==0.14.1 # via -r requirements.in From 4b89e49507a4e6e77a13e11dc4bb0adb115e6e1f Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:11:29 -0800 Subject: [PATCH 33/86] remove dep --- toolkit/scripts/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/scripts/requirements.txt b/toolkit/scripts/requirements.txt index fd3897fb2c1..7da67545f9b 100644 --- a/toolkit/scripts/requirements.txt +++ b/toolkit/scripts/requirements.txt @@ -6,7 +6,6 @@ # decorator==5.1.1 # via validators -rpmspec # via -r requirements.in python-rpm-spec==0.14.1 # via -r requirements.in From 38eb3b2cf05cb4932d567b8cf6017406ed24b90a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:21:32 -0800 Subject: [PATCH 34/86] drop the --parse --- toolkit/scripts/check_entangled_specs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index 028a2c19aeb..ff2535191cd 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -185,7 +185,7 @@ def _formatted_rpmspec_command(spec_path: str) -> str: # that parsing is stable and deterministic. source_dir = path.dirname(spec_path) return ( - "rpmspec --parse " + "rpmspec " "-D 'forgemeta %{{nil}}' " "-D 'py3_dist X' " "-D 'with_check 0' " From dd395a4bd2740980c4581645bc041e4402294a72 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:45:59 -0800 Subject: [PATCH 35/86] revert back to use pyrpm --- toolkit/scripts/check_entangled_specs.py | 115 ++++++++++++++++------- toolkit/scripts/requirements.txt | 1 + 2 files changed, 82 insertions(+), 34 deletions(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index ff2535191cd..2f79565b399 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -2,14 +2,13 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -from collections import defaultdict -from os import path -from typing import FrozenSet, List, Set +from os import path, listdir +from typing import FrozenSet, List import argparse -import subprocess -import shlex import sys +from pyrpm.spec import replace_macros, Spec + # Control output verbosity, keeping this module global since we do not # have a containing top-level scope verbose=False @@ -174,45 +173,93 @@ def print_verbose(message: str): print(message) -def _formatted_rpmspec_command(spec_path: str) -> str: - """Return a base rpmspec command string with common macro definitions. +def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: + """Load simple %global macro definitions from a macros file into a Spec. + + This is a minimal loader that understands lines of the form:: - We rely on rpmspec (and thus rpm) to load macros from macros.d (such as - macros.releaseversions) so that all tags are fully macro-expanded. + %global name value + + It is primarily used to inject values from files like + macros.releaseversions so that pyrpm can fully expand spec tags. """ - # Match the defines used elsewhere in the toolkit when querying specs so - # that parsing is stable and deterministic. - source_dir = path.dirname(spec_path) - return ( - "rpmspec " - "-D 'forgemeta %{{nil}}' " - "-D 'py3_dist X' " - "-D 'with_check 0' " - "-D 'dist .azl3' " - "-D '__python3 python3' " - f"-D '_sourcedir {source_dir}' " - "-D 'fillup_prereq fillup'" - ) + try: + with open(macros_path, encoding="utf-8") as f: + for line in f: + line = line.strip() + if not line or line.startswith("#"): + continue + if not line.startswith("%global"): + continue + parts = line.split(maxsplit=2) + if len(parts) < 3: + continue + + _, name, value = parts + # pyrpm stores macros on the Spec instance; update in place. + # getattr/hasattr used for compatibility with library versions. + macros = getattr(spec, "macros", None) + if isinstance(macros, dict): + macros[name] = value + except FileNotFoundError: + # Best-effort: if the macros file is missing we just skip it. + return -def read_spec_tag(spec_path: str, tag: str) -> str: - """Read a spec header tag using rpmspec with all macros expanded. - This relies on rpm's own macro machinery (including macros.d) so that - tags like version, release, sdkver, and mstflintver are fully resolved - before comparison. +def _hydrate_spec_with_macros(spec_path: str) -> "Spec": + """Create a Spec object and preload it with macros from macros.d. + + This wires in macros from known locations (notably macros.releaseversions) + so that calls to replace_macros() see fully defined values. """ - # rpmspec is case-insensitive for tag names, but normalize for clarity. - tag_name = tag.strip() - command = _formatted_rpmspec_command(spec_path) - rpmspec_cmd = f"{command} --srpm --qf '%{{{tag_name}}}' -q {spec_path}" + spec = Spec.from_file(spec_path) + + # Primary locations used in CI and builds. + rpm_macro_dirs = [ + "/usr/lib/rpm/macros.d", + "/usr/lib/rpm", + "/etc/rpm/macros.d", + "/etc/rpm", + ] + for macro_dir in rpm_macro_dirs: + if not path.isdir(macro_dir): + continue + for entry in listdir(macro_dir): + macros_path = path.join(macro_dir, entry) + if path.isfile(macros_path): + _load_macros_from_file(spec, macros_path) - raw_output = subprocess.check_output( - shlex.split(rpmspec_cmd), stderr=subprocess.DEVNULL + # Fallback: when running locally from a tree where the macros files live + # under build/pkg_artifacts, try to use that directory if present. + tree_local_macros_dir = path.join( + path.dirname(path.dirname(path.abspath(__file__))), + "build", + "pkg_artifacts", ) - return raw_output.decode("utf-8", errors="strict") + if path.isdir(tree_local_macros_dir): + for entry in listdir(tree_local_macros_dir): + macros_path = path.join(tree_local_macros_dir, entry) + if path.isfile(macros_path): + _load_macros_from_file(spec, macros_path) + + return spec + + +def read_spec_tag(spec_path: str, tag: str) -> str: + """Read a spec header tag via pyrpm with macros.d preloaded. + + The returned value has %macros expanded using pyrpm's replace_macros + after injecting macros from macros.releaseversions. + """ + + spec = _hydrate_spec_with_macros(spec_path) + value = getattr(spec, tag) + if value: + value = replace_macros(value, spec) + return value def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool: """Check if spec set violates matching rules for any of given tags. Return True/False accordingly.""" diff --git a/toolkit/scripts/requirements.txt b/toolkit/scripts/requirements.txt index 7da67545f9b..fd236eda7f2 100644 --- a/toolkit/scripts/requirements.txt +++ b/toolkit/scripts/requirements.txt @@ -6,6 +6,7 @@ # decorator==5.1.1 # via validators +pyrpm==0.4 # via -r requirements.in python-rpm-spec==0.14.1 # via -r requirements.in From 99c603c1b259aed9ab26bd10d835c17734292c7b Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:50:42 -0800 Subject: [PATCH 36/86] ignore errors? --- toolkit/scripts/check_entangled_specs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index 2f79565b399..de049fa796e 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -185,7 +185,9 @@ def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: """ try: - with open(macros_path, encoding="utf-8") as f: + # Some system macro files may not be valid UTF-8; ignore undecodable + # bytes so that we still parse simple %global lines when possible. + with open(macros_path, encoding="utf-8", errors="ignore") as f: for line in f: line = line.strip() if not line or line.startswith("#"): From 09a5adb97104c98e1dcd84a28fbed75efd0fb3bb Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 15:53:09 -0800 Subject: [PATCH 37/86] handle regular defines, not only global --- toolkit/scripts/check_entangled_specs.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index de049fa796e..6faf22cbdb2 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -192,7 +192,16 @@ def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: line = line.strip() if not line or line.startswith("#"): continue + if not line.startswith("%"): + continue + if not line.startswith("%global"): + # Transform lines like "%foo 1" into "%global foo 1" + parts = line.split(maxsplit=1) + if len(parts) == 2 and parts[0].startswith("%"): + name = parts[0][1:] + value = parts[1] + line = f"%global {name} {value}" continue parts = line.split(maxsplit=2) From de6682bc752922743d87a1c595cc71f4c0d59690 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 16:00:02 -0800 Subject: [PATCH 38/86] debug statement --- toolkit/scripts/check_entangled_specs.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index 6faf22cbdb2..e808446132c 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -174,11 +174,11 @@ def print_verbose(message: str): def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: - """Load simple %global macro definitions from a macros file into a Spec. + """Load simple %name macro definitions from a macros file into a Spec. This is a minimal loader that understands lines of the form:: - %global name value + %name value It is primarily used to inject values from files like macros.releaseversions so that pyrpm can fully expand spec tags. @@ -188,6 +188,7 @@ def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: # Some system macro files may not be valid UTF-8; ignore undecodable # bytes so that we still parse simple %global lines when possible. with open(macros_path, encoding="utf-8", errors="ignore") as f: + print_verbose(f"Loading macros from: {macros_path}") for line in f: line = line.strip() if not line or line.startswith("#"): @@ -195,17 +196,8 @@ def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: if not line.startswith("%"): continue - if not line.startswith("%global"): - # Transform lines like "%foo 1" into "%global foo 1" - parts = line.split(maxsplit=1) - if len(parts) == 2 and parts[0].startswith("%"): - name = parts[0][1:] - value = parts[1] - line = f"%global {name} {value}" - continue - - parts = line.split(maxsplit=2) - if len(parts) < 3: + parts = line.split(maxsplit=1) + if len(parts) < 2: continue _, name, value = parts From 1ebad828f176718982bcff1c477f3382b49735b4 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 28 Jan 2026 16:04:40 -0800 Subject: [PATCH 39/86] fix number of values to unpack --- toolkit/scripts/check_entangled_specs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index e808446132c..673c36a68fd 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -200,7 +200,7 @@ def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: if len(parts) < 2: continue - _, name, value = parts + name, value = parts # pyrpm stores macros on the Spec instance; update in place. # getattr/hasattr used for compatibility with library versions. macros = getattr(spec, "macros", None) From 3d6a74a2d1b3c4bd2082479d4bc60d0fc3927440 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 29 Jan 2026 12:10:54 -0800 Subject: [PATCH 40/86] remove wrong line --- toolkit/scripts/toolkit.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index b31431ce5d7..6d192f2d323 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -74,7 +74,6 @@ $(toolkit_archive_versioned_compressed): $(toolkit_archive) $(rpms_snapshot) $(d echo "$(toolkit_version)" > $(toolkit_release_file) && \ cp $(rpms_snapshot) $(toolkit_rpms_snapshot_file) && \ cp $(rel_versions_macro_file) $(toolkit_prep_dir) && \ - cp $(rpms_macros_file) $(toolkit_prep_dir) && \ 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) From 4d9a73e45aae79482706a5931ed33e3b03483197 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 29 Jan 2026 12:14:46 -0800 Subject: [PATCH 41/86] stop toolchain packing from using macros file --- toolkit/scripts/srpm_pack.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index 4202a7788c5..501185e66fc 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -107,7 +107,7 @@ $(STATUS_FLAGS_DIR)/build_srpms.flag: $(rel_versions_macro_file) $(chroot_worker --timestamp-file=$(TIMESTAMP_DIR)/srpm_packer.jsonl && \ touch $@ -$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(rel_versions_macro_file) $(toolchain_files) $(go-srpmpacker) +$(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(toolchain_files) $(go-srpmpacker) GODEBUG=netdns=go $(go-srpmpacker) \ --dir=$(SPECS_DIR) \ --output-dir=$(BUILD_SRPMS_DIR) \ @@ -118,7 +118,6 @@ $(STATUS_FLAGS_DIR)/build_toolchain_srpms.flag: $(rel_versions_macro_file) $(too --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) \ --pack-list="$(toolchain_spec_list)" \ $(if $(filter y,$(RUN_CHECK)),--run-check) \ From b3150b05166fccded5eab08e75b3e6b962e96024 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 29 Jan 2026 12:26:02 -0800 Subject: [PATCH 42/86] remove unused deps --- toolkit/scripts/pkggen.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 8c3129a795c..51034c048e0 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -93,7 +93,7 @@ analyze-built-graph: $(go-graphanalytics) 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) $(depend_SPECS_DIR) $(depend_SRPM_PACK_LIST) $(depend_RUN_CHECK) +$(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(go-versionsprocessor) $(depend_SPECS_DIR) $(go-versionsprocessor) \ --dir $(SPECS_DIR) \ --dist-tag $(DIST_TAG) \ From f400d13aa6387c1762f5c0ba650911ca11129424 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 29 Jan 2026 12:28:44 -0800 Subject: [PATCH 43/86] tweak target deps again --- toolkit/scripts/pkggen.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index 51034c048e0..fba8ce78c3d 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -93,7 +93,7 @@ analyze-built-graph: $(go-graphanalytics) 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) $(go-versionsprocessor) $(depend_SPECS_DIR) +$(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build_spec_dirs) $(go-versionsprocessor) $(go-versionsprocessor) \ --dir $(SPECS_DIR) \ --dist-tag $(DIST_TAG) \ From 5ed5609fc51b0a4a33949c9239f52971c444be2a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 30 Jan 2026 10:13:01 -0800 Subject: [PATCH 44/86] fix source reference --- SPECS/isert-hwe/isert-hwe.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 10f53608657..9426f6dbb58 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -168,7 +168,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n isert-%{target_mlnx_ofa_kernel} +%setup -n isert-%{target_mlnx_ofa_kernel_version} set -- * mkdir source mv "$@" source/ From d65240c2c979d0b8cf9653e71f5a99ba356a2ccf Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 30 Jan 2026 10:15:27 -0800 Subject: [PATCH 45/86] modify signed isert-hwe as well --- SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec index a2cec60bdb0..08a48a83f33 100644 --- a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec +++ b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec @@ -31,20 +31,22 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name isert-hwe} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -110,6 +112,9 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-isert-*.conf %changelog +* Fri Jan 30 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.1 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From 42ded23d8f615097dc14293102ed7009ef4f60ce Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 10:33:35 -0800 Subject: [PATCH 46/86] make sure the macro file is included --- toolkit/scripts/toolkit.mk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 6d192f2d323..51559ad610c 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -19,12 +19,14 @@ specs_dir_name = $(notdir $(SPECS_DIR)) toolkit_remove_archive = $(OUT_DIR)/toolkit-*.tar* toolkit_root_files = $(wildcard $(toolkit_root)/*) toolkit_version = $(RELEASE_VERSION)-$(build_arch) +rel_versions_macro_file_name = macros.releaseversions +rel_versions_macro_file = $(PKGBUILD_DIR)/$(rel_versions_macro_file_name) +rel_versions_macro_file_dest = $(toolkit_prep_dir)/$(rel_versions_macro_file_name) # Build files 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 -rel_versions_macro_file = $(PKGBUILD_DIR)/macros.releaseversions rpms_snapshot_per_specs = $(rpms_snapshot_build_dir)/$(specs_dir_name)_$(rpms_snapshot_name) valid_arch_spec_names_build_dir = $(BUILD_DIR)/valid_arch_spec_names @@ -73,11 +75,10 @@ $(toolkit_archive_versioned_compressed): $(toolkit_archive) $(rpms_snapshot) $(d cp $(toolkit_archive) $(toolkit_archive_versioned) && \ echo "$(toolkit_version)" > $(toolkit_release_file) && \ cp $(rpms_snapshot) $(toolkit_rpms_snapshot_file) && \ - cp $(rel_versions_macro_file) $(toolkit_prep_dir) && \ 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) && \ @@ -85,6 +86,7 @@ $(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_componen 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) $(rel_versions_macro_file_dest) && \ 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)) From 94903399dc812fde03d6fe8605ea3ee0ed134d71 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 11:48:50 -0800 Subject: [PATCH 47/86] remove the target --- toolkit/scripts/toolkit.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 51559ad610c..33b9c896799 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -78,7 +78,7 @@ $(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) $(rel_versions_macro_file) +$(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_component_extra_files) $(toolkit_root_files) rm -rf $(toolkit_prep_dir) && \ mkdir -p $(toolkit_prep_dir) && \ mkdir -p $(toolkit_repos_dir) && \ From 0105cc976e92ec5807f01cf24a2d5742e7a4b512 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:34:25 -0800 Subject: [PATCH 48/86] modify iser-hwe to use new versioning --- SPECS/iser-hwe/iser-hwe.spec | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SPECS/iser-hwe/iser-hwe.spec b/SPECS/iser-hwe/iser-hwe.spec index 9cdf5fb318b..0fc62a8d4fb 100644 --- a/SPECS/iser-hwe/iser-hwe.spec +++ b/SPECS/iser-hwe/iser-hwe.spec @@ -28,8 +28,10 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -40,8 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name iser-hwe} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,14 +68,14 @@ Summary: %{_name} Driver Name: iser-hwe Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/iser-%{_version}.tgz +Source0: %{_distro_sources_url}/iser-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -166,7 +167,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n iser-%{_version} +%setup -n iser-%{target_mlnx_ofa_kernel_version} set -- * mkdir source mv "$@" source/ @@ -251,6 +252,9 @@ fi # 1 : closed %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From 134f24b78488d848be26c279f4ab9e965f1f64f9 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:35:58 -0800 Subject: [PATCH 49/86] modify mft_kernel_hwe to use new versioning --- SPECS/mft_kernel-hwe/mft_kernel-hwe.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec index 670360f045e..114c4ef7cb7 100644 --- a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec +++ b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec @@ -1,7 +1,7 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -35,7 +35,7 @@ Name: mft_kernel-hwe Summary: %{name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel BuildRoot: /var/tmp/%{name}-%{version}-build @@ -213,6 +213,9 @@ find %{buildroot} -type f -name \*.ko -exec %{__strip} -p --strip-debug --discar %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 4.33.0-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 4.33.0-2_6.12.57.1.2 - Bump to match kernel-hwe. From 41b86e591118dd0e219d0bff0cd8d6916b507193 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:38:59 -0800 Subject: [PATCH 50/86] modify knem-hwe and sign to use dynamic versioning --- .../knem-hwe-modules-signed/knem-hwe-modules-signed.spec | 9 ++++++--- SPECS/knem-hwe/knem-hwe.spec | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec index 3fe14f5ad82..43a3bcbfc94 100644 --- a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec @@ -28,8 +28,8 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -44,7 +44,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: %{_name}-signed Version: 1.1.4.90mlnx3 -Release: 26%{release_suffix}%{?dist} +Release: 27%{release_suffix}%{?dist} Provides: knem-hwe-mlnx = %{version}-%{release} Obsoletes: knem-hwe-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -110,6 +110,9 @@ fi /lib/modules/ %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-27_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-26_6.12.57.1.2 - Bump to match kernel-hwe. diff --git a/SPECS/knem-hwe/knem-hwe.spec b/SPECS/knem-hwe/knem-hwe.spec index 3151b887434..aa476b107ed 100644 --- a/SPECS/knem-hwe/knem-hwe.spec +++ b/SPECS/knem-hwe/knem-hwe.spec @@ -28,8 +28,8 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -55,7 +55,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: knem-hwe Version: 1.1.4.90mlnx3 -Release: 26%{release_suffix}%{?dist} +Release: 27%{release_suffix}%{?dist} Provides: knem-hwe-mlnx = %{version}-%{release} Obsoletes: knem-hwe-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -241,6 +241,9 @@ fi %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-27_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-26_6.12.57.1.2 - Bump to match kernel-hwe. From 576d0bea5edc882d517537ec772d4ab5a449f92c Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:43:05 -0800 Subject: [PATCH 51/86] modify srp-hwe to use dynamic kernel versioning --- SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec | 13 +++++++++---- SPECS/srp-hwe/srp-hwe.spec | 16 ++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec index 1cbe2933d0e..cd9bc656608 100644 --- a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec +++ b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec @@ -32,8 +32,10 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -43,12 +45,12 @@ %global KVERSION %{target_kernel_version_full} %define _name srp-hwe -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: srp driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -111,6 +113,9 @@ popd %license %{_datadir}/licenses/%{_name}/copyright %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and MOFED + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. diff --git a/SPECS/srp-hwe/srp-hwe.spec b/SPECS/srp-hwe/srp-hwe.spec index 98ddaf71656..762ca30df09 100644 --- a/SPECS/srp-hwe/srp-hwe.spec +++ b/SPECS/srp-hwe/srp-hwe.spec @@ -28,8 +28,10 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -40,8 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name srp-hwe} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,7 +68,7 @@ Summary: srp driver Name: srp-hwe Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -167,7 +168,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n srp-%{_version} +%setup -n srp-%{_mofed_full_version} set -- * mkdir source mv "$@" source/ @@ -257,6 +258,9 @@ fi %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and MOFED + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From 8ed9853b0e7c52902a6f7692b2463c00598927ff Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:46:30 -0800 Subject: [PATCH 52/86] fix srp --- SPECS/srp-hwe/srp-hwe.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPECS/srp-hwe/srp-hwe.spec b/SPECS/srp-hwe/srp-hwe.spec index 762ca30df09..45ee7e9d570 100644 --- a/SPECS/srp-hwe/srp-hwe.spec +++ b/SPECS/srp-hwe/srp-hwe.spec @@ -168,7 +168,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n srp-%{_mofed_full_version} +%setup -n srp-%{target_mlnx_ofa_kernel_version} set -- * mkdir source mv "$@" source/ From d9e86a9fb6bb3e8074125fc58a230fce85298298 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:50:22 -0800 Subject: [PATCH 53/86] modify mlnx-nfsrdma to use dynamic kernel versioning --- SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec index e79afd41543..d536920b2ad 100644 --- a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec +++ b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec @@ -28,8 +28,10 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -41,8 +43,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name mlnx-nfsrdma-hwe} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -68,14 +69,14 @@ Summary: %{_name} Driver Name: mlnx-nfsrdma-hwe Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/mlnx-nfsrdma-%{_version}.tgz +Source0: %{_distro_sources_url}/mlnx-nfsrdma-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -167,7 +168,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n mlnx-nfsrdma-%{_version} +%setup -n mlnx-nfsrdma-%{target_mlnx_ofa_kernel_version} set -- * mkdir source mv "$@" source/ @@ -252,6 +253,9 @@ fi %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From f78053c21b3b74ca3d2b86651b77b02d59521abd Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:54:49 -0800 Subject: [PATCH 54/86] modif mlnx-ofa to use dynamic kernel versioning --- .../mlnx-ofa_kernel-hwe-modules-signed.spec | 9 ++++++--- SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec index 8a2964b78fe..e8882b1bd04 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec @@ -31,8 +31,8 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -46,7 +46,7 @@ Summary: Infiniband HCA Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -237,6 +237,9 @@ fi %license %{_datadir}/licenses/%{_name}/copyright %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. diff --git a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec index 546c9b88e00..3358c8b1549 100644 --- a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec +++ b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec @@ -28,8 +28,8 @@ %if 0%{azl} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -102,7 +102,7 @@ Summary: Infiniband HCA Driver Name: mlnx-ofa_kernel-hwe Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -449,6 +449,9 @@ update-alternatives --remove \ %{_prefix}/src/ofa_kernel/%{_arch}/[0-9]* %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From 1037f7ceab57e72939b93eec45efda06ea483e79 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 13:56:26 -0800 Subject: [PATCH 55/86] fix the signed mlnx-nfsrdma --- .../mlnx-nfsrdma-hwe-signed.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec index 85b65524093..d776eb98722 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec @@ -31,20 +31,20 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_name: %define _name mlnx-nfsrdma-hwe} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -117,6 +117,9 @@ fi %config(noreplace) %{_sysconfdir}/depmod.d/zz02-mlnx-nfsrdma-*.conf %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. From be79d6d92554e3f68b9539f56b0156f1d891ed1d Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 14:00:26 -0800 Subject: [PATCH 56/86] modify xpmem to use kernel dynamic versioning --- .../xpmem-hwe-modules-signed.spec | 13 +++++++++---- SPECS/xpmem-hwe/xpmem-hwe.spec | 14 +++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec index 633c506cfe8..bd779b1886c 100644 --- a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec @@ -5,15 +5,17 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %define _name xpmem-hwe-modules -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} # xpmem-modules is a sub-package in SPECS/xpmem. # We are making that into a main package for signing. @@ -21,7 +23,7 @@ Summary: Cross-partition memory Name: %{_name}-signed Version: 2.7.4 -Release: 26%{release_suffix}%{?dist} +Release: 27%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -93,6 +95,9 @@ if [ $1 = 0 ]; then # 1 : Erase, not upgrade fi %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 2.7.4-27_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 2.7.4-26_6.12.57.1.2 - Bump to match kernel-hwe. diff --git a/SPECS/xpmem-hwe/xpmem-hwe.spec b/SPECS/xpmem-hwe/xpmem-hwe.spec index 5f2ad042d01..45f3be28b9c 100644 --- a/SPECS/xpmem-hwe/xpmem-hwe.spec +++ b/SPECS/xpmem-hwe/xpmem-hwe.spec @@ -1,9 +1,10 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -# hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -13,7 +14,7 @@ %global KVERSION %{target_kernel_version_full} %global K_SRC /lib/modules/%{target_kernel_version_full}/build -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} # %{!?KVERSION: %global KVERSION %(uname -r)} %{!?KVERSION: %global KVERSION %{target_kernel_version_full}} @@ -43,7 +44,7 @@ Summary: Cross-partition memory Name: xpmem-hwe Version: 2.7.4 -Release: 26%{release_suffix}%{?dist} +Release: 27%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -206,6 +207,9 @@ fi %endif %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 2.7.4-27_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 2.7.4-26_6.12.57.1.2 - Bump to match kernel-hwe. From 49f01fb337a9c3af788bf3f747232811dac85602 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 14:01:08 -0800 Subject: [PATCH 57/86] not forget missing versions --- .../mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec index d776eb98722..ec9e6d658d8 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec @@ -33,6 +33,8 @@ # hard code versions due to ADO bug:58993948 %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} From 3702885aa9f3b226932df9f30d6a1e9c83df7cc3 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 14:04:07 -0800 Subject: [PATCH 58/86] fix remaining missing signed specs --- SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec | 13 +++++++++---- .../mft_kernel-hwe-signed.spec | 9 ++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec index cf8d11b56ee..9a5c1e1f34a 100644 --- a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec +++ b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec @@ -31,20 +31,22 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name iser-hwe} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-2%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -111,6 +113,9 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-iser-*.conf %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 25.07-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 25.07-2_6.12.57.1.2 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec index 579e6d21bca..7b605e3ca30 100644 --- a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec +++ b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec @@ -4,8 +4,8 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} # hard code versions due to ADO bug:58993948 -%global target_azl_build_kernel_version 6.12.57.1 -%global target_kernel_release 2 +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -15,7 +15,7 @@ Name: %{_name}-signed Summary: %{_name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 2%{release_suffix}%{?dist} +Release: 3%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel @@ -91,6 +91,9 @@ popd /lib/modules/%{KVERSION}/updates/ %changelog +* Mon Feb 02 2026 Mykhailo Bykhovtsev - 4.33.0-3_6.12.57.1.2 +- Tweak specs to use dynamic versioning for kernel + * Mon Jan 19 2026 Suresh Babu Chalamalasetty - 4.33.0-2_6.12.57.1.2 - Bump to match kernel-hwe. From e78d02931b581da486f7bdaf6639c0751887407a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 2 Feb 2026 14:04:50 -0800 Subject: [PATCH 59/86] remove bug's comment --- SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec | 2 +- SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec | 2 +- .../knem-hwe-modules-signed/knem-hwe-modules-signed.spec | 2 +- SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec | 2 +- .../mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec | 2 +- .../mlnx-ofa_kernel-hwe-modules-signed.spec | 2 +- SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec | 2 +- .../xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec | 2 +- SPECS/iser-hwe/iser-hwe.spec | 2 +- SPECS/knem-hwe/knem-hwe.spec | 2 +- SPECS/mft_kernel-hwe/mft_kernel-hwe.spec | 2 +- SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec | 2 +- SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec | 2 +- SPECS/srp-hwe/srp-hwe.spec | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec index 9a5c1e1f34a..8d1a06879c2 100644 --- a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec +++ b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec @@ -30,7 +30,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec index 08a48a83f33..6f906f85273 100644 --- a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec +++ b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec @@ -30,7 +30,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec index 43a3bcbfc94..9f2bc57296d 100644 --- a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec @@ -27,7 +27,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec index 7b605e3ca30..a3258987d46 100644 --- a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec +++ b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec @@ -3,7 +3,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec index ec9e6d658d8..58309115e8d 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec @@ -30,7 +30,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec index e8882b1bd04..edfa68d359e 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec @@ -30,7 +30,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec index cd9bc656608..743b5d6a457 100644 --- a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec +++ b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec @@ -31,7 +31,7 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec index bd779b1886c..5e2bfdee8b6 100644 --- a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec @@ -4,7 +4,7 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS/iser-hwe/iser-hwe.spec b/SPECS/iser-hwe/iser-hwe.spec index 0fc62a8d4fb..feb27f17c0d 100644 --- a/SPECS/iser-hwe/iser-hwe.spec +++ b/SPECS/iser-hwe/iser-hwe.spec @@ -27,7 +27,7 @@ # %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS/knem-hwe/knem-hwe.spec b/SPECS/knem-hwe/knem-hwe.spec index aa476b107ed..b2d12ef54a3 100644 --- a/SPECS/knem-hwe/knem-hwe.spec +++ b/SPECS/knem-hwe/knem-hwe.spec @@ -27,7 +27,7 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec index 114c4ef7cb7..6cd0a66e321 100644 --- a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec +++ b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec @@ -1,5 +1,5 @@ %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec index d536920b2ad..fd2d2c81a9e 100644 --- a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec +++ b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec @@ -27,7 +27,7 @@ # %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version diff --git a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec index 3358c8b1549..14617612305 100644 --- a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec +++ b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec @@ -27,7 +27,7 @@ # %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} diff --git a/SPECS/srp-hwe/srp-hwe.spec b/SPECS/srp-hwe/srp-hwe.spec index 45ee7e9d570..994ca1971c3 100644 --- a/SPECS/srp-hwe/srp-hwe.spec +++ b/SPECS/srp-hwe/srp-hwe.spec @@ -27,7 +27,7 @@ # %if 0%{azl} -# hard code versions due to ADO bug:58993948 + %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release %global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version From f877afb3b2062aa10e4b70a6b7a815533ab9133a Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 9 Feb 2026 22:23:52 -0800 Subject: [PATCH 60/86] don't package macros.releaseversions into the toolkit --- toolkit/scripts/toolkit.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 33b9c896799..aa8fe439708 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -19,9 +19,6 @@ specs_dir_name = $(notdir $(SPECS_DIR)) toolkit_remove_archive = $(OUT_DIR)/toolkit-*.tar* toolkit_root_files = $(wildcard $(toolkit_root)/*) toolkit_version = $(RELEASE_VERSION)-$(build_arch) -rel_versions_macro_file_name = macros.releaseversions -rel_versions_macro_file = $(PKGBUILD_DIR)/$(rel_versions_macro_file_name) -rel_versions_macro_file_dest = $(toolkit_prep_dir)/$(rel_versions_macro_file_name) # Build files rpms_snapshot_dir_name = rpms_snapshots @@ -86,7 +83,6 @@ $(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_componen 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) $(rel_versions_macro_file_dest) && \ 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)) From 99943d9bb9cc66eeee0a0b1659f28c0d474340dd Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 10 Feb 2026 11:34:23 -0800 Subject: [PATCH 61/86] revert the entagled changes --- toolkit/scripts/check_entangled_specs.py | 114 +++--------------- .../tests/test_check_entangled_specs.py | 73 +++++------ 2 files changed, 54 insertions(+), 133 deletions(-) diff --git a/toolkit/scripts/check_entangled_specs.py b/toolkit/scripts/check_entangled_specs.py index 673c36a68fd..6a6e941266d 100755 --- a/toolkit/scripts/check_entangled_specs.py +++ b/toolkit/scripts/check_entangled_specs.py @@ -2,9 +2,11 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. -from os import path, listdir -from typing import FrozenSet, List +from collections import defaultdict +from os import path +from typing import FrozenSet, List, Set import argparse +import pprint import sys from pyrpm.spec import replace_macros, Spec @@ -172,98 +174,6 @@ def print_verbose(message: str): if verbose: print(message) - -def _load_macros_from_file(spec: "Spec", macros_path: str) -> None: - """Load simple %name macro definitions from a macros file into a Spec. - - This is a minimal loader that understands lines of the form:: - - %name value - - It is primarily used to inject values from files like - macros.releaseversions so that pyrpm can fully expand spec tags. - """ - - try: - # Some system macro files may not be valid UTF-8; ignore undecodable - # bytes so that we still parse simple %global lines when possible. - with open(macros_path, encoding="utf-8", errors="ignore") as f: - print_verbose(f"Loading macros from: {macros_path}") - for line in f: - line = line.strip() - if not line or line.startswith("#"): - continue - if not line.startswith("%"): - continue - - parts = line.split(maxsplit=1) - if len(parts) < 2: - continue - - name, value = parts - # pyrpm stores macros on the Spec instance; update in place. - # getattr/hasattr used for compatibility with library versions. - macros = getattr(spec, "macros", None) - if isinstance(macros, dict): - macros[name] = value - except FileNotFoundError: - # Best-effort: if the macros file is missing we just skip it. - return - - -def _hydrate_spec_with_macros(spec_path: str) -> "Spec": - """Create a Spec object and preload it with macros from macros.d. - - This wires in macros from known locations (notably macros.releaseversions) - so that calls to replace_macros() see fully defined values. - """ - - spec = Spec.from_file(spec_path) - - # Primary locations used in CI and builds. - rpm_macro_dirs = [ - "/usr/lib/rpm/macros.d", - "/usr/lib/rpm", - "/etc/rpm/macros.d", - "/etc/rpm", - ] - for macro_dir in rpm_macro_dirs: - if not path.isdir(macro_dir): - continue - for entry in listdir(macro_dir): - macros_path = path.join(macro_dir, entry) - if path.isfile(macros_path): - _load_macros_from_file(spec, macros_path) - - # Fallback: when running locally from a tree where the macros files live - # under build/pkg_artifacts, try to use that directory if present. - tree_local_macros_dir = path.join( - path.dirname(path.dirname(path.abspath(__file__))), - "build", - "pkg_artifacts", - ) - if path.isdir(tree_local_macros_dir): - for entry in listdir(tree_local_macros_dir): - macros_path = path.join(tree_local_macros_dir, entry) - if path.isfile(macros_path): - _load_macros_from_file(spec, macros_path) - - return spec - - -def read_spec_tag(spec_path: str, tag: str) -> str: - """Read a spec header tag via pyrpm with macros.d preloaded. - - The returned value has %macros expanded using pyrpm's replace_macros - after injecting macros from macros.releaseversions. - """ - - spec = _hydrate_spec_with_macros(spec_path) - value = getattr(spec, tag) - if value: - value = replace_macros(value, spec) - return value - def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool: """Check if spec set violates matching rules for any of given tags. Return True/False accordingly.""" has_error = False @@ -271,11 +181,11 @@ def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool print_verbose(f"Processing group: {group}") spec_tag_map = {tag: {} for tag in tags} for spec_filename in group: - spec_path = path.join(base_path, spec_filename) + parsed_spec = Spec.from_file(path.join(base_path, spec_filename)) print_verbose(f"\t{spec_filename}") for tag, tag_current in tags.items(): - tag_value = read_spec_tag(spec_path, tag) + tag_value = get_tag_value(parsed_spec, tag) spec_tag_map[tag][spec_filename] = tag_value tag_want = f" (want: {tag_current})" if tag_current else "" print_verbose(f"\t\ttag({tag}) value: {tag_value}{tag_want}") @@ -293,9 +203,9 @@ def check_spec_tags(base_path: str, tags: dict, groups: List[FrozenSet]) -> bool return has_error def check_matches(base_path: str): - kernel_headers_spec_path = path.join(base_path, "SPECS/kernel-headers/kernel-headers.spec") - kernel_headers_version = read_spec_tag(kernel_headers_spec_path, 'version') - kernel_headers_release = read_spec_tag(kernel_headers_spec_path, 'release') + kernel_headers_spec = Spec.from_file(path.join(base_path, "SPECS/kernel-headers/kernel-headers.spec")) + kernel_headers_version = get_tag_value(kernel_headers_spec, 'version') + kernel_headers_release = get_tag_value(kernel_headers_spec, 'release') kernel_version_release = f"{kernel_headers_version}-{kernel_headers_release}" groups_to_check = [({'mstflintver':{}}, mstflintver_matching_groups), @@ -312,6 +222,12 @@ def check_matches(base_path: str): sys.exit(1) print('Repository state is consistent with spec entanglement rules.') +def get_tag_value(spec: "Spec", tag: str) -> str: + value = getattr(spec, tag) + if value: + value = replace_macros(value, spec) + return value + def main(): global verbose diff --git a/toolkit/scripts/tests/test_check_entangled_specs.py b/toolkit/scripts/tests/test_check_entangled_specs.py index bc9d9e531a4..a1feb922bdf 100644 --- a/toolkit/scripts/tests/test_check_entangled_specs.py +++ b/toolkit/scripts/tests/test_check_entangled_specs.py @@ -11,76 +11,81 @@ class TestCheckSpecTags(unittest.TestCase): - @patch('check_entangled_specs.read_spec_tag') - def test_check_spec_tags_no_errors(self, mock_read_spec_tag): - mock_read_spec_tag.side_effect = [ - "v1", "r1", "v1", "r1", - "v1.1", "r1.1", "v1.1", "r1.1", - ] + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') + def test_check_spec_tags_no_errors(self, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["v1", "r1", "v1", "r1", + "v1.1", "r1.1", "v1.1", "r1.1"] + mock_from_file.return_value = MagicMock() base_path = "/fake/path" - tags = {"version": {}, "release": {}} - groups = [ - frozenset(["spec1.spec", "spec2.spec"]), - frozenset(["spec3.spec", "spec4.spec"]), - ] + tags = {"version":{}, "release":{}} + groups = [frozenset(["spec1.spec", "spec2.spec"]), + frozenset(["spec3.spec", "spec4.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertFalse(result) - @patch('check_entangled_specs.read_spec_tag') - def test_check_spec_tags_with_errors(self, mock_read_spec_tag): - mock_read_spec_tag.side_effect = ["v2", "r2", "v2.1", "r2.1"] + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') + def test_check_spec_tags_with_errors(self, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["v2", "r2", "v2.1", "r2.1"] + mock_from_file.return_value = MagicMock() base_path = "/fake/path" - tags = {"version": "", "release": ""} + tags = {"version":"", "release":""} groups = [frozenset(["spec5.spec", "spec6.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertTrue(result) - @patch('check_entangled_specs.read_spec_tag') - def test_check_spec_tags_with_expected_value(self, mock_read_spec_tag): - mock_read_spec_tag.side_effect = ["v3", "v3"] + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') + def test_check_spec_tags_with_expected_value(self, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["v3","v3"] + mock_from_file.return_value = MagicMock() base_path = "/fake/path" - tags = {"version": "v3"} + tags = {"version":"v3"} groups = [frozenset(["spec7.spec", "spec8.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertFalse(result) - @patch('check_entangled_specs.read_spec_tag') - def test_check_spec_tags_with_mismatched_expected_value(self, mock_read_spec_tag): - mock_read_spec_tag.side_effect = ["v4", "v4"] + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') + def test_check_spec_tags_with_mismatched_expected_value(self, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["v4","v4"] + mock_from_file.return_value = MagicMock() base_path = "/fake/path" - tags = {"version": "v5"} + tags = {"version":"v5"} groups = [frozenset(["spec1.spec", "spec2.spec"])] result = check_entangled_specs.check_spec_tags(base_path, tags, groups) self.assertTrue(result) class TestCheckMatches(unittest.TestCase): - - @patch('check_entangled_specs.read_spec_tag') + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') @patch('check_entangled_specs.check_spec_tags') @patch('sys.exit') - def test_check_matches_no_errors(self, mock_exit, mock_check_spec_tags, mock_read_spec_tag): - mock_read_spec_tag.side_effect = ["1.0", "1"] - mock_check_spec_tags.side_effect = [False, False, False, False] - + def test_check_matches_no_errors(self, mock_exit, mock_check_spec_tags, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["1.0", "1"] + mock_from_file.return_value = MagicMock() + mock_check_spec_tags.side_effect = [ False, False, False, False, False ] base_path = "/fake/path" check_entangled_specs.check_matches(base_path) mock_exit.assert_not_called() - @patch('check_entangled_specs.read_spec_tag') + @patch('check_entangled_specs.Spec.from_file') + @patch('check_entangled_specs.get_tag_value') @patch('check_entangled_specs.check_spec_tags') @patch('sys.exit') - def test_check_matches_with_errors(self, mock_exit, mock_check_spec_tags, mock_read_spec_tag): - mock_read_spec_tag.side_effect = ["1.0", "1"] - mock_check_spec_tags.side_effect = [False, False, True, False] - + def test_check_matches_with_errors(self, mock_exit, mock_check_spec_tags, mock_get_tag_value, mock_from_file): + mock_get_tag_value.side_effect = ["1.0", "1"] + mock_from_file.return_value = MagicMock() + mock_check_spec_tags.side_effect = [False, False, True, False, False] base_path = "/fake/path" check_entangled_specs.check_matches(base_path) mock_exit.assert_called_once_with(1) From 911b1b82351a99229b9b8056060ebdf415475b0e Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 10 Feb 2026 11:35:25 -0800 Subject: [PATCH 62/86] revert back generating macros file for check entangled specs --- .github/workflows/check-entangled-specs.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/check-entangled-specs.yml b/.github/workflows/check-entangled-specs.yml index 0d652e05e60..74beaf4a13f 100644 --- a/.github/workflows/check-entangled-specs.yml +++ b/.github/workflows/check-entangled-specs.yml @@ -35,11 +35,5 @@ jobs: - name: Unit test for spec entanglement check run: PYTHONPATH=toolkit/scripts python3 toolkit/scripts/tests/test_check_entangled_specs.py - - name: Generate the macros file with version/release info - run: | - sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=lkg - - sudo cp -v ./build/pkg_artifacts/macros.releaseversions /usr/lib/rpm/macros.d/macros.releaseversions - - name: Run spec entanglement checking script run: python3 toolkit/scripts/check_entangled_specs.py . From 0daa5ebb6cdb5a1207d3cf5d1a233d50a0f236d7 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 19 Feb 2026 15:27:06 -0800 Subject: [PATCH 63/86] fix the date --- SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec | 2 +- .../knem-hwe-modules-signed/knem-hwe-modules-signed.spec | 2 +- SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec | 2 +- .../mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec | 2 +- .../mlnx-ofa_kernel-hwe-modules-signed.spec | 2 +- SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec | 2 +- .../xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec | 2 +- SPECS/iser-hwe/iser-hwe.spec | 2 +- SPECS/isert-hwe/isert-hwe.spec | 2 +- SPECS/knem-hwe/knem-hwe.spec | 2 +- SPECS/mft_kernel-hwe/mft_kernel-hwe.spec | 2 +- SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec | 2 +- SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec | 2 +- SPECS/srp-hwe/srp-hwe.spec | 2 +- SPECS/xpmem-hwe/xpmem-hwe.spec | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec index 80d7634b9f6..50444d5b6fe 100644 --- a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec +++ b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec @@ -113,7 +113,7 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-iser-*.conf %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec index 61b2c07903f..f056a3fc8ae 100644 --- a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec @@ -110,7 +110,7 @@ fi /lib/modules/ %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-28_6.12.57.1.4 diff --git a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec index d284470dbef..b1af65b504f 100644 --- a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec +++ b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec @@ -91,7 +91,7 @@ popd /lib/modules/%{KVERSION}/updates/ %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 4.33.0-4_6.12.57.1.4 diff --git a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec index 0fb2ef1c6e2..297dd748169 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec @@ -119,7 +119,7 @@ fi %config(noreplace) %{_sysconfdir}/depmod.d/zz02-mlnx-nfsrdma-*.conf %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel and mlnx_ofa * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec index 3c13fd5b8a8..ed7d844e65d 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec @@ -237,7 +237,7 @@ fi %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec index c2520860e83..866dc18fed2 100644 --- a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec +++ b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec @@ -113,7 +113,7 @@ popd %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel and MOFED * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec index ba7463c0c57..9b29fba71a0 100644 --- a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec @@ -95,7 +95,7 @@ if [ $1 = 0 ]; then # 1 : Erase, not upgrade fi %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel and mlnx_ofa * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 2.7.4-28_6.12.57.1.4 diff --git a/SPECS/iser-hwe/iser-hwe.spec b/SPECS/iser-hwe/iser-hwe.spec index 14514453892..8d9e9794f8b 100644 --- a/SPECS/iser-hwe/iser-hwe.spec +++ b/SPECS/iser-hwe/iser-hwe.spec @@ -252,7 +252,7 @@ fi # 1 : closed %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 - Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index 761413048bc..b751a123b32 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -253,7 +253,7 @@ fi # 1 : closed %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 - Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS/knem-hwe/knem-hwe.spec b/SPECS/knem-hwe/knem-hwe.spec index 22dc09c843b..e31b3d12a39 100644 --- a/SPECS/knem-hwe/knem-hwe.spec +++ b/SPECS/knem-hwe/knem-hwe.spec @@ -241,7 +241,7 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-28_6.12.57.1.4 diff --git a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec index 7743cfc7831..ce5155b2295 100644 --- a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec +++ b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec @@ -213,7 +213,7 @@ find %{buildroot} -type f -name \*.ko -exec %{__strip} -p --strip-debug --discar %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 4.33.0-4_6.12.57.1.4 diff --git a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec index dc08626fc80..e28bd5275b1 100644 --- a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec +++ b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec @@ -253,7 +253,7 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec index 6e0fd0739c9..8eaac38e9a3 100644 --- a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec +++ b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec @@ -449,7 +449,7 @@ update-alternatives --remove \ %{_prefix}/src/ofa_kernel/%{_arch}/[0-9]* %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS/srp-hwe/srp-hwe.spec b/SPECS/srp-hwe/srp-hwe.spec index 4e97e4a0450..b91d05b646b 100644 --- a/SPECS/srp-hwe/srp-hwe.spec +++ b/SPECS/srp-hwe/srp-hwe.spec @@ -258,7 +258,7 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel and MOFED * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 diff --git a/SPECS/xpmem-hwe/xpmem-hwe.spec b/SPECS/xpmem-hwe/xpmem-hwe.spec index 82918ecd408..3c9c435b86a 100644 --- a/SPECS/xpmem-hwe/xpmem-hwe.spec +++ b/SPECS/xpmem-hwe/xpmem-hwe.spec @@ -207,7 +207,7 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 +* Tue Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 - Tweak specs to use dynamic versioning for kernel and mlnx_ofa * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 2.7.4-28_6.12.57.1.4 From d4644d119c150309796e894dbdf048634b67e4fc Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 19 Feb 2026 16:00:33 -0800 Subject: [PATCH 64/86] update to PR's feedback --- .../docs/how_it_works/3_package_building.md | 4 ++ .../internal/safechroot/chrootinterface.go | 1 + .../tools/internal/safechroot/dummychroot.go | 4 ++ .../tools/internal/safechroot/safechroot.go | 44 ++++++++++++ .../pkg/specreaderutils/specreaderutil.go | 26 +------ toolkit/tools/pkgworker/pkgworker.go | 27 ++------ .../scheduler/buildagents/chrootagent.go | 4 +- .../tools/scheduler/buildagents/definition.go | 2 +- toolkit/tools/scheduler/scheduler.go | 2 +- toolkit/tools/srpmpacker/srpmpacker.go | 26 ++----- .../versionsprocessor/versionsprocessor.go | 69 +++++++++---------- 11 files changed, 102 insertions(+), 107 deletions(-) diff --git a/toolkit/docs/how_it_works/3_package_building.md b/toolkit/docs/how_it_works/3_package_building.md index 387e2fbc63d..938757f3bdc 100644 --- a/toolkit/docs/how_it_works/3_package_building.md +++ b/toolkit/docs/how_it_works/3_package_building.md @@ -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__release`, `azl__version`, note that the `` needs any `-` are 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. diff --git a/toolkit/tools/internal/safechroot/chrootinterface.go b/toolkit/tools/internal/safechroot/chrootinterface.go index 1cfe566b899..09c24f103bf 100644 --- a/toolkit/tools/internal/safechroot/chrootinterface.go +++ b/toolkit/tools/internal/safechroot/chrootinterface.go @@ -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 } diff --git a/toolkit/tools/internal/safechroot/dummychroot.go b/toolkit/tools/internal/safechroot/dummychroot.go index f094472e1f5..00d65d707fb 100644 --- a/toolkit/tools/internal/safechroot/dummychroot.go +++ b/toolkit/tools/internal/safechroot/dummychroot.go @@ -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 d.AddRPMMacrosFile(macrosFilePath) +} diff --git a/toolkit/tools/internal/safechroot/safechroot.go b/toolkit/tools/internal/safechroot/safechroot.go index 72c409df33e..81a4294d519 100644 --- a/toolkit/tools/internal/safechroot/safechroot.go +++ b/toolkit/tools/internal/safechroot/safechroot.go @@ -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" @@ -160,6 +162,48 @@ func NewOverlayMountPoint(chrootDir, source, target, lowerDir, upperDir, workDir return } +func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) (err error) { + + var ( + macroDir string + ) + + doParse := 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(doParse) + + // Destination path inside the chroot (same path as on the host). + macrosDestDir := filepath.Join(c.rootDir, macroDir) + macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(macrosFilePath)) + + // 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 mkdirErr + } + + 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 diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 443654a8eb2..706cceffb99 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -172,30 +172,10 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosF // 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 releaseVersionMacrosFile != "" { - macroDir, macroErr := rpm.GetMacroDir() - if macroErr != nil { - logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) - return - } - - // Destination path inside the chroot (same path as on the host). - macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) - - // 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 - } - - copyErr := file.Copy(releaseVersionMacrosFile, macrosDestFile) - if copyErr != nil { - logger.Log.Errorf("Failed to copy release version macros file into chroot (%s -> %s): %s", releaseVersionMacrosFile, macrosDestFile, copyErr) - return + err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) + if err != nil { + logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) } - - logger.Log.Infof("Copied release version macros file into chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } return diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index 4090463ef55..c89174bf399 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -15,7 +15,6 @@ import ( "time" "github.com/microsoft/azurelinux/toolkit/tools/internal/ccachemanager" - "github.com/microsoft/azurelinux/toolkit/tools/internal/directory" "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" @@ -221,29 +220,13 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF return } + // 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 releaseVersionMacrosFile != "" { - macroDir, macroErr := rpm.GetMacroDir() - if macroErr != nil { - err = fmt.Errorf("failed to get RPM macros directory: %w", macroErr) - return - } - - macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) - - macroErr = directory.EnsureDirExists(macrosDestDir) - if macroErr != nil { - err = fmt.Errorf("failed to create macros directory in chroot: %w", macroErr) - return - } - - macroErr = file.Copy(releaseVersionMacrosFile, macrosDestFile) - if macroErr != nil { - err = fmt.Errorf("failed to copy release version macros file into chroot: %w", macroErr) - return + err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) + if err != nil { + logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) } - - logger.Log.Infof("Copied release version macros file into pkgworker chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } defer chroot.Close(noCleanup) diff --git a/toolkit/tools/scheduler/buildagents/chrootagent.go b/toolkit/tools/scheduler/buildagents/chrootagent.go index 6a9dac152e8..032ee67ea5a 100644 --- a/toolkit/tools/scheduler/buildagents/chrootagent.go +++ b/toolkit/tools/scheduler/buildagents/chrootagent.go @@ -97,8 +97,8 @@ func serializeChrootBuildAgentConfig(config *BuildAgentConfig, basePackageName, fmt.Sprintf("--timeout=%s", allowableRuntime), } - if config.RpmmacrosFile != "" { - serializedArgs = append(serializedArgs, fmt.Sprintf("--rpmmacros-file=%s", config.RpmmacrosFile)) + if config.RPMMacrosFiles != "" { + serializedArgs = append(serializedArgs, fmt.Sprintf("--rpmmacros-file=%s", config.RPMMacrosFiles)) } if config.VersionsMacroFile != "" { diff --git a/toolkit/tools/scheduler/buildagents/definition.go b/toolkit/tools/scheduler/buildagents/definition.go index 04db6a66adb..4919de1f335 100644 --- a/toolkit/tools/scheduler/buildagents/definition.go +++ b/toolkit/tools/scheduler/buildagents/definition.go @@ -25,7 +25,7 @@ type BuildAgentConfig struct { DistTag string DistroReleaseVersion string DistroBuildNumber string - RpmmacrosFile string + RPMMacrosFiles string VersionsMacroFile string NoCleanup bool diff --git a/toolkit/tools/scheduler/scheduler.go b/toolkit/tools/scheduler/scheduler.go index 1e7ce2b9508..f8bd7bd3a2f 100644 --- a/toolkit/tools/scheduler/scheduler.go +++ b/toolkit/tools/scheduler/scheduler.go @@ -194,7 +194,7 @@ func main() { DistTag: *distTag, DistroReleaseVersion: *distroReleaseVersion, DistroBuildNumber: *distroBuildNumber, - RpmmacrosFile: *rpmmacrosFile, + RPMMacrosFiles: *rpmmacrosFile, VersionsMacroFile: *versionsMacroFile, NoCleanup: *noCleanup, diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 0f5d5ecc743..6e237a07016 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -389,30 +389,12 @@ func createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFil } // If a release version macros file is provided, copy it into the default RPM macros directory - // inside the chroot so rpmbuild picks it up automatically when packing SRPMs. + // inside the chroot so rpmspec/rpmbuild pick it up automatically. if releaseVersionMacrosFile != "" { - macroDir, macroErr := rpm.GetMacroDir() - if macroErr != nil { - logger.Log.Errorf("Failed to get RPM macro directory: %s", macroErr) - return - } - - macrosDestDir := filepath.Join(chroot.RootDir(), macroDir) - macrosDestFile := filepath.Join(macrosDestDir, filepath.Base(releaseVersionMacrosFile)) - - mkdirErr := directory.EnsureDirExists(macrosDestDir) - if mkdirErr != nil { - logger.Log.Errorf("Failed to create macros directory inside chroot (%s): %s", macrosDestDir, mkdirErr) - return - } - - copyErr := file.Copy(releaseVersionMacrosFile, macrosDestFile) - if copyErr != nil { - logger.Log.Errorf("Failed to copy release version macros file into chroot (%s -> %s): %s", releaseVersionMacrosFile, macrosDestFile, copyErr) - return + err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) + if err != nil { + logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) } - - logger.Log.Infof("Copied release version macros file into SRPM chroot (%s -> %s)", releaseVersionMacrosFile, macrosDestFile) } // Networking support is needed to download sources. diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 46ccc448d99..bf1f4dda76e 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -// specreader is a tool to parse spec files into a JSON structure +// versionsprocessor is a tool to generate a macro file of all specs version and release. package main @@ -9,6 +9,7 @@ import ( "fmt" "os" "path/filepath" + "regexp" "runtime" "strings" @@ -42,14 +43,12 @@ var ( func main() { const ( - querySrpm = `%{NAME}-%{VERSION}-%{RELEASE}.src.rpm` - queryProvidedPackages = `rpm %{ARCH}/%{nvra}.rpm\n[provides %{PROVIDENEVRS}\n][requires %{REQUIRENEVRS}\n][arch %{ARCH}\n]` - prefix = "azl" + prefix = "azl" ) var ( - chroot *safechroot.Chroot - macros_output []byte + chroot *safechroot.Chroot + macrosOutput []byte ) app.Version(exe.ToolkitVersion) @@ -105,47 +104,45 @@ func main() { specFileName := filepath.Base(specFile) sourceDir := filepath.Dir(specFile) - noCheckDefines := rpm.DefaultDistroDefines(false, *distTag) + defines := rpm.DefaultDistroDefines(false, *distTag) + + packages, err := rpm.QuerySPEC(specFile, sourceDir, `%{NAME}: %{evr}\n`, buildArch, defines, rpm.QueryHeaderArgument) - versionRelease, err := rpm.QuerySPEC(specFile, sourceDir, `%{VERSION}-%{RELEASE}`, buildArch, noCheckDefines, rpm.QueryHeaderArgument) if err != nil { logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) continue } - logger.PanicOnError(err) - - if len(versionRelease) == 0 { - logger.Log.Errorf("Invalid version-release retrieved from spec file (%s): %s", specFileName, versionRelease) - continue - } + for _, packageVersionString := range packages { - releaseVerSplit := strings.Split(versionRelease[0], "-") + // the output of the above query is in the format of "packagename: version-release", + // so split by ": " to get the version-release portion we want the second part + releaseVerSplit := regexp.MustCompile(`^[^:]+: (.+)-(.+)$`).FindStringSubmatch(packageVersionString)[1:] - if len(releaseVerSplit) < 2 { - logger.Log.Errorf("Invalid version-release format retrieved from spec file (%s): %s", specFileName, versionRelease[0]) - continue - } + if len(releaseVerSplit) != 2 { + logger.Log.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) + continue + } - version := releaseVerSplit[0] - release := releaseVerSplit[1] - releaseClean := strings.Replace(release, ".azl3", "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit + version := releaseVerSplit[0] + release := releaseVerSplit[1] + releaseClean := strings.Replace(release, *distTag, "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit - // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' - specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) - specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") - specFileNameMacroFormat = strings.ToLower(specFileNameMacroFormat) + // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' + specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) + specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") - versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" - releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" + versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" + releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" - // Generate RPM macro definitions instead of modifying spec files directly. - macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", - versionMacroString, version, - releaseMacroString, releaseClean, - ) + // Generate RPM macro definitions instead of modifying spec files directly. + macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", + versionMacroString, version, + releaseMacroString, releaseClean, + ) - macros_output = append(macros_output, []byte(macros)...) + macrosOutput = append(macrosOutput, []byte(macros)...) + } } return parseError @@ -169,11 +166,11 @@ func main() { continue } - macros_output = append(macros_output, []byte(contents)...) + macrosOutput = append(macrosOutput, []byte(contents)...) logger.Log.Infof("Appended contents of provided extra macros file (%s) to %s", extraPath, *output) } - err = file.Write(string(macros_output), *output) + err = file.Write(string(macrosOutput), *output) if err != nil { logger.Log.Errorf("Failed to write file (%s)", *output) return From 56f7a12317a838b0ce914e519c6cef32b321690b Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 14:55:35 -0800 Subject: [PATCH 65/86] adjusting to more pr's feedback --- .../tools/pkg/specreaderutils/specreaderutil.go | 1 - toolkit/tools/srpmpacker/srpmpacker.go | 1 - .../versionsprocessor/versionsprocessor.go | 17 +++++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 706cceffb99..4c142e77f42 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -127,7 +127,6 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist } // createChroot creates a chroot to parse SPECs inside of. -// If releaseVersionMacrosFile is non-empty, its parent directory is also made available inside the chroot. func createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile string) (chroot *safechroot.Chroot, err error) { const ( chrootName = "specparser_chroot" diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 6e237a07016..1cce4ff3256 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -319,7 +319,6 @@ func findSPECFiles(specsDir string, packList map[string]bool) (specFiles []strin } // createChroot creates a chroot to pack SRPMs inside of. -// If releaseVersionMacrosFile is non-empty, it will be copied into the default RPM macros directory inside the chroot. func createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFile string, useAzureCliAuth bool) (chroot *safechroot.Chroot, newBuildDir, newOutDir, newSpecsDir string, err error) { const ( chrootName = "srpmpacker_chroot" diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index bf1f4dda76e..53f5043bb5b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -2,6 +2,9 @@ // Licensed under the MIT License. // versionsprocessor is a tool to generate a macro file of all specs version and release. +// It iterates ove all of the SPEC files in the provided directory, gets the version and release for each SPEC, +// and then writes that information to an output file as RPM macros file.\ +// The output file is then provided to other tools and passed into their respective rpm macros folder so that rpmbuild command automatically recognize it. package main @@ -48,7 +51,7 @@ func main() { var ( chroot *safechroot.Chroot - macrosOutput []byte + macrosOutput []string ) app.Version(exe.ToolkitVersion) @@ -85,8 +88,6 @@ func main() { } doParse := func() error { - var parseError error - // Find all spec files allSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, nil) if err != nil { @@ -136,16 +137,16 @@ func main() { releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" // Generate RPM macro definitions instead of modifying spec files directly. - macros := fmt.Sprintf("%%%s %s\n%%%s %s\n", + macros := fmt.Sprintf("%%%s %s\n%%%s %s", versionMacroString, version, releaseMacroString, releaseClean, ) - macrosOutput = append(macrosOutput, []byte(macros)...) + macrosOutput = append(macrosOutput, macros) } } - return parseError + return err } if chroot != nil { @@ -166,11 +167,11 @@ func main() { continue } - macrosOutput = append(macrosOutput, []byte(contents)...) + macrosOutput = append(macrosOutput, contents) logger.Log.Infof("Appended contents of provided extra macros file (%s) to %s", extraPath, *output) } - err = file.Write(string(macrosOutput), *output) + err = file.WriteLines(macrosOutput, *output) if err != nil { logger.Log.Errorf("Failed to write file (%s)", *output) return From 3f038cfa1fbbeed0c09c43e21bc08233a350bc20 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 14:56:28 -0800 Subject: [PATCH 66/86] renaming input --- toolkit/tools/versionsprocessor/versionsprocessor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 53f5043bb5b..d8d758b5e8b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -41,7 +41,7 @@ var ( profFlags = exe.SetupProfileFlags(app) workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() - extraFiles = app.Flag("extra-macros-files", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() + extraFiles = app.Flag("extra-macros-file", "Additional files whose contents will be appended to the output; may be specified multiple times.").ExistingFiles() ) func main() { From d7d83c47d58b0a69dfa5e6efca13a04b041a8c40 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 15:03:33 -0800 Subject: [PATCH 67/86] renaming --- .../pkg/simpletoolchroot/simpletoolchroot.go | 12 ++++- toolkit/tools/pkgworker/pkgworker.go | 50 +++++++++---------- toolkit/tools/rpmssnapshot/rpmssnapshot.go | 9 ++-- toolkit/tools/scheduler/scheduler.go | 4 +- toolkit/tools/specreader/specreader.go | 38 +++++++------- toolkit/tools/srpmpacker/srpmpacker.go | 12 ++--- 6 files changed, 68 insertions(+), 57 deletions(-) diff --git a/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go b/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go index 27ae8c5451a..d3fe020161d 100644 --- a/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go +++ b/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go @@ -9,6 +9,7 @@ import ( "fmt" "path/filepath" + "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" "github.com/microsoft/azurelinux/toolkit/tools/internal/safechroot" ) @@ -45,7 +46,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 ) @@ -63,6 +64,15 @@ func (s *SimpleToolChroot) InitializeChroot(buildDir, chrootName, workerTarPath, return } + // 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 releaseVersionMacrosFile != "" { + err = s.chroot.AddRPMMacrosFile(releaseVersionMacrosFile) + if err != nil { + logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) + } + } + return } diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index c89174bf399..05628cbef7e 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -37,30 +37,30 @@ const ( ) var ( - app = kingpin.New("pkgworker", "A worker for building packages locally") - srpmFile = exe.InputFlag(app, "Full path to the SRPM to build") - workDir = app.Flag("work-dir", "The directory to create the build folder").Required().String() - workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz").Required().ExistingFile() - repoFile = app.Flag("repo-file", "Full path to local.repo").Required().ExistingFile() - rpmsDirPath = app.Flag("rpm-dir", "The directory to use as the local repo and to submit RPM packages to").Required().ExistingDir() - srpmsDirPath = app.Flag("srpm-dir", "The output directory for source RPM packages").Required().String() - toolchainDirPath = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain a top level directory for each architecture.").Required().ExistingDir() - cacheDir = app.Flag("cache-dir", "The cache directory containing downloaded dependency RPMS from Azure Linux Base").Required().ExistingDir() - basePackageName = app.Flag("base-package-name", "The name of the spec file used to build this package without the extension.").Required().String() - noCleanup = app.Flag("no-cleanup", "Whether or not to delete the chroot folder after the build is done").Bool() - distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() - distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with").Required().String() - distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with").Required().String() - rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use").ExistingFile() - versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() - runCheck = app.Flag("run-check", "Run the check during package build").Bool() - packagesToInstall = app.Flag("install-package", "Filepaths to RPM packages that should be installed before building.").Strings() - outArch = app.Flag("out-arch", "Architecture of resulting package").String() - useCcache = app.Flag("use-ccache", "Automatically install and use ccache during package builds").Bool() - ccacheRootDir = app.Flag("ccache-root-dir", "The directory used to store ccache outputs").String() - ccachConfig = app.Flag("ccache-config", "The configuration file for ccache.").String() - maxCPU = app.Flag("max-cpu", "Max number of CPUs used for package building").Default("").String() - timeout = app.Flag("timeout", "Timeout for package building").Required().Duration() + app = kingpin.New("pkgworker", "A worker for building packages locally") + srpmFile = exe.InputFlag(app, "Full path to the SRPM to build") + workDir = app.Flag("work-dir", "The directory to create the build folder").Required().String() + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz").Required().ExistingFile() + repoFile = app.Flag("repo-file", "Full path to local.repo").Required().ExistingFile() + rpmsDirPath = app.Flag("rpm-dir", "The directory to use as the local repo and to submit RPM packages to").Required().ExistingDir() + srpmsDirPath = app.Flag("srpm-dir", "The output directory for source RPM packages").Required().String() + toolchainDirPath = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain a top level directory for each architecture.").Required().ExistingDir() + cacheDir = app.Flag("cache-dir", "The cache directory containing downloaded dependency RPMS from Azure Linux Base").Required().ExistingDir() + basePackageName = app.Flag("base-package-name", "The name of the spec file used to build this package without the extension.").Required().String() + noCleanup = app.Flag("no-cleanup", "Whether or not to delete the chroot folder after the build is done").Bool() + distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() + distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with").Required().String() + distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with").Required().String() + rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use").ExistingFile() + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() + runCheck = app.Flag("run-check", "Run the check during package build").Bool() + packagesToInstall = app.Flag("install-package", "Filepaths to RPM packages that should be installed before building.").Strings() + outArch = app.Flag("out-arch", "Architecture of resulting package").String() + useCcache = app.Flag("use-ccache", "Automatically install and use ccache during package builds").Bool() + ccacheRootDir = app.Flag("ccache-root-dir", "The directory used to store ccache outputs").String() + ccachConfig = app.Flag("ccache-config", "The configuration file for ccache.").String() + maxCPU = app.Flag("max-cpu", "Max number of CPUs used for package building").Default("").String() + timeout = app.Flag("timeout", "Timeout for package building").Required().Duration() logFlags = exe.SetupLogFlags(app) ) @@ -118,7 +118,7 @@ func main() { defines[rpm.MaxCPUDefine] = *maxCPU } - builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *versionsMacroFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) + builtRPMs, err := buildSRPMInChroot(chrootDir, rpmsDirAbsPath, toolchainDirAbsPath, *workerTar, *srpmFile, *repoFile, *rpmmacrosFile, *releaseVersionMacrosFile, *outArch, defines, *noCleanup, *runCheck, *packagesToInstall, ccacheManager, *timeout) logger.FatalOnError(err, "Failed to build SRPM '%s'. For details see log file: %s .", *srpmFile, *logFlags.LogFile) // For regular (non-test) package builds: diff --git a/toolkit/tools/rpmssnapshot/rpmssnapshot.go b/toolkit/tools/rpmssnapshot/rpmssnapshot.go index d04d701e842..f4f3e2f0ab8 100644 --- a/toolkit/tools/rpmssnapshot/rpmssnapshot.go +++ b/toolkit/tools/rpmssnapshot/rpmssnapshot.go @@ -21,9 +21,10 @@ var ( specsDirPath = exe.InputStringFlag(app, "Path to specs directory.") outputSnapshotPath = exe.OutputFlag(app, "Path to the generated snapshot.") - buildDirPath = app.Flag("build-dir", "Directory to store temporary files.").Required().String() - distTag = app.Flag("dist-tag", "The distribution tag.").Required().String() - workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz.").Required().ExistingFile() + buildDirPath = app.Flag("build-dir", "Directory to store temporary files.").Required().String() + distTag = app.Flag("dist-tag", "The distribution tag.").Required().String() + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz.").Required().ExistingFile() + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while parsing specs.").ExistingFile() logFlags = exe.SetupLogFlags(app) ) @@ -33,7 +34,7 @@ func main() { kingpin.MustParse(app.Parse(os.Args[1:])) logger.InitBestEffort(logFlags) - snapshotGenerator, err := rpmssnapshot.New(*buildDirPath, *workerTar, *specsDirPath) + snapshotGenerator, err := rpmssnapshot.New(*buildDirPath, *workerTar, *specsDirPath, *releaseVersionMacrosFile) if err != nil { logger.Log.Fatalf("Failed to initialize RPM snapshot generator. Error: %v", err) } diff --git a/toolkit/tools/scheduler/scheduler.go b/toolkit/tools/scheduler/scheduler.go index f8bd7bd3a2f..fd3ee3eb8d5 100644 --- a/toolkit/tools/scheduler/scheduler.go +++ b/toolkit/tools/scheduler/scheduler.go @@ -76,7 +76,7 @@ var ( distroReleaseVersion = app.Flag("distro-release-version", "The distro release version that the SRPM will be built with.").Required().String() distroBuildNumber = app.Flag("distro-build-number", "The distro build number that the SRPM will be built with.").Required().String() rpmmacrosFile = app.Flag("rpmmacros-file", "Optional file path to an rpmmacros file for rpmbuild to use.").ExistingFile() - versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while building.").ExistingFile() buildAttempts = app.Flag("build-attempts", "Sets the number of times to try building a package.").Default(defaultBuildAttempts).Int() checkAttempts = app.Flag("check-attempts", "Sets the minimum number of times to test a package if the tests fail.").Default(defaultCheckAttempts).Int() extraLayers = app.Flag("extra-layers", "Sets the number of additional layers in the graph beyond the goal packages to buid.").Default(defaultExtraLayers).Int() @@ -195,7 +195,7 @@ func main() { DistroReleaseVersion: *distroReleaseVersion, DistroBuildNumber: *distroBuildNumber, RPMMacrosFiles: *rpmmacrosFile, - VersionsMacroFile: *versionsMacroFile, + VersionsMacroFile: *releaseVersionMacrosFile, NoCleanup: *noCleanup, UseCcache: *useCcache, diff --git a/toolkit/tools/specreader/specreader.go b/toolkit/tools/specreader/specreader.go index 75f9ea90403..7f0208a73df 100644 --- a/toolkit/tools/specreader/specreader.go +++ b/toolkit/tools/specreader/specreader.go @@ -25,24 +25,24 @@ const ( ) var ( - app = kingpin.New("specreader", "A tool to parse spec dependencies into JSON") - specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") - specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() - output = exe.OutputFlag(app, "Output file to export the JSON") - versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while parsing specs.").ExistingFile() - workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() - buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() - srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() - rpmsDir = app.Flag("rpm-dir", "Directory containing built RPMs.").Required().ExistingDir() - toolchainManifest = app.Flag("toolchain-manifest", "Path to a list of RPMs which are created by the toolchain. Will mark RPMs from this list as prebuilt.").ExistingFile() - existingToolchainRpmDir = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain top level directories for architecture.").Required().ExistingDir() - distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() - workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() - targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() - runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() - logFlags = exe.SetupLogFlags(app) - profFlags = exe.SetupProfileFlags(app) - timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() + app = kingpin.New("specreader", "A tool to parse spec dependencies into JSON") + specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") + specList = app.Flag("spec-list", "List of SPECs to parse. If empty will parse all SPECs.").Default("").String() + output = exe.OutputFlag(app, "Output file to export the JSON") + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while parsing specs.").ExistingFile() + workers = app.Flag("workers", "Number of concurrent goroutines to parse with").Default(defaultWorkerCount).Int() + buildDir = app.Flag("build-dir", "Directory to store temporary files while parsing.").String() + srpmsDir = app.Flag("srpm-dir", "Directory containing SRPMs.").Required().ExistingDir() + rpmsDir = app.Flag("rpm-dir", "Directory containing built RPMs.").Required().ExistingDir() + toolchainManifest = app.Flag("toolchain-manifest", "Path to a list of RPMs which are created by the toolchain. Will mark RPMs from this list as prebuilt.").ExistingFile() + existingToolchainRpmDir = app.Flag("toolchain-rpms-dir", "Directory that contains already built toolchain RPMs. Should contain top level directories for architecture.").Required().ExistingDir() + distTag = app.Flag("dist-tag", "The distribution tag the SPEC will be built with.").Required().String() + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz. If this argument is empty, specs will be parsed in the host environment.").ExistingFile() + targetArch = app.Flag("target-arch", "The architecture of the machine the RPM binaries run on").String() + runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() + logFlags = exe.SetupLogFlags(app) + profFlags = exe.SetupProfileFlags(app) + timestampFile = app.Flag("timestamp-file", "File that stores timestamps for this program.").String() ) func main() { @@ -75,6 +75,6 @@ func main() { specsAbsDir, err := filepath.Abs(*specsDir) logger.PanicOnError(err, "Unable to get absolute path for specs directory '%s': %s", *specsDir, err) - err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *versionsMacroFile, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) + err = specreaderutils.ParseSPECsWrapper(*buildDir, specsAbsDir, *rpmsDir, *srpmsDir, *existingToolchainRpmDir, *distTag, *output, *workerTar, *releaseVersionMacrosFile, *targetArch, specListSet, toolchainRPMs, *workers, *runCheck) logger.PanicOnError(err) } diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index 1cce4ff3256..afde7df595a 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -125,11 +125,11 @@ var ( srpmPackList = app.Flag("pack-list", "List of SPECs to pack. If empty will pack all SPECs.").Default("").String() runCheck = app.Flag("run-check", "Whether or not to run the spec file's check section during package build.").Bool() - workers = app.Flag("workers", "Number of concurrent goroutines to parse with.").Default(defaultWorkerCount).Uint() - concurrentNetOps = app.Flag("concurrent-net-ops", "Number of concurrent network operations to perform.").Default(defaultNetOpsCount).Uint() - repackAll = app.Flag("repack", "Rebuild all SRPMs, even if already built.").Bool() - nestedSourcesDir = app.Flag("nested-sources", "Set if for a given SPEC, its sources are contained in a SOURCES directory next to the SPEC file.").Bool() - versionsMacroFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while packing SRPMs.").ExistingFile() + workers = app.Flag("workers", "Number of concurrent goroutines to parse with.").Default(defaultWorkerCount).Uint() + concurrentNetOps = app.Flag("concurrent-net-ops", "Number of concurrent network operations to perform.").Default(defaultNetOpsCount).Uint() + repackAll = app.Flag("repack", "Rebuild all SRPMs, even if already built.").Bool() + nestedSourcesDir = app.Flag("nested-sources", "Set if for a given SPEC, its sources are contained in a SOURCES directory next to the SPEC file.").Bool() + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while packing SRPMs.").ExistingFile() // Use String() and not ExistingFile() as the Makefile may pass an empty string if the user did not specify any of these options sourceURL = app.Flag("source-url", "URL to a source server to download SPEC sources from.").String() @@ -216,7 +216,7 @@ func main() { packList, err := packagelist.ParsePackageList(*srpmPackList) logger.PanicOnError(err) - err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *versionsMacroFile, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) + err = createAllSRPMsWrapper(*specsDir, *distTag, *buildDir, *outDir, *workerTar, *releaseVersionMacrosFile, *workers, *concurrentNetOps, *nestedSourcesDir, *repackAll, *runCheck, packList, templateSrcConfig) logger.PanicOnError(err) } From 274df4af245d16446e67cab2f42f3c97fae18caa Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 15:07:55 -0800 Subject: [PATCH 68/86] pass the macros file to other places that might use it --- toolkit/scripts/pkggen.mk | 2 +- toolkit/scripts/srpm_pack.mk | 1 - toolkit/scripts/toolkit.mk | 7 +++++-- toolkit/tools/pkg/licensecheck/licensecheck.go | 2 +- toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go | 4 ++-- toolkit/tools/pkg/specarchchecker/specarchchecker.go | 4 ++-- toolkit/tools/specarchchecker/specarchchecker.go | 9 +++++---- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/toolkit/scripts/pkggen.mk b/toolkit/scripts/pkggen.mk index fba8ce78c3d..e907675f411 100644 --- a/toolkit/scripts/pkggen.mk +++ b/toolkit/scripts/pkggen.mk @@ -103,7 +103,7 @@ $(rel_versions_macro_file): $(chroot_worker) $(SPECS_DIR) $(build_specs) $(build --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-files=$(file))) \ + $(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) \ diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index 501185e66fc..9cb9f2ec2b8 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -17,7 +17,6 @@ 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)) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index aa8fe439708..9be4b4b6b32 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -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 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 @@ -93,12 +94,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) \ @@ -114,13 +116,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)" \ diff --git a/toolkit/tools/pkg/licensecheck/licensecheck.go b/toolkit/tools/pkg/licensecheck/licensecheck.go index 2321cee7130..7a5fb61ffdf 100644 --- a/toolkit/tools/pkg/licensecheck/licensecheck.go +++ b/toolkit/tools/pkg/licensecheck/licensecheck.go @@ -74,7 +74,7 @@ func New(buildDirPath, workerTarPath, rpmDirPath, nameFilePath, exceptionFilePat jobSemaphore: make(chan struct{}, runtime.NumCPU()*2), } - err = newLicenseChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, rpmDirPath) + err = newLicenseChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, rpmDirPath, "") if err != nil { err = fmt.Errorf("failed to initialize chroot:\n%w", err) return newLicenseChecker, err diff --git a/toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go b/toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go index e92373ecf92..3f000fee67a 100644 --- a/toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go +++ b/toolkit/tools/pkg/rpmssnapshot/rpmssnapshot.go @@ -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 } diff --git a/toolkit/tools/pkg/specarchchecker/specarchchecker.go b/toolkit/tools/pkg/specarchchecker/specarchchecker.go index e51b94c325b..50145a05ea3 100644 --- a/toolkit/tools/pkg/specarchchecker/specarchchecker.go +++ b/toolkit/tools/pkg/specarchchecker/specarchchecker.go @@ -21,10 +21,10 @@ type ArchChecker struct { } // New creates an ArchChecker. If the chroot is created successfully, the caller is responsible for calling CleanUp(). -func New(buildDirPath, workerTarPath, specsDirPath string) (newArchChecker *ArchChecker, err error) { +func New(buildDirPath, workerTarPath, specsDirPath, releaseVersionMacrosFile string) (newArchChecker *ArchChecker, err error) { const chrootName = "specarchchecker_chroot" newArchChecker = &ArchChecker{} - err = newArchChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, specsDirPath) + err = newArchChecker.simpleToolChroot.InitializeChroot(buildDirPath, chrootName, workerTarPath, specsDirPath, releaseVersionMacrosFile) return newArchChecker, err } diff --git a/toolkit/tools/specarchchecker/specarchchecker.go b/toolkit/tools/specarchchecker/specarchchecker.go index 8a7ccf146ff..1b9723b1682 100644 --- a/toolkit/tools/specarchchecker/specarchchecker.go +++ b/toolkit/tools/specarchchecker/specarchchecker.go @@ -26,9 +26,10 @@ var ( pkgsToBuild = app.Flag("packages", "Space separated list of top-level packages that should be built. Omit this argument to build all packages.").String() pkgsToRebuild = app.Flag("rebuild-packages", "Space separated list of base package names packages that should be rebuilt.").String() - buildDirPath = app.Flag("build-dir", "Directory to store temporary files.").Required().String() - distTag = app.Flag("dist-tag", "The distribution tag.").Required().String() - workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz.").Required().ExistingFile() + buildDirPath = app.Flag("build-dir", "Directory to store temporary files.").Required().String() + distTag = app.Flag("dist-tag", "The distribution tag.").Required().String() + workerTar = app.Flag("worker-tar", "Full path to worker_chroot.tar.gz.").Required().ExistingFile() + releaseVersionMacrosFile = app.Flag("versions-macro-file", "File containing release and version macros for all SPECS to use while parsing specs.").ExistingFile() testOnly = app.Flag("test-only", "Whether or not to run the filter out specs which don't run tests.").Bool() @@ -48,7 +49,7 @@ func main() { logger.Log.Fatalf("No specs were provided to filter.") } - archChecker, err := specarchchecker.New(*buildDirPath, *workerTar, *specsDirPath) + archChecker, err := specarchchecker.New(*buildDirPath, *workerTar, *specsDirPath, *releaseVersionMacrosFile) if err != nil { logger.Log.Fatalf("Failed to initialize spec arch checker. Error:\n%s", err) } From 044adafd0f82b6168828244dc1899bd2459c6d26 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 15:21:11 -0800 Subject: [PATCH 69/86] make public function --- .../pkg/specreaderutils/specreaderutil.go | 10 ++-- .../versionsprocessor/versionsprocessor.go | 48 +------------------ 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 4c142e77f42..6d58da3df2e 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -67,7 +67,7 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist if workerTar != "" { const leaveFilesOnDisk = false - chroot, err = createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile) + chroot, err = CreateChroot("specparser_chroot", workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile) if err != nil { return } @@ -127,9 +127,8 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist } // createChroot creates a chroot to parse SPECs inside of. -func createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile string) (chroot *safechroot.Chroot, err error) { +func CreateChroot(chrootName, workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile string) (chroot *safechroot.Chroot, err error) { const ( - chrootName = "specparser_chroot" existingDir = false leaveFilesOnDisk = false ) @@ -141,7 +140,10 @@ func createChroot(workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosF extraMountPoints := []*safechroot.MountPoint{ safechroot.NewMountPoint(specsDir, specsDir, "", safechroot.BindMountPointFlags, ""), - safechroot.NewMountPoint(srpmsDir, srpmsDir, "", safechroot.BindMountPointFlags, ""), + } + + if srpmsDir != "" { + extraMountPoints = append(extraMountPoints, safechroot.NewMountPoint(srpmsDir, srpmsDir, "", safechroot.BindMountPointFlags, "")) } chrootDir := filepath.Join(buildDir, chrootName) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index d8d758b5e8b..96ad4b29cee 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -16,8 +16,6 @@ import ( "runtime" "strings" - "github.com/microsoft/azurelinux/toolkit/tools/internal/buildpipeline" - "github.com/microsoft/azurelinux/toolkit/tools/internal/directory" "github.com/microsoft/azurelinux/toolkit/tools/internal/exe" "github.com/microsoft/azurelinux/toolkit/tools/internal/file" "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" @@ -80,7 +78,7 @@ func main() { if *workerTar != "" { const leaveFilesOnDisk = false - chroot, err = createChroot(*workerTar, *buildDir, *specsDir) + chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir, "", "") if err != nil { return } @@ -177,47 +175,3 @@ func main() { return } } - -// createChroot creates a chroot to parse SPECs inside of. -func createChroot(workerTar, buildDir, specsDir string) (chroot *safechroot.Chroot, err error) { - const ( - chrootName = "versionprocessor_chroot" - existingDir = false - leaveFilesOnDisk = false - ) - - // Mount the specs and srpms directories to an identical path inside the chroot. - // Since versionsprocessor saves the full paths to specs in its output that grapher will then consume, - // the pathing needs to be preserved from the host system. - var extraDirectories []string - - extraMountPoints := []*safechroot.MountPoint{ - safechroot.NewMountPoint(specsDir, specsDir, "", safechroot.BindMountPointFlags, ""), - } - - chrootDir := filepath.Join(buildDir, chrootName) - chroot = safechroot.NewChroot(chrootDir, existingDir) - - err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true) - if err != nil { - return - } - - // If this is not a regular build then copy in all of the SPECs since there are no bind mounts. - if !buildpipeline.IsRegularBuild() { - dirsToCopy := []string{specsDir} - for _, dir := range dirsToCopy { - dirInChroot := filepath.Join(chroot.RootDir(), dir) - err = directory.CopyContents(dir, dirInChroot) - if err != nil { - closeErr := chroot.Close(leaveFilesOnDisk) - if closeErr != nil { - logger.Log.Errorf("Failed to close chroot, err: %s", err) - } - return - } - } - } - - return -} From 4677b8fa0620d0c0bf42af3622e327c5e293cd99 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 20 Feb 2026 15:48:04 -0800 Subject: [PATCH 70/86] update regular specs to also use the new mechanism --- SPECS-SIGNED/iser-signed/iser-signed.spec | 15 ++-- SPECS-SIGNED/isert-signed/isert-signed.spec | 15 ++-- .../knem-modules-signed.spec | 11 ++- .../mft_kernel-signed/mft_kernel-signed.spec | 11 ++- .../mlnx-nfsrdma-signed.spec | 15 ++-- .../mlnx-ofa_kernel-modules-signed.spec | 83 ++++++++++--------- SPECS-SIGNED/srp-signed/srp-signed.spec | 15 ++-- .../xpmem-modules-signed.spec | 15 ++-- SPECS/iser/iser.spec | 18 ++-- SPECS/isert/isert.spec | 18 ++-- SPECS/knem/knem.spec | 11 ++- SPECS/mft_kernel/mft_kernel.spec | 11 ++- SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec | 18 ++-- SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec | 11 ++- SPECS/srp/srp.spec | 16 ++-- SPECS/xpmem/xpmem.spec | 15 ++-- 16 files changed, 180 insertions(+), 118 deletions(-) diff --git a/SPECS-SIGNED/iser-signed/iser-signed.spec b/SPECS-SIGNED/iser-signed/iser-signed.spec index b4812a1d04f..554ccb726e2 100644 --- a/SPECS-SIGNED/iser-signed/iser-signed.spec +++ b/SPECS-SIGNED/iser-signed/iser-signed.spec @@ -30,20 +30,22 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name iser} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -110,6 +112,9 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/isert-signed/isert-signed.spec b/SPECS-SIGNED/isert-signed/isert-signed.spec index 651837398ab..2ce35809a90 100644 --- a/SPECS-SIGNED/isert-signed/isert-signed.spec +++ b/SPECS-SIGNED/isert-signed/isert-signed.spec @@ -30,20 +30,22 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name isert} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -109,6 +111,9 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec index 7a52ad3e219..c0d576074e8 100644 --- a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec +++ b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec @@ -27,9 +27,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} @@ -43,7 +43,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: %{_name}-signed Version: 1.1.4.90mlnx3 -Release: 22%{release_suffix}%{?dist} +Release: 23%{release_suffix}%{?dist} Provides: knem-mlnx = %{version}-%{release} Obsoletes: knem-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -108,6 +108,9 @@ fi /lib/modules/ %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-23 +- Tweak specs to use dynamic versioning for kernel + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-22 - Bump release to rebuild for new release. diff --git a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec index 62d1af9dc2f..e19fedaf23e 100644 --- a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec +++ b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec @@ -3,9 +3,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} @@ -14,7 +14,7 @@ Name: %{_name}-signed Summary: %{_name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel @@ -81,6 +81,9 @@ popd /lib/modules/%{KVERSION}/updates/ %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-2 +- Tweak specs to use dynamic versioning for kernel + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 4.33.0-1 - Upgrade version to 4.33.0. diff --git a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec index ee61b001cba..23efa60471f 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec @@ -30,21 +30,23 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_name: %define _name mlnx-nfsrdma} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -117,6 +119,9 @@ fi %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec index 26e840e9974..8ec67b25540 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec @@ -30,13 +30,11 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} -%global KVERSION %{target_kernel_version_full} - %{!?_name: %global _name mlnx-ofa_kernel-modules} # mlnx-ofa_kernel-modules is a sub-package in SPECS/mlnx-ofa_kernel. @@ -45,7 +43,7 @@ Summary: Infiniband HCA Driver Name: %{_name}-signed Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -143,38 +141,38 @@ pushd rpm_contents # This spec's whole purpose is to inject the signed modules rpm2cpio %{SOURCE0} | cpio -idmv -cp -rf %{SOURCE1} ./lib/modules/%{KVERSION}/updates/compat/mlx_compat.ko -cp -rf %{SOURCE2} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_cm.ko -cp -rf %{SOURCE3} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_core.ko -cp -rf %{SOURCE4} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_ucm.ko -cp -rf %{SOURCE5} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_umad.ko -cp -rf %{SOURCE6} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_uverbs.ko -cp -rf %{SOURCE7} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/iw_cm.ko -cp -rf %{SOURCE8} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/rdma_cm.ko -cp -rf %{SOURCE9} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/rdma_ucm.ko -cp -rf %{SOURCE10} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/bnxt_re/bnxt_re.ko -cp -rf %{SOURCE11} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/efa/efa.ko -cp -rf %{SOURCE12} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mlx4/mlx4_ib.ko -cp -rf %{SOURCE13} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mlx5/mlx5_ib.ko -cp -rf %{SOURCE14} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/sw/rxe/rdma_rxe.ko -cp -rf %{SOURCE15} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/ipoib/ib_ipoib.ko -cp -rf %{SOURCE16} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/iser/ib_iser.ko -cp -rf %{SOURCE17} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/isert/ib_isert.ko -cp -rf %{SOURCE18} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/srp/ib_srp.ko -cp -rf %{SOURCE19} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko -cp -rf %{SOURCE20} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko -cp -rf %{SOURCE21} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko -cp -rf %{SOURCE22} ./lib/modules/%{KVERSION}/updates/drivers/nvme/host/nvme-rdma.ko -cp -rf %{SOURCE23} ./lib/modules/%{KVERSION}/updates/drivers/nvme/target/nvmet-rdma.ko -cp -rf %{SOURCE24} ./lib/modules/%{KVERSION}/updates/net/mlxdevm/mlxdevm.ko -cp -rf %{SOURCE25} ./lib/modules/%{KVERSION}/updates/net/smc/smc.ko -cp -rf %{SOURCE26} ./lib/modules/%{KVERSION}/updates/net/smc/smc_diag.ko -cp -rf %{SOURCE27} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/rpcrdma.ko -cp -rf %{SOURCE28} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/svcrdma.ko -cp -rf %{SOURCE29} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/xprtrdma.ko -cp -rf %{SOURCE30} ./lib/modules/%{KVERSION}/updates/drivers/fwctl/fwctl.ko -cp -rf %{SOURCE31} ./lib/modules/%{KVERSION}/updates/drivers/fwctl/mlx5/mlx5_fwctl.ko -cp -rf %{SOURCE32} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mana/mana_ib.ko +cp -rf %{SOURCE1} ./lib/modules/%{target_kernel_version_full}/updates/compat/mlx_compat.ko +cp -rf %{SOURCE2} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_cm.ko +cp -rf %{SOURCE3} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_core.ko +cp -rf %{SOURCE4} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_ucm.ko +cp -rf %{SOURCE5} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_umad.ko +cp -rf %{SOURCE6} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_uverbs.ko +cp -rf %{SOURCE7} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/iw_cm.ko +cp -rf %{SOURCE8} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/rdma_cm.ko +cp -rf %{SOURCE9} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/rdma_ucm.ko +cp -rf %{SOURCE10} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/bnxt_re/bnxt_re.ko +cp -rf %{SOURCE11} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/efa/efa.ko +cp -rf %{SOURCE12} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mlx4/mlx4_ib.ko +cp -rf %{SOURCE13} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mlx5/mlx5_ib.ko +cp -rf %{SOURCE14} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/sw/rxe/rdma_rxe.ko +cp -rf %{SOURCE15} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/ipoib/ib_ipoib.ko +cp -rf %{SOURCE16} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/iser/ib_iser.ko +cp -rf %{SOURCE17} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/isert/ib_isert.ko +cp -rf %{SOURCE18} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/srp/ib_srp.ko +cp -rf %{SOURCE19} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko +cp -rf %{SOURCE20} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko +cp -rf %{SOURCE21} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko +cp -rf %{SOURCE22} ./lib/modules/%{target_kernel_version_full}/updates/drivers/nvme/host/nvme-rdma.ko +cp -rf %{SOURCE23} ./lib/modules/%{target_kernel_version_full}/updates/drivers/nvme/target/nvmet-rdma.ko +cp -rf %{SOURCE24} ./lib/modules/%{target_kernel_version_full}/updates/net/mlxdevm/mlxdevm.ko +cp -rf %{SOURCE25} ./lib/modules/%{target_kernel_version_full}/updates/net/smc/smc.ko +cp -rf %{SOURCE26} ./lib/modules/%{target_kernel_version_full}/updates/net/smc/smc_diag.ko +cp -rf %{SOURCE27} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/rpcrdma.ko +cp -rf %{SOURCE28} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/svcrdma.ko +cp -rf %{SOURCE29} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/xprtrdma.ko +cp -rf %{SOURCE30} ./lib/modules/%{target_kernel_version_full}/updates/drivers/fwctl/fwctl.ko +cp -rf %{SOURCE31} ./lib/modules/%{target_kernel_version_full}/updates/drivers/fwctl/mlx5/mlx5_fwctl.ko +cp -rf %{SOURCE32} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mana/mana_ib.ko popd @@ -188,18 +186,21 @@ popd %post -n %{_name} -/sbin/depmod %{KVERSION} +/sbin/depmod %{target_kernel_version_full} %postun -n %{_name} if [ $1 = 0 ]; then # 1 : Erase, not upgrade - /sbin/depmod %{KVERSION} + /sbin/depmod %{target_kernel_version_full} fi %files -n %{_name} -/lib/modules/%{KVERSION}/updates/ +/lib/modules/%{target_kernel_version_full}/updates/ %license %{_datadir}/licenses/%{_name}/copyright %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel versions. + * Tue Nov 18 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update additional kernel modules fwctl mana and mlx5_dpll included from 25.07 diff --git a/SPECS-SIGNED/srp-signed/srp-signed.spec b/SPECS-SIGNED/srp-signed/srp-signed.spec index afd8edf4ce3..3d28efd2dfd 100644 --- a/SPECS-SIGNED/srp-signed/srp-signed.spec +++ b/SPECS-SIGNED/srp-signed/srp-signed.spec @@ -31,9 +31,11 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -42,12 +44,12 @@ %global KVERSION %{target_kernel_version_full} %define _name srp -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} Summary: srp driver Name: %{_name}-signed Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -110,6 +112,9 @@ popd %license %{_datadir}/licenses/%{_name}/copyright %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec index 420d3fe51a6..4f8b46055a9 100644 --- a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec @@ -4,15 +4,17 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %define _name xpmem-modules -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} # xpmem-modules is a sub-package in SPECS/xpmem. # We are making that into a main package for signing. @@ -20,7 +22,7 @@ Summary: Cross-partition memory Name: %{_name}-signed Version: 2.7.4 -Release: 22%{release_suffix}%{?dist} +Release: 23%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -93,6 +95,9 @@ fi %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-23 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 2.7.4-22 - Build with OFED 25.07.0.9.7.1. diff --git a/SPECS/iser/iser.spec b/SPECS/iser/iser.spec index e67720745a2..72a305fd2e5 100644 --- a/SPECS/iser/iser.spec +++ b/SPECS/iser/iser.spec @@ -27,9 +27,11 @@ # %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -39,8 +41,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name iser} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -66,14 +67,14 @@ Summary: %{_name} Driver Name: iser Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/iser-%{_version}.tgz +Source0: %{_distro_sources_url}/iser-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -252,6 +253,9 @@ fi # 1 : closed %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/isert/isert.spec b/SPECS/isert/isert.spec index 271e942653e..0450d845e4b 100644 --- a/SPECS/isert/isert.spec +++ b/SPECS/isert/isert.spec @@ -27,9 +27,11 @@ # %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -39,8 +41,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -66,14 +67,14 @@ Summary: %{_name} Driver Name: isert Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/isert-%{_version}.tgz +Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -252,6 +253,9 @@ fi # 1 : closed %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/knem/knem.spec b/SPECS/knem/knem.spec index 64b69713e83..9ce5aa8ea93 100644 --- a/SPECS/knem/knem.spec +++ b/SPECS/knem/knem.spec @@ -27,9 +27,9 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -54,7 +54,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: knem Version: 1.1.4.90mlnx3 -Release: 22%{release_suffix}%{?dist} +Release: 23%{release_suffix}%{?dist} Provides: knem-mlnx = %{version}-%{release} Obsoletes: knem-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -304,6 +304,9 @@ fi %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-23 +- Tweak specs to use dynamic versioning for kernel + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-22 - Build with OFED 25.07.0.9.7.1. - Update source path diff --git a/SPECS/mft_kernel/mft_kernel.spec b/SPECS/mft_kernel/mft_kernel.spec index b15ed380b55..62f9d111b3d 100644 --- a/SPECS/mft_kernel/mft_kernel.spec +++ b/SPECS/mft_kernel/mft_kernel.spec @@ -1,8 +1,8 @@ %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -35,7 +35,7 @@ Name: mft_kernel Summary: %{name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel BuildRoot: /var/tmp/%{name}-%{version}-build @@ -230,6 +230,9 @@ find %{buildroot} -type f -name \*.ko -exec %{__strip} -p --strip-debug --discar %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-2 +- Tweak specs to use dynamic versioning for kernel + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 4.33.0-1 - Upgrade version to 4.33.0. - Update source path diff --git a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec index c55b4fe59d9..6ff0993b400 100644 --- a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec +++ b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec @@ -27,9 +27,11 @@ # %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -40,8 +42,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name mlnx-nfsrdma} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,14 +68,14 @@ Summary: %{_name} Driver Name: mlnx-nfsrdma Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/%{_name}-%{_version}.tgz +Source0: %{_distro_sources_url}/%{_name}-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -253,6 +254,9 @@ fi %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec index 77d5bd244dd..d9108c0a33b 100644 --- a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec +++ b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec @@ -27,9 +27,9 @@ # %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -107,7 +107,7 @@ Summary: Infiniband HCA Driver Name: mlnx-ofa_kernel Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -766,6 +766,9 @@ update-alternatives --remove \ %{_prefix}/src/mlnx-ofa_kernel-%version %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/srp/srp.spec b/SPECS/srp/srp.spec index 7c235b802e1..6c3339bf19d 100644 --- a/SPECS/srp/srp.spec +++ b/SPECS/srp/srp.spec @@ -27,9 +27,11 @@ # %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -39,8 +41,7 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name srp} -%{!?_version: %define _version 25.07} -%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -66,7 +67,7 @@ Summary: srp driver Name: srp Version: 25.07 -Release: 1%{release_suffix}%{?dist} +Release: 2%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -258,6 +259,9 @@ fi %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/xpmem/xpmem.spec b/SPECS/xpmem/xpmem.spec index ed3d70569f8..b45177b13b6 100644 --- a/SPECS/xpmem/xpmem.spec +++ b/SPECS/xpmem/xpmem.spec @@ -1,9 +1,11 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) -%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) +%global target_azl_build_kernel_version %azl_kernel_hwe_version +%global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -12,7 +14,7 @@ %global KVERSION %{target_kernel_version_full} %global K_SRC /lib/modules/%{target_kernel_version_full}/build -%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} # %{!?KVERSION: %global KVERSION %(uname -r)} %{!?KVERSION: %global KVERSION %{target_kernel_version_full}} @@ -42,7 +44,7 @@ Summary: Cross-partition memory Name: xpmem Version: 2.7.4 -Release: 22%{release_suffix}%{?dist} +Release: 23%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -274,6 +276,9 @@ fi %endif %changelog +* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-23 +- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. + * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 2.7.4-22 - Build with OFED 25.07.0.9.7.1. - Update source path From 011904220dd41df7e28f441ec800441ca39b5606 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 23 Feb 2026 15:47:21 -0800 Subject: [PATCH 71/86] fix mlnx-ofa_kernel --- SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec index d9108c0a33b..9cb56cc1d9b 100644 --- a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec +++ b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec @@ -29,6 +29,8 @@ %if 0%{azl} %global target_azl_build_kernel_version %azl_kernel_hwe_version %global target_kernel_release %azl_kernel_hwe_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -90,7 +92,6 @@ %{!?KERNEL_SOURCES: %global KERNEL_SOURCES /lib/modules/%{KVERSION}/source} %{!?_name: %global _name mlnx-ofa_kernel} -%{!?_version: %global _version 25.07} %{!?_release: %global _release OFED.25.07.0.9.7.1} %global _kmp_rel %{_release}%{?_kmp_build_num}%{?_dist} %global MLNX_OFA_DRV_SRC 24.10-0.7.0 @@ -114,7 +115,7 @@ Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/%{_name}-%{_version}.tgz +Source0: %{_distro_sources_url}/%{_name}-%{target_mlnx_ofa_kernel_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation @@ -302,7 +303,7 @@ drivers against it. %{!?install_mod_dir: %global install_mod_dir updates} %prep -%setup -n %{_name}-%{_version} +%setup -n %{_name}-%{target_mlnx_ofa_kernel_version} set -- * mkdir source mv "$@" source/ From 478ece910c036cbf9d022b1b6334feb6aa1d0844 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Mon, 23 Feb 2026 16:24:37 -0800 Subject: [PATCH 72/86] use the right kernel package for the version and mlnx --- SPECS-SIGNED/iser-signed/iser-signed.spec | 8 ++++---- SPECS-SIGNED/isert-signed/isert-signed.spec | 8 ++++---- SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec | 4 ++-- SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec | 4 ++-- SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec | 8 ++++---- .../mlnx-ofa_kernel-modules-signed.spec | 4 ++-- SPECS-SIGNED/srp-signed/srp-signed.spec | 8 ++++---- .../xpmem-modules-signed/xpmem-modules-signed.spec | 8 ++++---- SPECS/iser/iser.spec | 8 ++++---- SPECS/isert/isert.spec | 8 ++++---- SPECS/knem/knem.spec | 4 ++-- SPECS/mft_kernel/mft_kernel.spec | 4 ++-- SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec | 8 ++++---- SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec | 8 ++++---- SPECS/srp/srp.spec | 8 ++++---- SPECS/xpmem/xpmem.spec | 8 ++++---- 16 files changed, 54 insertions(+), 54 deletions(-) diff --git a/SPECS-SIGNED/iser-signed/iser-signed.spec b/SPECS-SIGNED/iser-signed/iser-signed.spec index 554ccb726e2..4dce27289d0 100644 --- a/SPECS-SIGNED/iser-signed/iser-signed.spec +++ b/SPECS-SIGNED/iser-signed/iser-signed.spec @@ -30,10 +30,10 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/isert-signed/isert-signed.spec b/SPECS-SIGNED/isert-signed/isert-signed.spec index 2ce35809a90..b68f4f223aa 100644 --- a/SPECS-SIGNED/isert-signed/isert-signed.spec +++ b/SPECS-SIGNED/isert-signed/isert-signed.spec @@ -30,10 +30,10 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec index c0d576074e8..644be510115 100644 --- a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec +++ b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec @@ -27,8 +27,8 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec index e19fedaf23e..b7b355f50fa 100644 --- a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec +++ b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec @@ -3,8 +3,8 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec index 23efa60471f..8c0848298ac 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec @@ -30,10 +30,10 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec index 8ec67b25540..c133e4fd117 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec @@ -30,8 +30,8 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS-SIGNED/srp-signed/srp-signed.spec b/SPECS-SIGNED/srp-signed/srp-signed.spec index 3d28efd2dfd..f9139970901 100644 --- a/SPECS-SIGNED/srp-signed/srp-signed.spec +++ b/SPECS-SIGNED/srp-signed/srp-signed.spec @@ -31,10 +31,10 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec index 4f8b46055a9..9adb4a64b4e 100644 --- a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec @@ -4,10 +4,10 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} diff --git a/SPECS/iser/iser.spec b/SPECS/iser/iser.spec index 72a305fd2e5..5efa2b424de 100644 --- a/SPECS/iser/iser.spec +++ b/SPECS/iser/iser.spec @@ -27,10 +27,10 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/isert/isert.spec b/SPECS/isert/isert.spec index 0450d845e4b..44a2f32c742 100644 --- a/SPECS/isert/isert.spec +++ b/SPECS/isert/isert.spec @@ -27,10 +27,10 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/knem/knem.spec b/SPECS/knem/knem.spec index 9ce5aa8ea93..c80d934838d 100644 --- a/SPECS/knem/knem.spec +++ b/SPECS/knem/knem.spec @@ -27,8 +27,8 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/mft_kernel/mft_kernel.spec b/SPECS/mft_kernel/mft_kernel.spec index 62f9d111b3d..e6b9cc60328 100644 --- a/SPECS/mft_kernel/mft_kernel.spec +++ b/SPECS/mft_kernel/mft_kernel.spec @@ -1,7 +1,7 @@ %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec index 6ff0993b400..6436358d5c0 100644 --- a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec +++ b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec @@ -27,10 +27,10 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec index 9cb56cc1d9b..3c94bed18dc 100644 --- a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec +++ b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec @@ -27,10 +27,10 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/srp/srp.spec b/SPECS/srp/srp.spec index 6c3339bf19d..f9425514605 100644 --- a/SPECS/srp/srp.spec +++ b/SPECS/srp/srp.spec @@ -27,10 +27,10 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else diff --git a/SPECS/xpmem/xpmem.spec b/SPECS/xpmem/xpmem.spec index b45177b13b6..ec4ba2ca62b 100644 --- a/SPECS/xpmem/xpmem.spec +++ b/SPECS/xpmem/xpmem.spec @@ -1,10 +1,10 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +%global target_azl_build_kernel_version %azl_kernel_version +%global target_kernel_release %azl_kernel_release +%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version +%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else From 696301a3923e0eac01d1ed6ad8228a7df7cc14e1 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 24 Feb 2026 14:15:02 -0800 Subject: [PATCH 73/86] update the PR checks --- .github/workflows/check-package-cgmanifest.yml | 2 +- .github/workflows/check-source-signatures.yml | 4 +++- .github/workflows/validate-cg-manifest.sh | 18 +++++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-package-cgmanifest.yml b/.github/workflows/check-package-cgmanifest.yml index 6c10be17a69..02162e16e62 100644 --- a/.github/workflows/check-package-cgmanifest.yml +++ b/.github/workflows/check-package-cgmanifest.yml @@ -57,4 +57,4 @@ jobs: - name: Check each spec if: ${{ env.updated-specs != '' }} - run: .github/workflows/validate-cg-manifest.sh build/worker/worker_chroot.tar.gz ${{ env.updated-specs }} + run: .github/workflows/validate-cg-manifest.sh build/worker/worker_chroot.tar.gz build/pkg_artifacts/macros.releaseversions ${{ env.updated-specs }} diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index ad7b9c4594f..3a2abf879ff 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -81,6 +81,8 @@ jobs: sudo make -C toolkit -j$(nproc) chroot-tools REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} + # Generate the macros.releaseversions file that is needed by the signature check. + # The file contains versions and releases of all packages under SPECS folder. sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} - name: Check for invalid source signatures @@ -92,7 +94,7 @@ jobs: MACROS_RELEASEVERSIONS_PATH=$(find . -type f -path "*/build/pkg_artifacts/macros.releaseversions" -print -quit) if [ -z "$MACROS_RELEASEVERSIONS_PATH" ]; then - echo "build/pkg_artifacts/macros.releaseversions not found." + echo "macros.releaseversions was not found under */build/pkg_artifacts path." exit 1 fi diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index 9beb048c1ff..011d5c3329e 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -10,7 +10,8 @@ # - The URL listed in the cgmanifets is valid (can be downloaded) # $1 - Path to worker chroot's archive -# $2+ - Paths to spec files to check +# $2 - Path to macros.releaseversions file to copy to the chroot for rpmspec parsing +# $3+ - Paths to spec files to check set -euo pipefail @@ -90,6 +91,7 @@ chroot_rpmspec() { prepare_chroot_environment() { local chroot_archive local chroot_dir_path + local macros_file local chroot_rpm_macros_dir_path local dist_name local dist_number @@ -97,7 +99,8 @@ prepare_chroot_environment() { local rpm_macros_dir_path chroot_archive="$1" - chroot_dir_path="$2" + chroot_dir_path="$3" + macros_file="$2" echo "Creating worker chroot under '$chroot_dir_path'." @@ -125,12 +128,12 @@ prepare_chroot_environment() { done echo "Copying the version/release macros file to the chroot." - sudo cp -v "build/pkg_artifacts/macros.releaseversions" "$chroot_rpm_macros_dir_path" + sudo cp -v "$macros_file" "$chroot_rpm_macros_dir_path" echo } -if [[ $# -lt 2 ]]; then +if [[ $# -lt 3 ]]; then echo "No specs passed to validate." exit 1 fi @@ -140,6 +143,11 @@ if [[ ! -f "$1" ]]; then exit 1 fi +if [[ ! -f "$2" ]]; then + echo "Second argument is not a valid file. Please pass the path to the macros.releaseversions file to copy to the chroot." + exit 1 +fi + rm -f bad_registrations.txt WORK_DIR=$(mktemp -d -t) @@ -149,7 +157,7 @@ function clean_up { } trap clean_up EXIT SIGINT SIGTERM -prepare_chroot_environment "$1" "$WORK_DIR" +prepare_chroot_environment "$1" "$2" "$WORK_DIR" shift # Remove the first argument (the chroot archive) from the list of specs to check. echo "Checking $# specs." From c79a3fde0eb47b85a502e4b0edfa3f0fe4229329 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 24 Feb 2026 14:22:51 -0800 Subject: [PATCH 74/86] add more documentation --- toolkit/docs/building/building.md | 1 + 1 file changed, 1 insertion(+) diff --git a/toolkit/docs/building/building.md b/toolkit/docs/building/building.md index 951dd2f4e6b..e56071d9f22 100644 --- a/toolkit/docs/building/building.md +++ b/toolkit/docs/building/building.md @@ -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 `` files whose content will be appended to the main `macros.releaseversions` file used during package build. Used to resolve versions of kernel Out of Tree Modules. --- From 4314c1700ce1f0b80050d60018843ca5eecd5142 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 24 Feb 2026 14:40:53 -0800 Subject: [PATCH 75/86] refactor by splitting up the main function into subfunctions --- .../versionsprocessor/versionsprocessor.go | 91 ++++++++++++------- 1 file changed, 56 insertions(+), 35 deletions(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 96ad4b29cee..b9eab5a772a 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -76,14 +76,17 @@ func main() { } } - if *workerTar != "" { - const leaveFilesOnDisk = false - chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir, "", "") - if err != nil { - return - } - defer chroot.Close(leaveFilesOnDisk) + if *workerTar == "" { + logger.Log.Error("No worker tar provided, parsing specs in host environment. This may cause issues if the host environment is different from the target build environment.") + return + } + + const leaveFilesOnDisk = false + chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir, "", "") + if err != nil { + return } + defer chroot.Close(leaveFilesOnDisk) doParse := func() error { // Find all spec files @@ -114,32 +117,12 @@ func main() { for _, packageVersionString := range packages { - // the output of the above query is in the format of "packagename: version-release", - // so split by ": " to get the version-release portion we want the second part - releaseVerSplit := regexp.MustCompile(`^[^:]+: (.+)-(.+)$`).FindStringSubmatch(packageVersionString)[1:] - - if len(releaseVerSplit) != 2 { - logger.Log.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) + macros, err := processPackageVersionString(packageVersionString, specFileName, prefix) + if err != nil { + logger.Log.Errorf("Error processing package version string: %s", err) continue } - version := releaseVerSplit[0] - release := releaseVerSplit[1] - releaseClean := strings.Replace(release, *distTag, "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit - - // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' - specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) - specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") - - versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" - releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" - - // Generate RPM macro definitions instead of modifying spec files directly. - macros := fmt.Sprintf("%%%s %s\n%%%s %s", - versionMacroString, version, - releaseMacroString, releaseClean, - ) - macrosOutput = append(macrosOutput, macros) } } @@ -153,8 +136,44 @@ func main() { err = doParse() } + writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) +} + +func processPackageVersionString(packageVersionString string, specFileName string, prefix string) (macros string, err error) { + // the output of the above query is in the format of "packagename: version-release", + // so split by ": " to get the version-release portion we want the second part + releaseVerSplit := regexp.MustCompile(`^[^:]+: (.+)-(.+)$`).FindStringSubmatch(packageVersionString)[1:] + + if len(releaseVerSplit) != 2 { + err = fmt.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) + logger.Log.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) + + return "", err + } + + version := releaseVerSplit[0] + release := releaseVerSplit[1] + releaseClean := strings.Replace(release, *distTag, "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit + + // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' + specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) + specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") + + versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" + releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" + + // Generate RPM macro definitions instead of modifying spec files directly. + macros = fmt.Sprintf("%%%s %s\n%%%s %s", + versionMacroString, version, + releaseMacroString, releaseClean, + ) + + return macros, nil +} + +func writeExtraFilesToOutput(extraFiles []string, macrosOutput []string, output string) (err error) { // If extra files were provided, append their contents to the output as well. - for _, extraPath := range *extraFiles { + for _, extraPath := range extraFiles { if strings.TrimSpace(extraPath) == "" { continue } @@ -166,12 +185,14 @@ func main() { } macrosOutput = append(macrosOutput, contents) - logger.Log.Infof("Appended contents of provided extra macros file (%s) to %s", extraPath, *output) + logger.Log.Infof("Appended contents of provided extra macros file (%s) to %s", extraPath, output) } - err = file.WriteLines(macrosOutput, *output) + err = file.WriteLines(macrosOutput, output) if err != nil { - logger.Log.Errorf("Failed to write file (%s)", *output) - return + logger.Log.Errorf("Failed to write file (%s)", output) + return err } + + return nil } From 4d1aec88dfcff72fdd1967ffe2882b2d74b14b27 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 24 Feb 2026 14:43:18 -0800 Subject: [PATCH 76/86] make sure to shift again --- .github/workflows/validate-cg-manifest.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index 011d5c3329e..369d77996f2 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -160,6 +160,7 @@ trap clean_up EXIT SIGINT SIGTERM prepare_chroot_environment "$1" "$2" "$WORK_DIR" shift # Remove the first argument (the chroot archive) from the list of specs to check. +shift # Remove the second argument (the macros.releaseversions file) from the list of specs to check. echo "Checking $# specs." i=0 From d9e0bd02411aad725f6070e13e24e551dc977f72 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 26 Feb 2026 10:06:24 -0800 Subject: [PATCH 77/86] add unit tests to versionsprocessor and split it a bit more --- .../versionsprocessor/versionsprocessor.go | 50 +- .../versionsprocessor_test.go | 528 ++++++++++++++++++ 2 files changed, 559 insertions(+), 19 deletions(-) create mode 100644 toolkit/tools/versionsprocessor/versionsprocessor_test.go diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index b9eab5a772a..9465c56803b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -102,29 +102,12 @@ func main() { for _, specFile := range allSpecFiles { // Get spec file version-release - - specFileName := filepath.Base(specFile) - - sourceDir := filepath.Dir(specFile) - defines := rpm.DefaultDistroDefines(false, *distTag) - - packages, err := rpm.QuerySPEC(specFile, sourceDir, `%{NAME}: %{evr}\n`, buildArch, defines, rpm.QueryHeaderArgument) + macrosOutput, err = processSpecFile(specFile, buildArch, prefix, macrosOutput) if err != nil { - logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) + logger.Log.Errorf("Error processing spec file (%s): %s", specFile, err) continue } - - for _, packageVersionString := range packages { - - macros, err := processPackageVersionString(packageVersionString, specFileName, prefix) - if err != nil { - logger.Log.Errorf("Error processing package version string: %s", err) - continue - } - - macrosOutput = append(macrosOutput, macros) - } } return err @@ -139,6 +122,35 @@ func main() { writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) } +func processSpecFile(specFile string, buildArch string, prefix string, macrosOutput []string) (newMacrosOutput []string, err error) { + // Get spec file version-release + + specFileName := filepath.Base(specFile) + + sourceDir := filepath.Dir(specFile) + defines := rpm.DefaultDistroDefines(false, *distTag) + + packages, err := rpm.QuerySPEC(specFile, sourceDir, `%{NAME}: %{evr}\n`, buildArch, defines, rpm.QueryHeaderArgument) + + if err != nil { + logger.Log.Errorf("Failed to query spec file (%s). Error: %s", specFileName, err) + return nil, err + } + + for _, packageVersionString := range packages { + + macros, err := processPackageVersionString(packageVersionString, specFileName, prefix) + if err != nil { + logger.Log.Errorf("Error processing package version string: %s", err) + continue + } + + macrosOutput = append(macrosOutput, macros) + } + + return macrosOutput, nil +} + func processPackageVersionString(packageVersionString string, specFileName string, prefix string) (macros string, err error) { // the output of the above query is in the format of "packagename: version-release", // so split by ": " to get the version-release portion we want the second part diff --git a/toolkit/tools/versionsprocessor/versionsprocessor_test.go b/toolkit/tools/versionsprocessor/versionsprocessor_test.go new file mode 100644 index 00000000000..da0c3c74a2e --- /dev/null +++ b/toolkit/tools/versionsprocessor/versionsprocessor_test.go @@ -0,0 +1,528 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +package main + +import ( + "fmt" + "os" + "path/filepath" + "runtime" + "strings" + "testing" + + "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" + "github.com/microsoft/azurelinux/toolkit/tools/internal/rpm" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestMain(m *testing.M) { + logger.InitStderrLog() + os.Exit(m.Run()) +} + +// --------------------------------------------------------------------------- +// processPackageVersionString tests +// --------------------------------------------------------------------------- + +func TestProcessPackageVersionString_ValidInput(t *testing.T) { + tag := ".azl3" + distTag = &tag + + macros, err := processPackageVersionString("mypackage: 1.2.3-4.azl3", "mypackage.spec", "azl") + require.NoError(t, err) + assert.Contains(t, macros, "%azl_mypackage_version 1.2.3") + assert.Contains(t, macros, "%azl_mypackage_release 4") +} + +func TestProcessPackageVersionString_DashesInSpecName(t *testing.T) { + tag := ".azl3" + distTag = &tag + + macros, err := processPackageVersionString("my-cool-pkg: 2.0.0-1.azl3", "my-cool-pkg.spec", "azl") + require.NoError(t, err) + // Dashes should be replaced with underscores in macro names. + assert.Contains(t, macros, "%azl_my_cool_pkg_version 2.0.0") + assert.Contains(t, macros, "%azl_my_cool_pkg_release 1") +} + +func TestProcessPackageVersionString_ReleaseWithoutDistTag(t *testing.T) { + tag := ".azl3" + distTag = &tag + + macros, err := processPackageVersionString("pkg: 1.0-5", "pkg.spec", "azl") + require.NoError(t, err) + // When the dist tag is not present in the release, it should remain unchanged. + assert.Contains(t, macros, "%azl_pkg_version 1.0") + assert.Contains(t, macros, "%azl_pkg_release 5") +} + +func TestProcessPackageVersionString_EpochInVersion(t *testing.T) { + tag := ".azl3" + distTag = &tag + + macros, err := processPackageVersionString("pkg: 2:3.4.5-6.azl3", "pkg.spec", "azl") + require.NoError(t, err) + assert.Contains(t, macros, "%azl_pkg_version 2:3.4.5") + assert.Contains(t, macros, "%azl_pkg_release 6") +} + +func TestProcessPackageVersionString_CustomPrefix(t *testing.T) { + tag := ".azl3" + distTag = &tag + + macros, err := processPackageVersionString("mypkg: 1.0-1.azl3", "mypkg.spec", "custom") + require.NoError(t, err) + assert.Contains(t, macros, "%custom_mypkg_version 1.0") + assert.Contains(t, macros, "%custom_mypkg_release 1") +} + +func TestProcessPackageVersionString_PanicsOnBadFormat(t *testing.T) { + tag := ".azl3" + distTag = &tag + + // Input without the expected "name: version-release" format will cause a panic + // from the regex submatch slice indexing. + assert.Panics(t, func() { + processPackageVersionString("totally-invalid-input", "bad.spec", "azl") + }) +} + +func TestProcessPackageVersionString_EmptyDistTag(t *testing.T) { + tag := "" + distTag = &tag + + macros, err := processPackageVersionString("pkg: 1.0-2.azl3", "pkg.spec", "azl") + require.NoError(t, err) + // With an empty dist tag, the release should not be modified. + assert.Contains(t, macros, "%azl_pkg_release 2.azl3") +} + +func TestProcessPackageVersionString_TableDriven(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tests := []struct { + name string + input string + specFile string + prefix string + expectedVersion string + expectedRelease string + }{ + { + name: "simple package", + input: "bash: 5.1.8-1.azl3", + specFile: "bash.spec", + prefix: "azl", + expectedVersion: "%azl_bash_version 5.1.8", + expectedRelease: "%azl_bash_release 1", + }, + { + name: "package with underscores already", + input: "python_dateutil: 2.8.2-3.azl3", + specFile: "python_dateutil.spec", + prefix: "azl", + expectedVersion: "%azl_python_dateutil_version 2.8.2", + expectedRelease: "%azl_python_dateutil_release 3", + }, + { + name: "multi digit release", + input: "kernel: 6.6.51.1-9.azl3", + specFile: "kernel.spec", + prefix: "azl", + expectedVersion: "%azl_kernel_version 6.6.51.1", + expectedRelease: "%azl_kernel_release 9", + }, + { + name: "release with extra suffixes after dist tag", + input: "openssl: 3.3.0-1.azl3.1", + specFile: "openssl.spec", + prefix: "azl", + expectedVersion: "%azl_openssl_version 3.3.0", + expectedRelease: "%azl_openssl_release 1.1", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + macros, err := processPackageVersionString(tt.input, tt.specFile, tt.prefix) + require.NoError(t, err) + assert.Contains(t, macros, tt.expectedVersion) + assert.Contains(t, macros, tt.expectedRelease) + }) + } +} + +// --------------------------------------------------------------------------- +// Helper: create a minimal spec file that rpmspec can parse +// --------------------------------------------------------------------------- + +const specTemplate = `Summary: Test spec +Name: %s +Version: %s +Release: %s +License: MIT +URL: https://test.com +Vendor: Microsoft Corporation +Distribution: Azure Linux + +%%description +Test spec. + +%%changelog +* Mon Oct 11 2021 Test User %s-%s +- Test entry. +` + +func createSpecFile(t *testing.T, dir, name, version, release string) string { + t.Helper() + specDir := filepath.Join(dir, name) + err := os.MkdirAll(specDir, 0755) + require.NoError(t, err) + + specPath := filepath.Join(specDir, name+".spec") + content := fmt.Sprintf(specTemplate, name, version, release, version, release) + err = os.WriteFile(specPath, []byte(content), 0644) + require.NoError(t, err) + return specPath +} + +func testBuildArch(t *testing.T) string { + t.Helper() + arch, err := rpm.GetRpmArch(runtime.GOARCH) + require.NoError(t, err) + return arch +} + +// --------------------------------------------------------------------------- +// processSpecFile tests +// --------------------------------------------------------------------------- + +func TestProcessSpecFile_SinglePackage(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "testpkg", "1.2.3", "4%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + assert.Contains(t, macros[0], "%azl_testpkg_version 1.2.3") + assert.Contains(t, macros[0], "%azl_testpkg_release 4") +} + +func TestProcessSpecFile_VersionOnly(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "simplepkg", "5.0", "1%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + assert.Contains(t, macros[0], "%azl_simplepkg_version 5.0") +} + +func TestProcessSpecFile_ReleaseDistTagStripped(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "mypkg", "2.0.0", "7%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + // The dist tag ".azl3" should be stripped from the release. + assert.Contains(t, macros[0], "%azl_mypkg_release 7") + assert.NotContains(t, macros[0], ".azl3") +} + +func TestProcessSpecFile_DashInPackageName(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "my-cool-pkg", "3.1.0", "2%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + // The spec file name has dashes, which should become underscores in macro names. + assert.Contains(t, macros[0], "%azl_my_cool_pkg_version 3.1.0") + assert.Contains(t, macros[0], "%azl_my_cool_pkg_release 2") +} + +func TestProcessSpecFile_CustomPrefix(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "custompkg", "1.0", "1%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "myprefix", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + assert.Contains(t, macros[0], "%myprefix_custompkg_version 1.0") + assert.Contains(t, macros[0], "%myprefix_custompkg_release 1") +} + +func TestProcessSpecFile_WithSubpackages(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specDir := filepath.Join(tmpDir, "multipkg") + err := os.MkdirAll(specDir, 0755) + require.NoError(t, err) + + specContent := `Summary: Test spec with subpackages +Name: multipkg +Version: 4.0.0 +Release: 3%{?dist} +License: MIT +URL: https://test.com +Vendor: Microsoft Corporation +Distribution: Azure Linux + +%description +Main package. + +%package devel +Summary: Development files + +%description devel +Dev files. + +%package libs +Summary: Libraries + +%description libs +Libs. + +%changelog +* Mon Oct 11 2021 Test User 4.0.0-3 +- Test entry. +` + specPath := filepath.Join(specDir, "multipkg.spec") + err = os.WriteFile(specPath, []byte(specContent), 0644) + require.NoError(t, err) + + arch := testBuildArch(t) + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + // With --srpm, rpmspec returns the source RPM entry (1 result). + require.Len(t, macros, 1) + + assert.Contains(t, macros[0], "%azl_multipkg_version 4.0.0") + assert.Contains(t, macros[0], "%azl_multipkg_release 3") +} + +func TestProcessSpecFile_NonexistentFile(t *testing.T) { + tag := ".azl3" + distTag = &tag + + arch := testBuildArch(t) + macros, err := processSpecFile("/nonexistent/path/fake.spec", arch, "azl", nil) + assert.Error(t, err) + assert.Nil(t, macros) +} + +func TestProcessSpecFile_InvalidSpec(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specDir := filepath.Join(tmpDir, "badspec") + err := os.MkdirAll(specDir, 0755) + require.NoError(t, err) + + specPath := filepath.Join(specDir, "badspec.spec") + err = os.WriteFile(specPath, []byte("this is not a valid spec file"), 0644) + require.NoError(t, err) + + arch := testBuildArch(t) + macros, err := processSpecFile(specPath, arch, "azl", nil) + assert.Error(t, err) + assert.Nil(t, macros) +} + +func TestProcessSpecFile_ReleaseWithoutDistMacro(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + // Create spec with a release that has no %{?dist} macro. + specPath := createSpecFile(t, tmpDir, "nodist", "1.0", "5") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + // Release should remain as-is since there's no dist tag to strip. + assert.Contains(t, macros[0], "%azl_nodist_release 5") +} + +func TestProcessSpecFile_MultiDigitVersion(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + specPath := createSpecFile(t, tmpDir, "bigver", "10.20.30", "100%{?dist}") + arch := testBuildArch(t) + + macros, err := processSpecFile(specPath, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + assert.Contains(t, macros[0], "%azl_bigver_version 10.20.30") + assert.Contains(t, macros[0], "%azl_bigver_release 100") +} + +func TestProcessSpecFile_AccumulatesMacros(t *testing.T) { + tag := ".azl3" + distTag = &tag + + tmpDir := t.TempDir() + arch := testBuildArch(t) + + // Process a first spec and collect its macros. + specPath1 := createSpecFile(t, tmpDir, "pkga", "1.0", "1%{?dist}") + macros, err := processSpecFile(specPath1, arch, "azl", nil) + require.NoError(t, err) + require.Len(t, macros, 1) + + // Process a second spec, passing the existing macros slice. + specPath2 := createSpecFile(t, tmpDir, "pkgb", "2.0", "2%{?dist}") + macros, err = processSpecFile(specPath2, arch, "azl", macros) + require.NoError(t, err) + // Should now contain macros from both specs. + require.Len(t, macros, 2) + combined := strings.Join(macros, "\n") + assert.Contains(t, combined, "%azl_pkga_version 1.0") + assert.Contains(t, combined, "%azl_pkgb_version 2.0") +} + +// --------------------------------------------------------------------------- +// writeExtraFilesToOutput tests +// --------------------------------------------------------------------------- + +func TestWriteExtraFilesToOutput_NoExtraFiles(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + macros := []string{"%azl_pkg_version 1.0", "%azl_pkg_release 1"} + + err := writeExtraFilesToOutput(nil, macros, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + content := string(data) + assert.Contains(t, content, "%azl_pkg_version 1.0") + assert.Contains(t, content, "%azl_pkg_release 1") +} + +func TestWriteExtraFilesToOutput_WithExtraFile(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + + // Create an extra macros file. + extraFile := filepath.Join(tmpDir, "extra.macros") + err := os.WriteFile(extraFile, []byte("%extra_macro value123"), 0644) + require.NoError(t, err) + + macros := []string{"%azl_pkg_version 1.0"} + + err = writeExtraFilesToOutput([]string{extraFile}, macros, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + content := string(data) + assert.Contains(t, content, "%azl_pkg_version 1.0") + assert.Contains(t, content, "%extra_macro value123") +} + +func TestWriteExtraFilesToOutput_MultipleExtraFiles(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + + extra1 := filepath.Join(tmpDir, "extra1.macros") + extra2 := filepath.Join(tmpDir, "extra2.macros") + err := os.WriteFile(extra1, []byte("%macro_a valA"), 0644) + require.NoError(t, err) + err = os.WriteFile(extra2, []byte("%macro_b valB"), 0644) + require.NoError(t, err) + + macros := []string{"%azl_pkg_version 1.0"} + + err = writeExtraFilesToOutput([]string{extra1, extra2}, macros, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + content := string(data) + assert.Contains(t, content, "%azl_pkg_version 1.0") + assert.Contains(t, content, "%macro_a valA") + assert.Contains(t, content, "%macro_b valB") +} + +func TestWriteExtraFilesToOutput_SkipsEmptyPaths(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + + macros := []string{"%azl_pkg_version 1.0"} + + err := writeExtraFilesToOutput([]string{"", " ", ""}, macros, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + content := string(data) + // Should only contain the original macros, nothing extra. + assert.Contains(t, content, "%azl_pkg_version 1.0") + lines := strings.Split(strings.TrimSpace(content), "\n") + assert.Equal(t, 1, len(lines)) +} + +func TestWriteExtraFilesToOutput_NonexistentExtraFile(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + + macros := []string{"%azl_pkg_version 1.0"} + + // Should not fail entirely — the bad file is logged and skipped. + err := writeExtraFilesToOutput([]string{"/nonexistent/file.macros"}, macros, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + content := string(data) + assert.Contains(t, content, "%azl_pkg_version 1.0") +} + +func TestWriteExtraFilesToOutput_EmptyMacrosOutput(t *testing.T) { + tmpDir := t.TempDir() + outputPath := filepath.Join(tmpDir, "output.macros") + + err := writeExtraFilesToOutput(nil, nil, outputPath) + require.NoError(t, err) + + data, err := os.ReadFile(outputPath) + require.NoError(t, err) + assert.Equal(t, "", string(data)) +} + +func TestWriteExtraFilesToOutput_InvalidOutputPath(t *testing.T) { + // Writing to a path that cannot be created should return an error. + err := writeExtraFilesToOutput(nil, []string{"macro"}, "/nonexistent/dir/subdir/output.macros") + assert.Error(t, err) +} From b835db996cd1607831e6fdda517408a6a0e868ec Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Thu, 26 Feb 2026 11:42:42 -0800 Subject: [PATCH 78/86] misc tweaks --- .../versionsprocessor/versionsprocessor.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index 9465c56803b..ea82054b850 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -2,8 +2,8 @@ // Licensed under the MIT License. // versionsprocessor is a tool to generate a macro file of all specs version and release. -// It iterates ove all of the SPEC files in the provided directory, gets the version and release for each SPEC, -// and then writes that information to an output file as RPM macros file.\ +// It iterates over all of the SPEC files in the provided directory, gets the version and release for each SPEC, +// and then writes that information to an output file as RPM macros file. // The output file is then provided to other tools and passed into their respective rpm macros folder so that rpmbuild command automatically recognize it. package main @@ -65,14 +65,15 @@ func main() { timestamp.BeginTiming("versionsprocessor", *timestampFile) defer timestamp.CompleteTiming() - logger.PanicOnError(err) - var buildArch string = *targetArch if *targetArch == "" { buildArch, err = rpm.GetRpmArch(runtime.GOARCH) if err != nil { - return + logger.PanicOnError(err) + } + if err != nil { + logger.Log.Errorf("Failed to determine RPM architecture for runtime architecture %q: %v", runtime.GOARCH, err) } } @@ -84,7 +85,7 @@ func main() { const leaveFilesOnDisk = false chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir, "", "") if err != nil { - return + logger.PanicOnError("Failed to create chroot") } defer chroot.Close(leaveFilesOnDisk) @@ -119,7 +120,11 @@ func main() { err = doParse() } - writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) + err = writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) + if err != nil { + logger.Log.Errorf("Failed to write extra files to output: %s", err) + os.Exit(1) + } } func processSpecFile(specFile string, buildArch string, prefix string, macrosOutput []string) (newMacrosOutput []string, err error) { From 055369b6b95feb93ea9ee980d91214e7fc0b5929 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 27 Feb 2026 11:59:04 -0800 Subject: [PATCH 79/86] Remove SPECS and SPECS-SIGNED changes (moved to mbykhovtsev/kernel-macros-specs branch) --- .../iser-hwe-signed/iser-hwe-signed.spec | 15 ++-- SPECS-SIGNED/iser-signed/iser-signed.spec | 15 ++-- .../isert-hwe-signed/isert-hwe-signed.spec | 15 ++-- SPECS-SIGNED/isert-signed/isert-signed.spec | 15 ++-- .../knem-hwe-modules-signed.spec | 11 +-- .../knem-modules-signed.spec | 11 +-- .../mft_kernel-hwe-signed.spec | 11 +-- .../mft_kernel-signed/mft_kernel-signed.spec | 11 +-- .../mlnx-nfsrdma-hwe-signed.spec | 15 ++-- .../mlnx-nfsrdma-signed.spec | 15 ++-- .../mlnx-ofa_kernel-hwe-modules-signed.spec | 11 +-- .../mlnx-ofa_kernel-modules-signed.spec | 83 +++++++++---------- .../srp-hwe-signed/srp-hwe-signed.spec | 15 ++-- SPECS-SIGNED/srp-signed/srp-signed.spec | 15 ++-- .../xpmem-hwe-modules-signed.spec | 15 ++-- .../xpmem-modules-signed.spec | 15 ++-- SPECS/iser-hwe/iser-hwe.spec | 20 ++--- SPECS/iser/iser.spec | 18 ++-- SPECS/isert-hwe/isert-hwe.spec | 21 ++--- SPECS/isert/isert.spec | 18 ++-- SPECS/knem-hwe/knem-hwe.spec | 11 +-- SPECS/knem/knem.spec | 11 +-- SPECS/mft_kernel-hwe/mft_kernel-hwe.spec | 11 +-- SPECS/mft_kernel/mft_kernel.spec | 11 +-- SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec | 20 ++--- SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec | 18 ++-- .../mlnx-ofa_kernel-hwe.spec | 11 +-- SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec | 18 ++-- SPECS/srp-hwe/srp-hwe.spec | 18 ++-- SPECS/srp/srp.spec | 16 ++-- SPECS/xpmem-hwe/xpmem-hwe.spec | 14 ++-- SPECS/xpmem/xpmem.spec | 15 ++-- 32 files changed, 206 insertions(+), 333 deletions(-) diff --git a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec index 50444d5b6fe..052e062ae07 100644 --- a/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec +++ b/SPECS-SIGNED/iser-hwe-signed/iser-hwe-signed.spec @@ -30,23 +30,21 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name iser-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -113,9 +111,6 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-iser-*.conf %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/iser-signed/iser-signed.spec b/SPECS-SIGNED/iser-signed/iser-signed.spec index 4dce27289d0..b4812a1d04f 100644 --- a/SPECS-SIGNED/iser-signed/iser-signed.spec +++ b/SPECS-SIGNED/iser-signed/iser-signed.spec @@ -30,22 +30,20 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name iser} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -112,9 +110,6 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec index 61d8a5a8e8b..99d88ec12d7 100644 --- a/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec +++ b/SPECS-SIGNED/isert-hwe-signed/isert-hwe-signed.spec @@ -30,23 +30,21 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name isert-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -112,9 +110,6 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-isert-*.conf %changelog -* Fri Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/isert-signed/isert-signed.spec b/SPECS-SIGNED/isert-signed/isert-signed.spec index b68f4f223aa..651837398ab 100644 --- a/SPECS-SIGNED/isert-signed/isert-signed.spec +++ b/SPECS-SIGNED/isert-signed/isert-signed.spec @@ -30,22 +30,20 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %{!?_name: %define _name isert} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -111,9 +109,6 @@ fi # 1 : closed %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec index f056a3fc8ae..361a5883095 100644 --- a/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/knem-hwe-modules-signed/knem-hwe-modules-signed.spec @@ -27,9 +27,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -44,7 +44,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: %{_name}-signed Version: 1.1.4.90mlnx3 -Release: 29%{release_suffix}%{?dist} +Release: 28%{release_suffix}%{?dist} Provides: knem-hwe-mlnx = %{version}-%{release} Obsoletes: knem-hwe-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -110,9 +110,6 @@ fi /lib/modules/ %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-28_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec index 644be510115..7a52ad3e219 100644 --- a/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec +++ b/SPECS-SIGNED/knem-modules-signed/knem-modules-signed.spec @@ -27,9 +27,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} @@ -43,7 +43,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: %{_name}-signed Version: 1.1.4.90mlnx3 -Release: 23%{release_suffix}%{?dist} +Release: 22%{release_suffix}%{?dist} Provides: knem-mlnx = %{version}-%{release} Obsoletes: knem-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -108,9 +108,6 @@ fi /lib/modules/ %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-23 -- Tweak specs to use dynamic versioning for kernel - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-22 - Bump release to rebuild for new release. diff --git a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec index b1af65b504f..cbe39f5508b 100644 --- a/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec +++ b/SPECS-SIGNED/mft_kernel-hwe-signed/mft_kernel-hwe-signed.spec @@ -3,9 +3,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -15,7 +15,7 @@ Name: %{_name}-signed Summary: %{_name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel @@ -91,9 +91,6 @@ popd /lib/modules/%{KVERSION}/updates/ %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 4.33.0-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec index b7b355f50fa..62d1af9dc2f 100644 --- a/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec +++ b/SPECS-SIGNED/mft_kernel-signed/mft_kernel-signed.spec @@ -3,9 +3,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} @@ -14,7 +14,7 @@ Name: %{_name}-signed Summary: %{_name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel @@ -81,9 +81,6 @@ popd /lib/modules/%{KVERSION}/updates/ %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-2 -- Tweak specs to use dynamic versioning for kernel - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 4.33.0-1 - Upgrade version to 4.33.0. diff --git a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec index 297dd748169..b85ea567162 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-hwe-signed/mlnx-nfsrdma-hwe-signed.spec @@ -30,23 +30,21 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} %{!?_name: %define _name mlnx-nfsrdma-hwe} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -119,9 +117,6 @@ fi %config(noreplace) %{_sysconfdir}/depmod.d/zz02-mlnx-nfsrdma-*.conf %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec index 8c0848298ac..ee61b001cba 100644 --- a/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec +++ b/SPECS-SIGNED/mlnx-nfsrdma-signed/mlnx-nfsrdma-signed.spec @@ -30,23 +30,21 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} %{!?_name: %define _name mlnx-nfsrdma} Summary: %{_name} Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -119,9 +117,6 @@ fi %config(noreplace) %{_sysconfdir}/depmod.d/zz02-%{_name}-*.conf %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec index ed7d844e65d..5ebee92b39e 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-hwe-modules-signed/mlnx-ofa_kernel-hwe-modules-signed.spec @@ -30,9 +30,9 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} @@ -46,7 +46,7 @@ Summary: Infiniband HCA Driver Name: %{_name}-signed Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -237,9 +237,6 @@ fi %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec index c133e4fd117..26e840e9974 100644 --- a/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec +++ b/SPECS-SIGNED/mlnx-ofa_kernel-modules-signed/mlnx-ofa_kernel-modules-signed.spec @@ -30,11 +30,13 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} +%global KVERSION %{target_kernel_version_full} + %{!?_name: %global _name mlnx-ofa_kernel-modules} # mlnx-ofa_kernel-modules is a sub-package in SPECS/mlnx-ofa_kernel. @@ -43,7 +45,7 @@ Summary: Infiniband HCA Driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -141,38 +143,38 @@ pushd rpm_contents # This spec's whole purpose is to inject the signed modules rpm2cpio %{SOURCE0} | cpio -idmv -cp -rf %{SOURCE1} ./lib/modules/%{target_kernel_version_full}/updates/compat/mlx_compat.ko -cp -rf %{SOURCE2} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_cm.ko -cp -rf %{SOURCE3} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_core.ko -cp -rf %{SOURCE4} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_ucm.ko -cp -rf %{SOURCE5} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_umad.ko -cp -rf %{SOURCE6} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/ib_uverbs.ko -cp -rf %{SOURCE7} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/iw_cm.ko -cp -rf %{SOURCE8} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/rdma_cm.ko -cp -rf %{SOURCE9} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/core/rdma_ucm.ko -cp -rf %{SOURCE10} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/bnxt_re/bnxt_re.ko -cp -rf %{SOURCE11} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/efa/efa.ko -cp -rf %{SOURCE12} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mlx4/mlx4_ib.ko -cp -rf %{SOURCE13} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mlx5/mlx5_ib.ko -cp -rf %{SOURCE14} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/sw/rxe/rdma_rxe.ko -cp -rf %{SOURCE15} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/ipoib/ib_ipoib.ko -cp -rf %{SOURCE16} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/iser/ib_iser.ko -cp -rf %{SOURCE17} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/isert/ib_isert.ko -cp -rf %{SOURCE18} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/ulp/srp/ib_srp.ko -cp -rf %{SOURCE19} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko -cp -rf %{SOURCE20} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko -cp -rf %{SOURCE21} ./lib/modules/%{target_kernel_version_full}/updates/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko -cp -rf %{SOURCE22} ./lib/modules/%{target_kernel_version_full}/updates/drivers/nvme/host/nvme-rdma.ko -cp -rf %{SOURCE23} ./lib/modules/%{target_kernel_version_full}/updates/drivers/nvme/target/nvmet-rdma.ko -cp -rf %{SOURCE24} ./lib/modules/%{target_kernel_version_full}/updates/net/mlxdevm/mlxdevm.ko -cp -rf %{SOURCE25} ./lib/modules/%{target_kernel_version_full}/updates/net/smc/smc.ko -cp -rf %{SOURCE26} ./lib/modules/%{target_kernel_version_full}/updates/net/smc/smc_diag.ko -cp -rf %{SOURCE27} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/rpcrdma.ko -cp -rf %{SOURCE28} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/svcrdma.ko -cp -rf %{SOURCE29} ./lib/modules/%{target_kernel_version_full}/updates/net/sunrpc/xprtrdma/xprtrdma.ko -cp -rf %{SOURCE30} ./lib/modules/%{target_kernel_version_full}/updates/drivers/fwctl/fwctl.ko -cp -rf %{SOURCE31} ./lib/modules/%{target_kernel_version_full}/updates/drivers/fwctl/mlx5/mlx5_fwctl.ko -cp -rf %{SOURCE32} ./lib/modules/%{target_kernel_version_full}/updates/drivers/infiniband/hw/mana/mana_ib.ko +cp -rf %{SOURCE1} ./lib/modules/%{KVERSION}/updates/compat/mlx_compat.ko +cp -rf %{SOURCE2} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_cm.ko +cp -rf %{SOURCE3} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_core.ko +cp -rf %{SOURCE4} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_ucm.ko +cp -rf %{SOURCE5} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_umad.ko +cp -rf %{SOURCE6} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/ib_uverbs.ko +cp -rf %{SOURCE7} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/iw_cm.ko +cp -rf %{SOURCE8} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/rdma_cm.ko +cp -rf %{SOURCE9} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/core/rdma_ucm.ko +cp -rf %{SOURCE10} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/bnxt_re/bnxt_re.ko +cp -rf %{SOURCE11} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/efa/efa.ko +cp -rf %{SOURCE12} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mlx4/mlx4_ib.ko +cp -rf %{SOURCE13} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mlx5/mlx5_ib.ko +cp -rf %{SOURCE14} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/sw/rxe/rdma_rxe.ko +cp -rf %{SOURCE15} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/ipoib/ib_ipoib.ko +cp -rf %{SOURCE16} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/iser/ib_iser.ko +cp -rf %{SOURCE17} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/isert/ib_isert.ko +cp -rf %{SOURCE18} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/ulp/srp/ib_srp.ko +cp -rf %{SOURCE19} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko +cp -rf %{SOURCE20} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlxfw/mlxfw.ko +cp -rf %{SOURCE21} ./lib/modules/%{KVERSION}/updates/drivers/net/ethernet/mellanox/mlxsw/mlxsw_spectrum.ko +cp -rf %{SOURCE22} ./lib/modules/%{KVERSION}/updates/drivers/nvme/host/nvme-rdma.ko +cp -rf %{SOURCE23} ./lib/modules/%{KVERSION}/updates/drivers/nvme/target/nvmet-rdma.ko +cp -rf %{SOURCE24} ./lib/modules/%{KVERSION}/updates/net/mlxdevm/mlxdevm.ko +cp -rf %{SOURCE25} ./lib/modules/%{KVERSION}/updates/net/smc/smc.ko +cp -rf %{SOURCE26} ./lib/modules/%{KVERSION}/updates/net/smc/smc_diag.ko +cp -rf %{SOURCE27} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/rpcrdma.ko +cp -rf %{SOURCE28} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/svcrdma.ko +cp -rf %{SOURCE29} ./lib/modules/%{KVERSION}/updates/net/sunrpc/xprtrdma/xprtrdma.ko +cp -rf %{SOURCE30} ./lib/modules/%{KVERSION}/updates/drivers/fwctl/fwctl.ko +cp -rf %{SOURCE31} ./lib/modules/%{KVERSION}/updates/drivers/fwctl/mlx5/mlx5_fwctl.ko +cp -rf %{SOURCE32} ./lib/modules/%{KVERSION}/updates/drivers/infiniband/hw/mana/mana_ib.ko popd @@ -186,21 +188,18 @@ popd %post -n %{_name} -/sbin/depmod %{target_kernel_version_full} +/sbin/depmod %{KVERSION} %postun -n %{_name} if [ $1 = 0 ]; then # 1 : Erase, not upgrade - /sbin/depmod %{target_kernel_version_full} + /sbin/depmod %{KVERSION} fi %files -n %{_name} -/lib/modules/%{target_kernel_version_full}/updates/ +/lib/modules/%{KVERSION}/updates/ %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel versions. - * Tue Nov 18 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update additional kernel modules fwctl mana and mlx5_dpll included from 25.07 diff --git a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec index 866dc18fed2..3594bb08a34 100644 --- a/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec +++ b/SPECS-SIGNED/srp-hwe-signed/srp-hwe-signed.spec @@ -31,11 +31,9 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -45,12 +43,12 @@ %global KVERSION %{target_kernel_version_full} %define _name srp-hwe -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} Summary: srp driver Name: %{_name}-signed Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -113,9 +111,6 @@ popd %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel and MOFED - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/srp-signed/srp-signed.spec b/SPECS-SIGNED/srp-signed/srp-signed.spec index f9139970901..afd8edf4ce3 100644 --- a/SPECS-SIGNED/srp-signed/srp-signed.spec +++ b/SPECS-SIGNED/srp-signed/srp-signed.spec @@ -31,11 +31,9 @@ %define __os_install_post %{__os_install_post_leave_signatures} %{nil} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -44,12 +42,12 @@ %global KVERSION %{target_kernel_version_full} %define _name srp -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} Summary: srp driver Name: %{_name}-signed Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -112,9 +110,6 @@ popd %license %{_datadir}/licenses/%{_name}/copyright %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. diff --git a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec index 9b29fba71a0..0bb3db83821 100644 --- a/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-hwe-modules-signed/xpmem-hwe-modules-signed.spec @@ -4,18 +4,16 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %define _name xpmem-hwe-modules -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} # xpmem-modules is a sub-package in SPECS/xpmem. # We are making that into a main package for signing. @@ -23,7 +21,7 @@ Summary: Cross-partition memory Name: %{_name}-signed Version: 2.7.4 -Release: 29%{release_suffix}%{?dist} +Release: 28%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -95,9 +93,6 @@ if [ $1 = 0 ]; then # 1 : Erase, not upgrade fi %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 2.7.4-28_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec index 9adb4a64b4e..420d3fe51a6 100644 --- a/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec +++ b/SPECS-SIGNED/xpmem-modules-signed/xpmem-modules-signed.spec @@ -4,17 +4,15 @@ # The default %%__os_install_post macro ends up stripping the signatures off of the kernel module. %define __os_install_post %{__os_install_post_leave_signatures} %{nil} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %global KVERSION %{target_kernel_version_full} %define _name xpmem-modules -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} # xpmem-modules is a sub-package in SPECS/xpmem. # We are making that into a main package for signing. @@ -22,7 +20,7 @@ Summary: Cross-partition memory Name: %{_name}-signed Version: 2.7.4 -Release: 23%{release_suffix}%{?dist} +Release: 22%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -95,9 +93,6 @@ fi %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-23 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 2.7.4-22 - Build with OFED 25.07.0.9.7.1. diff --git a/SPECS/iser-hwe/iser-hwe.spec b/SPECS/iser-hwe/iser-hwe.spec index 8d9e9794f8b..dcbf93ffa48 100644 --- a/SPECS/iser-hwe/iser-hwe.spec +++ b/SPECS/iser-hwe/iser-hwe.spec @@ -27,11 +27,9 @@ # %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -42,7 +40,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name iser-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-4%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -68,14 +67,14 @@ Summary: %{_name} Driver Name: iser-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/iser-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/iser-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -167,7 +166,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n iser-%{target_mlnx_ofa_kernel_version} +%setup -n iser-%{_version} set -- * mkdir source mv "$@" source/ @@ -252,9 +251,6 @@ fi # 1 : closed %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/iser/iser.spec b/SPECS/iser/iser.spec index 5efa2b424de..e67720745a2 100644 --- a/SPECS/iser/iser.spec +++ b/SPECS/iser/iser.spec @@ -27,11 +27,9 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -41,7 +39,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name iser} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,14 +66,14 @@ Summary: %{_name} Driver Name: iser Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/iser-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/iser-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -253,9 +252,6 @@ fi # 1 : closed %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/isert-hwe/isert-hwe.spec b/SPECS/isert-hwe/isert-hwe.spec index b751a123b32..13c30d10bad 100644 --- a/SPECS/isert-hwe/isert-hwe.spec +++ b/SPECS/isert-hwe/isert-hwe.spec @@ -27,12 +27,9 @@ # %if 0%{azl} -# the naming convetion is azl__version and azl__release -# the package name will convert hyphens to underscores -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -43,7 +40,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-4%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -69,14 +67,14 @@ Summary: %{_name}-hwe Driver Name: isert-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/isert-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -168,7 +166,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n isert-%{target_mlnx_ofa_kernel_version} +%setup -n isert-%{_version} set -- * mkdir source mv "$@" source/ @@ -253,9 +251,6 @@ fi # 1 : closed %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.1 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/isert/isert.spec b/SPECS/isert/isert.spec index 44a2f32c742..271e942653e 100644 --- a/SPECS/isert/isert.spec +++ b/SPECS/isert/isert.spec @@ -27,11 +27,9 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -41,7 +39,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name isert} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,14 +66,14 @@ Summary: %{_name} Driver Name: isert Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/isert-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/isert-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -253,9 +252,6 @@ fi # 1 : closed %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/knem-hwe/knem-hwe.spec b/SPECS/knem-hwe/knem-hwe.spec index e31b3d12a39..7bfe44b8203 100644 --- a/SPECS/knem-hwe/knem-hwe.spec +++ b/SPECS/knem-hwe/knem-hwe.spec @@ -27,9 +27,9 @@ %{!?KMP: %global KMP 0} %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -55,7 +55,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: knem-hwe Version: 1.1.4.90mlnx3 -Release: 29%{release_suffix}%{?dist} +Release: 28%{release_suffix}%{?dist} Provides: knem-hwe-mlnx = %{version}-%{release} Obsoletes: knem-hwe-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -241,9 +241,6 @@ fi %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-29_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-28_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/knem/knem.spec b/SPECS/knem/knem.spec index c80d934838d..64b69713e83 100644 --- a/SPECS/knem/knem.spec +++ b/SPECS/knem/knem.spec @@ -27,9 +27,9 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -54,7 +54,7 @@ Summary: KNEM: High-Performance Intra-Node MPI Communication Name: knem Version: 1.1.4.90mlnx3 -Release: 23%{release_suffix}%{?dist} +Release: 22%{release_suffix}%{?dist} Provides: knem-mlnx = %{version}-%{release} Obsoletes: knem-mlnx < %{version}-%{release} License: BSD and GPLv2 @@ -304,9 +304,6 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 1.1.4.90mlnx3-23 -- Tweak specs to use dynamic versioning for kernel - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 1.1.4.90mlnx3-22 - Build with OFED 25.07.0.9.7.1. - Update source path diff --git a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec index ce5155b2295..9822abd474e 100644 --- a/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec +++ b/SPECS/mft_kernel-hwe/mft_kernel-hwe.spec @@ -1,7 +1,7 @@ %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -35,7 +35,7 @@ Name: mft_kernel-hwe Summary: %{name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel BuildRoot: /var/tmp/%{name}-%{version}-build @@ -213,9 +213,6 @@ find %{buildroot} -type f -name \*.ko -exec %{__strip} -p --strip-debug --discar %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 4.33.0-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/mft_kernel/mft_kernel.spec b/SPECS/mft_kernel/mft_kernel.spec index e6b9cc60328..b15ed380b55 100644 --- a/SPECS/mft_kernel/mft_kernel.spec +++ b/SPECS/mft_kernel/mft_kernel.spec @@ -1,8 +1,8 @@ %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -35,7 +35,7 @@ Name: mft_kernel Summary: %{name} Kernel Module for the %{KVERSION} kernel Version: 4.33.0 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: Dual BSD/GPLv2 Group: System Environment/Kernel BuildRoot: /var/tmp/%{name}-%{version}-build @@ -230,9 +230,6 @@ find %{buildroot} -type f -name \*.ko -exec %{__strip} -p --strip-debug --discar %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 4.33.0-2 -- Tweak specs to use dynamic versioning for kernel - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 4.33.0-1 - Upgrade version to 4.33.0. - Update source path diff --git a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec index e28bd5275b1..51e53ef9336 100644 --- a/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec +++ b/SPECS/mlnx-nfsrdma-hwe/mlnx-nfsrdma-hwe.spec @@ -27,11 +27,9 @@ # %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -43,7 +41,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name mlnx-nfsrdma-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-4%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -69,14 +68,14 @@ Summary: %{_name} Driver Name: mlnx-nfsrdma-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/mlnx-nfsrdma-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/mlnx-nfsrdma-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -168,7 +167,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n mlnx-nfsrdma-%{target_mlnx_ofa_kernel_version} +%setup -n mlnx-nfsrdma-%{_version} set -- * mkdir source mv "$@" source/ @@ -253,9 +252,6 @@ fi %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec index 6436358d5c0..c55b4fe59d9 100644 --- a/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec +++ b/SPECS/mlnx-nfsrdma/mlnx-nfsrdma.spec @@ -27,11 +27,9 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -42,7 +40,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name mlnx-nfsrdma} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -68,14 +67,14 @@ Summary: %{_name} Driver Name: mlnx-nfsrdma Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/%{_name}-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/%{_name}-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation Distribution: Azure Linux @@ -254,9 +253,6 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec index 8eaac38e9a3..5b55894d62e 100644 --- a/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec +++ b/SPECS/mlnx-ofa_kernel-hwe/mlnx-ofa_kernel-hwe.spec @@ -27,9 +27,9 @@ # %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -102,7 +102,7 @@ Summary: Infiniband HCA Driver Name: mlnx-ofa_kernel-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base @@ -449,9 +449,6 @@ update-alternatives --remove \ %{_prefix}/src/ofa_kernel/%{_arch}/[0-9]* %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec index 3c94bed18dc..77d5bd244dd 100644 --- a/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec +++ b/SPECS/mlnx-ofa_kernel/mlnx-ofa_kernel.spec @@ -27,11 +27,9 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -92,6 +90,7 @@ %{!?KERNEL_SOURCES: %global KERNEL_SOURCES /lib/modules/%{KVERSION}/source} %{!?_name: %global _name mlnx-ofa_kernel} +%{!?_version: %global _version 25.07} %{!?_release: %global _release OFED.25.07.0.9.7.1} %global _kmp_rel %{_release}%{?_kmp_build_num}%{?_dist} %global MLNX_OFA_DRV_SRC 24.10-0.7.0 @@ -108,14 +107,14 @@ Summary: Infiniband HCA Driver Name: mlnx-ofa_kernel Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com/ Group: System Environment/Base # DOCA OFED feature sources come from the following MLNX_OFED_SRC tgz. # This archive contains the SRPMs for each feature and each SRPM includes the source tarball and the SPEC file. # https://linux.mellanox.com/public/repo/doca/3.1.0/SOURCES/mlnx_ofed/MLNX_OFED_SRC-25.07-0.9.7.0.tgz -Source0: %{_distro_sources_url}/%{_name}-%{target_mlnx_ofa_kernel_version}.tgz +Source0: %{_distro_sources_url}/%{_name}-%{_version}.tgz BuildRoot: /var/tmp/%{name}-%{version}-build Vendor: Microsoft Corporation @@ -303,7 +302,7 @@ drivers against it. %{!?install_mod_dir: %global install_mod_dir updates} %prep -%setup -n %{_name}-%{target_mlnx_ofa_kernel_version} +%setup -n %{_name}-%{_version} set -- * mkdir source mv "$@" source/ @@ -767,9 +766,6 @@ update-alternatives --remove \ %{_prefix}/src/mlnx-ofa_kernel-%version %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/srp-hwe/srp-hwe.spec b/SPECS/srp-hwe/srp-hwe.spec index b91d05b646b..6e6ad4d71f5 100644 --- a/SPECS/srp-hwe/srp-hwe.spec +++ b/SPECS/srp-hwe/srp-hwe.spec @@ -27,11 +27,9 @@ # %if 0%{azl} - -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -42,7 +40,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name srp-hwe} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-4%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -68,7 +67,7 @@ Summary: srp driver Name: srp-hwe Version: 25.07 -Release: 5%{release_suffix}%{?dist} +Release: 4%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -168,7 +167,7 @@ BuildRequires: %kernel_module_package_buildreqs %{!?install_mod_dir: %global install_mod_dir updates/%{name}} %prep -%setup -n srp-%{target_mlnx_ofa_kernel_version} +%setup -n srp-%{_version} set -- * mkdir source mv "$@" source/ @@ -258,9 +257,6 @@ fi %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 25.07-5_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel and MOFED - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 25.07-4_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/srp/srp.spec b/SPECS/srp/srp.spec index f9425514605..7c235b802e1 100644 --- a/SPECS/srp/srp.spec +++ b/SPECS/srp/srp.spec @@ -27,11 +27,9 @@ # %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -41,7 +39,8 @@ %global K_SRC /lib/modules/%{target_kernel_version_full}/build %{!?_name: %define _name srp} -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_version: %define _version 25.07} +%{!?_mofed_full_version: %define _mofed_full_version %{_version}-1%{release_suffix}%{?dist}} %{!?_release: %define _release OFED.25.07.0.9.7.1} # KMP is disabled by default @@ -67,7 +66,7 @@ Summary: srp driver Name: srp Version: 25.07 -Release: 2%{release_suffix}%{?dist} +Release: 1%{release_suffix}%{?dist} License: GPLv2 Url: http://www.mellanox.com Group: System Environment/Base @@ -259,9 +258,6 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 25.07-2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 25.07-1 - Upgrade version to 25.07. - Update source path diff --git a/SPECS/xpmem-hwe/xpmem-hwe.spec b/SPECS/xpmem-hwe/xpmem-hwe.spec index 3c9c435b86a..2cee385867b 100644 --- a/SPECS/xpmem-hwe/xpmem-hwe.spec +++ b/SPECS/xpmem-hwe/xpmem-hwe.spec @@ -1,10 +1,9 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_hwe_version -%global target_kernel_release %azl_kernel_hwe_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_hwe_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_hwe_release +# hard code versions due to ADO bug:58993948 +%global target_azl_build_kernel_version 6.12.57.1 +%global target_kernel_release 4 %global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else @@ -14,7 +13,7 @@ %global KVERSION %{target_kernel_version_full} %global K_SRC /lib/modules/%{target_kernel_version_full}/build -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-4%{release_suffix}%{?dist}} # %{!?KVERSION: %global KVERSION %(uname -r)} %{!?KVERSION: %global KVERSION %{target_kernel_version_full}} @@ -44,7 +43,7 @@ Summary: Cross-partition memory Name: xpmem-hwe Version: 2.7.4 -Release: 29%{release_suffix}%{?dist} +Release: 28%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -207,9 +206,6 @@ fi %endif %changelog -* Tue Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-29_6.12.57.1.2 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa - * Fri Feb 06 2026 Suresh Babu Chalamalasetty - 2.7.4-28_6.12.57.1.4 - Bump to match kernel-hwe. diff --git a/SPECS/xpmem/xpmem.spec b/SPECS/xpmem/xpmem.spec index ec4ba2ca62b..ed3d70569f8 100644 --- a/SPECS/xpmem/xpmem.spec +++ b/SPECS/xpmem/xpmem.spec @@ -1,11 +1,9 @@ %{!?KMP: %global KMP 0} %if 0%{azl} -%global target_azl_build_kernel_version %azl_kernel_version -%global target_kernel_release %azl_kernel_release -%global target_mlnx_ofa_kernel_version %azl_mlnx_ofa_kernel_version -%global target_mlnx_ofa_kernel_release %azl_mlnx_ofa_kernel_release -%global target_kernel_version_full %{target_azl_build_kernel_version}-%{target_kernel_release}%{?dist} +%global target_kernel_version_full %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}-%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_azl_build_kernel_version %(/bin/rpm -q --queryformat '%{RPMTAG_VERSION}' $(/bin/rpm -q --whatprovides kernel-headers)) +%global target_kernel_release %(/bin/rpm -q --queryformat '%{RPMTAG_RELEASE}' $(/bin/rpm -q --whatprovides kernel-headers) | /bin/cut -d . -f 1) %global release_suffix _%{target_azl_build_kernel_version}.%{target_kernel_release} %else %global target_kernel_version_full f.a.k.e @@ -14,7 +12,7 @@ %global KVERSION %{target_kernel_version_full} %global K_SRC /lib/modules/%{target_kernel_version_full}/build -%{!?_mofed_full_version: %define _mofed_full_version %{target_mlnx_ofa_kernel_version}-%{target_mlnx_ofa_kernel_release}%{?dist}} +%{!?_mofed_full_version: %define _mofed_full_version 25.07-1%{release_suffix}%{?dist}} # %{!?KVERSION: %global KVERSION %(uname -r)} %{!?KVERSION: %global KVERSION %{target_kernel_version_full}} @@ -44,7 +42,7 @@ Summary: Cross-partition memory Name: xpmem Version: 2.7.4 -Release: 23%{release_suffix}%{?dist} +Release: 22%{release_suffix}%{?dist} License: GPLv2 and LGPLv2.1 Group: System Environment/Libraries Vendor: Microsoft Corporation @@ -276,9 +274,6 @@ fi %endif %changelog -* Mon Feb 10 2026 Mykhailo Bykhovtsev - 2.7.4-23 -- Tweak specs to use dynamic versioning for kernel and mlnx_ofa_kernel versions. - * Tue Nov 04 2025 Suresh Babu Chalamalasetty - 2.7.4-22 - Build with OFED 25.07.0.9.7.1. - Update source path From ef9ca66bed7bd59619f07adc90801c246d73732e Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 27 Feb 2026 12:03:57 -0800 Subject: [PATCH 80/86] Remove .github/workflows changes (moved to mbykhovtsev/kernel-macros-specs branch) --- .../workflows/check-package-cgmanifest.yml | 6 +----- .github/workflows/check-source-signatures.yml | 15 +------------- .github/workflows/validate-cg-manifest.sh | 20 ++++--------------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/check-package-cgmanifest.yml b/.github/workflows/check-package-cgmanifest.yml index 02162e16e62..8305138c079 100644 --- a/.github/workflows/check-package-cgmanifest.yml +++ b/.github/workflows/check-package-cgmanifest.yml @@ -51,10 +51,6 @@ jobs: if: ${{ env.updated-specs != '' }} run: sudo make -C toolkit -j$(nproc) chroot-tools REBUILD_TOOLS=y DAILY_BUILD_ID=lkg - - name: Generate the macros file with version/release info - if: ${{ env.updated-specs != '' }} - run: sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=lkg - - name: Check each spec if: ${{ env.updated-specs != '' }} - run: .github/workflows/validate-cg-manifest.sh build/worker/worker_chroot.tar.gz build/pkg_artifacts/macros.releaseversions ${{ env.updated-specs }} + run: .github/workflows/validate-cg-manifest.sh build/worker/worker_chroot.tar.gz ${{ env.updated-specs }} diff --git a/.github/workflows/check-source-signatures.yml b/.github/workflows/check-source-signatures.yml index 3a2abf879ff..7d697a2b046 100644 --- a/.github/workflows/check-source-signatures.yml +++ b/.github/workflows/check-source-signatures.yml @@ -81,10 +81,6 @@ jobs: sudo make -C toolkit -j$(nproc) chroot-tools REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} - # Generate the macros.releaseversions file that is needed by the signature check. - # The file contains versions and releases of all packages under SPECS folder. - sudo make -C toolkit -j$(nproc) generate-versions-macros-file REBUILD_TOOLS=y DAILY_BUILD_ID=${LKG_BUILD_ID} - - name: Check for invalid source signatures run: | if [ -z "${{ env.changed_pkgs }}" ]; then @@ -92,17 +88,8 @@ jobs: exit 0 fi - MACROS_RELEASEVERSIONS_PATH=$(find . -type f -path "*/build/pkg_artifacts/macros.releaseversions" -print -quit) - if [ -z "$MACROS_RELEASEVERSIONS_PATH" ]; then - echo "macros.releaseversions was not found under */build/pkg_artifacts path." - exit 1 - fi - - MACROS_RELEASEVERSIONS_PATH=$(realpath "$MACROS_RELEASEVERSIONS_PATH") - echo "Using macros.releaseversions at: $MACROS_RELEASEVERSIONS_PATH" - set -x - if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }} EXTRA_MACROS_FILES="$MACROS_RELEASEVERSIONS_PATH"; then + if ! sudo make -C toolkit -j$(nproc) input-srpms REBUILD_TOOLS=y DAILY_BUILD_ID=${{ env.LKG_BUILD_ID }} SRPM_PACK_LIST="${{ env.changed_pkgs }}" SPECS_DIR=../${{ matrix.specs-dir }}; then set +x printf "\n\n******************************\n" echo "Failed to check the signatures of the modified packages." diff --git a/.github/workflows/validate-cg-manifest.sh b/.github/workflows/validate-cg-manifest.sh index 369d77996f2..9da6278ea41 100755 --- a/.github/workflows/validate-cg-manifest.sh +++ b/.github/workflows/validate-cg-manifest.sh @@ -10,8 +10,7 @@ # - The URL listed in the cgmanifets is valid (can be downloaded) # $1 - Path to worker chroot's archive -# $2 - Path to macros.releaseversions file to copy to the chroot for rpmspec parsing -# $3+ - Paths to spec files to check +# $2+ - Paths to spec files to check set -euo pipefail @@ -91,7 +90,6 @@ chroot_rpmspec() { prepare_chroot_environment() { local chroot_archive local chroot_dir_path - local macros_file local chroot_rpm_macros_dir_path local dist_name local dist_number @@ -99,8 +97,7 @@ prepare_chroot_environment() { local rpm_macros_dir_path chroot_archive="$1" - chroot_dir_path="$3" - macros_file="$2" + chroot_dir_path="$2" echo "Creating worker chroot under '$chroot_dir_path'." @@ -127,13 +124,10 @@ prepare_chroot_environment() { sudo cp -v "$macro_file" "$chroot_rpm_macros_dir_path" done - echo "Copying the version/release macros file to the chroot." - sudo cp -v "$macros_file" "$chroot_rpm_macros_dir_path" - echo } -if [[ $# -lt 3 ]]; then +if [[ $# -lt 2 ]]; then echo "No specs passed to validate." exit 1 fi @@ -143,11 +137,6 @@ if [[ ! -f "$1" ]]; then exit 1 fi -if [[ ! -f "$2" ]]; then - echo "Second argument is not a valid file. Please pass the path to the macros.releaseversions file to copy to the chroot." - exit 1 -fi - rm -f bad_registrations.txt WORK_DIR=$(mktemp -d -t) @@ -157,10 +146,9 @@ function clean_up { } trap clean_up EXIT SIGINT SIGTERM -prepare_chroot_environment "$1" "$2" "$WORK_DIR" +prepare_chroot_environment "$1" "$WORK_DIR" shift # Remove the first argument (the chroot archive) from the list of specs to check. -shift # Remove the second argument (the macros.releaseversions file) from the list of specs to check. echo "Checking $# specs." i=0 From 69e7bc88257bd924c7065f2f9562f3d352380674 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Fri, 27 Feb 2026 12:11:36 -0800 Subject: [PATCH 81/86] fix the assertions --- toolkit/tools/versionsprocessor/versionsprocessor_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor_test.go b/toolkit/tools/versionsprocessor/versionsprocessor_test.go index da0c3c74a2e..5e25e838c1b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor_test.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor_test.go @@ -490,7 +490,7 @@ func TestWriteExtraFilesToOutput_SkipsEmptyPaths(t *testing.T) { // Should only contain the original macros, nothing extra. assert.Contains(t, content, "%azl_pkg_version 1.0") lines := strings.Split(strings.TrimSpace(content), "\n") - assert.Equal(t, 1, len(lines)) + assert.Equal(t, len(lines), 1) } func TestWriteExtraFilesToOutput_NonexistentExtraFile(t *testing.T) { From e8e4a10625dc20c6ad8d5364f48c94ab0d1e7892 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 3 Mar 2026 14:48:30 -0800 Subject: [PATCH 82/86] adjusting to PR's feedback --- toolkit/docs/building/building.md | 2 +- toolkit/scripts/srpm_pack.mk | 1 - .../tools/internal/safechroot/dummychroot.go | 2 +- .../tools/internal/safechroot/safechroot.go | 28 ++- .../tools/pkg/licensecheck/licensecheck.go | 4 +- .../pkg/specreaderutils/specreaderutil.go | 48 +++++- .../versionsprocessor/versionsprocessor.go | 78 +++++---- .../versionsprocessor_test.go | 163 +++++++----------- 8 files changed, 170 insertions(+), 156 deletions(-) diff --git a/toolkit/docs/building/building.md b/toolkit/docs/building/building.md index e56071d9f22..f878584ade8 100644 --- a/toolkit/docs/building/building.md +++ b/toolkit/docs/building/building.md @@ -814,7 +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 `` files whose content will be appended to the main `macros.releaseversions` file used during package build. Used to resolve versions of kernel Out of Tree Modules. +| EXTRA_MACROS_FILES | | Space separated list of additional `` containing additional RPM macros, which will be available to the build. Used to resolve versions of kernel Out of Tree Module packages. --- diff --git a/toolkit/scripts/srpm_pack.mk b/toolkit/scripts/srpm_pack.mk index 9cb9f2ec2b8..34eea4246f4 100644 --- a/toolkit/scripts/srpm_pack.mk +++ b/toolkit/scripts/srpm_pack.mk @@ -16,7 +16,6 @@ SRPM_FILE_SIGNATURE_HANDLING ?= enforce 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)) diff --git a/toolkit/tools/internal/safechroot/dummychroot.go b/toolkit/tools/internal/safechroot/dummychroot.go index 00d65d707fb..4894fe3894f 100644 --- a/toolkit/tools/internal/safechroot/dummychroot.go +++ b/toolkit/tools/internal/safechroot/dummychroot.go @@ -25,5 +25,5 @@ func (d *DummyChroot) AddFiles(filesToCopy ...FileToCopy) (err error) { } func (d *DummyChroot) AddRPMMacrosFile(macrosFilePath string) error { - return d.AddRPMMacrosFile(macrosFilePath) + return AddRPMMacrosFile(d, macrosFilePath) } diff --git a/toolkit/tools/internal/safechroot/safechroot.go b/toolkit/tools/internal/safechroot/safechroot.go index 81a4294d519..a39e5c93fda 100644 --- a/toolkit/tools/internal/safechroot/safechroot.go +++ b/toolkit/tools/internal/safechroot/safechroot.go @@ -162,13 +162,14 @@ func NewOverlayMountPoint(chrootDir, source, target, lowerDir, upperDir, workDir return } -func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) (err error) { +func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) error { + return AddRPMMacrosFile(c, macrosFilePath) +} - var ( - macroDir string - ) +func AddRPMMacrosFile(c ChrootInterface, macrosFilePath string) (err error) { + var macroDir string - doParse := func() error { + doGetMacroDir := func() error { var macroErr error macroDir, macroErr = rpm.GetMacroDir() @@ -180,12 +181,23 @@ func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) (err error) { return macroErr } - c.Run(doParse) + c.Run(doGetMacroDir) // Destination path inside the chroot (same path as on the host). - macrosDestDir := filepath.Join(c.rootDir, macroDir) + 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 { @@ -196,7 +208,7 @@ func (c *Chroot) AddRPMMacrosFile(macrosFilePath string) (err error) { 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 mkdirErr + return copyErr } logger.Log.Infof("Copied release version macros file into chroot (%s -> %s)", macrosFilePath, macrosDestFile) diff --git a/toolkit/tools/pkg/licensecheck/licensecheck.go b/toolkit/tools/pkg/licensecheck/licensecheck.go index 7a5fb61ffdf..62d62bc61f0 100644 --- a/toolkit/tools/pkg/licensecheck/licensecheck.go +++ b/toolkit/tools/pkg/licensecheck/licensecheck.go @@ -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) if err != nil { err = fmt.Errorf("failed to initialize chroot:\n%w", err) return newLicenseChecker, err diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 6d58da3df2e..9fafa2931a4 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -50,6 +50,29 @@ var ( } ) +// ChrootConfig holds the configuration for creating a chroot environment. +type ChrootConfig struct { + SrpmsDir string + ReleaseVersionMacrosFile string +} + +// ChrootOption is a functional option for configuring chroot creation. +type ChrootOption func(*ChrootConfig) + +// WithSrpmsDir sets the SRPM directory to mount inside the chroot. +func WithSrpmsDir(srpmsDir string) ChrootOption { + return func(c *ChrootConfig) { + c.SrpmsDir = srpmsDir + } +} + +// WithReleaseVersionMacrosFile sets the release version macros file to copy into the chroot. +func WithReleaseVersionMacrosFile(file string) ChrootOption { + return func(c *ChrootConfig) { + c.ReleaseVersionMacrosFile = file + } +} + // parseResult holds the worker results from parsing a SPEC file. type parseResult struct { packages []*pkgjson.Package @@ -67,7 +90,7 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist if workerTar != "" { const leaveFilesOnDisk = false - chroot, err = CreateChroot("specparser_chroot", workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile) + chroot, err = CreateChroot("specparser_chroot", workerTar, buildDir, specsDir, WithSrpmsDir(srpmsDir), WithReleaseVersionMacrosFile(releaseVersionMacrosFile)) if err != nil { return } @@ -126,13 +149,22 @@ func ParseSPECsWrapper(buildDir, specsDir, rpmsDir, srpmsDir, toolchainDir, dist return } -// createChroot creates a chroot to parse SPECs inside of. -func CreateChroot(chrootName, workerTar, buildDir, specsDir, srpmsDir, releaseVersionMacrosFile string) (chroot *safechroot.Chroot, err error) { +// CreateChroot creates a chroot to parse SPECs inside of. +// Required parameters are chrootName, workerTar, buildDir, and specsDir. +// Optional configuration can be provided via ChrootOption functions: +// - WithSrpmsDir: sets the SRPM directory to mount inside the chroot. +// - WithReleaseVersionMacrosFile: sets the release version macros file to copy into the chroot. +func CreateChroot(chrootName, workerTar, buildDir, specsDir string, opts ...ChrootOption) (chroot *safechroot.Chroot, err error) { const ( existingDir = false leaveFilesOnDisk = false ) + cfg := &ChrootConfig{} + for _, opt := range opts { + opt(cfg) + } + // Mount the specs and srpms directories to an identical path inside the chroot. // Since specreader saves the full paths to specs in its output that grapher will then consume, // the pathing needs to be preserved from the host system. @@ -142,8 +174,8 @@ func CreateChroot(chrootName, workerTar, buildDir, specsDir, srpmsDir, releaseVe safechroot.NewMountPoint(specsDir, specsDir, "", safechroot.BindMountPointFlags, ""), } - if srpmsDir != "" { - extraMountPoints = append(extraMountPoints, safechroot.NewMountPoint(srpmsDir, srpmsDir, "", safechroot.BindMountPointFlags, "")) + if cfg.SrpmsDir != "" { + extraMountPoints = append(extraMountPoints, safechroot.NewMountPoint(cfg.SrpmsDir, cfg.SrpmsDir, "", safechroot.BindMountPointFlags, "")) } chrootDir := filepath.Join(buildDir, chrootName) @@ -156,7 +188,7 @@ func CreateChroot(chrootName, workerTar, buildDir, specsDir, srpmsDir, releaseVe // If this is not a regular build then copy in all of the SPECs since there are no bind mounts. if !buildpipeline.IsRegularBuild() { - dirsToCopy := []string{specsDir, srpmsDir} + dirsToCopy := []string{specsDir, cfg.SrpmsDir} for _, dir := range dirsToCopy { dirInChroot := filepath.Join(chroot.RootDir(), dir) err = directory.CopyContents(dir, dirInChroot) @@ -172,8 +204,8 @@ func CreateChroot(chrootName, workerTar, buildDir, specsDir, srpmsDir, releaseVe // 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 releaseVersionMacrosFile != "" { - err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) + if cfg.ReleaseVersionMacrosFile != "" { + err = chroot.AddRPMMacrosFile(cfg.ReleaseVersionMacrosFile) if err != nil { logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) } diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index ea82054b850..b20e07b73a1 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -28,6 +28,8 @@ import ( "gopkg.in/alecthomas/kingpin.v2" ) +var packageVersionRegexp = regexp.MustCompile(`^[^:]+: (?:(.+):)?(.+)-(.+)$`) + var ( app = kingpin.New("versionsprocessor", "A tool to generate a macro file of all specs version and release") specsDir = exe.InputDirFlag(app, "Directory to scan for SPECS") @@ -43,10 +45,6 @@ var ( ) func main() { - const ( - prefix = "azl" - ) - var ( chroot *safechroot.Chroot macrosOutput []string @@ -72,9 +70,6 @@ func main() { if err != nil { logger.PanicOnError(err) } - if err != nil { - logger.Log.Errorf("Failed to determine RPM architecture for runtime architecture %q: %v", runtime.GOARCH, err) - } } if *workerTar == "" { @@ -83,17 +78,17 @@ func main() { } const leaveFilesOnDisk = false - chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir, "", "") + chroot, err = specreaderutils.CreateChroot("versionprocessor_chroot", *workerTar, *buildDir, *specsDir) if err != nil { logger.PanicOnError("Failed to create chroot") } defer chroot.Close(leaveFilesOnDisk) doParse := func() error { - // Find all spec files + // Find all spec files in provided specs dir allSpecFiles, err := specreaderutils.FindSpecFiles(*specsDir, nil) if err != nil { - logger.Log.Panicf("Error finding spec files: %s", err) + logger.Log.Errorf("Error finding spec files: %s", err) return err } @@ -101,10 +96,12 @@ func main() { // Process all specs files for _, specFile := range allSpecFiles { - // Get spec file version-release - macrosOutput, err = processSpecFile(specFile, buildArch, prefix, macrosOutput) + macrosOutput, err = processSpecFile(specFile, buildArch, *distTag, macrosOutput) + // We must continue processing all spec files even if there's an error with one of them, so just log the error and move on to the next file. + // Some spec files have errors or warnings unrelated to our query that cause the processing to fail, + // and we don't want that to prevent us from getting version-release information for the other spec files. if err != nil { logger.Log.Errorf("Error processing spec file (%s): %s", specFile, err) continue @@ -114,10 +111,10 @@ func main() { return err } - if chroot != nil { - err = chroot.Run(doParse) - } else { - err = doParse() + err = chroot.Run(doParse) + + if err != nil { + logger.Log.Errorf("Error processing spec files: %s", err) } err = writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) @@ -127,13 +124,13 @@ func main() { } } -func processSpecFile(specFile string, buildArch string, prefix string, macrosOutput []string) (newMacrosOutput []string, err error) { +func processSpecFile(specFile string, buildArch string, distTag string, macrosOutput []string) (newMacrosOutput []string, err error) { // Get spec file version-release specFileName := filepath.Base(specFile) sourceDir := filepath.Dir(specFile) - defines := rpm.DefaultDistroDefines(false, *distTag) + defines := rpm.DefaultDistroDefines(false, distTag) packages, err := rpm.QuerySPEC(specFile, sourceDir, `%{NAME}: %{evr}\n`, buildArch, defines, rpm.QueryHeaderArgument) @@ -144,46 +141,53 @@ func processSpecFile(specFile string, buildArch string, prefix string, macrosOut for _, packageVersionString := range packages { - macros, err := processPackageVersionString(packageVersionString, specFileName, prefix) + macros, err := processPackageVersionString(packageVersionString, specFileName, distTag) if err != nil { logger.Log.Errorf("Error processing package version string: %s", err) continue } - macrosOutput = append(macrosOutput, macros) + macrosOutput = append(macrosOutput, macros...) } return macrosOutput, nil } -func processPackageVersionString(packageVersionString string, specFileName string, prefix string) (macros string, err error) { +func processPackageVersionString(packageVersionString string, specFileName string, distTag string) (macros []string, err error) { + const ( + prefix = "azl" + ) // the output of the above query is in the format of "packagename: version-release", // so split by ": " to get the version-release portion we want the second part - releaseVerSplit := regexp.MustCompile(`^[^:]+: (.+)-(.+)$`).FindStringSubmatch(packageVersionString)[1:] + releaseVerSplit := packageVersionRegexp.FindStringSubmatch(packageVersionString)[1:] - if len(releaseVerSplit) != 2 { - err = fmt.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) - logger.Log.Errorf("Empty version-release format retrieved from spec file (%s)", specFileName) + if len(releaseVerSplit) <= 2 { + errorString := fmt.Sprintf("Empty version-release format retrieved from spec file (%s)", specFileName) + err = fmt.Errorf(errorString) + logger.Log.Errorf(errorString) - return "", err + return []string{""}, err } - version := releaseVerSplit[0] - release := releaseVerSplit[1] - releaseClean := strings.Replace(release, *distTag, "", 1) // targetting azl3 specifically since this won't go into above 3.0 toolkit + epoch := releaseVerSplit[0] + version := releaseVerSplit[1] + release := releaseVerSplit[2] + releaseClean := strings.Replace(release, distTag, "", 1) // strip out the .spec suffix and replace '-' with '_' as RPM macros cannot have '-' - specFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) - specFileNameMacroFormat = strings.ReplaceAll(specFileNameMacroFormat, "-", "_") + packageFileNameMacroFormat := strings.Replace(specFileName, ".spec", "", 1) + packageFileNameMacroFormat = strings.ReplaceAll(packageFileNameMacroFormat, "-", "_") - versionMacroString := prefix + "_" + specFileNameMacroFormat + "_version" - releaseMacroString := prefix + "_" + specFileNameMacroFormat + "_release" + epochReleaseString := prefix + "_" + packageFileNameMacroFormat + "_epoch" + versionMacroString := prefix + "_" + packageFileNameMacroFormat + "_version" + releaseMacroString := prefix + "_" + packageFileNameMacroFormat + "_release" // Generate RPM macro definitions instead of modifying spec files directly. - macros = fmt.Sprintf("%%%s %s\n%%%s %s", - versionMacroString, version, - releaseMacroString, releaseClean, - ) + macros = []string{ + fmt.Sprintf("%%%s %s", epochReleaseString, epoch), + fmt.Sprintf("%%%s %s", versionMacroString, version), + fmt.Sprintf("%%%s %s", releaseMacroString, releaseClean), + } return macros, nil } diff --git a/toolkit/tools/versionsprocessor/versionsprocessor_test.go b/toolkit/tools/versionsprocessor/versionsprocessor_test.go index 5e25e838c1b..c4cfb367180 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor_test.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor_test.go @@ -27,20 +27,18 @@ func TestMain(m *testing.M) { // --------------------------------------------------------------------------- func TestProcessPackageVersionString_ValidInput(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" - macros, err := processPackageVersionString("mypackage: 1.2.3-4.azl3", "mypackage.spec", "azl") + macros, err := processPackageVersionString("mypackage: 1.2.3-4.azl3", "mypackage.spec", distTag) require.NoError(t, err) assert.Contains(t, macros, "%azl_mypackage_version 1.2.3") assert.Contains(t, macros, "%azl_mypackage_release 4") } func TestProcessPackageVersionString_DashesInSpecName(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" - macros, err := processPackageVersionString("my-cool-pkg: 2.0.0-1.azl3", "my-cool-pkg.spec", "azl") + macros, err := processPackageVersionString("my-cool-pkg: 2.0.0-1.azl3", "my-cool-pkg.spec", distTag) require.NoError(t, err) // Dashes should be replaced with underscores in macro names. assert.Contains(t, macros, "%azl_my_cool_pkg_version 2.0.0") @@ -48,10 +46,9 @@ func TestProcessPackageVersionString_DashesInSpecName(t *testing.T) { } func TestProcessPackageVersionString_ReleaseWithoutDistTag(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" - macros, err := processPackageVersionString("pkg: 1.0-5", "pkg.spec", "azl") + macros, err := processPackageVersionString("pkg: 1.0-5", "pkg.spec", distTag) require.NoError(t, err) // When the dist tag is not present in the release, it should remain unchanged. assert.Contains(t, macros, "%azl_pkg_version 1.0") @@ -59,49 +56,36 @@ func TestProcessPackageVersionString_ReleaseWithoutDistTag(t *testing.T) { } func TestProcessPackageVersionString_EpochInVersion(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" - macros, err := processPackageVersionString("pkg: 2:3.4.5-6.azl3", "pkg.spec", "azl") + macros, err := processPackageVersionString("pkg: 2:3.4.5-6.azl3", "pkg.spec", distTag) require.NoError(t, err) - assert.Contains(t, macros, "%azl_pkg_version 2:3.4.5") + assert.Contains(t, macros, "%azl_pkg_epoch 2") + assert.Contains(t, macros, "%azl_pkg_version 3.4.5") assert.Contains(t, macros, "%azl_pkg_release 6") } -func TestProcessPackageVersionString_CustomPrefix(t *testing.T) { - tag := ".azl3" - distTag = &tag - - macros, err := processPackageVersionString("mypkg: 1.0-1.azl3", "mypkg.spec", "custom") - require.NoError(t, err) - assert.Contains(t, macros, "%custom_mypkg_version 1.0") - assert.Contains(t, macros, "%custom_mypkg_release 1") -} - func TestProcessPackageVersionString_PanicsOnBadFormat(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" // Input without the expected "name: version-release" format will cause a panic // from the regex submatch slice indexing. assert.Panics(t, func() { - processPackageVersionString("totally-invalid-input", "bad.spec", "azl") + processPackageVersionString("totally-invalid-input", "bad.spec", distTag) }) } func TestProcessPackageVersionString_EmptyDistTag(t *testing.T) { - tag := "" - distTag = &tag + distTag := "" - macros, err := processPackageVersionString("pkg: 1.0-2.azl3", "pkg.spec", "azl") + macros, err := processPackageVersionString("pkg: 1.0-2.azl3", "pkg.spec", distTag) require.NoError(t, err) // With an empty dist tag, the release should not be modified. assert.Contains(t, macros, "%azl_pkg_release 2.azl3") } func TestProcessPackageVersionString_TableDriven(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tests := []struct { name string @@ -147,7 +131,7 @@ func TestProcessPackageVersionString_TableDriven(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - macros, err := processPackageVersionString(tt.input, tt.specFile, tt.prefix) + macros, err := processPackageVersionString(tt.input, tt.specFile, distTag) require.NoError(t, err) assert.Contains(t, macros, tt.expectedVersion) assert.Contains(t, macros, tt.expectedRelease) @@ -201,84 +185,66 @@ func testBuildArch(t *testing.T) string { // --------------------------------------------------------------------------- func TestProcessSpecFile_SinglePackage(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specPath := createSpecFile(t, tmpDir, "testpkg", "1.2.3", "4%{?dist}") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) - assert.Contains(t, macros[0], "%azl_testpkg_version 1.2.3") - assert.Contains(t, macros[0], "%azl_testpkg_release 4") + require.Len(t, macros, 3) + assert.Contains(t, macros[0], "%azl_testpkg_epoch ") + assert.Contains(t, macros[1], "%azl_testpkg_version 1.2.3") + assert.Contains(t, macros[2], "%azl_testpkg_release 4") } func TestProcessSpecFile_VersionOnly(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specPath := createSpecFile(t, tmpDir, "simplepkg", "5.0", "1%{?dist}") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) - assert.Contains(t, macros[0], "%azl_simplepkg_version 5.0") + require.Len(t, macros, 3) + assert.Contains(t, macros[1], "%azl_simplepkg_version 5.0") } func TestProcessSpecFile_ReleaseDistTagStripped(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specPath := createSpecFile(t, tmpDir, "mypkg", "2.0.0", "7%{?dist}") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) + require.Len(t, macros, 3) // The dist tag ".azl3" should be stripped from the release. - assert.Contains(t, macros[0], "%azl_mypkg_release 7") - assert.NotContains(t, macros[0], ".azl3") + assert.Contains(t, macros[2], "%azl_mypkg_release 7") + assert.NotContains(t, macros[2], ".azl3") } func TestProcessSpecFile_DashInPackageName(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specPath := createSpecFile(t, tmpDir, "my-cool-pkg", "3.1.0", "2%{?dist}") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) + require.Len(t, macros, 3) // The spec file name has dashes, which should become underscores in macro names. - assert.Contains(t, macros[0], "%azl_my_cool_pkg_version 3.1.0") - assert.Contains(t, macros[0], "%azl_my_cool_pkg_release 2") -} - -func TestProcessSpecFile_CustomPrefix(t *testing.T) { - tag := ".azl3" - distTag = &tag - - tmpDir := t.TempDir() - specPath := createSpecFile(t, tmpDir, "custompkg", "1.0", "1%{?dist}") - arch := testBuildArch(t) - - macros, err := processSpecFile(specPath, arch, "myprefix", nil) - require.NoError(t, err) - require.Len(t, macros, 1) - assert.Contains(t, macros[0], "%myprefix_custompkg_version 1.0") - assert.Contains(t, macros[0], "%myprefix_custompkg_release 1") + assert.Contains(t, macros[0], "%azl_my_cool_pkg_epoch ") + assert.Contains(t, macros[1], "%azl_my_cool_pkg_version 3.1.0") + assert.Contains(t, macros[2], "%azl_my_cool_pkg_release 2") } func TestProcessSpecFile_WithSubpackages(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specDir := filepath.Join(tmpDir, "multipkg") @@ -318,28 +284,27 @@ Libs. require.NoError(t, err) arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) // With --srpm, rpmspec returns the source RPM entry (1 result). - require.Len(t, macros, 1) + require.Len(t, macros, 3) - assert.Contains(t, macros[0], "%azl_multipkg_version 4.0.0") - assert.Contains(t, macros[0], "%azl_multipkg_release 3") + assert.Contains(t, macros[0], "%azl_multipkg_epoch ") + assert.Contains(t, macros[1], "%azl_multipkg_version 4.0.0") + assert.Contains(t, macros[2], "%azl_multipkg_release 3") } func TestProcessSpecFile_NonexistentFile(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" arch := testBuildArch(t) - macros, err := processSpecFile("/nonexistent/path/fake.spec", arch, "azl", nil) + macros, err := processSpecFile("/nonexistent/path/fake.spec", arch, distTag, nil) assert.Error(t, err) assert.Nil(t, macros) } func TestProcessSpecFile_InvalidSpec(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specDir := filepath.Join(tmpDir, "badspec") @@ -351,61 +316,61 @@ func TestProcessSpecFile_InvalidSpec(t *testing.T) { require.NoError(t, err) arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) assert.Error(t, err) assert.Nil(t, macros) } func TestProcessSpecFile_ReleaseWithoutDistMacro(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() // Create spec with a release that has no %{?dist} macro. specPath := createSpecFile(t, tmpDir, "nodist", "1.0", "5") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) + require.Len(t, macros, 3) // Release should remain as-is since there's no dist tag to strip. - assert.Contains(t, macros[0], "%azl_nodist_release 5") + assert.Contains(t, macros[0], "%azl_nodist_epoch ") + assert.Contains(t, macros[1], "%azl_nodist_version 1.0") + assert.Contains(t, macros[2], "%azl_nodist_release 5") } func TestProcessSpecFile_MultiDigitVersion(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() specPath := createSpecFile(t, tmpDir, "bigver", "10.20.30", "100%{?dist}") arch := testBuildArch(t) - macros, err := processSpecFile(specPath, arch, "azl", nil) + macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) - assert.Contains(t, macros[0], "%azl_bigver_version 10.20.30") - assert.Contains(t, macros[0], "%azl_bigver_release 100") + require.Len(t, macros, 3) + assert.Contains(t, macros[0], "%azl_bigver_epoch ") + assert.Contains(t, macros[1], "%azl_bigver_version 10.20.30") + assert.Contains(t, macros[2], "%azl_bigver_release 100") } func TestProcessSpecFile_AccumulatesMacros(t *testing.T) { - tag := ".azl3" - distTag = &tag + distTag := ".azl3" tmpDir := t.TempDir() arch := testBuildArch(t) // Process a first spec and collect its macros. specPath1 := createSpecFile(t, tmpDir, "pkga", "1.0", "1%{?dist}") - macros, err := processSpecFile(specPath1, arch, "azl", nil) + macros, err := processSpecFile(specPath1, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 1) + require.Len(t, macros, 3) // Process a second spec, passing the existing macros slice. specPath2 := createSpecFile(t, tmpDir, "pkgb", "2.0", "2%{?dist}") - macros, err = processSpecFile(specPath2, arch, "azl", macros) + macros, err = processSpecFile(specPath2, arch, distTag, macros) require.NoError(t, err) // Should now contain macros from both specs. - require.Len(t, macros, 2) + require.Len(t, macros, 6) combined := strings.Join(macros, "\n") assert.Contains(t, combined, "%azl_pkga_version 1.0") assert.Contains(t, combined, "%azl_pkgb_version 2.0") From 4711adc9a9ce58d1d64239a500614ed7762f9ad8 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 3 Mar 2026 15:03:08 -0800 Subject: [PATCH 83/86] more tweaks --- toolkit/tools/versionsprocessor/versionsprocessor.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index b20e07b73a1..fc83b2d649b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -68,12 +68,13 @@ func main() { if *targetArch == "" { buildArch, err = rpm.GetRpmArch(runtime.GOARCH) if err != nil { - logger.PanicOnError(err) + logger.Log.Errorf("Failed to get RPM architecture for GOARCH %s: %s", runtime.GOARCH, err) + return } } if *workerTar == "" { - logger.Log.Error("No worker tar provided, parsing specs in host environment. This may cause issues if the host environment is different from the target build environment.") + logger.Log.Error("No worker tar provided, please provide a worker tar to parse specs in the chroot environment.") return } @@ -99,12 +100,9 @@ func main() { // Get spec file version-release macrosOutput, err = processSpecFile(specFile, buildArch, *distTag, macrosOutput) - // We must continue processing all spec files even if there's an error with one of them, so just log the error and move on to the next file. - // Some spec files have errors or warnings unrelated to our query that cause the processing to fail, - // and we don't want that to prevent us from getting version-release information for the other spec files. if err != nil { logger.Log.Errorf("Error processing spec file (%s): %s", specFile, err) - continue + return err } } From dba804ce804953c4a006e65288e2ce76d410f4ad Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Tue, 3 Mar 2026 15:06:23 -0800 Subject: [PATCH 84/86] fix formatting --- toolkit/tools/pkg/specreaderutils/specreaderutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index 9fafa2931a4..daf8e426391 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -52,7 +52,7 @@ var ( // ChrootConfig holds the configuration for creating a chroot environment. type ChrootConfig struct { - SrpmsDir string + SrpmsDir string ReleaseVersionMacrosFile string } From 45a96fa52f236d264e8e2715568fc0a887029d3b Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 4 Mar 2026 15:40:43 -0800 Subject: [PATCH 85/86] adjust to PRs feedback --- toolkit/Makefile | 2 +- .../docs/how_it_works/3_package_building.md | 2 +- toolkit/scripts/toolkit.mk | 1 + .../tools/internal/safechroot/safechroot.go | 12 ++++- .../pkg/simpletoolchroot/simpletoolchroot.go | 12 +---- .../pkg/specreaderutils/specreaderutil.go | 11 +--- toolkit/tools/pkgworker/pkgworker.go | 11 +--- toolkit/tools/srpmpacker/srpmpacker.go | 11 +--- .../versionsprocessor/versionsprocessor.go | 37 ++++++++++--- .../versionsprocessor_test.go | 54 +++++++++---------- 10 files changed, 74 insertions(+), 79 deletions(-) diff --git a/toolkit/Makefile b/toolkit/Makefile index 6690db8bca2..cf129ae8209 100644 --- a/toolkit/Makefile +++ b/toolkit/Makefile @@ -170,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)) TOOLCHAIN_GPG_VALIDATION_KEYS ?= $(default_gpg_keys) IMAGE_GPG_VALIDATION_KEYS ?= $(default_gpg_keys) diff --git a/toolkit/docs/how_it_works/3_package_building.md b/toolkit/docs/how_it_works/3_package_building.md index 938757f3bdc..9153b04083c 100644 --- a/toolkit/docs/how_it_works/3_package_building.md +++ b/toolkit/docs/how_it_works/3_package_building.md @@ -119,7 +119,7 @@ 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__release`, `azl__version`, note that the `` needs any `-` are replaced with `_` due to macros not allowing `-`. +`azl__release`, `azl__version`, note that the `` needs any `-` replaced with `_` due to macros not allowing `-`. ### Stage 1: Grapher diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 9be4b4b6b32..8d89179221b 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -84,6 +84,7 @@ $(toolkit_archive): $(go_tool_targets) $(mariner_repos_files) $(toolkit_componen 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) && \ 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)) diff --git a/toolkit/tools/internal/safechroot/safechroot.go b/toolkit/tools/internal/safechroot/safechroot.go index a39e5c93fda..0cea950085d 100644 --- a/toolkit/tools/internal/safechroot/safechroot.go +++ b/toolkit/tools/internal/safechroot/safechroot.go @@ -265,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 @@ -375,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 } diff --git a/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go b/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go index d3fe020161d..1a2a510a43c 100644 --- a/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go +++ b/toolkit/tools/pkg/simpletoolchroot/simpletoolchroot.go @@ -9,7 +9,6 @@ import ( "fmt" "path/filepath" - "github.com/microsoft/azurelinux/toolkit/tools/internal/logger" "github.com/microsoft/azurelinux/toolkit/tools/internal/safechroot" ) @@ -58,21 +57,12 @@ 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 } - // 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 releaseVersionMacrosFile != "" { - err = s.chroot.AddRPMMacrosFile(releaseVersionMacrosFile) - if err != nil { - logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) - } - } - return } diff --git a/toolkit/tools/pkg/specreaderutils/specreaderutil.go b/toolkit/tools/pkg/specreaderutils/specreaderutil.go index daf8e426391..660c39c2eb3 100644 --- a/toolkit/tools/pkg/specreaderutils/specreaderutil.go +++ b/toolkit/tools/pkg/specreaderutils/specreaderutil.go @@ -181,7 +181,7 @@ func CreateChroot(chrootName, workerTar, buildDir, specsDir string, opts ...Chro chrootDir := filepath.Join(buildDir, chrootName) chroot = safechroot.NewChroot(chrootDir, existingDir) - err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true) + err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true, cfg.ReleaseVersionMacrosFile) if err != nil { return } @@ -202,15 +202,6 @@ func CreateChroot(chrootName, workerTar, buildDir, specsDir string, opts ...Chro } } - // 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 cfg.ReleaseVersionMacrosFile != "" { - err = chroot.AddRPMMacrosFile(cfg.ReleaseVersionMacrosFile) - if err != nil { - logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) - } - } - return } diff --git a/toolkit/tools/pkgworker/pkgworker.go b/toolkit/tools/pkgworker/pkgworker.go index 05628cbef7e..7c0eef8ead5 100644 --- a/toolkit/tools/pkgworker/pkgworker.go +++ b/toolkit/tools/pkgworker/pkgworker.go @@ -214,20 +214,11 @@ func buildSRPMInChroot(chrootDir, rpmDirPath, toolchainDirPath, workerTar, srpmF extraDirs = append(extraDirs, chrootCcacheDir) } - err = chroot.Initialize(workerTar, extraDirs, mountPoints, true) + err = chroot.Initialize(workerTar, extraDirs, mountPoints, true, releaseVersionMacrosFile) if err != nil { err = fmt.Errorf("failed to initialize chroot:\n%w", err) return } - - // 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 releaseVersionMacrosFile != "" { - err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) - if err != nil { - logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) - } - } defer chroot.Close(noCleanup) // Place extra files that will be needed to build into the chroot diff --git a/toolkit/tools/srpmpacker/srpmpacker.go b/toolkit/tools/srpmpacker/srpmpacker.go index afde7df595a..54c4e7ff3f3 100644 --- a/toolkit/tools/srpmpacker/srpmpacker.go +++ b/toolkit/tools/srpmpacker/srpmpacker.go @@ -356,7 +356,7 @@ func createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFil chrootDir := filepath.Join(buildDir, chrootName) chroot = safechroot.NewChroot(chrootDir, existingDir) - err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true) + err = chroot.Initialize(workerTar, extraDirectories, extraMountPoints, true, releaseVersionMacrosFile) if err != nil { return } @@ -387,15 +387,6 @@ func createChroot(workerTar, buildDir, outDir, specsDir, releaseVersionMacrosFil } } - // 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 releaseVersionMacrosFile != "" { - err = chroot.AddRPMMacrosFile(releaseVersionMacrosFile) - if err != nil { - logger.Log.Errorf("Failed to add release version macros file to chroot: %s", err) - } - } - // Networking support is needed to download sources. files := []safechroot.FileToCopy{ {Src: "/etc/resolv.conf", Dest: "/etc/resolv.conf"}, diff --git a/toolkit/tools/versionsprocessor/versionsprocessor.go b/toolkit/tools/versionsprocessor/versionsprocessor.go index fc83b2d649b..ba0d35abdb0 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor.go @@ -95,15 +95,32 @@ func main() { logger.Log.Infof("Processing version and release for %d spec files into %s", len(allSpecFiles), *output) - // Process all specs files + type ProcessResult struct { + macros []string + err error + } + resultsChannel := make(chan ProcessResult, len(allSpecFiles)) + for _, specFile := range allSpecFiles { - // Get spec file version-release - macrosOutput, err = processSpecFile(specFile, buildArch, *distTag, macrosOutput) + go func(sf string) { + macros, processErr := processSpecFile(sf, buildArch, *distTag, nil) + if processErr != nil { + processErr = fmt.Errorf("error processing spec file (%s): %w", sf, processErr) + } + resultsChannel <- ProcessResult{ + macros: macros, + err: processErr, + } + }(specFile) + } - if err != nil { - logger.Log.Errorf("Error processing spec file (%s): %s", specFile, err) - return err + for i := 0; i < len(allSpecFiles); i++ { + result := <-resultsChannel + if result.err != nil { + logger.Log.Errorf("%s", result.err) + return result.err } + macrosOutput = append(macrosOutput, result.macros...) } return err @@ -112,7 +129,7 @@ func main() { err = chroot.Run(doParse) if err != nil { - logger.Log.Errorf("Error processing spec files: %s", err) + logger.Log.Fatalf("Error processing spec files: %s", err) } err = writeExtraFilesToOutput(*extraFiles, macrosOutput, *output) @@ -182,11 +199,15 @@ func processPackageVersionString(packageVersionString string, specFileName strin // Generate RPM macro definitions instead of modifying spec files directly. macros = []string{ - fmt.Sprintf("%%%s %s", epochReleaseString, epoch), fmt.Sprintf("%%%s %s", versionMacroString, version), fmt.Sprintf("%%%s %s", releaseMacroString, releaseClean), } + // Only append (to the front of the list) if we have an epoch + if epoch != "" { + macros = append([]string{fmt.Sprintf("%%%s %s", epochReleaseString, epoch)}, macros...) + } + return macros, nil } diff --git a/toolkit/tools/versionsprocessor/versionsprocessor_test.go b/toolkit/tools/versionsprocessor/versionsprocessor_test.go index c4cfb367180..a7ba832750b 100644 --- a/toolkit/tools/versionsprocessor/versionsprocessor_test.go +++ b/toolkit/tools/versionsprocessor/versionsprocessor_test.go @@ -193,10 +193,10 @@ func TestProcessSpecFile_SinglePackage(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) - assert.Contains(t, macros[0], "%azl_testpkg_epoch ") - assert.Contains(t, macros[1], "%azl_testpkg_version 1.2.3") - assert.Contains(t, macros[2], "%azl_testpkg_release 4") + require.Len(t, macros, 2) + assert.NotContains(t, macros[0], "%azl_testpkg_epoch ") + assert.Contains(t, macros[0], "%azl_testpkg_version 1.2.3") + assert.Contains(t, macros[1], "%azl_testpkg_release 4") } func TestProcessSpecFile_VersionOnly(t *testing.T) { @@ -208,8 +208,8 @@ func TestProcessSpecFile_VersionOnly(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) - assert.Contains(t, macros[1], "%azl_simplepkg_version 5.0") + require.Len(t, macros, 2) + assert.Contains(t, macros[0], "%azl_simplepkg_version 5.0") } func TestProcessSpecFile_ReleaseDistTagStripped(t *testing.T) { @@ -221,10 +221,10 @@ func TestProcessSpecFile_ReleaseDistTagStripped(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) + require.Len(t, macros, 2) // The dist tag ".azl3" should be stripped from the release. - assert.Contains(t, macros[2], "%azl_mypkg_release 7") - assert.NotContains(t, macros[2], ".azl3") + assert.Contains(t, macros[1], "%azl_mypkg_release 7") + assert.NotContains(t, macros[1], ".azl3") } func TestProcessSpecFile_DashInPackageName(t *testing.T) { @@ -236,11 +236,11 @@ func TestProcessSpecFile_DashInPackageName(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) + require.Len(t, macros, 2) // The spec file name has dashes, which should become underscores in macro names. - assert.Contains(t, macros[0], "%azl_my_cool_pkg_epoch ") - assert.Contains(t, macros[1], "%azl_my_cool_pkg_version 3.1.0") - assert.Contains(t, macros[2], "%azl_my_cool_pkg_release 2") + assert.NotContains(t, macros[0], "%azl_my_cool_pkg_epoch ") + assert.Contains(t, macros[0], "%azl_my_cool_pkg_version 3.1.0") + assert.Contains(t, macros[1], "%azl_my_cool_pkg_release 2") } func TestProcessSpecFile_WithSubpackages(t *testing.T) { @@ -287,11 +287,11 @@ Libs. macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) // With --srpm, rpmspec returns the source RPM entry (1 result). - require.Len(t, macros, 3) + require.Len(t, macros, 2) - assert.Contains(t, macros[0], "%azl_multipkg_epoch ") - assert.Contains(t, macros[1], "%azl_multipkg_version 4.0.0") - assert.Contains(t, macros[2], "%azl_multipkg_release 3") + assert.NotContains(t, macros[0], "%azl_multipkg_epoch ") + assert.Contains(t, macros[0], "%azl_multipkg_version 4.0.0") + assert.Contains(t, macros[1], "%azl_multipkg_release 3") } func TestProcessSpecFile_NonexistentFile(t *testing.T) { @@ -331,11 +331,11 @@ func TestProcessSpecFile_ReleaseWithoutDistMacro(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) + require.Len(t, macros, 2) // Release should remain as-is since there's no dist tag to strip. - assert.Contains(t, macros[0], "%azl_nodist_epoch ") - assert.Contains(t, macros[1], "%azl_nodist_version 1.0") - assert.Contains(t, macros[2], "%azl_nodist_release 5") + assert.NotContains(t, macros[0], "%azl_nodist_epoch ") + assert.Contains(t, macros[0], "%azl_nodist_version 1.0") + assert.Contains(t, macros[1], "%azl_nodist_release 5") } func TestProcessSpecFile_MultiDigitVersion(t *testing.T) { @@ -347,10 +347,10 @@ func TestProcessSpecFile_MultiDigitVersion(t *testing.T) { macros, err := processSpecFile(specPath, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) - assert.Contains(t, macros[0], "%azl_bigver_epoch ") - assert.Contains(t, macros[1], "%azl_bigver_version 10.20.30") - assert.Contains(t, macros[2], "%azl_bigver_release 100") + require.Len(t, macros, 2) + assert.NotContains(t, macros[0], "%azl_bigver_epoch ") + assert.Contains(t, macros[0], "%azl_bigver_version 10.20.30") + assert.Contains(t, macros[1], "%azl_bigver_release 100") } func TestProcessSpecFile_AccumulatesMacros(t *testing.T) { @@ -363,14 +363,14 @@ func TestProcessSpecFile_AccumulatesMacros(t *testing.T) { specPath1 := createSpecFile(t, tmpDir, "pkga", "1.0", "1%{?dist}") macros, err := processSpecFile(specPath1, arch, distTag, nil) require.NoError(t, err) - require.Len(t, macros, 3) + require.Len(t, macros, 2) // Process a second spec, passing the existing macros slice. specPath2 := createSpecFile(t, tmpDir, "pkgb", "2.0", "2%{?dist}") macros, err = processSpecFile(specPath2, arch, distTag, macros) require.NoError(t, err) // Should now contain macros from both specs. - require.Len(t, macros, 6) + require.Len(t, macros, 4) combined := strings.Join(macros, "\n") assert.Contains(t, combined, "%azl_pkga_version 1.0") assert.Contains(t, combined, "%azl_pkgb_version 2.0") From 4a398637cf79fc548847e57df9a0f4d38875abb3 Mon Sep 17 00:00:00 2001 From: Mykhailo Bykhovtsev Date: Wed, 4 Mar 2026 16:44:34 -0800 Subject: [PATCH 86/86] add as build dep --- toolkit/scripts/toolkit.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/scripts/toolkit.mk b/toolkit/scripts/toolkit.mk index 8d89179221b..7392072490c 100644 --- a/toolkit/scripts/toolkit.mk +++ b/toolkit/scripts/toolkit.mk @@ -76,7 +76,7 @@ $(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) && \