zypper-upgraderepo 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/zypper/upgraderepo/repository.rb +11 -5
- data/lib/zypper/upgraderepo/request.rb +14 -6
- data/lib/zypper/upgraderepo/requests/http.rb +16 -3
- data/lib/zypper/upgraderepo/requests/local.rb +2 -0
- data/lib/zypper/upgraderepo/traversable.rb +1 -1
- data/lib/zypper/upgraderepo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f063f691c5f780a94c2016e4be62f636c4e70e6f21377993b3a2b6c57d7ca59
|
4
|
+
data.tar.gz: 68b13bc527f0f87456a4613c2ed7c3ab23214991a6a8eea09c0d94b8da7c7c73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78c01cb2796e0ada9252bccbbcf027b2e9f81e09d593f6b2f682c86d717e348c02ee58ba2008696edccc441288bb8ad569dc90d42d362c5acd94945d8580f82e
|
7
|
+
data.tar.gz: b406a9567d05634b2c4f906e5fb925b6d9ae78275f9f4fd42c920b1ea2bac696d14db2ac081b2f40ed7bd331eeb87e38a6ceec8563c0a2a6103985d8dd79d662
|
data/Gemfile.lock
CHANGED
@@ -65,12 +65,10 @@ module Zypper
|
|
65
65
|
def resolve_variables!(version)
|
66
66
|
each_with_number do |r|
|
67
67
|
if r.url =~ /\$/
|
68
|
-
r.url = r.url
|
69
|
-
.gsub(/\$releasever_minor/, version.split('.')[1])
|
70
|
-
.gsub(/\$releasever/, version)
|
71
|
-
.gsub(/\$basearch/, @arch)
|
72
|
-
.gsub(/\$arch/, @cpu_arch)
|
68
|
+
r.url = expand_variables(r.url, version)
|
73
69
|
end
|
70
|
+
r.name = expand_variables(r.name, version)
|
71
|
+
r.alias = expand_variables(r.alias, version)
|
74
72
|
end
|
75
73
|
|
76
74
|
self
|
@@ -85,6 +83,14 @@ module Zypper
|
|
85
83
|
|
86
84
|
private
|
87
85
|
|
86
|
+
def expand_variables(str, version)
|
87
|
+
str.gsub(/\$releasever_major/, version.split('.')[0])
|
88
|
+
.gsub(/\$releasever_minor/, version.split('.')[1])
|
89
|
+
.gsub(/\$releasever/, version)
|
90
|
+
.gsub(/\$basearch/, @arch)
|
91
|
+
.gsub(/\$arch/, @cpu_arch)
|
92
|
+
end
|
93
|
+
|
88
94
|
def load_overrides(filename)
|
89
95
|
raise FileNotFound, filename unless File.exist?(filename)
|
90
96
|
ini = IniParse.parse(File.read(filename))
|
@@ -6,7 +6,6 @@ require_relative 'requests/http.rb'
|
|
6
6
|
module Zypper
|
7
7
|
module Upgraderepo
|
8
8
|
|
9
|
-
|
10
9
|
class Request
|
11
10
|
|
12
11
|
def self.build(repo, timeout)
|
@@ -14,7 +13,7 @@ module Zypper
|
|
14
13
|
|
15
14
|
raise InvalidProtocol, repo unless @@registry.include? repo.protocol
|
16
15
|
|
17
|
-
Object.const_get(
|
16
|
+
Object.const_get(self.find_class(repo)).new(repo, timeout)
|
18
17
|
end
|
19
18
|
|
20
19
|
def self.protocols
|
@@ -26,17 +25,26 @@ module Zypper
|
|
26
25
|
def self.load_requests
|
27
26
|
res = {}
|
28
27
|
Requests.constants.each do |klass|
|
29
|
-
Object.const_get("Zypper::Upgraderepo::Requests::#{klass}")
|
30
|
-
|
28
|
+
obj = Object.const_get("Zypper::Upgraderepo::Requests::#{klass}")
|
29
|
+
obj.register_protocol.each do |protocol|
|
30
|
+
res[protocol] ||= {}
|
31
|
+
res[protocol][obj.domain] = "Zypper::Upgraderepo::Requests::#{klass}"
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
34
35
|
res
|
35
36
|
end
|
36
37
|
|
37
|
-
|
38
|
-
|
38
|
+
def self.find_class(repo)
|
39
|
+
domain = URI(repo.url).hostname
|
39
40
|
|
41
|
+
if @@registry[repo.protocol].has_key? domain
|
42
|
+
return @@registry[repo.protocol][domain]
|
43
|
+
else
|
44
|
+
return @@registry[repo.protocol]['default']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
40
48
|
|
41
49
|
end
|
42
50
|
end
|
@@ -93,6 +93,8 @@ module Zypper
|
|
93
93
|
|
94
94
|
def self.register_protocol; ['https', 'http'] end
|
95
95
|
|
96
|
+
def self.domain; 'default' end
|
97
|
+
|
96
98
|
def evaluate_alternative(version)
|
97
99
|
if not_found?
|
98
100
|
return traverse_url(URI(url), version)
|
@@ -114,14 +116,25 @@ module Zypper
|
|
114
116
|
available?
|
115
117
|
end
|
116
118
|
|
117
|
-
def subfolders
|
118
|
-
|
119
|
+
def subfolders(uri)
|
120
|
+
ping.body.to_s.scan(Regexp.new('href=[\'\"][^\/\"]+\/[\'\"]')).delete_if do |x|
|
119
121
|
x =~ /^\// || x =~ /^\.\./ || x =~ /\:\/\// || x =~ /href=[\"\'](media\.1|boot|EFI)\/[\"\']/
|
120
122
|
end.uniq.map do |d|
|
121
123
|
d.scan(/href=[\"\']([^"]+)[\'\"]/).pop.pop
|
122
124
|
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class DownloadOpensuseOrgRequest < HttpRequest
|
129
|
+
|
130
|
+
def self.domain; 'download.opensuse.org' end
|
123
131
|
|
124
|
-
|
132
|
+
def subfolders(uri)
|
133
|
+
u = URI(uri.to_s)
|
134
|
+
u.path = "/download#{u.path}"
|
135
|
+
u.query = 'jsontable'
|
136
|
+
require 'json'
|
137
|
+
JSON.parse(ping(u, false).body.to_s)["data"].map { |x| x["name"] }
|
125
138
|
end
|
126
139
|
end
|
127
140
|
|
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.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fabio Mucciante
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,7 +116,7 @@ licenses:
|
|
116
116
|
metadata:
|
117
117
|
bug_tracker_uri: https://github.com/fabiomux/zypper-upgraderepo/issues
|
118
118
|
changelog_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html#changelog
|
119
|
-
documentation_uri: https://www.rubydoc.info/gems/zypper-upgraderepo/1.7.
|
119
|
+
documentation_uri: https://www.rubydoc.info/gems/zypper-upgraderepo/1.7.1
|
120
120
|
homepage_uri: https://freeaptitude.altervista.org/projects/zypper-upgraderepo.html
|
121
121
|
source_code_uri: https://github.com/fabiomux/zypper-upgraderepo
|
122
122
|
wiki_uri: https://github.com/fabiomux/zypper-upgraderepo/wiki
|