gem2rpm 1.0.2 → 2.0.0
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 +4 -4
- data/README.md +16 -10
- data/bin/gem2rpm +1 -1
- data/lib/gem2rpm/configuration.rb +9 -0
- data/lib/gem2rpm/context.rb +52 -0
- data/lib/gem2rpm/gem/dependency.rb +1 -7
- data/lib/gem2rpm/rpm_dependency.rb +51 -18
- data/lib/gem2rpm/rpm_dependency_list.rb +9 -2
- data/lib/gem2rpm.rb +16 -36
- data/templates/default.spec.erb +2 -2
- data/templates/fedora-38-rawhide-vagrant-plugin.spec.erb +108 -0
- data/templates/fedora-38-rawhide.spec.erb +115 -0
- data/templates/opensuse.spec.erb +1 -1
- metadata +9 -12
- data/lib/gem2rpm/gem/format.rb +0 -19
- data/lib/gem2rpm/gem/package.rb +0 -14
- data/lib/gem2rpm/gem/spec_fetcher.rb +0 -24
- /data/templates/{fedora-27-rawhide-vagrant-plugin.spec.erb → fedora-27-37-vagrant-plugin.spec.erb} +0 -0
- /data/templates/{fedora-27-rawhide.spec.erb → fedora-27-37.spec.erb} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11d77266b1e026b1a36bea252f44e5f4173a4e28676f68430a9fdf3e87e57796
|
|
4
|
+
data.tar.gz: 220723ca0dc6a1aacc82eacc45e814e801e53d10f9eb3783763e19010d059dbe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e34849b598bce5ce3b320f4a2b58edac3f56525b572f7fdf3bdeb59da4df031b64aba92e6974ff664030dd2ab5a9517d1d1038b5c50b47e04200c7cd2e95f1c
|
|
7
|
+
data.tar.gz: 7126e6bcc0686ba628d3ea371b0b23a167d7ba52c9cda1b12aeefbdd2e1a6967d65bbd4e5dc01b7f1136b50a818e90f31706bda902b94af267641cd7258ef85c
|
data/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
[](https://travis-ci.org/fedora-ruby/gem2rpm)
|
|
2
|
-
|
|
3
1
|
# gem2rpm
|
|
4
2
|
|
|
5
3
|
gem2rpm converts RubyGems packages to RPM spec files.
|
|
@@ -34,14 +32,26 @@ and run gem2rpm:
|
|
|
34
32
|
```
|
|
35
33
|
$ gem2rpm GEM-1.2.3.gem
|
|
36
34
|
```
|
|
35
|
+
This will print an rpm spec file based on the information contained in the gem's spec file.
|
|
37
36
|
|
|
38
|
-
You can also use the `--fetch` flag to fetch the (latest) gem before generating the spec file,
|
|
37
|
+
You can also use the `--fetch` flag to fetch the (latest) gem before generating the spec file,
|
|
38
|
+
achieving similar effect as running 'gem fetch GEM' plus 'gem2rpm GEM-1.2.3.gem':
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
$ gem2rpm --fetch GEM
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
>[!TIP]
|
|
45
|
+
> For gems that include prebuilt binary extension (e.g. for `nokogiri`),
|
|
46
|
+
> the `gem fetch` downloads its platform-specific version.
|
|
47
|
+
> gem2rpm, however, always fetches plain Ruby version (which includes the full source code but no prebuilt binaries).
|
|
48
|
+
> To replicate this behavior with `gem fetch`, use the `--platform ruby` option:
|
|
49
|
+
>
|
|
50
|
+
> ```
|
|
51
|
+
> $ gem fetch GEM --platform ruby
|
|
52
|
+
> ```
|
|
53
|
+
|
|
54
|
+
In general, it is necessary to edit the generated spec file because the gem is missing some important information that is customarily provided in rpm's, most notably the license and the changelog.
|
|
45
55
|
|
|
46
56
|
|
|
47
57
|
Rather than editing the generated specfile, edit the template from which
|
|
@@ -73,7 +83,7 @@ $ gem2rpm --templates
|
|
|
73
83
|
The template is a standard ERB file that comes with several variables:
|
|
74
84
|
|
|
75
85
|
- `package` - the `Gem::Package` for the gem
|
|
76
|
-
- `spec` - the `Gem::Specification` for the gem
|
|
86
|
+
- `spec` - the `Gem::Specification` for the gem
|
|
77
87
|
- `config` - the `Gem2Rpm::Configuration` that can redefine default macros or rules used in `spec` template helpers
|
|
78
88
|
- `runtime_dependencies` - the `Gem2Rpm::RpmDependencyList` providing list of package runtime dependencies
|
|
79
89
|
- `development_dependencies` - the `Gem2Rpm::RpmDependencyList` providing list of package development dependencies
|
|
@@ -82,10 +92,6 @@ The template is a standard ERB file that comes with several variables:
|
|
|
82
92
|
- `main_files` - the `Gem2Rpm::RpmFileList` providing list of files suitable for main package
|
|
83
93
|
- `doc_files` - the `Gem2Rpm::RpmFileList` providing list of files suitable for -doc subpackage
|
|
84
94
|
|
|
85
|
-
The following variables still work, but are now deprecated:
|
|
86
|
-
|
|
87
|
-
- `format` - The `Gem::Format` for the gem. Please note that this is kept just for compatibility reasons, since RubyGems 2.0 removed this class.
|
|
88
|
-
|
|
89
95
|
### Template Configuration
|
|
90
96
|
|
|
91
97
|
To make the templates lighter and more complete, Gem2Rpm introduced in version 0.11.0 new configurable template variables such as `main_files` or `doc_files` that can be further configured via local `config` variable as follows:
|
|
@@ -123,7 +129,7 @@ Because of the differences between the two packaging schemes, it is impossible t
|
|
|
123
129
|
## See also
|
|
124
130
|
|
|
125
131
|
Fedora ruby and rubygem packaging guidelines:
|
|
126
|
-
-
|
|
132
|
+
- https://docs.fedoraproject.org/en-US/packaging-guidelines/Ruby
|
|
127
133
|
|
|
128
134
|
Project website
|
|
129
135
|
- https://github.com/fedora-ruby/gem2rpm
|
data/bin/gem2rpm
CHANGED
|
@@ -90,7 +90,7 @@ end
|
|
|
90
90
|
|
|
91
91
|
# Create a SRPM.
|
|
92
92
|
if options[:srpm]
|
|
93
|
-
gemname =
|
|
93
|
+
gemname = Gem::Package.new(gemfile).spec.name
|
|
94
94
|
Dir.mktmpdir "gem2rpm-#{gemname}-" do |srpmdir|
|
|
95
95
|
specfile = File.join(srpmdir, "rubygem-#{gemname}.spec")
|
|
96
96
|
|
|
@@ -36,14 +36,18 @@ module Gem2Rpm
|
|
|
36
36
|
DEFAULT_RULES = {
|
|
37
37
|
:doc => [
|
|
38
38
|
/\/?CHANGELOG.*/i,
|
|
39
|
+
/\/?CHANGES.*/i,
|
|
39
40
|
/\/?CONTRIBUTING.*/i,
|
|
40
41
|
/\/?CONTRIBUTORS.*/i,
|
|
41
42
|
/\/?AUTHORS.*/i,
|
|
42
43
|
/\/?README.*/i,
|
|
43
44
|
/\/?History.*/i,
|
|
44
45
|
/\/?Release.*/i,
|
|
46
|
+
/\/?SECURITY.*/i,
|
|
45
47
|
/\/?doc(\/.*)?/,
|
|
48
|
+
'Appraisals',
|
|
46
49
|
'NEWS',
|
|
50
|
+
'TODO',
|
|
47
51
|
],
|
|
48
52
|
:license => [
|
|
49
53
|
/\/?MIT/,
|
|
@@ -54,6 +58,7 @@ module Gem2Rpm
|
|
|
54
58
|
:ignore => [
|
|
55
59
|
'.gemtest',
|
|
56
60
|
'.gitignore',
|
|
61
|
+
'.github',
|
|
57
62
|
'.travis.yml',
|
|
58
63
|
'.hound.yml',
|
|
59
64
|
'.yardopts',
|
|
@@ -61,7 +66,11 @@ module Gem2Rpm
|
|
|
61
66
|
'.rvmrc',
|
|
62
67
|
'.rubocop.yml',
|
|
63
68
|
'.rubocop_todo.yml',
|
|
69
|
+
'.ruby-version',
|
|
64
70
|
/^\..*rc$/i,
|
|
71
|
+
'appveyor.yml',
|
|
72
|
+
'coveralls.yml',
|
|
73
|
+
'Guardfile',
|
|
65
74
|
],
|
|
66
75
|
:test => [
|
|
67
76
|
'.rspec',
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'gem2rpm/template_helpers'
|
|
2
|
+
|
|
3
|
+
module Gem2Rpm
|
|
4
|
+
class Context
|
|
5
|
+
include Gem2Rpm::TemplateHelpers
|
|
6
|
+
|
|
7
|
+
attr_reader :nongem, :local, :doc_subpackage, :package, :spec,
|
|
8
|
+
:config, :runtime_dependencies, :development_dependencies, :tests,
|
|
9
|
+
:files, :download_path
|
|
10
|
+
|
|
11
|
+
def initialize(fname, nongem = true, local = false, doc_subpackage = true)
|
|
12
|
+
@nongem = nongem
|
|
13
|
+
@local = local
|
|
14
|
+
@doc_subpackage = doc_subpackage
|
|
15
|
+
|
|
16
|
+
@package = Gem::Package.new(fname)
|
|
17
|
+
@spec = Gem2Rpm::Specification.new(@package.spec)
|
|
18
|
+
|
|
19
|
+
@config = Configuration.instance.reset
|
|
20
|
+
|
|
21
|
+
@runtime_dependencies = Gem2Rpm::RpmDependencyList.new(@spec.runtime_dependencies)
|
|
22
|
+
@development_dependencies = Gem2Rpm::RpmDependencyList.new(@spec.development_dependencies)
|
|
23
|
+
|
|
24
|
+
@tests = TestSuite.new(spec)
|
|
25
|
+
|
|
26
|
+
# Ruby 2.0 doesn't have sorted files
|
|
27
|
+
@files = RpmFileList.new(spec.files.sort)
|
|
28
|
+
|
|
29
|
+
@download_path = ""
|
|
30
|
+
unless @local
|
|
31
|
+
begin
|
|
32
|
+
@download_path = Gem2Rpm.find_download_url(@spec.name, @spec.version)
|
|
33
|
+
rescue DownloadUrlError => e
|
|
34
|
+
$stderr.puts "Warning: Could not retrieve full URL for #{@spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
|
|
35
|
+
$stderr.puts e.inspect
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def main_files
|
|
41
|
+
@files.top_level_entries.main_entries
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def doc_files
|
|
45
|
+
@files.top_level_entries.doc_entries
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def packager
|
|
49
|
+
Gem2Rpm.packager
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -5,13 +5,7 @@ module Gem2Rpm
|
|
|
5
5
|
class Dependency < SimpleDelegator
|
|
6
6
|
# What does this dependency require?
|
|
7
7
|
def requirement
|
|
8
|
-
|
|
9
|
-
super
|
|
10
|
-
rescue
|
|
11
|
-
version_requirements # For RubyGems < 1.3.6
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Helpers.requirement_versions_to_rpm r
|
|
8
|
+
Helpers.requirement_versions_to_rpm super
|
|
15
9
|
end
|
|
16
10
|
|
|
17
11
|
# Dependency type. Needs to be explicitly reimplemented.
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
require 'gem2rpm/gem/dependency'
|
|
2
|
+
|
|
1
3
|
module Gem2Rpm
|
|
2
4
|
class RpmDependency < Gem2Rpm::Dependency
|
|
5
|
+
attr_reader :boolean
|
|
6
|
+
|
|
3
7
|
def initialize(dependency)
|
|
8
|
+
@boolean = dependency.boolean if dependency.respond_to? :boolean
|
|
9
|
+
|
|
4
10
|
if dependency.respond_to? :__getobj__
|
|
5
11
|
super dependency.__getobj__
|
|
6
12
|
else
|
|
@@ -10,40 +16,67 @@ module Gem2Rpm
|
|
|
10
16
|
|
|
11
17
|
# Convert to rubygem() virtual provide dependency.
|
|
12
18
|
def virtualize
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
clone.tap do |dep|
|
|
20
|
+
if dep.boolean
|
|
21
|
+
dep.instance_variable_set('@boolean', "rubygem(#{dep.name})")
|
|
22
|
+
else
|
|
23
|
+
dep.name = "rubygem(#{dep.name})"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
17
26
|
end
|
|
18
27
|
|
|
19
28
|
# Output dependency with RPM requires tag.
|
|
20
29
|
def with_requires
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
clone.tap do |dep|
|
|
31
|
+
prefix = case dep.type
|
|
32
|
+
when :development
|
|
33
|
+
"BuildRequires:"
|
|
34
|
+
else
|
|
35
|
+
"Requires:"
|
|
36
|
+
end
|
|
28
37
|
|
|
29
|
-
|
|
38
|
+
if dep.boolean
|
|
39
|
+
dep.instance_variable_set('@boolean', "#{prefix} #{dep.boolean}")
|
|
40
|
+
else
|
|
41
|
+
dep.name = "#{prefix} #{dep.name}"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
30
44
|
end
|
|
31
45
|
|
|
32
46
|
# Comment out the dependency.
|
|
33
47
|
def comment_out
|
|
34
|
-
|
|
35
|
-
|
|
48
|
+
clone.tap do |dep|
|
|
49
|
+
if dep.boolean
|
|
50
|
+
dep.instance_variable_set('@boolean', "# #{dep.boolean}")
|
|
51
|
+
else
|
|
52
|
+
dep.name = "# #{dep.name}"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Represent as boolean RPM dependency.
|
|
58
|
+
def booleanize
|
|
59
|
+
clone.tap do |dep|
|
|
60
|
+
rpm_dependencies = requirement.map do |version|
|
|
61
|
+
version = nil if version && version.to_s.empty?
|
|
62
|
+
[name, version].compact.join(' ')
|
|
63
|
+
end
|
|
36
64
|
|
|
37
|
-
|
|
65
|
+
rpm_dependencies = rpm_dependencies.join(' with ')
|
|
66
|
+
if requirement.size > 1
|
|
67
|
+
rpm_dependencies = "(#{rpm_dependencies})"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
dep.instance_variable_set('@boolean', rpm_dependencies)
|
|
71
|
+
end
|
|
38
72
|
end
|
|
39
73
|
|
|
40
74
|
# Returns string with entry suitable for RPM .spec file.
|
|
41
75
|
def to_rpm
|
|
42
|
-
|
|
76
|
+
boolean || requirement.map do |version|
|
|
43
77
|
version = nil if version && version.to_s.empty?
|
|
44
78
|
[name, version].compact.join(' ')
|
|
45
|
-
end
|
|
46
|
-
rpm_dependencies.join("\n")
|
|
79
|
+
end.join("\n")
|
|
47
80
|
end
|
|
48
81
|
end
|
|
49
82
|
end
|
|
@@ -12,7 +12,7 @@ module Gem2Rpm
|
|
|
12
12
|
# element as a parameter. Returns the array itself.
|
|
13
13
|
# If no block is given, an Enumerator is returned.
|
|
14
14
|
def each
|
|
15
|
-
# Return Enumerator when called
|
|
15
|
+
# Return Enumerator when called without block.
|
|
16
16
|
return to_enum(__callee__) unless block_given?
|
|
17
17
|
|
|
18
18
|
@items.each { |item| yield item }
|
|
@@ -22,7 +22,7 @@ module Gem2Rpm
|
|
|
22
22
|
# block is not true. The ordering of non-rejected elements is maintained.
|
|
23
23
|
# If no block is given, an Enumerator is returned instead.
|
|
24
24
|
def reject
|
|
25
|
-
# Return Enumerator when called
|
|
25
|
+
# Return Enumerator when called without block.
|
|
26
26
|
return to_enum(__callee__) unless block_given?
|
|
27
27
|
|
|
28
28
|
self.class.new(@items.reject { |item| yield item })
|
|
@@ -49,6 +49,13 @@ module Gem2Rpm
|
|
|
49
49
|
self.class.new dep_list
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
# Represent as boolean RPM dependency.
|
|
53
|
+
def booleanize
|
|
54
|
+
dep_list = self.map(&:booleanize)
|
|
55
|
+
|
|
56
|
+
self.class.new dep_list
|
|
57
|
+
end
|
|
58
|
+
|
|
52
59
|
# Returns string with all dependencies from the list converted into entries
|
|
53
60
|
# suitable for RPM .spec file. Thise entries should include all necessary
|
|
54
61
|
# macros depending on file categorization.
|
data/lib/gem2rpm.rb
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
require 'erb'
|
|
2
2
|
require 'socket'
|
|
3
|
+
require 'rubygems/package'
|
|
4
|
+
require 'gem2rpm/context'
|
|
3
5
|
require 'gem2rpm/distro'
|
|
4
|
-
require 'gem2rpm/gem/format'
|
|
5
|
-
require 'gem2rpm/gem/package'
|
|
6
|
-
require 'gem2rpm/gem/spec_fetcher'
|
|
7
6
|
require 'gem2rpm/gem/specification'
|
|
8
7
|
require 'gem2rpm/rpm_dependency_list'
|
|
9
8
|
require 'gem2rpm/rpm_file_list'
|
|
@@ -12,9 +11,7 @@ require 'gem2rpm/template'
|
|
|
12
11
|
require 'gem2rpm/test_suite'
|
|
13
12
|
|
|
14
13
|
module Gem2Rpm
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Gem2Rpm::VERSION = "1.0.2".freeze
|
|
14
|
+
Gem2Rpm::VERSION = "2.0.0".freeze
|
|
18
15
|
|
|
19
16
|
class Exception < RuntimeError; end
|
|
20
17
|
class DownloadUrlError < Exception; end
|
|
@@ -46,7 +43,7 @@ module Gem2Rpm
|
|
|
46
43
|
|
|
47
44
|
def self.find_download_url(name, version)
|
|
48
45
|
dep = Gem::Dependency.new(name, "=#{version}")
|
|
49
|
-
fetcher =
|
|
46
|
+
fetcher = Gem::SpecFetcher.fetcher
|
|
50
47
|
|
|
51
48
|
spec_and_source, errors = fetcher.spec_for_dependency(dep, false)
|
|
52
49
|
|
|
@@ -64,41 +61,24 @@ module Gem2Rpm
|
|
|
64
61
|
|
|
65
62
|
def self.convert(fname, template, out = $stdout, nongem = true, local = false,
|
|
66
63
|
doc_subpackage = true)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
files = RpmFileList.new(spec.files)
|
|
80
|
-
main_files = files.top_level_entries.main_entries
|
|
81
|
-
doc_files = files.top_level_entries.doc_entries
|
|
82
|
-
|
|
83
|
-
download_path = ""
|
|
84
|
-
unless local
|
|
85
|
-
begin
|
|
86
|
-
download_path = find_download_url(spec.name, spec.version)
|
|
87
|
-
rescue DownloadUrlError => e
|
|
88
|
-
$stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
|
|
89
|
-
$stderr.puts e.inspect
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
erb = ERB.new(template.read, 0, '-')
|
|
94
|
-
out.puts erb.result(binding)
|
|
64
|
+
context = Gem2Rpm::Context.new(fname, nongem, local, doc_subpackage)
|
|
65
|
+
|
|
66
|
+
# Check if keyword arguments are used. The condition could let go as soon
|
|
67
|
+
# as only Ruby 2.6+ is supported.
|
|
68
|
+
kwargs = !(ERB.new("").method(:initialize).parameters & [[:key, :trim_mode]]).empty?
|
|
69
|
+
erb = if kwargs
|
|
70
|
+
ERB.new(template.read, trim_mode: '-')
|
|
71
|
+
else
|
|
72
|
+
ERB.new(template.read, 0, '-')
|
|
73
|
+
end
|
|
74
|
+
out.puts erb.result(context.instance_eval { binding })
|
|
95
75
|
rescue Gem::Exception => e
|
|
96
76
|
puts e
|
|
97
77
|
end
|
|
98
78
|
|
|
99
79
|
# Print gem dependencies to the specified output ($stdout by default).
|
|
100
80
|
def self.print_dependencies(gemfile, out = $stdout)
|
|
101
|
-
dl = RpmDependencyList.new(
|
|
81
|
+
dl = RpmDependencyList.new(Gem::Package.new(gemfile).spec.dependencies)
|
|
102
82
|
out.puts dl.virtualize.to_rpm
|
|
103
83
|
end
|
|
104
84
|
|
data/templates/default.spec.erb
CHANGED
|
@@ -16,14 +16,14 @@ Source0: %{rbname}-%{version}.gem
|
|
|
16
16
|
Source1: ruby-gems-%{rbname}.spec.in
|
|
17
17
|
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
|
18
18
|
Requires: ruby <%= spec.required_ruby_version %>
|
|
19
|
-
Requires: ruby-gems >= <%= Gem::
|
|
19
|
+
Requires: ruby-gems >= <%= Gem::VERSION %>
|
|
20
20
|
<% for d in spec.dependencies -%>
|
|
21
21
|
<% for req in d.requirement -%>
|
|
22
22
|
Requires: ruby-gems-<%= d.name %> <%= req %>
|
|
23
23
|
<% end -%>
|
|
24
24
|
<% end -%>
|
|
25
25
|
BuildRequires: ruby <%= spec.required_ruby_version %>
|
|
26
|
-
BuildRequires: ruby-gems >= <%= Gem::
|
|
26
|
+
BuildRequires: ruby-gems >= <%= Gem::VERSION %>
|
|
27
27
|
BuildArch: noarch
|
|
28
28
|
Provides: ruby(<%= spec.name.capitalize %>) = %{version}
|
|
29
29
|
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Generated from <%= spec.file_name %> by gem2rpm -*- rpm-spec -*-
|
|
2
|
+
%global vagrant_plugin_name <%= spec.name %>
|
|
3
|
+
|
|
4
|
+
Name: %{vagrant_plugin_name}
|
|
5
|
+
Version: <%= spec.version %>
|
|
6
|
+
Release: 1%{?dist}
|
|
7
|
+
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
|
8
|
+
License: <%= spec.licenses.join(" AND ") %>
|
|
9
|
+
<% if spec.homepage -%>
|
|
10
|
+
URL: <%= spec.homepage %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
Source0: <%= download_path %>%{vagrant_plugin_name}-%{version}.gem
|
|
13
|
+
Requires: vagrant
|
|
14
|
+
BuildRequires: vagrant
|
|
15
|
+
<% if spec.extensions.empty? -%>
|
|
16
|
+
BuildArch: noarch
|
|
17
|
+
<% end -%>
|
|
18
|
+
Provides: vagrant(%{vagrant_plugin_name}) = %{version}
|
|
19
|
+
|
|
20
|
+
%description
|
|
21
|
+
<%= spec.description %>
|
|
22
|
+
|
|
23
|
+
<% if doc_subpackage -%>
|
|
24
|
+
%package doc
|
|
25
|
+
Summary: Documentation for %{name}
|
|
26
|
+
Requires: %{name} = %{version}-%{release}
|
|
27
|
+
BuildArch: noarch
|
|
28
|
+
|
|
29
|
+
%description doc
|
|
30
|
+
Documentation for %{name}.
|
|
31
|
+
<% end # if doc_subpackage -%>
|
|
32
|
+
|
|
33
|
+
%prep
|
|
34
|
+
%setup -q -n %{vagrant_plugin_name}-%{version}
|
|
35
|
+
|
|
36
|
+
%build
|
|
37
|
+
# Create the gem as gem install only works on a gem file
|
|
38
|
+
gem build ../%{vagrant_plugin_name}-%{version}.gemspec
|
|
39
|
+
|
|
40
|
+
# %%vagrant_plugin_install compiles any C extensions and installs the gem into ./%%gem_dir
|
|
41
|
+
# by default, so that we can move it into the buildroot in %%install
|
|
42
|
+
%vagrant_plugin_install
|
|
43
|
+
|
|
44
|
+
%install
|
|
45
|
+
mkdir -p %{buildroot}%{vagrant_plugin_dir}
|
|
46
|
+
cp -a .%{vagrant_plugin_dir}/* \
|
|
47
|
+
%{buildroot}%{vagrant_plugin_dir}/
|
|
48
|
+
|
|
49
|
+
<% unless spec.extensions.empty? -%>
|
|
50
|
+
mkdir -p %{buildroot}%{vagrant_plugin_extdir_mri}
|
|
51
|
+
cp -a .%{vagrant_plugin_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{vagrant_plugin_extdir_mri}/
|
|
52
|
+
|
|
53
|
+
<% for ext in spec.extensions -%>
|
|
54
|
+
# Prevent dangling symlink in -debuginfo (rhbz#878863).
|
|
55
|
+
rm -rf %{buildroot}%{vagrant_plugin_instdir}/<%= ext.split(File::SEPARATOR).first %>/
|
|
56
|
+
<% end -%>
|
|
57
|
+
<% end -%>
|
|
58
|
+
|
|
59
|
+
<% unless spec.executables.empty? -%>
|
|
60
|
+
mkdir -p %{buildroot}%{_bindir}
|
|
61
|
+
cp -a .%{_bindir}/* \
|
|
62
|
+
%{buildroot}%{_bindir}/
|
|
63
|
+
|
|
64
|
+
find %{buildroot}%{vagrant_plugin_instdir}/<%= spec.bindir %> -type f | xargs chmod a+x
|
|
65
|
+
<% end -%>
|
|
66
|
+
|
|
67
|
+
%check
|
|
68
|
+
pushd .%{gem_instdir}
|
|
69
|
+
<% if tests.entries.empty? -%>
|
|
70
|
+
# Run the test suite.
|
|
71
|
+
<% end -%>
|
|
72
|
+
<% for t in tests -%>
|
|
73
|
+
# <%= t.command %>
|
|
74
|
+
<% end -%>
|
|
75
|
+
popd
|
|
76
|
+
|
|
77
|
+
<%
|
|
78
|
+
# Change macros for Vagrant packaging
|
|
79
|
+
config.macros[:instdir] = '%{vagrant_plugin_instdir}'
|
|
80
|
+
config.macros[:libdir] = '%{vagrant_plugin_libdir}'
|
|
81
|
+
-%>
|
|
82
|
+
%files
|
|
83
|
+
%dir %{vagrant_plugin_instdir}
|
|
84
|
+
<% for f in spec.executables -%>
|
|
85
|
+
%{_bindir}/<%= f %>
|
|
86
|
+
<% end -%>
|
|
87
|
+
<% unless spec.extensions.empty? -%>
|
|
88
|
+
%{vagrant_plugin_extdir_mri}
|
|
89
|
+
<% end -%>
|
|
90
|
+
<%= main_files.reject do |item|
|
|
91
|
+
spec.extensions.detect { |extension| item =~ /^#{extension.split(File::SEPARATOR).first}$/}
|
|
92
|
+
end.to_rpm %>
|
|
93
|
+
<% unless doc_subpackage -%>
|
|
94
|
+
%doc %{vagrant_plugin_docdir}
|
|
95
|
+
<%= doc_files.to_rpm %>
|
|
96
|
+
<% end -%>
|
|
97
|
+
%exclude %{vagrant_plugin_cache}
|
|
98
|
+
%{vagrant_plugin_spec}
|
|
99
|
+
|
|
100
|
+
<% if doc_subpackage -%>
|
|
101
|
+
%files doc
|
|
102
|
+
%doc %{vagrant_plugin_docdir}
|
|
103
|
+
<%= files.top_level_entries.doc_entries.to_rpm %>
|
|
104
|
+
<% end # if doc_subpackage -%>
|
|
105
|
+
|
|
106
|
+
%changelog
|
|
107
|
+
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1
|
|
108
|
+
- Initial package
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Generated from <%= spec.file_name %> by gem2rpm -*- rpm-spec -*-
|
|
2
|
+
%global gem_name <%= spec.name %>
|
|
3
|
+
|
|
4
|
+
Name: rubygem-%{gem_name}
|
|
5
|
+
Version: <%= spec.version %>
|
|
6
|
+
Release: 1%{?dist}
|
|
7
|
+
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
|
8
|
+
License: <%= spec.licenses.join(" AND ") %>
|
|
9
|
+
<% if spec.homepage -%>
|
|
10
|
+
URL: <%= spec.homepage %>
|
|
11
|
+
<% end -%>
|
|
12
|
+
Source0: <%= download_path %>%{gem_name}-%{version}.gem
|
|
13
|
+
BuildRequires: ruby(release)
|
|
14
|
+
<% for req in spec.required_rubygems_version -%>
|
|
15
|
+
BuildRequires: <%= requirement 'rubygems-devel', req %>
|
|
16
|
+
<% end -%>
|
|
17
|
+
<% for req in spec.required_ruby_version -%>
|
|
18
|
+
BuildRequires: <%= requirement "ruby#{'-devel' unless spec.extensions.empty?}", req %>
|
|
19
|
+
<% end -%>
|
|
20
|
+
<% unless spec.extensions.empty? -%>
|
|
21
|
+
# Compiler is required for build of gem binary extension.
|
|
22
|
+
# https://fedoraproject.org/wiki/Packaging:C_and_C++#BuildRequires_and_Requires
|
|
23
|
+
BuildRequires: gcc
|
|
24
|
+
<% end -%>
|
|
25
|
+
<%= development_dependencies.reject do |d|
|
|
26
|
+
["rdoc", "rake", "bundler"].include? d.name
|
|
27
|
+
end.virtualize.with_requires.comment_out.to_rpm -%>
|
|
28
|
+
<% if spec.extensions.empty? -%>
|
|
29
|
+
BuildArch: noarch
|
|
30
|
+
<% end -%>
|
|
31
|
+
|
|
32
|
+
%description
|
|
33
|
+
<%= spec.description %>
|
|
34
|
+
|
|
35
|
+
<% if doc_subpackage -%>
|
|
36
|
+
%package doc
|
|
37
|
+
Summary: Documentation for %{name}
|
|
38
|
+
Requires: %{name} = %{version}-%{release}
|
|
39
|
+
BuildArch: noarch
|
|
40
|
+
|
|
41
|
+
%description doc
|
|
42
|
+
Documentation for %{name}.
|
|
43
|
+
<% end # if doc_subpackage -%>
|
|
44
|
+
|
|
45
|
+
%prep
|
|
46
|
+
%setup -q -n %{gem_name}-%{version}
|
|
47
|
+
|
|
48
|
+
%build
|
|
49
|
+
# Create the gem as gem install only works on a gem file
|
|
50
|
+
gem build ../%{gem_name}-%{version}.gemspec
|
|
51
|
+
|
|
52
|
+
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
|
|
53
|
+
# by default, so that we can move it into the buildroot in %%install
|
|
54
|
+
%gem_install
|
|
55
|
+
|
|
56
|
+
%install
|
|
57
|
+
mkdir -p %{buildroot}%{gem_dir}
|
|
58
|
+
cp -a .%{gem_dir}/* \
|
|
59
|
+
%{buildroot}%{gem_dir}/
|
|
60
|
+
|
|
61
|
+
<% unless spec.extensions.empty? -%>
|
|
62
|
+
mkdir -p %{buildroot}%{gem_extdir_mri}
|
|
63
|
+
cp -a .%{gem_extdir_mri}/{gem.build_complete,*.so} %{buildroot}%{gem_extdir_mri}/
|
|
64
|
+
|
|
65
|
+
<% for ext in spec.extensions -%>
|
|
66
|
+
# Prevent dangling symlink in -debuginfo (rhbz#878863).
|
|
67
|
+
rm -rf %{buildroot}%{gem_instdir}/<%= ext.split(File::SEPARATOR).first %>/
|
|
68
|
+
<% end -%>
|
|
69
|
+
<% end -%>
|
|
70
|
+
|
|
71
|
+
<% unless spec.executables.empty? -%>
|
|
72
|
+
mkdir -p %{buildroot}%{_bindir}
|
|
73
|
+
cp -a .%{_bindir}/* \
|
|
74
|
+
%{buildroot}%{_bindir}/
|
|
75
|
+
|
|
76
|
+
find %{buildroot}%{gem_instdir}/<%= spec.bindir %> -type f | xargs chmod a+x
|
|
77
|
+
<% end -%>
|
|
78
|
+
|
|
79
|
+
%check
|
|
80
|
+
pushd .%{gem_instdir}
|
|
81
|
+
<% if tests.entries.empty? -%>
|
|
82
|
+
# Run the test suite.
|
|
83
|
+
<% end -%>
|
|
84
|
+
<% for t in tests -%>
|
|
85
|
+
# <%= t.command %>
|
|
86
|
+
<% end -%>
|
|
87
|
+
popd
|
|
88
|
+
|
|
89
|
+
%files
|
|
90
|
+
%dir %{gem_instdir}
|
|
91
|
+
<% for f in spec.executables -%>
|
|
92
|
+
%{_bindir}/<%= f %>
|
|
93
|
+
<% end -%>
|
|
94
|
+
<% unless spec.extensions.empty? -%>
|
|
95
|
+
%{gem_extdir_mri}
|
|
96
|
+
<% end -%>
|
|
97
|
+
<%= main_files.reject do |item|
|
|
98
|
+
spec.extensions.detect { |extension| item =~ /^#{extension.split(File::SEPARATOR).first}$/}
|
|
99
|
+
end.to_rpm %>
|
|
100
|
+
<% unless doc_subpackage -%>
|
|
101
|
+
%doc %{gem_docdir}
|
|
102
|
+
<%= doc_files.to_rpm %>
|
|
103
|
+
<% end -%>
|
|
104
|
+
%exclude %{gem_cache}
|
|
105
|
+
%{gem_spec}
|
|
106
|
+
|
|
107
|
+
<% if doc_subpackage -%>
|
|
108
|
+
%files doc
|
|
109
|
+
%doc %{gem_docdir}
|
|
110
|
+
<%= doc_files.to_rpm %>
|
|
111
|
+
<% end # if doc_subpackage -%>
|
|
112
|
+
|
|
113
|
+
%changelog
|
|
114
|
+
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1
|
|
115
|
+
- Initial package
|
data/templates/opensuse.spec.erb
CHANGED
|
@@ -26,7 +26,7 @@ License: GPLv2+ or Ruby
|
|
|
26
26
|
#
|
|
27
27
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
28
28
|
BuildRequires: rubygems_with_buildroot_patch
|
|
29
|
-
Requires: rubygems >= <%= Gem::
|
|
29
|
+
Requires: rubygems >= <%= Gem::VERSION %>
|
|
30
30
|
<%
|
|
31
31
|
# no need to add a requires ruby >= 0 here. will be pulled in via rubygems already
|
|
32
32
|
unless spec.required_ruby_version == ['']
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gem2rpm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Lutterkort
|
|
8
8
|
- Vit Ondruch
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies: []
|
|
14
13
|
description: |2
|
|
15
14
|
Generate source rpms and rpm spec files from a Ruby Gem.
|
|
@@ -20,8 +19,8 @@ executables:
|
|
|
20
19
|
extensions: []
|
|
21
20
|
extra_rdoc_files:
|
|
22
21
|
- AUTHORS
|
|
23
|
-
- README.md
|
|
24
22
|
- LICENSE
|
|
23
|
+
- README.md
|
|
25
24
|
files:
|
|
26
25
|
- AUTHORS
|
|
27
26
|
- LICENSE
|
|
@@ -29,11 +28,9 @@ files:
|
|
|
29
28
|
- bin/gem2rpm
|
|
30
29
|
- lib/gem2rpm.rb
|
|
31
30
|
- lib/gem2rpm/configuration.rb
|
|
31
|
+
- lib/gem2rpm/context.rb
|
|
32
32
|
- lib/gem2rpm/distro.rb
|
|
33
33
|
- lib/gem2rpm/gem/dependency.rb
|
|
34
|
-
- lib/gem2rpm/gem/format.rb
|
|
35
|
-
- lib/gem2rpm/gem/package.rb
|
|
36
|
-
- lib/gem2rpm/gem/spec_fetcher.rb
|
|
37
34
|
- lib/gem2rpm/gem/specification.rb
|
|
38
35
|
- lib/gem2rpm/helpers.rb
|
|
39
36
|
- lib/gem2rpm/rpm_dependency.rb
|
|
@@ -50,8 +47,10 @@ files:
|
|
|
50
47
|
- templates/fedora-21-25.spec.erb
|
|
51
48
|
- templates/fedora-26-vagrant-plugin.spec.erb
|
|
52
49
|
- templates/fedora-26.spec.erb
|
|
53
|
-
- templates/fedora-27-
|
|
54
|
-
- templates/fedora-27-
|
|
50
|
+
- templates/fedora-27-37-vagrant-plugin.spec.erb
|
|
51
|
+
- templates/fedora-27-37.spec.erb
|
|
52
|
+
- templates/fedora-38-rawhide-vagrant-plugin.spec.erb
|
|
53
|
+
- templates/fedora-38-rawhide.spec.erb
|
|
55
54
|
- templates/fedora.spec.erb
|
|
56
55
|
- templates/opensuse.spec.erb
|
|
57
56
|
- templates/pld.spec.erb
|
|
@@ -59,7 +58,6 @@ homepage: https://github.com/fedora-ruby/gem2rpm
|
|
|
59
58
|
licenses:
|
|
60
59
|
- GPL-2.0+
|
|
61
60
|
metadata: {}
|
|
62
|
-
post_install_message:
|
|
63
61
|
rdoc_options: []
|
|
64
62
|
require_paths:
|
|
65
63
|
- lib
|
|
@@ -74,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
72
|
- !ruby/object:Gem::Version
|
|
75
73
|
version: '0'
|
|
76
74
|
requirements: []
|
|
77
|
-
rubygems_version: 3.
|
|
78
|
-
signing_key:
|
|
75
|
+
rubygems_version: 3.6.9
|
|
79
76
|
specification_version: 4
|
|
80
77
|
summary: Generate rpm specfiles from gems
|
|
81
78
|
test_files: []
|
data/lib/gem2rpm/gem/format.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require 'delegate'
|
|
2
|
-
|
|
3
|
-
module Gem2Rpm
|
|
4
|
-
class Format < SimpleDelegator
|
|
5
|
-
# Returns the value of attribute gem_path
|
|
6
|
-
def gem_path
|
|
7
|
-
super
|
|
8
|
-
rescue
|
|
9
|
-
spec.file_name
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# Returns the value of attribute file_entries
|
|
13
|
-
def file_entries
|
|
14
|
-
super
|
|
15
|
-
rescue
|
|
16
|
-
spec.files
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/lib/gem2rpm/gem/package.rb
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
require 'delegate'
|
|
2
|
-
require 'rubygems/package'
|
|
3
|
-
begin
|
|
4
|
-
require 'rubygems/format'
|
|
5
|
-
rescue LoadError
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
module Gem2Rpm
|
|
9
|
-
class Package < SimpleDelegator
|
|
10
|
-
def initialize(gem)
|
|
11
|
-
super(Gem::Package.new(gem)) rescue super(Gem::Format.from_file_by_path(gem))
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
require 'delegate'
|
|
2
|
-
require 'ostruct'
|
|
3
|
-
|
|
4
|
-
module Gem2Rpm
|
|
5
|
-
class SpecFetcher < SimpleDelegator
|
|
6
|
-
# Find and fetch specs that match +dependency+.
|
|
7
|
-
#
|
|
8
|
-
# If +matching_platform+ is false, gems for all platforms are returned.
|
|
9
|
-
def spec_for_dependency(dependency, matching_platform = true)
|
|
10
|
-
super
|
|
11
|
-
rescue
|
|
12
|
-
errors = []
|
|
13
|
-
|
|
14
|
-
begin
|
|
15
|
-
spec, source = find_matching(dependency, true, matching_platform).first
|
|
16
|
-
rescue Gem::Exception => e
|
|
17
|
-
errors << OpenStruct.new(:error => e)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
source = OpenStruct.new(:uri => source)
|
|
21
|
-
[[[spec, source]], errors]
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
/data/templates/{fedora-27-rawhide-vagrant-plugin.spec.erb → fedora-27-37-vagrant-plugin.spec.erb}
RENAMED
|
File without changes
|
|
File without changes
|