Fix regex in crew whatprovides. (#10387)

* Fix regex in crew whatprovides.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add regex test.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
This commit is contained in:
Satadru Pramanik, DO, MPH, MEng
2024-08-31 18:01:55 -04:00
committed by GitHub
parent 68f183bdfb
commit 34e6887026
3 changed files with 16 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ require_relative '../lib/package_utils'
class Command
def self.whatprovides(regex)
matched_list = `grep -R "#{regex}" #{CREW_LIB_PATH}/manifest/#{ARCH}`.lines(chomp: true).flat_map do |result|
matched_list = `grep -ER "#{regex}" #{CREW_LIB_PATH}/manifest/#{ARCH}`.lines(chomp: true).flat_map do |result|
filelist, matched_file = result.split(':', 2)
pkg_name = File.basename(filelist, '.filelist')
pkg_name_status = File.file?(File.join(CREW_PACKAGES_PATH, "#{pkg_name}.rb")) ? pkg_name : nil