Skip to content

Commit

Permalink
csmock: make kfp work for pkgs without the -release suffix
Browse files Browse the repository at this point in the history
The code that extracts package name from the `name-version-release`
string did not work as expected if the `-release` part was missing.
Consequently, it did not find the corresponding `exclude-paths.txt`
file in the known-false-positives while scanning a source code tarball
named: `RedHatInsights-compliance-backend-bd2b8accb3d4aae88a8c1a71563ec3f5ead7b1fa.tar.gz`

Resolves: https://issues.redhat.com/browse/OSH-392
Closes: csutils#136
  • Loading branch information
kdudka committed Nov 3, 2023
1 parent 2e89ad7 commit 921b941
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions py/csmock
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,11 @@ exceeds the specified limit (defaults to 1024).")
else:
props.nvr = re.sub("\\.tar$", "", re.sub("\\.[^.]*$", "", srpm_base))

# cut off version-release to obtain package name
props.pkg = re.sub("-[^-]+-[0-9][^-]*$", "", props.nvr)
# cut off the -version-release suffix to obtain package name (if -release is missing, cut -version only)
props.pkg = props.nvr
m = re.search(r"^(.*?)(-[^-]+)(-[0-9][^-]*)?$", props.nvr)
if m:
props.pkg = m.group(1)

# resolve name of the file/dir we are going to store the results to
if args.output is None:
Expand Down

0 comments on commit 921b941

Please sign in to comment.