From 5f5d0ec23ee93850f52c91220225912b7046fa92 Mon Sep 17 00:00:00 2001 From: Jarek Prokop Date: Thu, 24 Nov 2022 16:23:25 +0100 Subject: Skip retired packages, remove intermediary licences.csv remove validate_ruby_files.rb validate_ruby_files is now part of fedora2spdx. Most of what that file contained was duplicate information anyway. --- fedora2spdx.rb | 133 +++++---- licences.csv | 496 ---------------------------------- rubygems_fedora_gem2rpm_matches.csv | 5 +- rubygems_fedora_spdx_state.csv | 12 +- rubygems_fedora_valid_no_action.csv | 2 - rubygems_fedora_valid_spdx.csv | 2 - rubygems_try_convert_conjunctions.csv | 7 +- validate_ruby_files.rb | 73 ----- 8 files changed, 93 insertions(+), 637 deletions(-) delete mode 100644 licences.csv delete mode 100644 validate_ruby_files.rb diff --git a/fedora2spdx.rb b/fedora2spdx.rb index 7cc2398..67bcbc2 100644 --- a/fedora2spdx.rb +++ b/fedora2spdx.rb @@ -4,11 +4,11 @@ require 'open3' require 'rubygems' require 'rubygems/package' require 'tmpdir' -require 'licensee' -# Licences.csv are from validate_ruby_files.rb and it contains what was possible to gather from upstream gemfiles and Fedora specfiles. -# This file exists to validate, that the output from gem2rpm for Fedora is the same. And possibly also validate Licensefiles, cos -# the goddamn MIT and BSD have around 20 possibilities from callaway to spdx... -csv = CSV.parse(File.read('licences.csv'), col_sep: ';', headers: true) +# require 'licensee' + +# Constants + +CSV_HEADER = "gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license;dead_package".freeze class ThreadWorker MAX_THREADS = Etc.nprocessors @@ -57,21 +57,37 @@ class ThreadWorker end class << self - def execute(command, pwd: nil) + def execute(command, pwd: nil, ret_exit: false) options = {} options[:chdir] = pwd if pwd $stderr.puts "Executing: #{command}" + sleep 0.5 stdout, stderr, status = Open3.capture3(command, options) - raise CommandError.new("Command failed: #{command}", stdout, stderr, status.exitstatus) unless status.success? + raise CommandError.new("Command failed: #{command}; #{stderr}; #{stdout}", stdout, stderr, status.exitstatus) unless status.success? - status.exitstatus + if ret_exit + status.exitstatus + else + stdout + end end end end +csv = ThreadWorker.new(Dir['rubygem-*.spec']) do |slice| + slice.map do |file| + name, spec_license = nil, nil + file = File.read(file) + name = file.scan(/%(?:global|define)[[:space:]]+gem_name[[:space:]]+([A-Za-z0-9\-_.]+)/).flatten.first.strip + raise "name empty #{name} #{spec_license}" if name.empty? + spec_license = file.scan(/License:[[:space:]]*(.*)/).flatten.first.strip + [name, spec_license] + end +end.gather_pool + # Fetch the Fedora sources -ThreadWorker.new(csv.to_a[1..]) do |slice| +ThreadWorker.new(csv) do |slice| slice.map do |row| name = "rubygem-#{row[0]}" @@ -84,13 +100,22 @@ end.gather_pool # Sigh... they have tar as rubygem source... EXCLUDED_SOURCES = %w[rubygem-morph-cli rubygem-krb5-auth rubygem-asciidoctor rubygem-rgen rubygem-net-irc].freeze +orphaned = [] + # Fetch the gem from lookaside cache -ThreadWorker.new(csv.to_a[1..]) do |slice| +ThreadWorker.new(csv) do |slice| slice.map do |row| name = "rubygem-#{row[0]}" dir = Dir["#{name}/*.gem"] + dead = Dir["#{name}/dead.package"] + + unless dead.empty? + orphaned << name + next + end + next unless dir.empty? next if EXCLUDED_SOURCES.include? name @@ -100,7 +125,7 @@ ThreadWorker.new(csv.to_a[1..]) do |slice| puts "sources for #{name}" ThreadWorker.execute("fedpkg sources", pwd: name) end -end.gather_pool +end.gather_pool.reject(&:nil?) res = if File.exist?("gem2rpm.cache") File.read("gem2rpm.cache").split("\n") @@ -214,8 +239,18 @@ end # end # str + ";" + fedora_name + ";" + fedora_license.to_s + ";" + gem2rpm_license.to_s # end +# Somehow the following block changes contents of res, let's deep copy res2 = Marshal.load Marshal.dump(res) +license_check = ->(fedora_license) { + begin + status = ThreadWorker.execute("license-validate \"#{fedora_license}\"", ret_exit: true).to_s + "#{status}" + rescue ThreadWorker::CommandError => e + if e.status == 1 then "#{e.status}" else "#{e.stderr}######{e.stdout}" end + end +} + ret = ThreadWorker.new(res)do |slice| slice.map do |arr| gem2rpm_name = arr[0] @@ -223,41 +258,40 @@ ret = ThreadWorker.new(res)do |slice| gem2rpm_license = arr[2]&.strip gem2rpm_license_file = arr[3] - fedora_gem = csv.find { |row| row["gem_name"] == gem2rpm_name } - fedora_name = fedora_gem["gem_name"] - fedora_license = fedora_gem["fedora_license"]&.strip - fedora_gem_license = fedora_gem["gem_license"] + fedora_license = csv.find { |row| row[0] == gem2rpm_name }[1].strip + fedora_name = gem2rpm_name + # begin + # fedora_name = fedora_gem["gem_name"] + # rescue => e + # require 'irb';binding.irb + # end + # fedora_license = fedora_gem["fedora_license"]&.strip + # fedora_gem_license = fedora_gem["gem_license"] - raise "The names of gems differ. Leading me to this is gem2rpm: #{gem2rpm_name} fedora: #{fedora_name}" if gem2rpm_name != fedora_name + # raise "The names of gems differ. Leading me to this is gem2rpm: #{gem2rpm_name} fedora: #{fedora_name}" if gem2rpm_name != fedora_name str = '' - if fedora_license == fedora_gem_license && fedora_license == gem2rpm_license + if fedora_license == gem2rpm_license # Matches str = true.to_s - res = begin - status = ThreadWorker.execute("license-validate \"#{fedora_license}\"").to_s - "#{status}" - rescue ThreadWorker::CommandError => e - "#{e.status}" - end + res = license_check.call(fedora_license) str += ";" + res str else # Doesn't match - str = false.to_s + ";" + begin - status = ThreadWorker.execute("license-validate \"#{fedora_license}\"").to_s - "#{status}" - rescue ThreadWorker::CommandError => e - if e.status == 1 then "#{e.status}" else "#{e.stderr}######{e.stdout}" end - end + str = false.to_s + ";" + license_check.call(fedora_license) end str + ";" + fedora_name + ";" + fedora_license.to_s + ";" + gem2rpm_license.to_s end end.gather_pool(2) -final = ret.sort { |a, b| c = a.split(";"); d = b.split(";"); c[1] <=> d[1] }.unshift("gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license") + +orphaned = orphaned.map { |package| "#{false};255;#{package};N/A;N/A;#{true}" } +sort_by_license_check = ->(a,b) { c = a.split(";"); d = b.split(";"); c[1] <=> d[1] } + +final = ret.sort(&sort_by_license_check).union(orphaned).unshift(CSV_HEADER) puts final # The state of Fedora Rubygems (excl a few that dont have gem as their source in Fedora lookaside cache) @@ -276,41 +310,40 @@ try_convert = ThreadWorker.new(res2) do |slice| gem2rpm_license = arr[2]&.strip&.gsub(" and ", " AND ")&.gsub(" or ", " OR ") gem2rpm_license_file = arr[3] - fedora_gem = csv.find { |row| row["gem_name"] == gem2rpm_name } - fedora_name = fedora_gem["gem_name"] - fedora_license = fedora_gem["fedora_license"]&.strip&.gsub(" and ", " AND ")&.gsub(" or ", " OR ") - fedora_gem_license = fedora_gem["gem_license"] + fedora_license = csv.find { |row| row[0] == gem2rpm_name }[1].strip + fedora_name = gem2rpm_name + # begin + # fedora_name = fedora_gem["gem_name"] + # rescue => e + # require 'irb';binding.irb + # end + # fedora_license = fedora_gem["fedora_license"]&.strip + # fedora_gem_license = fedora_gem["gem_license"] - raise "The names of gems differ. Leading me to this is gem2rpm: #{gem2rpm_name} fedora: #{fedora_name}" if gem2rpm_name != fedora_name + # raise "The names of gems differ. Leading me to this is gem2rpm: #{gem2rpm_name} fedora: #{fedora_name}" if gem2rpm_name != fedora_name + fedora_license = fedora_license&.strip&.gsub(" and ", " AND ")&.gsub(" or ", " OR ") + # fedora_gem_license = fedora_gem["gem_license"] + + # raise "The names of gems differ. Leading me to this is gem2rpm: #{gem2rpm_name} fedora: #{fedora_name}" if gem2rpm_name != fedora_name str = '' - if fedora_license == fedora_gem_license && fedora_license == gem2rpm_license + if fedora_license == gem2rpm_license # Matches str = true.to_s - res = begin - status = ThreadWorker.execute("license-validate \"#{fedora_license}\"").to_s - "#{status}" - rescue ThreadWorker::CommandError => e - "#{e.status}" - end + res = license_check.call(fedora_license) str += ";" + res str else # Doesn't match - str = false.to_s + ";" + begin - status = ThreadWorker.execute("license-validate \"#{fedora_license}\"").to_s - "#{status}" - rescue ThreadWorker::CommandError => e - if e.status == 1 then "#{e.status}" else "#{e.stderr}######{e.stdout}" end - end + str = false.to_s + ";" + license_check.call(fedora_license) end str + ";" + fedora_name + ";" + fedora_license.to_s + ";" + gem2rpm_license.to_s end end.gather_pool(2) - .sort { |a, b| c = a.split(";"); d = b.split(";"); c[1] <=> d[1] } - .unshift("gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license") + .sort(&sort_by_license_check) + .unshift(CSV_HEADER) File.write("rubygems_try_convert_conjunctions.csv", try_convert.join("\n")) diff --git a/licences.csv b/licences.csv deleted file mode 100644 index 0d8446b..0000000 --- a/licences.csv +++ /dev/null @@ -1,496 +0,0 @@ -gem_name;gem_version;fedora_license;gem_license -Ascii85;1.1.0;MIT;MIT -POpen4;0.1.4;GPLv2 or Ruby; -Platform;0.4.2;MIT;MIT -RedCloth;4.3.2;MIT;MIT -ZenTest;4.12.1;MIT;MIT -abrt;0.4.0;MIT;MIT -abstract;1.0.0;GPLv2 or Ruby; -actioncable;7.0.4;MIT;MIT -actionmailbox;7.0.4;MIT;MIT -actionmailer;7.0.4;MIT;MIT -actionpack;7.0.4;MIT;MIT -actiontext;7.0.4;MIT;MIT -actionview;7.0.4;MIT;MIT -activejob;7.0.4;MIT;MIT -activemodel-serializers-xml;1.0.2;MIT;MIT -activemodel;7.0.4;MIT;MIT -activerecord;7.0.4;MIT;MIT -activeresource;6.0.0;MIT;MIT -activestorage;7.0.4;MIT;MIT -activesupport;7.0.4;MIT;MIT -acts_as_list;1.0.4;MIT;MIT -addressable;2.8.0;ASL 2.0;Apache-2.0 -afm;0.2.2;MIT;MIT -algorithms;0.6.1;MIT;MIT -allison;2.0.3;AFL; -ammeter;1.1.5;MIT; -ansi;1.5.0;BSD;BSD-2-Clause -apipie-rails;0.8.1;MIT AND Apache-2.0; -appraisal;0.5.2;MIT; -archive-tar-minitar;0.5.2;GPLv2+ or Ruby; -arel;9.0.0;MIT;MIT -aruba;2.1.0;MIT and CC-BY and (MIT or GPLv2) and (MIT or BSD or GPLv2);MIT -asciidoctor-pdf;2.3.4;MIT;MIT -asciidoctor;2.0.18;MIT;MIT -async_sinatra;1.3.0;MIT;MIT -atk;4.0.3;LGPLv2;LGPL-2.1+ -atomic;1.1.101;ASL 2.0;Apache-2.0 -awesome_print;1.0.2;MIT; -aws-sigv4;1.0.2;ASL 2.0;Apache-2.0 -backports;3.23.0;MIT;MIT -bacon-colored_output;1.1.1;MIT; -bacon;1.2.0;MIT; -base32;0.3.4;MIT;MIT -bcrypt;3.1.17;MIT and Public Domain and ISC;MIT -bcrypt_pbkdf;1.1.0;MIT and BSD and ISC;MIT -benchmark-ips;2.10.0;MIT;MIT -between_meals;0.0.12;ASL 2.0;Apache-2.0 -bindex;0.8.1;MIT;MIT -bootsnap;1.4.7;MIT;MIT -boxgrinder-build;0.10.4;LGPLv3+; -boxgrinder-core;0.3.14;LGPLv3+; -bson;4.15.0;Apache-2.0;Apache-2.0 -builder;3.2.4;MIT;MIT -bundler;2.3.25;MIT;MIT -bundler_ext;0.4.2;MIT;MIT -byebug;11.1.3;BSD;BSD-2-Clause -cairo-gobject;4.0.3;LGPLv2+;LGPL-2.1+ -cairo;1.17.8;GPLv2 or Ruby;Ruby -capybara;3.37.1;MIT;MIT -chake;0.21.2;MIT;MIT -childprocess;4.1.0;MIT;MIT -chronic;0.10.2;MIT;MIT -chunky_png;1.4.0;MIT;MIT -cinch;2.2.4;MIT;MIT -clockwork;2.0.4;MIT;MIT -clutter-gdk;4.0.3;LGPLv2+;LGPL-2.1+ -clutter-gstreamer;4.0.3;LGPLv2+;LGPL-2.1+ -clutter-gtk;4.0.3;LGPLv2+;LGPL-2.1+ -clutter;4.0.3;LGPLv2+;LGPL-2.1+ -codeclimate-test-reporter;1.0.8;MIT;MIT -coderay;1.1.3;MIT;MIT -coffee-script-source;1.10.0;MIT;MIT -coffee-script;2.4.1;MIT;MIT -color;1.8;MIT;MIT -colorator;1.1.0;MIT;MIT -colorize;0.8.1;GPLv2;GPL-2.0 -comp_tree;1.1.3;MIT; -concurrent-ruby;1.1.9;MIT;MIT -connection_pool;2.2.5;MIT;MIT -contracts;0.17;BSD;BSD-2-Clause -cookiejar;0.3.3;BSD ; -coveralls;0.8.13;MIT;MIT -crack;0.4.5;MIT;MIT -crass;1.0.4;MIT;MIT -creole;0.5.0;GPLv2 or Ruby; -css_parser;1.12.0;MIT;MIT -cucumber-core;10.1.0;MIT;MIT -cucumber-create-meta;6.0.1;MIT;MIT -cucumber-cucumber-expressions;14.0.0;MIT;MIT -cucumber-gherkin;22.0.0;MIT;MIT -cucumber-messages;17.1.0;MIT;MIT -cucumber-tag-expressions;4.0.2;MIT;MIT -cucumber-wire;6.2.0;MIT;MIT -cucumber;7.1.0;MIT;MIT -curb;1.0.1;Ruby;MIT -daemon_controller;1.2.0;MIT;MIT -daemons;1.1.9;MIT and (GPLv2+ or Ruby); -dalli;3.2.0;MIT;MIT -declarative_authorization;0.5.7;MIT; -deep_merge;1.2.2;MIT;MIT -delorean;2.1.0;MIT; -diff-lcs;1.5.0;MIT OR Artistic-2.0 OR GPL-2.0-or-later;MIT -diffy;3.2.1;MIT;MIT -dnsruby;1.61.7;ASL 2.0;Apache License, Version 2.0 -docile;1.1.5;MIT;MIT -domain_name;0.5.20190701;BSD and (MPLv1.1 or GPLv2+ or LGPLv2+);BSD-2-Clause -drake;0.9.2.0.3.1;MIT; -ed25519;1.3.0;MIT;MIT -ejs;1.1.1;MIT; -elasticsearch-transport;5.0.4;ASL 2.0;Apache 2 -em-http-request;1.1.7;MIT;MIT -em-socksify;0.3.0;MIT; -em-spec;0.2.7;MIT; -em-websocket-client;0.1.2;MIT;MIT -em-websocket;0.5.2;MIT;MIT -ensure_valid_encoding;0.5.3;MIT; -erubi;1.10.0;MIT;MIT -escape;0.0.4;BSD; -ethon;0.15.0;MIT;MIT -eventmachine;1.2.7;GPLv2 or Ruby;Ruby -excon;0.91.0;MIT;MIT -execjs;2.8.1;MIT;MIT -facon;0.5.0;MIT; -factory_bot;6.2.1;MIT;MIT -fake_ftp;0.3.0;MIT;MIT -fakefs;1.2.2;MIT;MIT -faraday;1.0.1;MIT;MIT -fattr;2.2.2;BSD or Ruby;same as ruby's -ffi;1.15.5;BSD;BSD-3-Clause -file-tail;1.2.0;ASL 2.0;Apache-2.0 -flexmock;2.3.6;MIT;MIT -fog-core;2.2.4;MIT;MIT -fog-json;1.2.0;MIT;MIT -fog-libvirt;0.9.0;MIT;MIT -fog-xml;0.1.4;MIT;MIT -foreigner;1.7.4;MIT;MIT -formatador;0.2.5;MIT; -forwardable-extended;2.6.0;MIT;MIT -gdk3;4.0.3;LGPLv2+;LGPL-2.1+ -gdk_pixbuf2;4.0.3;LGPLv2;LGPL-2.1+ -gem-nice-install;0.3.0;MIT;MIT -gem2rpm;1.0.2;GPLv2+;GPL-2.0+ -generator_spec;0.9.4;MIT;MIT -gettext;3.4.3;Ruby;Ruby -gio2;4.0.3;LGPLv2;LGPL-2.1+ -gist;6.0.0;MIT;MIT -git;1.12.0;MIT;MIT -glib2;4.0.3;LGPLv2;LGPL-2.1+ -globalid;1.0.0;MIT;MIT -glu;8.3.0;MIT;MIT -glut;8.3.0;MIT;MIT -gobject-introspection;4.0.3;LGPLv2+;LGPL-2.1+ -goocanvas;2.2.0;LGPLv2;LGPLv2.1 or later -goocanvas;1.2.6;LGPLv2; -gssapi;1.3.1;MIT;MIT -gstreamer;4.0.3;LGPLv2;LGPL-2.1+ -gtk2;3.4.3;LGPLv2;LGPL-2.1+ -gtk3;4.0.3;LGPLv2+;LGPL-2.1+ -gtksourceview2;3.4.3;LGPLv2;LGPL-2.1+ -gtksourceview3;4.0.3;LGPLv2+;LGPL-2.1+ -guard-compat;1.2.1;MIT;MIT -guard-livereload;2.5.2;MIT;MIT -guard-shell;0.7.1;MIT;MIT -guard;2.18.0;MIT;MIT -haml;5.2.2;MIT and WTFPL;MIT -hashdiff;1.0.1;MIT;MIT -hashery;2.1.2;BSD;BSD-2-Clause -hashicorp-checkpoint;0.1.5;MPLv2.0;MPL2 -hashie;4.1.0;MIT;MIT -hashr;2.0.1;MIT; -hiera-vault;0.2.2;ASL 2.0;Apache-2.0 -highline;2.0.3;GPLv2 or Ruby or BSD;Ruby -hikidoc;0.1.0;MIT;MIT -hiredis;0.6.3;BSD;BSD-3-Clause -hitimes;2.0.0;ISC;ISC -hocon;1.3.1;ASL 2.0;Apache License, v2 -hoe;3.26.0;MIT;MIT -hpricot;0.8.6;MIT and ASL 2.0; -hrx;1.0.0;ASL 2.0;Apache-2.0 -htmlentities;4.3.4;MIT;MIT -http-accept;2.1.1;MIT;MIT -http-cookie;1.0.5;MIT;MIT -http_connection;1.4.4;MIT; -http_parser.rb;0.6.0;MIT;MIT -httparty;0.18.1;MIT;MIT -httpclient;2.8.3;(Ruby or BSD) and Public Domain;ruby -i18n;1.8.11;MIT and (BSD or Ruby);MIT -i18n_data;0.10.0;MIT;MIT -icaro;1.0.6;GPLv3; -idn;0.0.2;ASL 2.0 and LGPLv2+; -image_processing;1.12.2;MIT;MIT -image_size;3.2.0;Ruby or GPLv2;Ruby -imagesize;0.1.1;GPLv2 or Ruby; -importmap-rails;1.0.3;MIT;MIT -introspection;0.0.4;MIT;MIT -ipaddress;0.8.3;MIT;MIT -isolate;3.5.1;MIT;MIT -jbuilder;2.11.5;MIT;MIT -jekyll-asciidoc;3.0.0;MIT;MIT -jekyll-email-protect;1.1.0;MIT;MIT -jekyll-feed;0.17.0;MIT;MIT -jekyll-git-authors;1.0.0;MIT;MIT -jekyll-sass-converter;2.2.0;MIT;MIT -jekyll-seo-tag;2.8.0;MIT;MIT -jekyll-toc;0.17.1;MIT;MIT -jekyll-watch;2.2.1;MIT;MIT -jekyll;4.3.1;MIT;MIT -jmespath;1.6.1;ASL 2.0;Apache-2.0 -jquery-rails;4.4.0;MIT;MIT -json;2.6.2;Ruby or BSD;Ruby -json_spec;1.1.5;MIT;MIT -kramdown-parser-gfm;1.1.0;MIT;MIT -kramdown-syntax-coderay;1.0.1;MIT;MIT -kramdown;2.4.0;MIT;MIT -krb5-auth;0.8.3;LGPLv2+; -launchy;2.4.3;ISC;ISC -levenshtein;0.2.2;GPLv2; -linked-list;0.0.16;MIT;MIT -liquid;4.0.3;MIT;MIT -listen;3.7.1;MIT;MIT -little-plugger;1.1.4;MIT; -locale;2.1.3;GPLv2 or Ruby;Ruby -lockfile;1.4.3;GPLv2 or Ruby; -log4r;1.1.10;LGPLv3; -logstash-event;1.2.02;ASL 2.0;Apache License (2.0) -loofah;2.18.0;MIT;MIT -lumberjack;1.0.13;MIT;MIT -macaddr;1.7.2;Ruby or BSD;Ruby -mail;2.7.1;MIT;MIT -marc;1.2.0;MIT;MIT -marcel;1.0.2;MIT and ASL 2.0;MIT -mechanize;2.8.5;MIT;MIT -memcache-client;1.8.5;BSD; -memfs;1.0.0;MIT;MIT -mercenary;0.4.0;MIT;MIT -metaclass;0.0.4;MIT;MIT -method_source;1.0.0;MIT;MIT -middleware;0.1.0;MIT; -mime-types-data;3.2020.1104;MIT;MIT -mime-types;3.4.1;MIT;MIT -mimemagic;0.3.2;MIT;MIT -mini_magick;4.11.0;MIT;MIT -mini_mime;1.1.0;MIT;MIT -mini_portile;0.6.2;MIT;MIT -mini_portile2;2.8.0;MIT;MIT -minima;2.5.1;MIT;MIT -minitest-around;0.4.1;MIT;MIT -minitest-profile;0.0.2;MIT;MIT -minitest-stub-const;0.6;MIT;MIT -minitest;5.16.3;MIT;MIT -minitest;4.7.0;MIT; -mixlib-cli;1.7.0;ASL 2.0;Apache-2.0 -mixlib-config;2.2.4;ASL 2.0;Apache-2.0 -mixlib-log;3.0.9;ASL 2.0;Apache-2.0 -mixlib-shellout;2.3.2;ASL 2.0; -mizuho;0.9.20;MIT;MIT -mkrf;0.2.3;MIT; -mocha;1.15.0;MIT or Ruby or BSD;MIT -mongo;2.14.0;ASL 2.0;Apache-2.0 -mongoid;7.3.3;MIT;MIT -moped;1.5.3;MIT; -more_core_extensions;1.2.0;MIT;MIT -morph-cli;0.2.3;MIT;MIT -msgpack;1.4.4;ASL 2.0;Apache 2.0 -multi_json;1.15.0;MIT;MIT -multi_test;0.1.2;MIT;MIT -multi_xml;0.6.0;MIT;MIT -multipart-post;2.2.3;MIT;MIT -mustache;1.1.1;MIT;MIT -mustermann;1.1.1;MIT;MIT -mysql2;0.5.4;MIT;MIT -narray;0.6.1.1;BSD and Ruby;Ruby -native-package-installer;1.1.5;LGPLv3+;LGPL-3+ -ncursesw;1.4.10;LGPLv2+;LGPL-2.1 -nenv;0.3.0;MIT;MIT -nesty;1.0.2;MIT;MIT -net-http-digest_auth;1.4.1;MIT;MIT -net-http-persistent;4.0.1;MIT;MIT -net-irc;0.0.9;GPLv2 or Ruby ; -net-ldap;0.17.1;MIT;MIT -net-scp;3.0.0;MIT;MIT -net-sftp;3.0.0;MIT or LGPLv2;MIT -net-ssh;6.1.0;MIT;MIT -netrc;0.11.0;MIT;MIT -nifti;0.0.2;LGPLv3+;LGPLv3 -nio4r;2.5.8;MIT and (BSD or GPLv2+);MIT -nokogiri;1.13.9;MIT and ASL 2.0;MIT -notiffany;0.1.3;MIT;MIT -open4;1.3.4;BSD or Ruby;Ruby -opengl;0.10.0;MIT;MIT -opennebula;5.12.8;ASL 2.0;Apache-2.0 -openscap;0.4.9;GPLv2+;GPL-2.0 -optimist;3.0.1;MIT;MIT -ox;2.14.11;MIT;MIT -pango;4.0.3;LGPLv2;LGPL-2.1+ -parallel;1.12.1;MIT;MIT -parse-cron;0.1.4;MIT; -parseconfig;1.1.2;MIT;MIT -pastel;0.8.0;MIT;MIT -pathspec;0.2.1;ASL 2.0;Apache-2.0 -pathutil;0.14.0;MIT;MIT -pdf-core;0.9.0;GPLv2 or GPLv3 or Ruby ;PRAWN -pdf-inspector;1.3.0;GPLv2 or GPLv3 or Ruby;PRAWN -pdf-reader;2.4.2;MIT;MIT -pdfkit;0.8.7.2;MIT;MIT -pg;1.3.5;(BSD or Ruby) and PostgreSQL;BSD-2-Clause -pkg-config;1.4.9;LGPLv2+;LGPLv2+ -plist;3.4.0;MIT;MIT -polyglot;0.3.5;MIT;MIT -poppler;4.0.3;LGPLv2;LGPL-2.1+ -posix-spawn;0.3.15;MIT;MIT -power_assert;2.0.2;Ruby or BSD;BSD-2-Clause -powerpack;0.1.1;MIT;MIT -pr_geohash;1.0.0;MIT; -prawn-icon;3.1.0;Ruby or GPLv2 or GPLv3;RUBY -prawn-svg;0.32.0;MIT;MIT -prawn-table;0.2.2;Ruby or GPLv2 or GPLv3;RUBY -prawn-templates;0.1.2;Ruby or GPLv2 or GPLv3;Nonstandard -prawn;2.4.0;(GPLv2 or GPLv3 or Ruby) and APAFML;PRAWN -progressbar;1.11.0;MIT;MIT -protobuf;3.10.3;MIT and BSD;MIT -proxifier;1.0.3;MIT; -pry-byebug;3.6.0;MIT;MIT -pry;0.14.1;MIT;MIT -public_suffix;4.0.6;MIT and MPLv2.0;MIT -puma;5.6.5;BSD-3-Clause;BSD-3-Clause -pundit;2.1.0;MIT;MIT -puppet-lint;2.4.2;MIT; -puppet-resource_api;1.8.14;ASL 2.0;Apache-2.0 -rabbit;3.0.1;GPLv2+ and CC-BY;GPLv2+ -racc;1.6.0;BSD;Ruby -rack-accept;0.4.5;MIT; -rack-cache;1.13.0;MIT;MIT -rack-cors;1.1.1;MIT;MIT -rack-protection;2.2.0;MIT;MIT -rack-restful_submit;1.2.2;MIT; -rack-test;1.1.0;MIT;MIT -rack;2.2.4;MIT and BSD;MIT -rails-controller-testing;1.0.5;MIT;MIT -rails-deprecated_sanitizer;1.0.4;MIT;MIT -rails-dom-testing;2.0.3;MIT;MIT -rails-html-sanitizer;1.4.3;MIT;MIT -rails;7.0.4;MIT;MIT -railties;7.0.4;MIT;MIT -rainbow;3.0.0;MIT;MIT -rake-compiler;1.2.0;MIT;MIT -rake-contrib;1.0.0;MIT;MIT -rake;13.0.6;MIT;MIT -rb-inotify;0.10.1;MIT;MIT -rb-readline;0.5.5;BSD;BSD -rbvmomi;3.0.0;MIT;MIT -rchardet;1.8.0;LGPLv2;LGPL -rdiscount;2.2.0.2;ASL 1.1;BSD-3-Clause -rdoc;6.4.0;GPL-2.0 AND Ruby AND BSD-3-Clause AND CC-BY-2.5 AND OFL-1.1-RFN;Ruby -rdtool;0.6.38;GPLv2+ or Ruby;GPL-2+ -red-colors;0.3.0;MIT;MIT -redcarpet;3.3.2;MIT and ISC;MIT -redis;4.7.1;MIT;MIT -ref;2.0.0;MIT;MIT -regexp_parser;2.5.0;MIT;MIT -regexp_property_values;1.0.0;MIT;MIT -require_all;3.0.0;MIT;MIT -resolve-hostname;0.1.0;MIT;MIT -rest-client;2.1.0;MIT;MIT -rgen;0.8.4;MIT; -rmagick;5.0.0;MIT;MIT -rmail;1.1.4;BSD; -ronn-ng;0.9.1;MIT;MIT -rouge;4.0.0;MIT and BSD;MIT -rr;1.2.1;MIT;MIT -rspec-collection_matchers;1.2.0;MIT;MIT -rspec-core;3.12.0;MIT;MIT -rspec-expectations;3.12.0;MIT;MIT -rspec-its;1.3.0;MIT;MIT -rspec-mocks;3.12.0;MIT;MIT -rspec-pending_for;0.1.16;MIT;MIT -rspec-rails;5.1.1;MIT;MIT -rspec-support;3.12.0;MIT;MIT -rspec;3.12.0;MIT;MIT -rsvg2;4.0.3;LGPLv2;LGPL-2.1+ -rttool;1.0.3.0;Ruby; -rubeyond;0.1;GPLv3+; -ruby-dbus;0.16.0;LGPLv2+ and MIT;LGPL-2.1 -ruby-libvirt;0.7.1;LGPLv2+;LGPLv2 -ruby-opengl;0.61.0;MIT; -ruby-progressbar;1.11.0;MIT;MIT -ruby-rc4;0.1.5;MIT; -ruby-shadow;2.5.0;Public Domain;Public Domain License -ruby-vips;2.0.17;MIT;MIT -ruby_dep;1.5.0;MIT;MIT -ruby_engine;2.0.0;MIT;MIT -ruby_version;1.0.2;MIT;MIT -rubygems-mirror;1.3.0;MIT;MIT -rubyzip;2.3.2;Ruby or BSD;BSD 2-Clause -rugged;1.2.0;MIT;MIT -safe_yaml;1.0.4;MIT;MIT -sass-rails;6.0.0;MIT;MIT -sass-twitter-bootstrap;2.3.0;ASL 2.0; -sass;3.7.4;MIT;MIT -sassc-rails;2.1.2;MIT and OFL;MIT -sassc;2.4.0;MIT;MIT -scanf;1.0.0;BSD;BSD-2-Clause -scrub_rb;1.0.1;MIT;MIT -scruffy;0.3.0;MIT; -sd_notify;0.1.1;MIT;MIT -selenium-webdriver;4.1.0;ASL 2.0;Apache-2.0 -semantic;1.6.1;MIT;MIT -semantic_puppet;1.0.4;ASL 2.0;Apache-2.0 -sequel;5.58.0;MIT;MIT -serialport;1.3.2;GPLv2;GPL-2 -session;3.1.0;Ruby; -settingslogic;2.0.9;MIT; -sexp_processor;4.14.1;MIT;MIT -shellany;0.0.1;MIT;MIT -shindo;0.3.10;MIT; -shoulda-context;1.2.2;MIT;MIT -shoulda-matchers;5.1.0;MIT;MIT -shoulda;3.6.0;MIT;MIT -simplecov-html;0.10.0;MIT;MIT -simplecov;0.13.0;MIT;MIT -simpleidn;0.2.1;MIT;MIT -sinatra-cross_origin;0.4.0;MIT; -sinatra-rabbit;1.1.6;ASL 2.0; -sinatra;2.2.0;MIT;MIT -slim;4.1.0;MIT;MIT -snmp;1.3.2;MIT;MIT -spring-watcher-listen;2.0.1;MIT;MIT -spring;2.1.1;MIT;MIT -sprockets-rails;3.2.2;MIT;MIT -sprockets;4.0.2;MIT;MIT -sqlite3;1.4.2;BSD;BSD-3-Clause -sshkey;2.0.0;MIT;MIT -state_machine;1.2.0;MIT; -stomp;1.4.10;ASL 2.0;Apache-2.0 -stringex;2.8.5;MIT;MIT -sugarjar;0.0.11;ASL 2.0;Apache-2.0 -syck;1.4.1;MIT;MIT -sync;0.5.0;BSD-2-Clause;BSD-2-Clause -syntax;1.2.0;BSD;BSD -sys-uname;1.2.2;ASL 2.0;Apache-2.0 -systemu;2.6.5;Ruby;Ruby -temple;0.8.2;MIT;MIT -term-ansicolor;1.7.1;Apache-2.0;Apache-2.0 -terminal-table;3.0.2;MIT;MIT -test-unit-notify;1.0.4;LGPLv2+ and (LGPLv2+ or GFDL or CC-BY-SA);LGPLv2.1 or later -test-unit-rr;1.0.5;LGPLv2+;LGPLv2 or later -test-unit;3.5.5;(BSD or Ruby or Python) and (BSD or Ruby);Ruby -test_construct;2.0.2;MIT;MIT -test_declarative;0.0.6;MIT;MIT -text;1.3.1;MIT;MIT -thor;1.2.1;MIT;MIT -thread_order;1.1.1;MIT;MIT -thread_safe;0.3.6;ASL 2.0 and Public Domain;Apache-2.0 -tilt;2.0.10;MIT;MIT -timecop;0.9.4;MIT;MIT -timers;4.0.1;MIT;MIT -tins;1.31.1;MIT;MIT -tk;0.4.0;BSD or Ruby;BSD-2-Clause -tomlrb;2.0.1;MIT;MIT -transaction-simple;1.4.0.2;MIT; -treetop;1.6.10;MIT;MIT -ttfunk;1.7.0;GPLv2 or GPLv3 or Ruby;Nonstandard -tty-color;0.6.0;MIT;MIT -turbolinks-source;5.2.0;MIT;MIT -turbolinks;5.1.1;MIT;MIT -typhoeus;1.4.0;MIT;MIT -tzinfo;2.0.5;MIT;MIT -uglifier;3.2.0;MIT and BSD;MIT -unf;0.1.4;BSD;2-clause BSDL -unf_ext;0.0.8.2;MIT;MIT -unicode-display_width;2.2.0;MIT;MIT -unicode;0.4.4.4;Ruby;Ruby -uuid;2.3.7;MIT or CC-BY-SA; -uuidtools;2.2.0;ASL 2.0;Apache-2.0 -vault;0.15.0;MPLv2.0;MPL-2.0 -vcr;2.3.0;MIT; -vte;3.4.3;LGPLv2;LGPL-2.1+ -vte3;4.0.3;LGPLv2+;LGPL-2.1+ -web-console;4.2.0;MIT;MIT -webkit2-gtk;4.0.3;LGPLv2+;LGPL-2.1+ -webmock;3.14.0;MIT;MIT -webrick;1.7.0;Ruby and BSD-2-Clause;Ruby -webrobots;0.1.2;BSD;2-clause BSDL -websocket-driver;0.7.5;ASL 2.0;Apache-2.0 -websocket-extensions;0.1.5;Apache-2.0;Apache-2.0 -websocket;1.2.9;MIT;MIT -whiskey_disk;0.6.24;MIT; -xml-simple;1.1.9;MIT;MIT -xmlparser;0.7.2.1;GPLv2+ and ( Ruby or GPLv2+ or MIT ) and ( GPLv2+ or Artistic ) ; -xmlrpc;0.3.2;Ruby or BSD;Ruby -xpath;3.2.0;MIT;MIT -yaml-lint;0.0.10;MIT;MIT -yard;0.9.28;MIT and (BSD or Ruby);MIT -zeitwerk;2.5.4;MIT;MIT -zoom;0.5.0;LGPLv2+; diff --git a/rubygems_fedora_gem2rpm_matches.csv b/rubygems_fedora_gem2rpm_matches.csv index e23a760..74981b3 100644 --- a/rubygems_fedora_gem2rpm_matches.csv +++ b/rubygems_fedora_gem2rpm_matches.csv @@ -1,5 +1,4 @@ true;0;Ascii85;MIT;MIT -true;0;Platform;MIT;MIT true;0;RedCloth;MIT;MIT true;0;ZenTest;MIT;MIT true;0;abrt;MIT;MIT @@ -19,7 +18,6 @@ true;0;activesupport;MIT;MIT true;0;acts_as_list;MIT;MIT true;0;afm;MIT;MIT true;0;algorithms;MIT;MIT -true;0;arel;MIT;MIT true;0;asciidoctor-pdf;MIT;MIT true;0;async_sinatra;MIT;MIT true;0;backports;MIT;MIT @@ -291,4 +289,5 @@ true;0;yaml-lint;MIT;MIT true;0;zeitwerk;MIT;MIT true;1;pkg-config;LGPLv2+;LGPLv2+ true;1;rb-readline;BSD;BSD -true;1;syntax;BSD;BSD \ No newline at end of file +true;1;syntax;BSD;BSD +true;1;webrick;Ruby and BSD-2-Clause;Ruby and BSD-2-Clause \ No newline at end of file diff --git a/rubygems_fedora_spdx_state.csv b/rubygems_fedora_spdx_state.csv index 2face31..d52f68b 100644 --- a/rubygems_fedora_spdx_state.csv +++ b/rubygems_fedora_spdx_state.csv @@ -1,6 +1,5 @@ -gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license +gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license;dead_package true;0;Ascii85;MIT;MIT -true;0;Platform;MIT;MIT true;0;RedCloth;MIT;MIT true;0;ZenTest;MIT;MIT true;0;abrt;MIT;MIT @@ -23,7 +22,6 @@ true;0;algorithms;MIT;MIT false;0;ammeter;MIT; false;0;apipie-rails;MIT AND Apache-2.0; false;0;appraisal;MIT; -true;0;arel;MIT;MIT true;0;asciidoctor-pdf;MIT;MIT true;0;async_sinatra;MIT;MIT false;0;awesome_print;MIT; @@ -333,7 +331,6 @@ true;0;xml-simple;MIT;MIT true;0;xpath;MIT;MIT true;0;yaml-lint;MIT;MIT true;0;zeitwerk;MIT;MIT -false;1;POpen4;GPLv2 or Ruby; false;1;abstract;GPLv2 or Ruby; false;1;addressable;ASL 2.0;Apache-2.0 false;1;allison;AFL; @@ -480,10 +477,13 @@ false;1;vault;MPLv2.0;MPL-2.0 false;1;vte;LGPLv2;LGPL-2.1+ false;1;vte3;LGPLv2+;LGPL-2.1+ false;1;webkit2-gtk;LGPLv2+;LGPL-2.1+ -false;1;webrick;Ruby and BSD-2-Clause;Ruby and BSD-2-Clause +true;1;webrick;Ruby and BSD-2-Clause;Ruby and BSD-2-Clause false;1;webrobots;BSD;2-clause BSDL false;1;websocket-driver;ASL 2.0;Apache-2.0 false;1;xmlparser;GPLv2+ and ( Ruby or GPLv2+ or MIT ) and ( GPLv2+ or Artistic ); false;1;xmlrpc;Ruby or BSD;Ruby and BSD-2-Clause false;1;yard;MIT and (BSD or Ruby);MIT -false;1;zoom;LGPLv2+; \ No newline at end of file +false;1;zoom;LGPLv2+; +false;255;rubygem-POpen4;N/A;N/A;true +false;255;rubygem-Platform;N/A;N/A;true +false;255;rubygem-arel;N/A;N/A;true \ No newline at end of file diff --git a/rubygems_fedora_valid_no_action.csv b/rubygems_fedora_valid_no_action.csv index a3de0c4..895e62f 100644 --- a/rubygems_fedora_valid_no_action.csv +++ b/rubygems_fedora_valid_no_action.csv @@ -1,5 +1,4 @@ true;0;Ascii85;MIT;MIT -true;0;Platform;MIT;MIT true;0;RedCloth;MIT;MIT true;0;ZenTest;MIT;MIT true;0;abrt;MIT;MIT @@ -19,7 +18,6 @@ true;0;activesupport;MIT;MIT true;0;acts_as_list;MIT;MIT true;0;afm;MIT;MIT true;0;algorithms;MIT;MIT -true;0;arel;MIT;MIT true;0;asciidoctor-pdf;MIT;MIT true;0;async_sinatra;MIT;MIT true;0;backports;MIT;MIT diff --git a/rubygems_fedora_valid_spdx.csv b/rubygems_fedora_valid_spdx.csv index adec226..b49da51 100644 --- a/rubygems_fedora_valid_spdx.csv +++ b/rubygems_fedora_valid_spdx.csv @@ -1,5 +1,4 @@ true;0;Ascii85;MIT;MIT -true;0;Platform;MIT;MIT true;0;RedCloth;MIT;MIT true;0;ZenTest;MIT;MIT true;0;abrt;MIT;MIT @@ -22,7 +21,6 @@ true;0;algorithms;MIT;MIT false;0;ammeter;MIT; false;0;apipie-rails;MIT AND Apache-2.0; false;0;appraisal;MIT; -true;0;arel;MIT;MIT true;0;asciidoctor-pdf;MIT;MIT true;0;async_sinatra;MIT;MIT false;0;awesome_print;MIT; diff --git a/rubygems_try_convert_conjunctions.csv b/rubygems_try_convert_conjunctions.csv index d571ae7..bfe339c 100644 --- a/rubygems_try_convert_conjunctions.csv +++ b/rubygems_try_convert_conjunctions.csv @@ -1,6 +1,5 @@ -gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license +gem2rpm_and_fedora_matches?;license_validate_exit_code;gem_name;fedora_license;gem2rpm_license;dead_package true;0;Ascii85;MIT;MIT -true;0;Platform;MIT;MIT true;0;RedCloth;MIT;MIT true;0;ZenTest;MIT;MIT true;0;abrt;MIT;MIT @@ -23,7 +22,6 @@ true;0;algorithms;MIT;MIT false;0;ammeter;MIT; false;0;apipie-rails;MIT AND Apache-2.0; false;0;appraisal;MIT; -true;0;arel;MIT;MIT true;0;asciidoctor-pdf;MIT;MIT true;0;async_sinatra;MIT;MIT false;0;awesome_print;MIT; @@ -328,7 +326,7 @@ true;0;unicode-display_width;MIT;MIT false;0;vcr;MIT; true;0;web-console;MIT;MIT true;0;webmock;MIT;MIT -false;0;webrick;Ruby AND BSD-2-Clause;Ruby AND BSD-2-Clause +true;0;webrick;Ruby AND BSD-2-Clause;Ruby AND BSD-2-Clause true;0;websocket;MIT;MIT true;0;websocket-extensions;Apache-2.0;Apache-2.0 false;0;whiskey_disk;MIT; @@ -336,7 +334,6 @@ true;0;xml-simple;MIT;MIT true;0;xpath;MIT;MIT true;0;yaml-lint;MIT;MIT true;0;zeitwerk;MIT;MIT -false;1;POpen4;GPLv2 OR Ruby; false;1;abstract;GPLv2 OR Ruby; false;1;addressable;ASL 2.0;Apache-2.0 false;1;allison;AFL; diff --git a/validate_ruby_files.rb b/validate_ruby_files.rb deleted file mode 100644 index 0ebfe93..0000000 --- a/validate_ruby_files.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true -$LOAD_PATH.unshift('/home/jprokop/bin') -require 'rb_parallel' -require 'httparty' -require 'json' - -class ValidateJob < RubyJobQueue - def initialize(jobs, verbosity, max_parallel = (Etc.nprocessors / 2)) - super jobs, verbosity, max_parallel - end - - def execute(slice) - work(slice[0], slice[1], slice[2]) - end - - private - - def work(gem_name, gem_ver, fedspec_license) - license = gem_license(gem_name, gem_ver) - [gem_name, gem_ver, fedspec_license, license&.first] - end - - def wait_finish - @threads.each(&:join) - end - - def gem_info(gem_name) - JSON.load(HTTParty.get("https://rubygems.org/api/v1/versions/#{gem_name}.json").response.body.to_s) - end - - def gem_for_ver(gem_name, gem_ver) - info = gem_info(gem_name) - info.find do |h| - h["number"] == gem_ver - end || info.sort() { |a, b| Gem::Version.new(a['number']) <=> Gem::Version.new(b['number']) }.first - # ^ Some gems haven't had a proper release in a long time so they are using "Version" with a githash, making it even more confusing. - end - - def gem_license(gem_name, gem_ver) - remote_gem = gem_for_ver(gem_name, gem_ver) - require 'irb'; binding.irb unless remote_gem - remote_gem["licenses"] - end -end - -jobs = [] - -Dir['rubygem-*.spec'].each do |file| - name, spec_license = nil, nil - file = File.read(file) - # puts file.each_line.to_a[0] - # puts file.each_line.to_a[1] - name = file.scan(/%(?:global|define)[[:space:]]+gem_name[[:space:]]+([A-Za-z0-9\-_.]+)/).flatten.first - spec_license = file.scan(/License:[[:space:]]*(.*)/).flatten.first - version = nil - begin - version = Gem::Version.new(file.scan(/Version:[[:space:]]*(.*)/).flatten.first) - rescue ArgumentError - # Why do maintainers do this ?! - possible_variations = %w[majorver mainver version gemver coffee_script_version].join('|') - version = Gem::Version.new(file.scan(/%(?:global|define)[[:space:]]*(?:#{possible_variations})[[:space:]]*(.+)/).flatten.first) if version.nil? || version =~ /(#{possible_variations})/ - end - - raise "spec license empty" if spec_license.empty? - raise "name empty #{name} #{spec_license}" if name.empty? - raise "version empty for #{name}" if version.to_s.empty? - - jobs << [name, version.to_s, spec_license].flatten -end -gem_info = ValidateJob.new(jobs, Logger::DEBUG).collect -puts 'name;version;Fedora License;Gem License' -gem_licenses = gem_info.map() { |arr| arr.join(";") }.join("\n") -File.write("licences.csv", gem_licenses) -- cgit