Skip to content

Commit c62e42d

Browse files
authored
🚑 (patch) user.llvm:variant for package_id (#36)
- Make variant determination logs debug only - use `self.info.options.clear()` to clear ALL options. `default_linker_script` was missed last time.
1 parent b3b21b0 commit c62e42d

1 file changed

Lines changed: 11 additions & 22 deletions

File tree

all/conanfile.py

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ def _determine_llvm_variant(self):
126126
# This will set the settings_target which will download the appropriate
127127
# fork of LLVM for that architecture.
128128
if not self.settings_target:
129-
self.output.info("Using upstream LLVM binary")
129+
self.output.debug("Using upstream LLVM binary")
130130
return "upstream"
131131

132132
TARGET_OS = self.settings_target.get_safe("os")
133133
TARGET_ARCH = self.settings_target.get_safe("arch")
134134

135-
self.output.info(
135+
self.output.debug(
136136
f"host: os: '{TARGET_OS}', architecture: '{TARGET_ARCH}'")
137137

138138
# ARM Cortex-M baremetal gets special ARM Embedded Toolchain
@@ -144,7 +144,7 @@ def _determine_llvm_variant(self):
144144
"cortex-m35p", "cortex-m35pf",
145145
"cortex-m55", "cortex-m85",
146146
]:
147-
self.output.info("Using ARM Embedded LLVM fork")
147+
self.output.debug("Using ARM Embedded LLVM fork")
148148
return "arm-embedded"
149149

150150
# Everything else uses regular LLVM
@@ -153,7 +153,7 @@ def _determine_llvm_variant(self):
153153
# - AVR (avr)
154154
# - Other ARM variants (cortex-a, etc.)
155155
# - Host builds
156-
self.output.info("Using upstream LLVM binary")
156+
self.output.debug("Using upstream LLVM binary")
157157
return "upstream"
158158

159159
def _extract_macos_dmg(self, url: str, sha256: str):
@@ -498,22 +498,11 @@ def package_id(self):
498498
# All options should be removed as none of them should impact the
499499
# package id hash. These options are only used for delivering command
500500
# line arguments via the package_info.
501-
del self.info.options.default_arch
502-
del self.info.options.lto
503-
del self.info.options.function_sections
504-
del self.info.options.data_sections
505-
del self.info.options.gc_sections
506-
del self.info.options.use_semihosting
507-
# Remove any compiler or build_type settings from recipe hash
508-
del self.info.settings.compiler
509-
del self.info.settings.build_type
510-
511-
# Normalize Cortex-M variants to share the same package_id
512-
if self.settings_target:
513-
target_arch = str(self.settings_target.get_safe("arch") or "")
514-
target_os = str(self.settings_target.get_safe("os") or "")
501+
self.info.options.clear()
502+
503+
# Clear all settings - only the variant matters
504+
self.info.settings.clear()
515505

516-
# All Cortex-M variants use the SAME binary - normalize them
517-
if target_os == "baremetal" and target_arch.startswith("cortex-m"):
518-
# Use conf system to modify the hash for the package ID
519-
self.info.conf.define("user.llvm:target_family", "cortex-m")
506+
# Only keep the variant in the package_id
507+
variant = self._determine_llvm_variant()
508+
self.info.conf.define("user.llvm:variant", variant)

0 commit comments

Comments
 (0)