zypper-upgraderepo 1.5.0 → 1.6.0

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: 44bef40acdc725f7422911297413011d47e967d568497f74770ae162494a60dd
4
- data.tar.gz: 4fa8b988dc188ee5deb97671ee31e99db1cf64efde819b8be2b5fef630b0b352
3
+ metadata.gz: 16c361a53d2dfbdfec788a093bd3bf5b8bf0baaedbb2e3c744f1b8ccf9184af0
4
+ data.tar.gz: da0e38eef39182fa0049f3009bbb5ffb35d06cfb0395e8ac58db055e9148c62c
5
5
  SHA512:
6
- metadata.gz: 6385cf9e04fcdd33ee544b64d64e16c123f750493d1a9b3b67eac84d167006debb05fada54488eaa7d5cbb414378d1ffd14e528d086cbe5b93af680ac643aa13
7
- data.tar.gz: ca6a79d5387b76704b93994ff3e11bf0170f1950bbccad3335ff1564cde32d97edf55388c686858c75e594a3e46ac758ba2a66c1fadfba0b5b24157459240d31
6
+ metadata.gz: 26cac0292f39db0f6662924a7bcc14632ff0799af489eb9444c2b08acb4c3efe50e6dd09820d6395f0bb0cd4539c8a08bcb21f9595984e4fffa2fd72a49efdbd
7
+ data.tar.gz: 061ec093eaa6049a19ad15484e617400de8c1901e25f5a418053e0e66c1c24156eb498bc5502dbe54b06706e34f3f213d4411ca218ebec059df2362e7374fe37
data/Gemfile.lock CHANGED
@@ -1,30 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zypper-upgraderepo (1.5.0)
4
+ zypper-upgraderepo (1.6.0)
5
5
  iniparse
6
6
  minitar
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- diff-lcs (1.4.4)
11
+ diff-lcs (1.5.0)
12
12
  iniparse (1.5.0)
13
13
  minitar (0.9)
14
- rake (13.0.1)
15
- rspec (3.9.0)
16
- rspec-core (~> 3.9.0)
17
- rspec-expectations (~> 3.9.0)
18
- rspec-mocks (~> 3.9.0)
19
- rspec-core (3.9.2)
20
- rspec-support (~> 3.9.3)
21
- rspec-expectations (3.9.2)
14
+ rake (13.0.6)
15
+ rspec (3.10.0)
16
+ rspec-core (~> 3.10.0)
17
+ rspec-expectations (~> 3.10.0)
18
+ rspec-mocks (~> 3.10.0)
19
+ rspec-core (3.10.1)
20
+ rspec-support (~> 3.10.0)
21
+ rspec-expectations (3.10.1)
22
22
  diff-lcs (>= 1.2.0, < 2.0)
23
- rspec-support (~> 3.9.0)
24
- rspec-mocks (3.9.1)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-mocks (3.10.2)
25
25
  diff-lcs (>= 1.2.0, < 2.0)
26
- rspec-support (~> 3.9.0)
27
- rspec-support (3.9.3)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-support (3.10.3)
28
28
 
29
29
  PLATFORMS
30
30
  ruby
@@ -36,4 +36,4 @@ DEPENDENCIES
36
36
  zypper-upgraderepo!
37
37
 
38
38
  BUNDLED WITH
39
- 2.1.4
39
+ 2.2.19
@@ -27,6 +27,7 @@ module Zypper
27
27
  options.overrides_filename = nil
28
28
  options.only_invalid = false
29
29
  options.only_protocols = nil
30
+ options.allow_unstable = false
30
31
 
31
32
  opt_parser = OptionParser.new do |opt|
32
33
 
@@ -49,21 +50,25 @@ module Zypper
49
50
  options.operation = :check_current
50
51
  end
51
52
 
52
- opt.on('-N', '--check-next', 'Check the repositories for the next version') do |o|
53
+ opt.on('-n', '--check-next', 'Check the repositories for the next version') do |o|
53
54
  options.operation = :check_next
54
55
  end
55
56
 
56
- opt.on('-C', '--check-to <VERSION>', 'Check for a custom VERSION') do |v|
57
+ opt.on('-C', '--check-for <VERSION>', 'Check for a custom VERSION') do |v|
57
58
  options.version = v
58
- options.operation = :check_to
59
+ options.operation = :check_for
60
+ end
61
+
62
+ opt.on('-l', '--check-last', 'Check the repositories for the last version') do |o|
63
+ options.operation = :check_last
59
64
  end
60
65
 
61
66
  opt.on('-R', '--reset', 'Reset the repositories to the current OS version.') do |v|
