xmvn/0001-Prefer-namespaced-metadata-when-duplicates-are-found.patch
Troy Dawson bc1da2d47d RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/xmvn#515a8a5737ed2174d24a4065bfff104c14220016
2020-10-15 14:06:52 -07:00

60 lines
2.2 KiB
Diff

From 1474fd57e606bdb00417524a7b648f7841b014c8 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 28 Jun 2019 12:15:23 +0200
Subject: [PATCH 1/3] Prefer namespaced metadata when duplicates are found
---
.../metadata/impl/DefaultMetadataResult.java | 33 +++++++++++--------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
index c8b63214..67bafef5 100644
--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
+++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/metadata/impl/DefaultMetadataResult.java
@@ -94,23 +94,28 @@ class DefaultMetadataResult
}
ArtifactMetadata otherMetadata = artifactMap.get( artifact );
- if ( otherMetadata != null )
+
+ if ( otherMetadata == null )
+ {
+ artifactMap.put( artifact, metadata );
+ continue;
+ }
+
+ duplicateArtifacts.add( artifact );
+
+ if ( ignoreDuplicates )
{
- duplicateArtifacts.add( artifact );
-
- if ( ignoreDuplicates )
- {
- artifactMap.remove( artifact );
- logger.warn( "Ignoring metadata for artifact {} as it has duplicate metadata", artifact );
- continue;
- }
- else
- {
- logger.warn( "Duplicate metadata for artifact {}", artifact );
- }
+ artifactMap.remove( artifact );
+ logger.warn( "Ignoring metadata for artifact {} as it has duplicate metadata", artifact );
+ continue;
}
- artifactMap.put( artifact, metadata );
+ logger.warn( "Duplicate metadata for artifact {}", artifact );
+
+ if ( otherMetadata.getNamespace().isEmpty() || !metadata.getNamespace().isEmpty() )
+ {
+ artifactMap.put( artifact, metadata );
+ }
}
}
--
2.21.0