Skip to content

Commit fd4c9f8

Browse files
committed
Handle inconsistent certifi/ca-certificates version numbering
Change-Id: I46efa877a04afa2e92bc004a7e5c1e5c158ae31a Reviewed-on: https://review.couchbase.org/c/build-tools/+/195166 Reviewed-by: Blair Watt <[email protected]> Tested-by: Chris Hillery <[email protected]>
1 parent 8fec793 commit fd4c9f8

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed

blackduck/jenkins/detect-scan/bd_aliases.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,3 @@
5151
"4c1ff009-d3b6-4f0c-8c3c-fd810d1b8d5c":
5252
bd-id-aliases:
5353
- "a38e1dc0-f53d-4dc1-adb4-6328fc424fb5"
54-
55-
# python-certifi / certifi
56-
"f1890115-04dd-4eaf-8ff0-5e2643582990":
57-
fallback-versions:
58-
"2023.5.7": "2023.05.07"

blackduck/jenkins/detect-scan/update-manual-manifest

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ class UpdateComponents:
2525
# Match a version number that starts with a "v" followed by a digit.
2626
v_re = re.compile(r"^v[0-9]")
2727

28+
# Match a version number that looks like a date
29+
date_re = re.compile(r"^([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})$")
30+
2831
# There are two important data structures in this class: comp_map and manifest.
2932
# comp_map represents the current state in Black Duck (when the program is
3033
# first run), while manifest represents the desired state as specified by the
@@ -269,20 +272,34 @@ class UpdateComponents:
269272
"""
270273
Given a version name for a specified component name,
271274
canonicalize that version name. Normally this is just the
272-
version name unchanged, but Erlang and Golang have inconsistent
275+
version name unchanged, but a few components have inconsistent
273276
version naming in the Knowledgebase which leads to false
274-
matches/misses. We also strip a leading "v" because a number
275-
of components in the Knowledgebase are inconsitent about this.
277+
matches/misses. We also strip a leading "v" because a number of
278+
components in the Knowledgebase are inconsistent about this.
276279
"""
277280

281+
if self.v_re.search(version):
282+
# Strip any leading "v" before any other possible heuristics
283+
version = version[1:]
284+
278285
if component_name.startswith("erlang"):
286+
# Strip any leading "OTP-"
279287
return version[4:] if version.startswith("OTP-") else version
280-
elif component_name.startswith("go programming language"):
288+
if component_name.startswith("go programming language"):
289+
# Strip any leading "go"
281290
return version[2:] if version.startswith("go") else version
282-
elif self.v_re.search(version):
283-
return version[1:]
284-
else:
285-
return version
291+
if "certifi" in component_name:
292+
match = self.date_re.match(version)
293+
if match:
294+
# Choose to have zero-padded month/day values, eg.
295+
# "2023.05.07" vs. "2023.5.7". Certifi seems to use
296+
# zero-padding; Conda tends to report those versions
297+
# without zero-padding; and Black Duck randomly has
298+
# one or the other.
299+
return f"{match[1]:>04}.{match[2]:>02}.{match[3]:>02}"
300+
301+
return version
302+
286303

287304
def fallback_version_if_necessary(self, comp_name, comp_id, manifest_ver):
288305
"""

0 commit comments

Comments
 (0)