From 9ad6d7006ead02ff71f858ce1f6170d4be90b3ff Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Mon, 5 Dec 2022 15:23:31 +0100 Subject: New script version. Now retries on fetching. Update for 2022-12-05. --- fedora2spdx.rb | 38 ++++++++++++++++++++++++++++++++++- rubygems_fedora_spdx_state.csv | 3 ++- rubygems_fedora_valid_spdx.csv | 1 + rubygems_try_convert_conjunctions.csv | 1 + 4 files changed, 41 insertions(+), 2 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 diff --git a/rubygems_fedora_spdx_state.csv b/rubygems_fedora_spdx_state.csv index e92f526..beea023 100644 --- a/rubygems_fedora_spdx_state.csv +++ b/rubygems_fedora_spdx_state.csv @@ -99,6 +99,7 @@ true;0;fog-xml;MIT;MIT true;0;foreigner;MIT;MIT false;0;formatador;MIT; true;0;forwardable-extended;MIT;MIT +false;0;gdk4;LGPL-2.1-or-later;LGPL-2.1+ true;0;gem-nice-install;MIT;MIT true;0;generator_spec;MIT;MIT false;0;gettext;Ruby;Ruby and LGPL-3.0+ @@ -449,7 +450,7 @@ false;1;rsvg2;LGPLv2;LGPL-2.1+ false;1;rubeyond;GPLv3+; false;1;ruby-dbus;LGPLv2+ and MIT;LGPL-2.1 false;1;ruby-libvirt;LGPLv2+;LGPLv2 -false;1;ruby-shadow;Public Domain;Public Domain License +false;1;ruby-shadow;Public Domain;Unlicense false;1;rubyzip;Ruby or BSD;BSD 2-Clause false;1;sass-twitter-bootstrap;ASL 2.0; false;1;sassc-rails;MIT and OFL;MIT diff --git a/rubygems_fedora_valid_spdx.csv b/rubygems_fedora_valid_spdx.csv index b49da51..2ac696b 100644 --- a/rubygems_fedora_valid_spdx.csv +++ b/rubygems_fedora_valid_spdx.csv @@ -98,6 +98,7 @@ true;0;fog-xml;MIT;MIT true;0;foreigner;MIT;MIT false;0;formatador;MIT; true;0;forwardable-extended;MIT;MIT +false;0;gdk4;LGPL-2.1-or-later;LGPL-2.1+ true;0;gem-nice-install;MIT;MIT true;0;generator_spec;MIT;MIT false;0;gettext;Ruby;Ruby and LGPL-3.0+ diff --git a/rubygems_try_convert_conjunctions.csv b/rubygems_try_convert_conjunctions.csv index e1f9044..fe7f682 100644 --- a/rubygems_try_convert_conjunctions.csv +++ b/rubygems_try_convert_conjunctions.csv @@ -98,6 +98,7 @@ true;0;fog-xml;MIT;MIT true;0;foreigner;MIT;MIT false;0;formatador;MIT; true;0;forwardable-extended;MIT;MIT +false;0;gdk4;LGPL-2.1-or-later;LGPL-2.1+ true;0;gem-nice-install;MIT;MIT true;0;generator_spec;MIT;MIT false;0;gettext;Ruby;Ruby AND LGPL-3.0+ -- cgit