From 85482fdd1ccf0c1c8a087f926d7c37ee4d1cae63 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Fri, 12 Jan 2024 19:56:53 +0100 Subject: [PATCH] Fix randomly mismatched zipped variant keys Values from top level keys with possibly (as in hash seed-dependent) different ordering overwrote some of the determined used variants. If values of related zipped keys were left untouched, this led to mismatched ordering of zip_keys entries. ref: - https://github.com/conda-forge/conda-smithy/issues/1459#issuecomment-1858846653 Signed-off-by: Marcel Bargull --- conda_smithy/configure_feedstock.py | 10 ++++++++++ news/fix-squished-zip_key-ordering.rst | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 news/fix-squished-zip_key-ordering.rst diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 5c2685dec..91068f3c2 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -391,6 +391,16 @@ def _collapse_subpackage_variants( for k, v in squished_used_variants.items(): if k in all_used_vars: + input_variant = squished_input_variants.get(k) + if input_variant and isinstance(input_variant, (tuple, list)): + # Ensure we retain the input order to avoid mismatched entries + # with the preserve_top_level_loops overrides below. + # NOTE: "pin_run_as_build" (dict of dict) order is not handled. + # "tuple" below only used for uniform list/tuple/str comparison. + v_set = set(map(tuple, v)) + v = type(input_variant)( + v_i for v_i in input_variant if tuple(v_i) in v_set + ) used_key_values[k] = v for k in preserve_top_level_loops: diff --git a/news/fix-squished-zip_key-ordering.rst b/news/fix-squished-zip_key-ordering.rst new file mode 100644 index 000000000..e75ce8760 --- /dev/null +++ b/news/fix-squished-zip_key-ordering.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* Fix randomly mismatched zipped variant keys. (#1459 and #1782 via #1815) + +**Security:** + +*