libyui-rake 0.1.20 → 0.1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 289128538d5b119be1af09ead2c0560a71a94078588053835383e21fa5bb76c6
4
- data.tar.gz: 3557d5112aad595ded8eadf1fa699e9b6fa38ae6f51e1ed8c6de9a8dafaf593e
3
+ metadata.gz: 628c79e773ab9286bd477d87379fc9603a0d13e94988c9e2df6bf059c084e5a0
4
+ data.tar.gz: 2db3b8e03f22243882944f53f9e2b1d6f628f91e633119444940cd0a9ae7becf
5
5
  SHA512:
6
- metadata.gz: da624337f6a4bdb9e30b75a29e43970f9435c0854c9b4381e8945edd83f7c041e48c5bd8bb9a8f5c512ccb31f2b4e3ff55cecd7d8dd578c46bf3707f02fa90f5
7
- data.tar.gz: 65636fad104c4853573ef0a2dac53f6c907396a5ff0eef46ba4c03afe2263b6d67f177aa8487ab2dbd3aff9b9ba80d21d63da2d891916b9e1da9058dfbc059b8
6
+ metadata.gz: 05a07328e9b67b309e800a360617e1e0d06bf3ae78939f11051bab4d4674631deeba0dfa2bf14e35ca493a71f43f617c4a064618eb5156aefb678569dcfa3a85
7
+ data.tar.gz: 20376aa46a7ae7b7d74ef4ef6c0ab050dc455cff06f1cbf42b9a13bd16e416e30bea014c2d1b5be6f9dacf4c4ae454527ae348ed772273137b948241794f3e5f
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Libyui::Rake
2
2
 
