libyui-rake 0.1.20 → 0.1.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/libyui/tasks.rb +97 -16
- data/lib/tasks/so_version.rake +53 -0
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb1e31490efabef68a3c8511a5581e701a469f63319bd7c6d8e22583aa237be0
|
4
|
+
data.tar.gz: ba2d271755666488c29ef5ea6bb1463b3c22b83c2d66c29b8535dd69561d39fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb6c9c0ed3946d9356c32b3386b0e7efad6ddd994c7e1f7f0c5ab8a99f5f72017805e6c3a6240729a53e525dd7e63e44498f360d125221c8f1b599a09413939c
|
7
|
+
data.tar.gz: 13b7448b50b61662d6e72aa8e571eeeea993945f0c216820796b4969c6df92368c06966794db5676ba71438410dd7f56a2260bc92709af789d5e237c096385f5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.22
|
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,29 +41,110 @@ module Libyui
|
|
41
41
|
|
42
42
|
# Some helpers to be used on tasks definition
|
43
43
|
module Helpers
|
44
|
-
#
|
44
|
+
# Returns the CMake version from the version file.
|
45
|
+
# VERSION_TWEAK is optional.
|
45
46
|
#
|
46
|
-
# @param
|
47
|
-
# @
|
48
|
-
|
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)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Extract values from a CMake version file
|
87
|
+
#
|
88
|
+
# @see cmake_value
|
89
|
+
#
|
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"
|
49
104
|
def cmake_value(s, key)
|
50
105
|
e_key = Regexp.escape(key)
|
51
106
|
m = /SET\s*\(\s*#{e_key}\s+"([^"]*)"\s*\)/.match(s)
|
52
107
|
m ? m[1] : nil
|
53
108
|
end
|
54
109
|
|
55
|
-
#
|
56
|
-
# VERSION_TWEAK is optional.
|
110
|
+
# Filename of the CMake version file
|
57
111
|
#
|
58
|
-
# @param
|
59
|
-
# @return [String]
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
67
148
|
end
|
68
149
|
end
|
69
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.
|
4
|
+
version: 0.1.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YaST team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-30 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.
|
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.
|
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
|
-
|
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
|