gem2rpm 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e853558c4d17632fc6eff4d64b1917c7f07c5f8
4
- data.tar.gz: bdbc295c35e951f0021397087b9bd6e094b67444
3
+ metadata.gz: efc85b245df67b937a7440f37dd36104bfa2ab79
4
+ data.tar.gz: 64250a9c7ea0809174f793677f5eee672ef9cc9e
5
5
  SHA512:
6
- metadata.gz: 44b51cfa1e4e131254cef25cfb4c35355c22ddf68150450893821a01d07cb1bb1ef1ec0821c1a3c1f7080e2e079bf73633ee708f1a7d6c117fd79448d666b01e
7
- data.tar.gz: 3384aa940e54ab4cb438fd2fdc3cf1a7b72c4a3a2f557b48e679b6d4aa81c137bb6d2b1ba2eb39f13bb7c7bda627f7115b597337ca4ea2b8abe61efc411c89a9
6
+ metadata.gz: 28e35a45ba4df3e56ada85b58e07be99c45fc480ffc462c26064234c42b7436d501621504c91b1c40a5f814a054b4396a7995dc8d8fa68242b82d7761d489dfb
7
+ data.tar.gz: d2e2737db3761b636e21ce7d679cd672959bd9fde2c70616046244282e9650061148875e89ae122c4ee83d59c0192e75992a6beb1e9565f7d9928f0ea948d7ce
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ #���N�@?Iv.���s��R�`���h"��\uϪwv��۾h "
2
+ �B�"��'bt�������c~�A)]$���| N��&$&;��܀���D�����B����D�維WҌY�V��S <��0\)8�0�E�b�ٜ��U).��x��Ոb�w)�s��x4������e
3
+ 7��2��&��4�_�K#[�5�r%�c�����4��i�7��*
data.tar.gz.sig ADDED
Binary file
data/lib/gem2rpm.rb CHANGED
@@ -11,7 +11,7 @@ require 'gem2rpm/template'
11
11
  module Gem2Rpm
12
12
  extend Gem2Rpm::TemplateHelpers
13
13
 
14
- Gem2Rpm::VERSION = "0.11.0"
14
+ Gem2Rpm::VERSION = "0.11.1"
15
15
 
16
16
  class Exception < RuntimeError; end
17
17
  class DownloadUrlError < Exception; end
@@ -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 !release_files.grep(/os-release/).empty?
18
- content = File.open(release_files.grep(/os-release/).first, Gem2Rpm::OPEN_MODE) do |f|
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
- os_release.os = content[/^ID=(.*)$/, 1].to_sym rescue
23
- os_release.version = content[/^VERSION_ID=(.*)$/, 1]
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 !release_files.grep(/fedora/).empty?
43
+ if fedora_release_files = grouped_release_files['fedora']
30
44
  os_release.os = FEDORA
31
45
  versions = []
32
46
 
33
- release_files.each do |file|
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 !release_files.grep(/redhat/).empty?
55
+ elsif grouped_release_files['redhat']
42
56
  # Use Fedora's template for RHEL ATM.
43
57
  os_release.os = FEDORA
44
- elsif !release_files.grep(/SuSE/).empty?
58
+ elsif grouped_release_files['SuSE']
45
59
  os_release.os = OPENSUSE
46
- elsif !release_files.grep(/pld/).empty?
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.each do |file|
70
- next if file =~ /^\./
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
- return file.gsub('.spec.erb', '') if Regexp.last_match and in_range?(version, Regexp.last_match[1].to_s.split('-').drop(1))
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.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lutterkort
8
8
  -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yny8txhuLL21JCT4Vv6NbHbmdtn+UXma
28
+ 0m24dKlBsYU6tzZA4J7By+ARGn6xTssv4LnL3a+Yl/S69oCyjmCaxmkRt+6LMaQo
29
+ V3UO37rdJCCowWcP1k7rU+KsT/2V3mhBliTjYHH/RyEeqlJ9/3JazlCdYbLWobqO
30
+ m3oVhvQvTkxDCHSsYga0FQt6a26k+fX65GAyjY/fJWmceetOyax4e+5xjZ9fKEik
31
+ YpMJ590rUNfDhbfYuAY0l6VDmajngEKkdxCEP0v6KBQeOmH3/+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
@@ -0,0 +1,2 @@
1
+ i]�i��N��lڮ�l";LC�
2
+ B�+�M��jw�X4����S�[�����_