3
- [![Build Status](https://travis-ci.org/libyui/libyui-rake.svg?branch=master
4
- )](https://travis-ci.org/libyui/libyui-rake)
3
+ [![Workflow Status](https://github.com/libyui/libyui-rake/workflows/CI/badge.svg?branch=master)](
4
+ https://github.com/libyui/libyui-rake/actions?query=branch%3Amaster)
5
5
 
6
6
  Rake tasks to help with uniform handling of libyui related projects. It provides setup for
7
7
  [packaging tasks](http://github.com/openSUSE/packaging_tasks) and add some additional tasks.
@@ -10,7 +10,7 @@ Rake tasks to help with uniform handling of libyui related projects. It provides
10
10
 
11
11
  Create a `Rakefile` with this content:
12
12
 
13
- ```
13
+ ```ruby
14
14
  require "libyui/rake"
15
15
  ```
16
16
 
@@ -32,7 +32,7 @@ configuration choosing from a set of [targets
32
32
  definitions](https://github.com/libyui/libyui-rake/blob/master/data/targets.yml).
33
33
  For example, if you want to submit to SLE12, you can do:
34
34
 
35
- ```
35
+ ```ruby
36
36
  Libyui::Tasks.submit_to(:sle12)
37
37
  ```
38
38
  This method can receive, as a second parameter, the path to your own
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.20
1
+ 0.1.24
data/data/targets.yml CHANGED
@@ -59,11 +59,26 @@
59
59
  obs_project: "Devel:YaST:SLE-15-SP2"
60
60
  obs_sr_project: "SUSE:SLE-15-SP2:Update"
61
61
  obs_target: "SUSE_SLE-15-SP2_GA"
62
+ :sle15sp3:
63
+ obs_api: "https://api.suse.de/"
64
+ obs_project: "Devel:YaST:SLE-15-SP3"
65
+ obs_sr_project: "SUSE:SLE-15-SP3:Update"
66
+ obs_target: "SUSE_SLE-15-SP3_GA"
67
+ :sle15sp4:
68
+ obs_api: "https://api.suse.de/"
69
+ obs_project: "Devel:YaST:SLE-15-SP4"
70
+ obs_sr_project: "SUSE:SLE-15-SP4:Update"
71
+ obs_target: "SUSE_SLE-15-SP4_GA"
72
+ :sle15sp5:
73
+ obs_api: "https://api.suse.de/"
74
+ obs_project: "Devel:YaST:SLE-15-SP5"
75
+ obs_sr_project: "SUSE:SLE-15-SP5:Update"
76
+ obs_target: "SUSE_SLE-15-SP5_GA"
62
77
  :sle_latest:
63
78
  obs_api: "https://api.suse.de/"
64
79
  obs_project: "Devel:YaST:Head"
65
- obs_sr_project: "SUSE:SLE-15-SP3:GA"
66
- obs_target: "SUSE_SLE-15-SP3_GA"
80
+ obs_sr_project: "SUSE:SLE-15-SP5:GA"
81
+ obs_target: "SUSE_SLE-15-SP5_GA"
67
82
  :factory:
68
83
  obs_project: "devel:libraries:libyui"
69
84
  obs_sr_project: "openSUSE:Factory"
data/lib/libyui/rake.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright (C) 2015 SUSE LLC
3
5
  # This library is free software; you can redistribute it and/or modify
@@ -23,7 +25,7 @@ Libyui::Tasks.configuration do |conf|
23
25
  include Libyui::Tasks::Helpers
24
26
 
25
27
  # read package name from spec file name because CWD can have a -branch suffix
26
- main_spec = Dir.glob("package/*.spec").sort.last
28
+ main_spec = Dir.glob("package/*.spec").max
27
29
  conf.package_name = main_spec[/package\/(.*)\.spec$/, 1]
28
30
 
29
31
  conf.version = cmake_version
@@ -36,7 +38,7 @@ Libyui::Tasks.configuration do |conf|
36
38
  end
37
39
 
38
40
  # load libyui-rake tasks
39
- task_path = File.expand_path("../../tasks", __FILE__)
41
+ task_path = File.expand_path("../tasks", __dir__)
40
42
  Dir["#{task_path}/*.rake"].each do |f|
41
43
  load f
42
44
  end
data/lib/libyui/tasks.rb CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
- # Copyright (C) 2015 SUSE LLC
4
+ # Copyright (C) 2015-2021 SUSE LLC
3
5
  # This library is free software; you can redistribute it and/or modify
4
6
  # it only under the terms of version 2.1 of the GNU Lesser General Public
5
7
  # License as published by the Free Software Foundation.
@@ -19,9 +21,9 @@ module Libyui
19
21
  # Facilities to write Libyui related rake tasks.
20
22
  module Tasks
21
23
  # Name of the CMake version file
22
- VERSION_CMAKE = "VERSION.cmake".freeze
24
+ VERSION_CMAKE = "VERSION.cmake"
23
25
  # Targets definition
24
- TARGETS_FILE = File.expand_path("../../../data/targets.yml", __FILE__)
26
+ TARGETS_FILE = File.expand_path("../../data/targets.yml", __dir__)
25
27
 
26
28
  # Wrapper to set up packaging tasks
27
29
  def self.configuration(&block)
@@ -32,6 +34,7 @@ module Libyui
32
34
  targets = YAML.load_file(file)
33
35
  config = targets[target]
34
36
  raise "Not configuration found for #{target}" if config.nil?
37
+
35
38
  Libyui::Tasks.configuration do |conf|
36
39
  config.each do |meth, val|
37
40
  conf.public_send("#{meth}=", val)
@@ -41,29 +44,110 @@ module Libyui
41
44
 
42
45
  # Some helpers to be used on tasks definition
43
46
  module Helpers
44
- # Extracts the value from a CMake string
47
+ # Returns the CMake version from the version file.
48
+ # VERSION_TWEAK is optional.
49
+ #
50
+ # @param filename [String, nil] %{VERSION_CMAKE} by default
51
+ # @return [String] like "1.2.3" or "1.2.3.4"
52
+ def cmake_version(filename = nil)
53
+ filename = cmake_filename(filename)
54
+
55
+ values = cmake_values(filename,
56
+ "VERSION_MAJOR", "VERSION_MINOR", "VERSION_PATCH", "VERSION_TWEAK")
57
+
58
+ values.compact.join(".")
59
+ end
60
+
61
+ # Returns the CMake so version from the version file.
62
+ #
63
+ # @param filename [String, nil] %{VERSION_CMAKE} by default
64
+ # @return [String] like "4.0.0"
65
+ def cmake_so_version(filename = nil)
66
+ filename = cmake_filename(filename)
67
+
68
+ values = cmake_values(filename, "SONAME_MAJOR", "SONAME_MINOR", "SONAME_PATCH")
69
+
70
+ values.compact.join(".")
71
+ end
72
+
73
+ # Bumps the so version in the CMake version file
74
+ #
75
+ # @param filename [string, nil] %{VERSION_CMAKE} by default
76
+ def bump_cmake_so_version(filename = nil)
77
+ filename = cmake_filename(filename)
78
+
79
+ so_version = cmake_so_version(filename).split(".").first.to_i.next
80
+
81
+ content = File.read(filename)
82
+ content.sub!(/(^SET.*SONAME_MAJOR.*)"([^"\n])*"/, "\\1\"#{so_version}\"")
83
+ content.sub!(/(^SET.*SONAME_MINOR.*)"([^"\n])*"/, "\\1\"0\"")
84
+ content.sub!(/(^SET.*SONAME_PATCH.*)"([^"\n])*"/, "\\1\"0\"")
85
+
86
+ File.write(filename, content)
87
+ end
88
+
89
+ # Extract values from a CMake version file
90
+ #
91
+ # @see cmake_value
45
92
  #
