summaryrefslogtreecommitdiffstats
path: root/fedora2spdx.rb
diff options
context:
space:
mode:
Diffstat (limited to 'fedora2spdx.rb')
-rw-r--r--fedora2spdx.rb38
1 files changed, 37 insertions, 1 deletions
diff --git a/fedora2spdx.rb b/fedora2spdx.rb
index 3b4af7d..3503a39 100644
--- a/fedora2spdx.rb
+++ b/fedora2spdx.rb
@@ -93,7 +93,14 @@ ThreadWorker.new(csv) do |slice|
next if Dir.exist?(name)
- ThreadWorker.execute("fedpkg clone -a #{name}")
+ counter = 0
+ begin
+ ThreadWorker.execute("fedpkg clone -a #{name}")
+ rescue ThreadWorker::CommandError => e
+ counter += 1
+ retry if counter <= 3
+ raise e
+ end
end
end.gather_pool
@@ -123,7 +130,15 @@ ThreadWorker.new(csv) do |slice|
raise "#{dir} ; too much stuff" if dir.size > 1
puts "sources for #{name}"
+ counter = 0
+ begin
+
ThreadWorker.execute("fedpkg sources", pwd: name)
+ rescue ThreadWorker::CommandError => e
+ counter += 1
+ retry if counter <= 3
+ raise e
+ end
end
end.gather_pool.reject(&:nil?)
@@ -361,6 +376,23 @@ if ARGV[0] == '--email'
license_checked = license_check_ok.size - 1
no_act = no_action.size - 1
conv = converted.size - 1
+ action = total_checked - license_checked
+
+ to_fix = general_state - license_check_ok
+
+ max_left = to_fix.map { |str| CSV.parse str, col_sep: ';' }
+ .flatten(1)
+ .max(1) { |a,b| "rubygem-#{a[2]},".length <=> "rubygem#{b[2]},".length }
+ .map { |a| "rubygem#{a[2]},".length }
+ .flatten
+ .first
+
+ package_list = to_fix
+ .map { |str| CSV.parse(str, col_sep: ';') }
+ .flatten(1)
+ .map { |arr| "rubygem-#{arr[2]},".ljust(max_left + 1) + arr[3].to_s }
+
+ # require 'irb'; binding.irb
puts "
* Total rubygems in Fedora: #{total}
@@ -368,5 +400,9 @@ if ARGV[0] == '--email'
* Fedora License field and gem2rpm license match and license-validate succeeds: #{no_act}/#{total_checked}
* license-validate says they are OK SPDX, but licenses may or may not match between Fedora and upstream: #{license_checked}/#{total_checked}
* license-validate with converted conjunctions: #{conv}/#{total_checked}
+ * Action required: #{action}/#{total_checked}
+
+ Packages that need to convert to valid SPDX:
+#{package_list.join("\n")}
"
end