Skip to content

Commit

Permalink
Merge pull request #37 from libyui/ci_fix
Browse files Browse the repository at this point in the history
Added SLE15-SP5 targets, newer Rubocop
  • Loading branch information
lslezak authored Apr 28, 2022
2 parents 9f7dd4f + 4ebcd05 commit a6f1ffb
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:1.24.1)" yast2-devtools

# just for easier debugging...
- name: Inspect Installed Packages
Expand Down
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,3 +14,6 @@ Metrics/AbcSize:
Metrics/MethodLength:
Max: 14

Metrics/BlockLength:
Exclude:
- lib/tasks/version.rake
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

gemspec
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.23
0.1.24
9 changes: 7 additions & 2 deletions data/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 4 additions & 2 deletions lib/libyui/rake.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -36,7 +38,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
13 changes: 8 additions & 5 deletions lib/libyui/tasks.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,9 +21,9 @@ 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", __FILE__)
TARGETS_FILE = File.expand_path("../../data/targets.yml", __dir__)

# Wrapper to set up packaging tasks
def self.configuration(&block)
Expand All @@ -32,6 +34,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)
Expand Down Expand Up @@ -101,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

Expand Down Expand Up @@ -144,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
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/so_version.rake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:"]
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/test.rake
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/tasks/version.rake
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -27,7 +29,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
Expand Down
33 changes: 20 additions & 13 deletions libyui-rake.gemspec
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,31 +19,36 @@
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"

# author
spec.author = "YaST team"
spec.email = "[email protected]"
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.email = "[email protected]"
spec.homepage = "https://github.com/libyui/libyui-rake"

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.
DESCRIPTION

# gem content
spec.files = Dir["lib/**/*.rb", "lib/tasks/*.rake", "data/*", "COPYING", "README.md", "VERSION"]

# define LOAD_PATH
spec.require_path = "lib"

# Ruby 2.5.0+ is required
spec.required_ruby_version = ">= 2.5.0"

# dependencies
spec.add_runtime_dependency("rake", "> 10.0", "< 99")
spec.add_runtime_dependency("packaging_rake_tasks", "~> 1.5")
# "~> 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
9 changes: 9 additions & 0 deletions package/rubygem-libyui-rake.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Apr 8 07:14:20 UTC 2022 - Ladislav Slezák <[email protected]>

- 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 <[email protected]>

Expand Down
2 changes: 1 addition & 1 deletion package/rubygem-libyui-rake.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit a6f1ffb

Please sign in to comment.