libyui-rake 0.1.17 → 0.1.23

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: a16d63403d503679095db38f9e1d7e901f1d9a29e9c395a8ece98e7dee3216e5
4
- data.tar.gz: 645f9bfab51c1f5c7ba7b14f405c0af52295ad0ce4a79c6795568d59ecab5b8c
3
+ metadata.gz: cdb114dfba2f8d8816e5f2fcfa000f95de9cf8fda7d6e57b787ea690442fd62f
4
+ data.tar.gz: 88bc3c1d5ddd10bde1d811aa9514d9a65d137cbb1cada7dcc52ae9bea5285c3c
5
5
  SHA512:
6
- metadata.gz: dc504b96a770598cc8ff65c8a13553160a9870acbdff6d21e8c34fd9828d55da7cad3309ef457b58b6a12d4deb3326203c2550de2d0532fd31e7e77330e1c354
7
- data.tar.gz: e8b4268efcf73975f32e6b1adbbc74b497be7f461b742821a752fdf82e733bbe4690d890c297377b1faf6596b81a4a788d4e80a9e29f5317042e1863ac97f9a8
6
+ metadata.gz: 50318f61dac4997534ed0c431ac502c2f1d9e22daf943ad14959535de68968fc9884434b3531e9a8f74f9120ad2316a9e788481bac20f855cb14fd5cf9699120
7
+ data.tar.gz: 0dbbee57f083abcdc2499567177c311435a7146714cefd0037d77e9694df908c5f51b1467430dcdd743346d6494f6aa11f1a2cf4c397ba727ba5d40a84572987
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.17
1
+ 0.1.23
data/data/targets.yml CHANGED
@@ -54,11 +54,26 @@
54
54
  obs_project: "Devel:YaST:SLE-15-SP1"
55
55
  obs_sr_project: "SUSE:SLE-15-SP1:Update"
56
56
  obs_target: "SUSE_SLE-15-SP1_GA"
57
+ :sle15sp2:
58
+ obs_api: "https://api.suse.de/"
59
+ obs_project: "Devel:YaST:SLE-15-SP2"
60
+ obs_sr_project: "SUSE:SLE-15-SP2:Update"
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"
57
72
  :sle_latest:
58
73
  obs_api: "https://api.suse.de/"
59
74
  obs_project: "Devel:YaST:Head"
60
- obs_sr_project: "SUSE:SLE-15-SP2:GA"
61
- obs_target: "SUSE_SLE-15-SP2_GA"
75
+ obs_sr_project: "SUSE:SLE-15-SP4:GA"
76
+ obs_target: "SUSE_SLE-15-SP4_GA"
62
77
  :factory:
63
78
  obs_project: "devel:libraries:libyui"
64
79
  obs_sr_project: "openSUSE:Factory"
data/lib/libyui/tasks.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (C) 2015 SUSE LLC
2
+ # Copyright (C) 2015-2021 SUSE LLC
3
3
  # This library is free software; you can redistribute it and/or modify
4
4
  # it only under the terms of version 2.1 of the GNU Lesser General Public
5
5
  # License as published by the Free Software Foundation.
@@ -41,35 +41,110 @@ module Libyui
41
41
 
42
42
  # Some helpers to be used on tasks definition
43
43
  module Helpers
44
- # Read the version from spec file
45
- # @return [String] like "1.2.3"
46
- def spec_version(spec_filename)
47
- File.read(spec_filename)[/^Version:\s*(\S+)/, 1]
44
+ # Returns the CMake version from the version file.
45
+ # VERSION_TWEAK is optional.
46
+ #
47
+ # @param filename [String, nil] %{VERSION_CMAKE} by default
48
+ # @return [String] like "1.2.3" or "1.2.3.4"
49
+ def cmake_version(filename = nil)
50
+ filename = cmake_filename(filename)
51
+
52
+ values = cmake_values(filename,
53
+ "VERSION_MAJOR", "VERSION_MINOR", "VERSION_PATCH", "VERSION_TWEAK")
54
+
55
+ values.compact.join(".")
56
+ end
57
+
58
+ # Returns the CMake so version from the version file.
59
+ #
60
+ # @param filename [String, nil] %{VERSION_CMAKE} by default
61
+ # @return [String] like "4.0.0"
62
+ def cmake_so_version(filename = nil)
63
+ filename = cmake_filename(filename)
64
+
65
+ values = cmake_values(filename, "SONAME_MAJOR", "SONAME_MINOR", "SONAME_PATCH")
66
+
67
+ values.compact.join(".")
68
+ end
69
+
70
+ # Bumps the so version in the CMake version file
71
+ #
72
+ # @param filename [string, nil] %{VERSION_CMAKE} by default
73
+ def bump_cmake_so_version(filename = nil)
74
+ filename = cmake_filename(filename)
75
+
76
+ so_version = cmake_so_version(filename).split(".").first.to_i.next
77
+
78
+ content = File.read(filename)
79
+ content.sub!(/(^SET.*SONAME_MAJOR.*)"([^"\n])*"/, "\\1\"#{so_version}\"")
80
+ content.sub!(/(^SET.*SONAME_MINOR.*)"([^"\n])*"/, "\\1\"0\"")
81
+ content.sub!(/(^SET.*SONAME_PATCH.*)"([^"\n])*"/, "\\1\"0\"")
82
+
83
+ File.write(filename, content)
48
84
  end
49
85
 