46
- # @param s [String] '... SET( VERSION_MAJOR "3") ...'
47
- # @param key [String] 'VERSION_MAJOR'
48
- # @return "3"
49
- def cmake_value(s, key)
93
+ # @param filename [String]
94
+ # @param keys [Array<String>]
95
+ def cmake_values(filename, *keys)
96
+ content = File.read(filename)
97
+
98
+ keys.map { |k| cmake_value(content, k) }
99
+ end
100
+
101
+ # Extracts the value of the given key from the content of a CMake version file
102
+ #
103
+ # @param s [String] e.g., '... SET( VERSION_MAJOR "3") ...'
104
+ # @param key [String] e.g., 'VERSION_MAJOR'
105
+ #
106
+ # @return [String] e.g., "3"
107
+ def cmake_value(text, key)
50
108
  e_key = Regexp.escape(key)
51
- m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(s)
109
+ m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(text)
52
110
  m ? m[1] : nil
53
111
  end
54
112
 
55
- # Returns the CMake version from the version file.
56
- # VERSION_TWEAK is optional.
113
+ # Filename of the CMake version file
57
114
  #
58
- # @param [String] Version file (VERSION_CMAKE by default)
59
- # @return [String] like "1.2.3" or "1.2.3.4"
60
- # @see VERSION_CMAKE
61
- def cmake_version(file = nil)
62
- f = File.read(file || VERSION_CMAKE)
63
- [cmake_value(f, "VERSION_MAJOR"),
64
- cmake_value(f, "VERSION_MINOR"),
65
- cmake_value(f, "VERSION_PATCH"),
66
- cmake_value(f, "VERSION_TWEAK")].compact.join(".")
115
+ # @param filename [string, nil] %{VERSION_CMAKE} if no filename is given
116
+ # @return [String]
117
+ def cmake_filename(filename)
118
+ filename || VERSION_CMAKE
119
+ end
120
+
121
+ # Returns the so version from the given spec file
122
+ #
123
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
124
+ # @return [String, nil] e.g., "12"
125
+ def spec_so_version(filename = nil)
126
+ filename = spec_filename(filename)
127
+
128
+ File.read(filename).scan(/^%define\s+so_version\s+(\d+)/).flatten.first
129
+ end
130
+
131
+ # Bumps the so version in the given spec file
132
+ #
133
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
134
+ def bump_spec_so_version(filename = nil)
135
+ filename = spec_filename(filename)
136
+
137
+ so_version = spec_so_version(filename).to_i.next
138
+
139
+ content = File.read(filename)
140
+ content.gsub!(/^(%define\s+so_version\s+)\d+$/, "\\1#{so_version}")
141
+
142
+ File.write(filename, content)
143
+ end
144
+
145
+ # Filename of the spec file
146
+ #
147
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
148
+ # @return [String]
149
+ def spec_filename(filename)
150
+ filename || Dir.glob("package/*.spec").min
67
151
  end
68
152
  end
