From 2150897984de80456aebcf87fb0182c6ac59ccba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 7 Apr 2022 09:48:11 +0200 Subject: [PATCH 1/7] Do not hardcode the default Ruby version Use the %{rb_default_ruby_abi} RPM macro --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2668d7e..6ec5654 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2 - name: Install Dependencies - run: zypper --non-interactive install --no-recommends 'rubygem(ruby:2.7.0:rubocop:0.41.2)' yast2-devtools + run: zypper --non-interactive install --no-recommends "rubygem(`rpm --eval '%{rb_default_ruby_abi}'`:rubocop:0.41.2)" yast2-devtools # just for easier debugging... - name: Inspect Installed Packages From 6cd21026cc529e8b776c492e09d8060eeed18778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 08:49:46 +0200 Subject: [PATCH 2/7] Rubocop automatic fixes (-a) --- .rubocop.yml | 2 +- lib/libyui/rake.rb | 2 +- lib/libyui/tasks.rb | 3 ++- lib/tasks/version.rake | 2 +- libyui-rake.gemspec | 17 +++++++++-------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index de42fdb..9f91c24 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,6 @@ # use the shared Yast defaults inherit_from: - /usr/share/YaST2/data/devtools/data/rubocop_yast_style.yml + /usr/share/YaST2/data/devtools/data/rubocop-1.24.1_yast_style.yml Metrics/LineLength: Max: 100 diff --git a/lib/libyui/rake.rb b/lib/libyui/rake.rb index b4aa371..ff5e29e 100644 --- a/lib/libyui/rake.rb +++ b/lib/libyui/rake.rb @@ -36,7 +36,7 @@ end # load libyui-rake tasks -task_path = File.expand_path("../../tasks", __FILE__) +task_path = File.expand_path("../tasks", __dir__) Dir["#{task_path}/*.rake"].each do |f| load f end diff --git a/lib/libyui/tasks.rb b/lib/libyui/tasks.rb index 7ad4539..0c2c791 100644 --- a/lib/libyui/tasks.rb +++ b/lib/libyui/tasks.rb @@ -21,7 +21,7 @@ module Tasks # Name of the CMake version file VERSION_CMAKE = "VERSION.cmake".freeze # Targets definition - TARGETS_FILE = File.expand_path("../../../data/targets.yml", __FILE__) + TARGETS_FILE = File.expand_path("../../data/targets.yml", __dir__) # Wrapper to set up packaging tasks def self.configuration(&block) @@ -32,6 +32,7 @@ def self.submit_to(target, file = TARGETS_FILE) targets = YAML.load_file(file) config = targets[target] raise "Not configuration found for #{target}" if config.nil? + Libyui::Tasks.configuration do |conf| config.each do |meth, val| conf.public_send("#{meth}=", val) diff --git a/lib/tasks/version.rake b/lib/tasks/version.rake index d491230..a8a8a3c 100644 --- a/lib/tasks/version.rake +++ b/lib/tasks/version.rake @@ -27,7 +27,7 @@ namespace :version do spec_v = spec_version(spec_filename) if cmake_v != spec_v raise "Version mismatch, #{Libyui::Tasks::VERSION_CMAKE}:#{cmake_v} "\ - "#{spec_filename}:#{spec_v}" + "#{spec_filename}:#{spec_v}" end end puts cmake_v if verbose diff --git a/libyui-rake.gemspec b/libyui-rake.gemspec index d896191..b678775 100644 --- a/libyui-rake.gemspec +++ b/libyui-rake.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| # gem name and description spec.name = "libyui-rake" - spec.version = File.read(File.expand_path("../VERSION", __FILE__)).chomp + spec.version = File.read(File.expand_path("VERSION", __dir__)).chomp spec.summary = "Rake tasks that provide basic workflow for libyui development" spec.license = "LGPL-2.1" @@ -27,12 +27,12 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/openSUSE/libyui-rake" spec.summary = "Rake tasks providing basic workflow for libyui development" - spec.description = <<-end -Rake tasks that support the workflow of a libyui developer. It allows packaging -a repo, sending it to the build service, creating a submit request to the -target repo or running the client from the git repo. -Heavily inspired by yast-rake. -end + spec.description = <<~END + Rake tasks that support the workflow of a libyui developer. It allows packaging + a repo, sending it to the build service, creating a submit request to the + target repo or running the client from the git repo. + Heavily inspired by yast-rake. + END # gem content spec.files = Dir["lib/**/*.rb", "lib/tasks/*.rake", "data/*", "COPYING", "README.md", "VERSION"] @@ -41,7 +41,8 @@ end spec.require_path = "lib" # dependencies - spec.add_runtime_dependency("rake", "> 10.0", "< 99") spec.add_runtime_dependency("packaging_rake_tasks", "~> 1.5") + spec.add_runtime_dependency("rake", "> 10.0", "< 99") # "~> 1.5" means ">= 1.5 and < 2" (thanks to darix) + spec.metadata["rubygems_mfa_required"] = "true" end From 8279127f317e5dc2f3e659bb60e5c5ccd1644d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 08:52:36 +0200 Subject: [PATCH 3/7] Rubocop automatic fixes (-A) --- Gemfile | 2 ++ Rakefile | 2 ++ lib/libyui/rake.rb | 4 +++- lib/libyui/tasks.rb | 6 ++++-- lib/tasks/so_version.rake | 4 +++- lib/tasks/test.rake | 2 ++ lib/tasks/version.rake | 2 ++ libyui-rake.gemspec | 2 ++ 8 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index cc91aef..0350b57 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source "https://rubygems.org" gemspec diff --git a/Rakefile b/Rakefile index 3cc7987..24e7bde 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015 SUSE LLC # This library is free software; you can redistribute it and/or modify diff --git a/lib/libyui/rake.rb b/lib/libyui/rake.rb index ff5e29e..6809278 100644 --- a/lib/libyui/rake.rb +++ b/lib/libyui/rake.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015 SUSE LLC # This library is free software; you can redistribute it and/or modify @@ -23,7 +25,7 @@ include Libyui::Tasks::Helpers # read package name from spec file name because CWD can have a -branch suffix - main_spec = Dir.glob("package/*.spec").sort.last + main_spec = Dir.glob("package/*.spec").max conf.package_name = main_spec[/package\/(.*)\.spec$/, 1] conf.version = cmake_version diff --git a/lib/libyui/tasks.rb b/lib/libyui/tasks.rb index 0c2c791..2cac04c 100644 --- a/lib/libyui/tasks.rb +++ b/lib/libyui/tasks.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015-2021 SUSE LLC # This library is free software; you can redistribute it and/or modify @@ -19,7 +21,7 @@ module Libyui # Facilities to write Libyui related rake tasks. module Tasks # Name of the CMake version file - VERSION_CMAKE = "VERSION.cmake".freeze + VERSION_CMAKE = "VERSION.cmake" # Targets definition TARGETS_FILE = File.expand_path("../../data/targets.yml", __dir__) @@ -145,7 +147,7 @@ def bump_spec_so_version(filename = nil) # @param filename [String, nil] if nil, it uses the shortest spec filename # @return [String] def spec_filename(filename) - filename || Dir.glob("package/*.spec").sort.first + filename || Dir.glob("package/*.spec").min end end end diff --git a/lib/tasks/so_version.rake b/lib/tasks/so_version.rake index 2f34244..2dbe0f4 100644 --- a/lib/tasks/so_version.rake +++ b/lib/tasks/so_version.rake @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2021 SUSE LLC # This library is free software; you can redistribute it and/or modify @@ -24,7 +26,7 @@ namespace :so_version do filenames = Dir.glob("package/*.spec").sort filenames.reject! { |f| spec_so_version(f).nil? } - mismatches = filenames.select { |f| spec_so_version(f) != so_version } + mismatches = filenames.reject { |f| spec_so_version(f) == so_version } if mismatches.any? messages = ["so version mismatch:"] diff --git a/lib/tasks/test.rake b/lib/tasks/test.rake index 3d339a4..6a7b57a 100644 --- a/lib/tasks/test.rake +++ b/lib/tasks/test.rake @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015 SUSE LLC # This library is free software; you can redistribute it and/or modify diff --git a/lib/tasks/version.rake b/lib/tasks/version.rake index a8a8a3c..ac26b59 100644 --- a/lib/tasks/version.rake +++ b/lib/tasks/version.rake @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015 SUSE LLC # This library is free software; you can redistribute it and/or modify diff --git a/libyui-rake.gemspec b/libyui-rake.gemspec index b678775..d904f34 100644 --- a/libyui-rake.gemspec +++ b/libyui-rake.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + #-- # Copyright (C) 2015 SUSE LLC # This library is free software; you can redistribute it and/or modify From 1281424a0f1fb9ed5b898c33fdbb06c293d31a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 09:09:05 +0200 Subject: [PATCH 4/7] Manual Rubocop fixes --- .github/workflows/ci.yml | 2 +- .rubocop.yml | 3 +++ lib/libyui/tasks.rb | 4 ++-- libyui-rake.gemspec | 14 ++++++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ec5654..8cc941b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v2 - name: Install Dependencies - run: zypper --non-interactive install --no-recommends "rubygem(`rpm --eval '%{rb_default_ruby_abi}'`:rubocop:0.41.2)" yast2-devtools + run: zypper --non-interactive install --no-recommends "rubygem(`rpm --eval '%{rb_default_ruby_abi}'`:rubocop:1.24.1)" yast2-devtools # just for easier debugging... - name: Inspect Installed Packages diff --git a/.rubocop.yml b/.rubocop.yml index 9f91c24..f38eaef 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,3 +14,6 @@ Metrics/AbcSize: Metrics/MethodLength: Max: 14 +Metrics/BlockLength: + Exclude: + - lib/tasks/version.rake diff --git a/lib/libyui/tasks.rb b/lib/libyui/tasks.rb index 2cac04c..7ab85d9 100644 --- a/lib/libyui/tasks.rb +++ b/lib/libyui/tasks.rb @@ -104,9 +104,9 @@ def cmake_values(filename, *keys) # @param key [String] e.g., 'VERSION_MAJOR' # # @return [String] e.g., "3" - def cmake_value(s, key) + def cmake_value(text, key) e_key = Regexp.escape(key) - m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(s) + m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(text) m ? m[1] : nil end diff --git a/libyui-rake.gemspec b/libyui-rake.gemspec index d904f34..9f2a123 100644 --- a/libyui-rake.gemspec +++ b/libyui-rake.gemspec @@ -25,16 +25,15 @@ Gem::Specification.new do |spec| # author spec.author = "YaST team" - spec.email = "yast-devel@suse.com" - spec.homepage = "https://github.com/openSUSE/libyui-rake" + spec.email = "yast-devel@lists.opensuse.org" + spec.homepage = "https://github.com/libyui/libyui-rake" - spec.summary = "Rake tasks providing basic workflow for libyui development" - spec.description = <<~END + spec.description = <<~DESCRIPTION Rake tasks that support the workflow of a libyui developer. It allows packaging a repo, sending it to the build service, creating a submit request to the target repo or running the client from the git repo. Heavily inspired by yast-rake. - END + DESCRIPTION # gem content spec.files = Dir["lib/**/*.rb", "lib/tasks/*.rake", "data/*", "COPYING", "README.md", "VERSION"] @@ -42,9 +41,12 @@ Gem::Specification.new do |spec| # define LOAD_PATH spec.require_path = "lib" + # Ruby 2.5.0+ is required + spec.required_ruby_version = ">= 2.5.0" + # dependencies + # "~> 1.5" means ">= 1.5 and < 2" (thanks to darix) spec.add_runtime_dependency("packaging_rake_tasks", "~> 1.5") spec.add_runtime_dependency("rake", "> 10.0", "< 99") - # "~> 1.5" means ">= 1.5 and < 2" (thanks to darix) spec.metadata["rubygems_mfa_required"] = "true" end From 9f2e1fed0116fd3ca9f52873e13fee27787d4408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 09:58:33 +0200 Subject: [PATCH 5/7] Updated submit data - Added SLE15-SP5 target, "sle_latest" moved to SLE15-SP5 - Related to bsc#1198109 --- data/targets.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/data/targets.yml b/data/targets.yml index a761e47..1217839 100644 --- a/data/targets.yml +++ b/data/targets.yml @@ -69,11 +69,16 @@ obs_project: "Devel:YaST:SLE-15-SP4" obs_sr_project: "SUSE:SLE-15-SP4:Update" obs_target: "SUSE_SLE-15-SP4_GA" +:sle15sp5: + obs_api: "https://api.suse.de/" + obs_project: "Devel:YaST:SLE-15-SP5" + obs_sr_project: "SUSE:SLE-15-SP5:Update" + obs_target: "SUSE_SLE-15-SP5_GA" :sle_latest: obs_api: "https://api.suse.de/" obs_project: "Devel:YaST:Head" - obs_sr_project: "SUSE:SLE-15-SP4:GA" - obs_target: "SUSE_SLE-15-SP4_GA" + obs_sr_project: "SUSE:SLE-15-SP5:GA" + obs_target: "SUSE_SLE-15-SP5_GA" :factory: obs_project: "devel:libraries:libyui" obs_sr_project: "openSUSE:Factory" From 49123085319ead9b2ad7ff9c6b12b44d5cb19f30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 09:59:06 +0200 Subject: [PATCH 6/7] 0.1.24 --- VERSION | 2 +- package/rubygem-libyui-rake.changes | 9 +++++++++ package/rubygem-libyui-rake.spec | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 001d752..5a48b6b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.23 +0.1.24 diff --git a/package/rubygem-libyui-rake.changes b/package/rubygem-libyui-rake.changes index ced0f23..d9ee848 100644 --- a/package/rubygem-libyui-rake.changes +++ b/package/rubygem-libyui-rake.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Apr 8 07:14:20 UTC 2022 - Ladislav Slezák + +- Use Rubocop 1.24.1 (the old one does not work in Ruby 3) +- Updated data in Gemspec +- Updated submit data, added SLE15-SP5 target, "sle_latest" moved + to SLE15-SP5 (related to bsc#1198109) +- 0.1.24 + ------------------------------------------------------------------- Wed Mar 31 13:35:58 UTC 2021 - Ladislav Slezák diff --git a/package/rubygem-libyui-rake.spec b/package/rubygem-libyui-rake.spec index 488349e..e5d2ec3 100644 --- a/package/rubygem-libyui-rake.spec +++ b/package/rubygem-libyui-rake.spec @@ -17,7 +17,7 @@ Name: rubygem-libyui-rake -Version: 0.1.23 +Version: 0.1.24 Release: 0 %define mod_name libyui-rake %define mod_full_name %{mod_name}-%{version} From 4ebcd0552ae0beef2d4c8ad487a8fd600b086c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Fri, 8 Apr 2022 13:01:17 +0200 Subject: [PATCH 7/7] Added MFA comment --- libyui-rake.gemspec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libyui-rake.gemspec b/libyui-rake.gemspec index 9f2a123..4f92254 100644 --- a/libyui-rake.gemspec +++ b/libyui-rake.gemspec @@ -48,5 +48,7 @@ Gem::Specification.new do |spec| # "~> 1.5" means ">= 1.5 and < 2" (thanks to darix) spec.add_runtime_dependency("packaging_rake_tasks", "~> 1.5") spec.add_runtime_dependency("rake", "> 10.0", "< 99") + # enable MFA (2FA) authentication at rubygems.org + # see https://guides.rubygems.org/mfa-requirement-opt-in/ spec.metadata["rubygems_mfa_required"] = "true" end