@@ -61,6 +61,10 @@ class CycloneDxLicenseExpression(ToDictMixin):
61
61
"""
62
62
expression : str = attr .ib (default = None )
63
63
64
+ @property
65
+ def identifier (self ):
66
+ return self .expression
67
+
64
68
@classmethod
65
69
def from_package (cls , package ):
66
70
"""
@@ -81,6 +85,10 @@ class CycloneDxProperty(ToDictMixin):
81
85
name : str = attr .ib ()
82
86
value : str = attr .ib ()
83
87
88
+ @property
89
+ def identifier (self ):
90
+ return f"{ self .name } -{ self .value } "
91
+
84
92
85
93
@attr .s
86
94
class CycloneDxHashObject (ToDictMixin ):
@@ -98,6 +106,10 @@ class CycloneDxHashObject(ToDictMixin):
98
106
alg : str = attr .ib ()
99
107
content : str = attr .ib ()
100
108
109
+ @property
110
+ def identifier (self ):
111
+ return f"{ self .alg } -{ self .content } "
112
+
101
113
@classmethod
102
114
def from_package (cls , package ):
103
115
"""
@@ -159,6 +171,10 @@ class CycloneDxExternalRef(ToDictMixin):
159
171
comment : str = attr .ib (default = None )
160
172
hashes : List [CycloneDxHashObject ] = attr .ib (factory = list )
161
173
174
+ @property
175
+ def identifier (self ):
176
+ return f"{ self .url } -{ self .type } -{ self .comment } "
177
+
162
178
@classmethod
163
179
def from_package (cls , package : dict ):
164
180
"""
@@ -290,7 +306,8 @@ def from_package(cls, package):
290
306
properties .append (
291
307
CycloneDxProperty (
292
308
name = 'WARNING' ,
293
- value = f'WARNING: component skipped in CycloneDX output: { package !r} '
309
+ value = f'WARNING: component skipped in CycloneDX output:'
310
+ f' purl: { package ["purl" ]} at datafile_paths: { package ["datafile_paths" ]} '
294
311
)
295
312
)
296
313
@@ -428,8 +445,8 @@ def merge_lists(x, y):
428
445
Merge ``y`` list items in list ``x`` avoiding duplicate entries.
429
446
Return the updated ``x``.
430
447
"""
431
- seen = set (x )
432
- new = (i for i in y if i not in seen )
448
+ seen = set ([ item . identifier for item in x ] )
449
+ new = (item for item in y if item . identifier not in seen )
433
450
x .extend (new )
434
451
return x
435
452
0 commit comments