gem2rpm 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +3 -0
- data.tar.gz.sig +0 -0
- data/lib/gem2rpm.rb +1 -1
- data/lib/gem2rpm/distro.rb +34 -12
- metadata +27 -4
- metadata.gz.sig +2 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efc85b245df67b937a7440f37dd36104bfa2ab79
|
4
|
+
data.tar.gz: 64250a9c7ea0809174f793677f5eee672ef9cc9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e35a45ba4df3e56ada85b58e07be99c45fc480ffc462c26064234c42b7436d501621504c91b1c40a5f814a054b4396a7995dc8d8fa68242b82d7761d489dfb
|
7
|
+
data.tar.gz: d2e2737db3761b636e21ce7d679cd672959bd9fde2c70616046244282e9650061148875e89ae122c4ee83d59c0192e75992a6beb1e9565f7d9928f0ea948d7ce
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/lib/gem2rpm.rb
CHANGED
data/lib/gem2rpm/distro.rb
CHANGED
@@ -9,28 +9,42 @@ module Gem2Rpm
|
|
9
9
|
|
10
10
|
OsRelease = Struct.new :os, :version
|
11
11
|
|
12
|
+
# Returns struct with OS detected based on release files.
|
13
|
+
#
|
14
|
+
# Distro.os_release.os contains either one of supported distributions
|
15
|
+
# (:fedora, :pld, :opensuse) or :default for unrecognized/unsupported
|
16
|
+
# distributions.
|
17
|
+
#
|
18
|
+
# Distro.os_release.version contains version if it is possible to detect.
|
12
19
|
def self.os_release
|
13
20
|
@os_release ||= begin
|
14
21
|
os_release = OsRelease.new DEFAULT
|
15
22
|
|
23
|
+
grouped_release_files = release_files.group_by do |file|
|
24
|
+
File.basename(file)[/os-release|fedora|redhat|SuSE|pld/] || 'unrecognized'
|
25
|
+
end
|
26
|
+
|
16
27
|
# Try os-release first.
|
17
|
-
if
|
18
|
-
content = File.open(
|
28
|
+
if os_release_files = grouped_release_files['os-release']
|
29
|
+
content = File.open(os_release_files.first, Gem2Rpm::OPEN_MODE) do |f|
|
19
30
|
f.read
|
20
31
|
end
|
21
32
|
|
22
|
-
|
23
|
-
|
33
|
+
begin
|
34
|
+
os_release.os = content[/^ID=(.*)$/, 1].to_sym
|
35
|
+
os_release.version = content[/^VERSION_ID=(.*)$/, 1]
|
36
|
+
rescue
|
37
|
+
end
|
24
38
|
end
|
25
39
|
|
26
40
|
# If os-release failed (it is empty or has not enough information),
|
27
41
|
# try some other release files.
|
28
42
|
if os_release.os == DEFAULT
|
29
|
-
if
|
43
|
+
if fedora_release_files = grouped_release_files['fedora']
|
30
44
|
os_release.os = FEDORA
|
31
45
|
versions = []
|
32
46
|
|
33
|
-
|
47
|
+
fedora_release_files.each do |file|
|
34
48
|
/\d+/ =~ File.open(file, OPEN_MODE).readline
|
35
49
|
versions << Regexp.last_match.to_s if Regexp.last_match
|
36
50
|
end
|
@@ -38,12 +52,12 @@ module Gem2Rpm
|
|
38
52
|
versions.uniq!
|
39
53
|
|
40
54
|
os_release.version = versions.first if versions.length == 1
|
41
|
-
elsif
|
55
|
+
elsif grouped_release_files['redhat']
|
42
56
|
# Use Fedora's template for RHEL ATM.
|
43
57
|
os_release.os = FEDORA
|
44
|
-
elsif
|
58
|
+
elsif grouped_release_files['SuSE']
|
45
59
|
os_release.os = OPENSUSE
|
46
|
-
elsif
|
60
|
+
elsif grouped_release_files['pld']
|
47
61
|
os_release.os = PLD
|
48
62
|
end
|
49
63
|
end
|
@@ -56,21 +70,29 @@ module Gem2Rpm
|
|
56
70
|
template_by_os_version(os_release.os, os_release.version) || DEFAULT
|
57
71
|
end
|
58
72
|
|
73
|
+
# Provides list of release files found on the system.
|
59
74
|
def self.release_files
|
60
75
|
@release_files ||=
|
61
76
|
Dir.glob('/etc/{os-release,*{_version,-release}}*').uniq.select {|e| File.file? e}
|
62
77
|
end
|
63
78
|
|
79
|
+
# Allows to override release files list.
|
64
80
|
def self.release_files=(files)
|
81
|
+
@os_release = nil
|
65
82
|
@release_files = files
|
66
83
|
end
|
67
84
|
|
85
|
+
# Tries to find best suitable template for specified os and version.
|
68
86
|
def self.template_by_os_version(os, version)
|
69
|
-
Template.list.
|
70
|
-
|
87
|
+
os_templates = Template.list.grep /#{os}.*\.spec\.erb/
|
88
|
+
|
89
|
+
os_templates.each do |file|
|
71
90
|
# We want only distro RubyGems templates to get the right versions
|
72
91
|
next unless file =~ /^#{os}((-([0-9]+\.{0,1}[0-9]+){0,}){0,}(-(#{ROLLING_RELEASES.join('|')})){0,1}).spec.erb/
|
73
|
-
|
92
|
+
|
93
|
+
if match = Regexp.last_match
|
94
|
+
return file.gsub('.spec.erb', '') if in_range?(version, match[1].to_s.split('-').drop(1)) || match[1].empty?
|
95
|
+
end
|
74
96
|
end
|
75
97
|
|
76
98
|
nil
|
metadata
CHANGED
@@ -1,15 +1,37 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem2rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lutterkort
|
8
8
|
- Vit Ondruch
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
11
|
+
cert_chain:
|
12
|
+
- |
|
13
|
+
-----BEGIN CERTIFICATE-----
|
14
|
+
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRIwEAYDVQQDDAl2Lm9u
|
15
|
+
ZHJ1Y2gxFzAVBgoJkiaJk/IsZAEZFgd0aXNjYWxpMRIwEAYKCZImiZPyLGQBGRYC
|
16
|
+
Y3owHhcNMTQxMjA0MTMyNDA3WhcNMTUxMjA0MTMyNDA3WjBBMRIw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Y0l6VDmajngEKkdxCEP0v6KBQeOmH3/+oOxcSVnc3NAp2J
|
32
|
+
eE+DjyUv9Cq0yBFpfdrGk1fHwX/dtWcFrsKNxw==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
13
35
|
dependencies: []
|
14
36
|
description: |2
|
15
37
|
Generate source rpms and rpm spec files from a Ruby Gem.
|
@@ -47,7 +69,8 @@ files:
|
|
47
69
|
- templates/opensuse.spec.erb
|
48
70
|
- templates/pld.spec.erb
|
49
71
|
homepage: https://github.com/fedora-ruby/gem2rpm
|
50
|
-
licenses:
|
72
|
+
licenses:
|
73
|
+
- GPLv2+
|
51
74
|
metadata: {}
|
52
75
|
post_install_message:
|
53
76
|
rdoc_options: []
|
metadata.gz.sig
ADDED