62
67
  options.operation = :reset
63
68
  end
64
69
 
65
- opt.on('-u', '--upgrade', 'Upgrade to the last version available') do |o|
66
- options.operation = :upgrade
70
+ opt.on('-u', '--upgrade', 'Upgrade to the next version available') do |o|
71
+ options.operation = :upgrade_to_next
67
72
  end
68
73
 
69
74
  opt.on('-U', '--upgrade-to <VERSION>', 'Upgrade to a specific VERSION') do |v|
@@ -71,9 +76,21 @@ module Zypper
71
76
  options.operation = :upgrade_to
72
77
  end
73
78
 
79
+ opt.on('-L', '--upgrade-to-last', 'Upgrade to the last version available') do |o|
80
+ options.operation = :upgrade_to_last
81
+ end
82
+
83
+ opt.on('-s', '--status', 'Prints the version status of the current and available releases') do |o|
84
+ options.operation = :status
85
+ end
86
+
74
87
  opt.separator ''
75
88
  opt.separator 'Options:'
76
89
 
90
+ opt.on('--allow-unstable', 'Consider the unstable version as a valid release version') do |o|
91
+ options.allow_unstable = true
92
+ end
93
+
77
94
  opt.on('--no-name', 'Don\'t upgrade the name') do |o|
78
95
  options.name = false
79
96
  end
@@ -6,12 +6,20 @@ module Zypper
6
6
 
7
7
  class OsRelease
8
8
 
9
- attr_reader :custom
9
+ attr_reader :custom, :unstable
10
10
 
11
11
  OS_VERSIONS = ['13.1', '13.2', '42.1', '42.2', '42.3', '15.0', '15.1', '15.2', '15.3']
12
12
 
13
+ UNSTABLE_VERSION = '15.4'
13
14
 
14
15
  def initialize(options)
16
+
17
+ if options.allow_unstable
18
+ raise NoUnstableVersionAvailable if UNSTABLE_VERSION.empty?
19
+ OS_VERSIONS << UNSTABLE_VERSION
20
+ @unstable = true
21
+ end
22
+
15
23
  fname = if File.exist? '/etc/os-release'
16
24
  '/etc/os-release'
17
25
  elsif File.exist? '/etc/SuSE-release'
@@ -32,6 +40,10 @@ module Zypper
32
40
  OS_VERSIONS[@current_idx]
33
41
  end
34
42
 
43
+ def last
44
+ OS_VERSIONS[-1]
45
+ end
46
+
35
47
  def next
36
48
  unless last?
37
49
  OS_VERSIONS[@current_idx.next]
@@ -48,6 +60,22 @@ module Zypper
48
60
  end
49
61
  end
50
62
 
