Accepting request 569569 from home:lnussel:branches:devel:languages:ruby
- generate bundled(rubygem($name)) = $version provides for bundled gems in the vendor directory. OBS-URL: https://build.opensuse.org/request/show/569569 OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-common?expand=0&rev=97
This commit is contained in:
parent
6106252abc
commit
ea19926d07
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 24 16:13:42 UTC 2018 - lnussel@suse.de
|
||||||
|
|
||||||
|
- generate bundled(rubygem($name)) = $version provides for bundled
|
||||||
|
gems in the vendor directory.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Dec 12 13:30:27 UTC 2017 - mrueckert@suse.de
|
Tue Dec 12 13:30:27 UTC 2017 - mrueckert@suse.de
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package ruby-common
|
# spec file for package ruby-common
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -42,6 +42,7 @@ Source13: gemfile.attr
|
|||||||
Source14: gemfile.rb
|
Source14: gemfile.rb
|
||||||
Source15: rails.macros
|
Source15: rails.macros
|
||||||
Source16: g2r
|
Source16: g2r
|
||||||
|
Source17: rubygems_bundled.attr
|
||||||
Summary: Collection of scripts and macros for ruby packaging
|
Summary: Collection of scripts and macros for ruby packaging
|
||||||
License: MIT
|
License: MIT
|
||||||
Group: Development/Languages/Ruby
|
Group: Development/Languages/Ruby
|
||||||
@ -100,6 +101,7 @@ install -D -m 0644 %{S:13} %{buildroot}/usr/lib/rpm/fileattrs/gemfile.attr
|
|||||||
install -D -m 0755 %{S:14} %{buildroot}/usr/lib/rpm/gemfile.rb
|
install -D -m 0755 %{S:14} %{buildroot}/usr/lib/rpm/gemfile.rb
|
||||||
install -D -m 0644 %{S:15} %{buildroot}/etc/rpm/macros.rails
|
install -D -m 0644 %{S:15} %{buildroot}/etc/rpm/macros.rails
|
||||||
install -D -m 0755 %{S:16} %{buildroot}%{_bindir}/g2r
|
install -D -m 0755 %{S:16} %{buildroot}%{_bindir}/g2r
|
||||||
|
install -D -m 0644 %{S:17} %{buildroot}/usr/lib/rpm/fileattrs/rubygems_bundled.attr
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
@ -109,6 +111,7 @@ install -D -m 0755 %{S:16} %{buildroot}%{_bindir}/g2r
|
|||||||
%config /etc/rpm/macros.*ruby*
|
%config /etc/rpm/macros.*ruby*
|
||||||
%dir /usr/lib/rpm/fileattrs
|
%dir /usr/lib/rpm/fileattrs
|
||||||
/usr/lib/rpm/fileattrs/rubygems.attr
|
/usr/lib/rpm/fileattrs/rubygems.attr
|
||||||
|
/usr/lib/rpm/fileattrs/rubygems_bundled.attr
|
||||||
/usr/lib/rpm/rubygemsdeps.rb
|
/usr/lib/rpm/rubygemsdeps.rb
|
||||||
/usr/lib/rpm/gem_install.sh
|
/usr/lib/rpm/gem_install.sh
|
||||||
/usr/lib/rpm/gem_build_cleanup.sh
|
/usr/lib/rpm/gem_build_cleanup.sh
|
||||||
|
3
rubygems_bundled.attr
Normal file
3
rubygems_bundled.attr
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
%__rubygems_bundled_provides %{_rpmconfigdir}/rubygemsdeps.rb --provides --bundled
|
||||||
|
%__rubygems_bundled_path .*/vendor/bundle/.*/specifications/.*\.gemspec$
|
||||||
|
|
@ -47,7 +47,12 @@ requires=false
|
|||||||
opts.on("-R", "--requires", "Output the requires of the package") do |val|
|
opts.on("-R", "--requires", "Output the requires of the package") do |val|
|
||||||
requires=true
|
requires=true
|
||||||
end
|
end
|
||||||
file_match=".*/gems/[^/]*/specifications/.*\.gemspec$"
|
bundled=false
|
||||||
|
opts.on("-b", "--bundled", "Output provides as bundled ones") do |val|
|
||||||
|
bundled=true
|
||||||
|
end
|
||||||
|
|
||||||
|
file_match=nil
|
||||||
opts.on("-m", "--file-match REGEX", String,
|
opts.on("-m", "--file-match REGEX", String,
|
||||||
"Override the regex against which the input file names",
|
"Override the regex against which the input file names",
|
||||||
"matched with the supplied regex") do |val|
|
"matched with the supplied regex") do |val|
|
||||||
@ -65,6 +70,19 @@ unless provides || requires
|
|||||||
exit(0)
|
exit(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if file_match.nil?
|
||||||
|
if bundled
|
||||||
|
file_match = ".*/vendor/bundle/[^/]*/[^/]*/specifications/.*\.gemspec$"
|
||||||
|
else
|
||||||
|
file_match = ".*/gems/[^/]*/specifications/.*\.gemspec$"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
$rubyapi_re = %r{.*/([^/]*)/gems/([^/]*)/.*}
|
||||||
|
if bundled
|
||||||
|
$rubyapi_re = %r{.*/vendor/bundle/([^/]*)/([^/]*)/.*}
|
||||||
|
end
|
||||||
|
|
||||||
def fatal(msg)
|
def fatal(msg)
|
||||||
$stderr.puts msg
|
$stderr.puts msg
|
||||||
exit 1
|
exit 1
|
||||||
@ -89,7 +107,7 @@ def register_gemspec_from_file(gemspecs, rubyabi, file)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def rubyabi_from_path(path)
|
def rubyabi_from_path(path)
|
||||||
m = path.match(%r{.*/([^/]*)/gems/([^/]*)/.*})
|
m = path.match($rubyapi_re)
|
||||||
# return m ? m[1] : RbConfig::CONFIG["ruby_version"]
|
# return m ? m[1] : RbConfig::CONFIG["ruby_version"]
|
||||||
return { :interpreter => m[1], :version => m[2], :abi => "#{m[1]}:#{m[2]}", :requires => "#{m[1]}(abi) = #{m[2]}" }
|
return { :interpreter => m[1], :version => m[2], :abi => "#{m[1]}:#{m[2]}", :requires => "#{m[1]}(abi) = #{m[2]}" }
|
||||||
end
|
end
|
||||||
@ -124,12 +142,16 @@ gemspecs.each do |rubyabi_hash, spec|
|
|||||||
# puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = #{spec.version}" if versions.length > 2
|
# puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = #{spec.version}" if versions.length > 2
|
||||||
|
|
||||||
# version without ruby version - asking for trouble
|
# version without ruby version - asking for trouble
|
||||||
puts "rubygem(#{spec.name}) = #{spec.version}"
|
if bundled
|
||||||
if rubyabi
|
puts "bundled(rubygem(#{spec.name})) = #{spec.version}"
|
||||||
puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}"
|
else
|
||||||
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}) = #{spec.version}" if versions.length > 0
|
puts "rubygem(#{spec.name}) = #{spec.version}"
|
||||||
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}) = #{spec.version}" if versions.length > 1
|
if rubyabi
|
||||||
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}.#{versions[2]}) = #{spec.version}" if versions.length > 2
|
puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}"
|
||||||
|
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}) = #{spec.version}" if versions.length > 0
|
||||||
|
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}) = #{spec.version}" if versions.length > 1
|
||||||
|
puts "rubygem(#{rubyabi}:#{spec.name}:#{versions[0]}.#{versions[1]}.#{versions[2]}) = #{spec.version}" if versions.length > 2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user