From 66ba33a8c28497e01eddcb0cd17fbe324674eabc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Mon, 11 Sep 2023 18:43:28 +0200 Subject: [PATCH 3/3] Reproducible exclusions order in maven metadata --- python/javapackages/metadata/dependency.py | 4 ++-- python/javapackages/metadata/exclusion.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/python/javapackages/metadata/dependency.py b/python/javapackages/metadata/dependency.py index 1709e1fb..5931134d 100644 --- a/python/javapackages/metadata/dependency.py +++ b/python/javapackages/metadata/dependency.py @@ -46,7 +46,7 @@ class MetadataDependency(ObjectBinding): defaults = {'extension': 'jar', 'requestedVersion': 'SYSTEM'} types = {'optional': str, # todo bool - 'exclusions': set([MetadataExclusion])} + 'exclusions': list([MetadataExclusion])} def is_optional(self): if self.optional and self.optional.lower() == "true": @@ -145,4 +145,4 @@ class MetadataDependency(ObjectBinding): classifier=mvn_dep.classifier, optional=mvn_dep.optional, requestedVersion=mvn_dep.version, - exclusions=exclusions) + exclusions=sorted(exclusions)) diff --git a/python/javapackages/metadata/exclusion.py b/python/javapackages/metadata/exclusion.py index 3152b090..5b9503c0 100644 --- a/python/javapackages/metadata/exclusion.py +++ b/python/javapackages/metadata/exclusion.py @@ -41,6 +41,15 @@ class MetadataExclusion(ObjectBinding): element_name = 'exclusion' fields = ['groupId', 'artifactId'] + def __lt__(self, other): + if self.groupId < other.groupId: + return True + if self.groupId > other.groupId: + return False + if self.artifactId < other.artifactId: + return True + return False + def get_mvn_str(self): return Printer.get_mvn_str(self.groupId, self.artifactId) -- 2.42.0