63
+ def fullname
64
+ @release['__anonymous__']['PRETTY_NAME'].gsub(/"/, '')
65
+ end
66
+
67
+ def seniority
68
+ OS_VERSIONS.count - @current_idx.next
69
+ end
70
+
71
+ def newer
72
+ if seniority > 0
73
+ OS_VERSIONS[@current_idx.next..-1]
74
+ else
75
+ []
76
+ end
77
+ end
78
+
51
79
  def last?
52
80
  @current_idx == (OS_VERSIONS.count - 1)
53
81
  end
@@ -75,7 +75,7 @@ module Zypper
75
75
 
76
76
  def save
77
77
  @list.each do |i|
78
- i.save
78
+ i[:repo].save
79
79
  end
80
80
  end
81
81
 
@@ -137,6 +137,16 @@ module Zypper
137
137
  end
138
138
  end
139
139
 
140
+ class NoUnstableVersionAvailable < StandardError
141
+ def initialize
142
+ super 'No unstable version is available, remove the --allow-unstable switch to continue'
143
+ end
144
+
145
+ def error_code
146
+ 11
147
+ end
148
+ end
149
+
140
150
  class NoConnection < StandardError
141
151
  def initialize
142
152
  super 'Internet connection has some trouble'
@@ -1,5 +1,5 @@
1
1
  module Zypper
2
2
  module Upgraderepo
3
- VERSION = "1.5.0"
3
+ VERSION = "1.6.0"
4
4
  end
5
5
  end
@@ -56,6 +56,17 @@ module Zypper
56
56
  self.separator
57
57
  end
58
58
 
59
+ def self.status(os_release)
60
+ color = os_release.seniority == 0 ? :green : :yellow
61
+ puts '----------------------------------------------'
62
+ puts "Full name | #{os_release.fullname.bold}"
63
+ puts '----------------------------------------------'
64
+ puts "Current release | #{os_release.current.send(color)}"
65
+ puts "Next release | #{os_release.seniority > 0 ? os_release.next.bold.green : '-'}"
66
+ puts "Last release | #{os_release.last.send(os_release.unstable ? :red : :clean)} (#{os_release.unstable ? 'Unstable'.bold.red : 'Stable'.bold.green})"
67
+ puts "Available | #{os_release.seniority > 0 ? os_release.newer.map{ |i| i.bold }.join(', ') : '-' }"
68
+ puts '----------------------------------------------'
69
+ end
59
70
 
60
71
  private
61
72
 
@@ -119,6 +130,17 @@ module Zypper
119
130
  def self.footer
120
131
  self.separator
121
132
  end
133
+
134
+ def self.status(os_release)
135
+ puts "---------------------------------------------------"
136
+ puts " System releases based on #{os_release.fullname.bold}"
137
+ puts "---------------------------------------------------"
138
+ puts " Current | Next | Last | Available"
139
+ puts "--------------------------------------------------"
140
+ puts " #{os_release.current} | #{os_release.seniority > 0 ? os_release.next.bold.green : ' - ' } | #{os_release.last.send(os_release.unstable ? :red : :clean)} | #{os_release.seniority > 0 ? os_release.newer.join(', ') : '-'}"
141
+ puts "--------------------------------------------------"
142
+ Messages.warning "The #{'last'.bold.red} version should be considered #{'Unstable'.bold.red}" if os_release.unstable
143
+ end
122
144
  end
123
145
 
124
146
 
@@ -154,6 +176,10 @@ module Zypper
154
176
  def self.footer
155
177
  end
156
178
 
179
+ def self.status(os_release)
180
+ puts os_release.seniority.to_s + ' ' + os_release.newer.join(' ')
181
+ end
182
+
157
183
  end
158
184
 
159
185
 
@@ -200,6 +226,15 @@ module Zypper
200
226
  def self.footer
201
227
  end
202
228
 
229
+ def self.status(os_release)
230
+ puts '[os_release]'
231
+ puts "name=#{os_release.fullname}"
232
+ puts "current=#{os_release.current}"
233
+ puts "next=#{os_release.next}"
234
+ puts "last=#{os_release.last}"
235
+ puts "available=#{os_release.newer.join(' ')}"
236
+ puts "allow_unstable=#{os_release.unstable}"
237
+ end
203
238
 
204
239
  private
205
240
 
@@ -42,12 +42,18 @@ module Zypper
42
42
  check_repos(@os_release.next)
43
43
  end
44
44
 
45
- def check_to
45
+ def check_for
46
46
  @repos.upgrade!(@os_release.custom)
47
47
  check_repos(@os_release.custom)
48
48
  end
49
49
 
50
- def upgrade
50
+ def check_last
51
+ raise AlreadyUpgraded, 'latest' if @os_release.last?
52
+ @repos.upgrade!(@os_release.last)
53
+ check_repos(@os_release.last)
54
+ end
55
+
56
+ def upgrade_to_next
51
57
  raise AlreadyUpgraded, 'latest' if @os_release.last?
52
58
  @repos.upgrade!(@os_release.next)
53
59
  upgrade_repos(@os_release.next)
@@ -59,10 +65,19 @@ module Zypper
59
65
  upgrade_repos(@os_release.custom)
60
66
  end
61
67
 
68
+ def upgrade_to_last
69
+ raise AlreadyUpgraded, 'latest' if @os_release.last?
70
+ @repos.upgrade!(@os_release.last)
71
+ upgrade_repos(@os_release.last)
72
+ end
73
+
62
74
  def reset
63
75
  upgrade_repos(@os_release.current)
64
76
  end
65
77
 
78
+ def status
79
+ @view_class.status(@os_release)
80
+ end
66
81
 
67
82
  private
68
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zypper-upgraderepo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Mucciante
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-17 00:00:00.000000000 Z
11
+ date: 2022-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,7 +120,7 @@ licenses:
120
120
  metadata:
121
121
  bug_tracker_uri: https://github.com/fabiomux/zypper-upgraderepo/issues
122
122
  changelog_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelogs
123
- documentation_uri: https://www.rubydoc.info/gems/zypper-upgraderepo/1.5.0
123
+ documentation_uri: https://www.rubydoc.info/gems/zypper-upgraderepo/1.6.0
124
124
  homepage_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html
125
125
  source_code_uri: https://github.com/fabiomux/zypper-upgraderepo
126
126
  wiki_uri: https://github.com/fabiomux/zypper-upgraderepo/wiki
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.0.8
142
+ rubygems_version: 3.2.19
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: Zypper addon to check and upgrade local repositories.