69
153
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright (C) 2021 SUSE LLC
5
+ # This library is free software; you can redistribute it and/or modify
6
+ # it only under the terms of version 2.1 of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation.
8
+ #
9
+ # This library is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12
+ # details.
13
+ #
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
+ #++
18
+
19
+ namespace :so_version do
20
+ include Libyui::Tasks::Helpers
21
+
22
+ desc "Check that the so version numbers are in sync"
23
+ task :check do
24
+ so_version = cmake_so_version.split(".").first
25
+
26
+ filenames = Dir.glob("package/*.spec").sort
27
+ filenames.reject! { |f| spec_so_version(f).nil? }
28
+
29
+ mismatches = filenames.reject { |f| spec_so_version(f) == so_version }
30
+
31
+ if mismatches.any?
32
+ messages = ["so version mismatch:"]
33
+ messages << "cmake so version: #{so_version}"
34
+ messages += mismatches.map { |f| "#{f}: #{spec_so_version(f)}" }
35
+
36
+ raise messages.join("\n")
37
+ end
38
+
39
+ puts cmake_so_version if verbose
40
+ end
41
+
42
+ desc "Increase the so version in spec and cmake files"
43
+ task bump: :check do
44
+ bump_cmake_so_version
45
+
46
+ Dir.glob("package/*.spec").each { |f| bump_spec_so_version(f) }
47
+
48
+ puts cmake_so_version if verbose
49
+ end
50
+
51
+ desc "Show the so version"
52
+ task :show do
53
+ puts cmake_so_version
54
+ end
55
+ end
data/lib/tasks/test.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright (C) 2015 SUSE LLC
3
5
  # This library is free software; you can redistribute it and/or modify
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # Copyright (C) 2015 SUSE LLC
3
5
  # This library is free software; you can redistribute it and/or modify
@@ -27,7 +29,7 @@ namespace :version do
27
29
  spec_v = spec_version(spec_filename)
28
30
  if cmake_v != spec_v
29
31
  raise "Version mismatch, #{Libyui::Tasks::VERSION_CMAKE}:#{cmake_v} "\
30
- "#{spec_filename}:#{spec_v}"
32
+ "#{spec_filename}:#{spec_v}"
31
33
  end
32
34
  end
33
35
  puts cmake_v if verbose
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libyui-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.20
4
+ version: 0.1.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - YaST team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-23 00:00:00.000000000 Z
11
+ date: 2022-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: packaging_rake_tasks
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,26 +44,12 @@ dependencies:
30
44
  - - "<"
31
45
  - !ruby/object:Gem::Version
32
46
  version: '99'
33
- - !ruby/object:Gem::Dependency
34
- name: packaging_rake_tasks
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 1.4.8
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 1.4.8
47
47
  description: |
48
48
  Rake tasks that support the workflow of a libyui developer. It allows packaging
49
49
  a repo, sending it to the build service, creating a submit request to the
50
50
  target repo or running the client from the git repo.
51
51
  Heavily inspired by yast-rake.
52
- email: yast-devel@suse.com
52
+ email: yast-devel@lists.opensuse.org
53
53
  executables: []
54
54
  extensions: []
55
55
  extra_rdoc_files: []
@@ -60,13 +60,15 @@ files:
60
60
  - data/targets.yml
61
61
  - lib/libyui/rake.rb
62
62
  - lib/libyui/tasks.rb
63
+ - lib/tasks/so_version.rake
63
64
  - lib/tasks/test.rake
64
65
  - lib/tasks/version.rake
65
- homepage: https://github.com/openSUSE/libyui-rake
66
+ homepage: https://github.com/libyui/libyui-rake
66
67
  licenses:
67
68
  - LGPL-2.1
68
- metadata: {}
69
- post_install_message:
69
+ metadata:
70
+ rubygems_mfa_required: 'true'
71
+ post_install_message:
70
72
  rdoc_options: []
71
73
  require_paths:
72
74
  - lib
@@ -74,15 +76,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
76
  requirements:
75
77
  - - ">="
76
78
  - !ruby/object:Gem::Version
77
- version: '0'
79
+ version: 2.5.0
78
80
  required_rubygems_version: !ruby/object:Gem::Requirement
79
81
  requirements:
80
82
  - - ">="
81
83
  - !ruby/object:Gem::Version
82
84
  version: '0'
83
85
  requirements: []
84
- rubygems_version: 3.0.3
85
- signing_key:
86
+ rubygems_version: 3.3.7
87
+ signing_key:
86
88
  specification_version: 4
87
- summary: Rake tasks providing basic workflow for libyui development
89
+ summary: Rake tasks that provide basic workflow for libyui development
88
90
  test_files: []