Whatprovides unittest (#10385)

* Fix whatprovides: handle case of manifest filelist not corresponding to a package file.

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

* Add unit test for whatprovides.

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

* Bump version

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

* Remove arm manifest for deprecated imagemagick6 package.

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 17:30:39 -04:00
committed by GitHub
parent 386f42ff6e
commit 68f183bdfb
5 changed files with 32 additions and 796 deletions

View File

@@ -7,15 +7,17 @@ class Command
matched_list = `grep -R "#{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 = pkg_name
if PackageUtils.compatible?(Package.load_package(File.join(CREW_PACKAGES_PATH, "#{pkg_name}.rb")))
pkg_name_status = pkg_name.lightgreen if PackageUtils.installed?(pkg_name)
else
pkg_name_status = pkg_name.lightred
pkg_name_status = File.file?(File.join(CREW_PACKAGES_PATH, "#{pkg_name}.rb")) ? pkg_name : nil
if pkg_name_status
if PackageUtils.compatible?(Package.load_package(File.join(CREW_PACKAGES_PATH, "#{pkg_name}.rb")))
pkg_name_status = pkg_name.lightgreen if PackageUtils.installed?(pkg_name)
else
pkg_name_status = pkg_name.lightred
end
end
"#{pkg_name_status}: #{matched_file}"
end.sort
pkg_name_status.nil? ? '' : "#{pkg_name_status}: #{matched_file}"
end.sort.map(&:strip).reject(&:empty?)
puts matched_list, "\nTotal found: #{matched_list.length}".lightgreen if matched_list.any?
end