50
- # Extracts the value from a CMake string
86
+ # Extract values from a CMake version file
87
+ #
88
+ # @see cmake_value
51
89
  #
52
- # @param s [String] '... SET( VERSION_MAJOR "3") ...'
53
- # @param key [String] 'VERSION_MAJOR'
54
- # @return "3"
90
+ # @param filename [String]
91
+ # @param keys [Array<String>]
92
+ def cmake_values(filename, *keys)
93
+ content = File.read(filename)
94
+
95
+ keys.map { |k| cmake_value(content, k) }
96
+ end
97
+
98
+ # Extracts the value of the given key from the content of a CMake version file
99
+ #
100
+ # @param s [String] e.g., '... SET( VERSION_MAJOR "3") ...'
101
+ # @param key [String] e.g., 'VERSION_MAJOR'
102
+ #
103
+ # @return [String] e.g., "3"
55
104
  def cmake_value(s, key)
56
105
  e_key = Regexp.escape(key)
57
106
  m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(s)
58
107
  m ? m[1] : nil
59
108
  end
60
109
 
61
- # Returns the CMake version from the version file.
62
- # VERSION_TWEAK is optional.
110
+ # Filename of the CMake version file
63
111
  #
64
- # @param [String] Version file (VERSION_CMAKE by default)
65
- # @return [String] like "1.2.3" or "1.2.3.4"
66
- # @see VERSION_CMAKE
67
- def cmake_version(file = nil)
68
- f = File.read(file || VERSION_CMAKE)
69
- [cmake_value(f, "VERSION_MAJOR"),
70
- cmake_value(f, "VERSION_MINOR"),
71
- cmake_value(f, "VERSION_PATCH"),
72
- cmake_value(f, "VERSION_TWEAK")].compact.join(".")
112
+ # @param filename [string, nil] %{VERSION_CMAKE} if no filename is given
113
+ # @return [String]
114
+ def cmake_filename(filename)
115
+ filename || VERSION_CMAKE
116
+ end
117
+
118
+ # Returns the so version from the given spec file
119
+ #
120
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
121
+ # @return [String, nil] e.g., "12"
122
+ def spec_so_version(filename = nil)
123
+ filename = spec_filename(filename)
124
+
125
+ File.read(filename).scan(/^%define\s+so_version\s+(\d+)/).flatten.first
126
+ end
127
+
128
+ # Bumps the so version in the given spec file
129
+ #
130
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
131
+ def bump_spec_so_version(filename = nil)
132
+ filename = spec_filename(filename)
133
+
134
+ so_version = spec_so_version(filename).to_i.next
135
+
136
+ content = File.read(filename)
137
+ content.gsub!(/^(%define\s+so_version\s+)\d+$/, "\\1#{so_version}")
138
+
139
+ File.write(filename, content)
140
+ end
141
+
142
+ # Filename of the spec file
143
+ #
144
+ # @param filename [String, nil] if nil, it uses the shortest spec filename
145
+ # @return [String]
146
+ def spec_filename(filename)
147
+ filename || Dir.glob("package/*.spec").sort.first
73
148
  end
74
149
  end
75
150
  end
@@ -0,0 +1,53 @@
1
+ #--
2
+ # Copyright (C) 2021 SUSE LLC
3
+ # This library is free software; you can redistribute it and/or modify
4
+ # it only under the terms of version 2.1 of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation.
6
+ #
7
+ # This library is distributed in the hope that it will be useful, but WITHOUT
8
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
+ # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
10
+ # details.
11
+ #
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
+ #++
16
+
17
+ namespace :so_version do
18
+ include Libyui::Tasks::Helpers
19
+
20
+ desc "Check that the so version numbers are in sync"
21
+ task :check do
22
+ so_version = cmake_so_version.split(".").first
23
+
24
+ filenames = Dir.glob("package/*.spec").sort
25
+ filenames.reject! { |f| spec_so_version(f).nil? }
26
+
27
+ mismatches = filenames.select { |f| spec_so_version(f) != so_version }
28
+
29
+ if mismatches.any?
30
+ messages = ["so version mismatch:"]
31
+ messages << "cmake so version: #{so_version}"
32
+ messages += mismatches.map { |f| "#{f}: #{spec_so_version(f)}" }
33
+
34
+ raise messages.join("\n")
35
+ end
36
+
37
+ puts cmake_so_version if verbose
38
+ end
39
+
40
+ desc "Increase the so version in spec and cmake files"
41
+ task bump: :check do
42
+ bump_cmake_so_version
43
+
44
+ Dir.glob("package/*.spec").each { |f| bump_spec_so_version(f) }
45
+
46
+ puts cmake_so_version if verbose
47
+ end
48
+
49
+ desc "Show the so version"
50
+ task :show do
51
+ puts cmake_so_version
52
+ end
53
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libyui-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - YaST team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-13 00:00:00.000000000 Z
11
+ date: 2021-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.4.8
39
+ version: '1.5'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 1.4.8
46
+ version: '1.5'
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
@@ -60,6 +60,7 @@ 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
66
  homepage: https://github.com/openSUSE/libyui-rake
@@ -81,7 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
82
  - !ruby/object:Gem::Version
82
83
  version: '0'
83
84
  requirements: []
84
- rubygems_version: 3.0.3
85
+ rubyforge_project:
86
+ rubygems_version: 2.7.6.2
85
87
  signing_key:
86
88
  specification_version: 4
87
89
  summary: Rake tasks providing basic workflow for libyui development