Accepting request 558540 from devel:languages:ruby
Automatic submission by obs-autosubmit OBS-URL: https://build.opensuse.org/request/show/558540 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ruby-common?expand=0&rev=11
This commit is contained in:
commit
20e9485ddc
5
g2r
Normal file
5
g2r
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
if [ -e gem2rpm.yml ] ; then
|
||||
cfg="--config gem2rpm.yml"
|
||||
fi
|
||||
exec gem2rpm $cfg -o *spec *gem
|
@ -88,6 +88,9 @@ opt_parser = OptionParser.new do |opts|
|
||||
opts.on('--default-gem [FILENAME]', 'Which filename to use when we dont find another gem file.') do |fname|
|
||||
options.defaultgem=fname
|
||||
end
|
||||
opts.on('--extconf-opts [EXTOPTS]', 'which options to pass to extconf') do |extopts|
|
||||
options.extconfopts=extopts
|
||||
end
|
||||
opts.on('--gem-binary [PATH]', 'Path to gem. By default we loop over all gem binaries we find') do |fname|
|
||||
GILogger.warn("The --gem-binary option is deprecated.")
|
||||
end
|
||||
@ -178,6 +181,10 @@ GILogger.info "Using suffix #{options.rubysuffix}"
|
||||
cmdline = [gembinary, 'install', '--verbose', '--local', '--build-root', options.buildroot]
|
||||
cmdline += options.otheropts
|
||||
cmdline << options.gemfile
|
||||
unless options.extconfopts.nil?
|
||||
cmdline << '--'
|
||||
cmdline << options.extconfopts
|
||||
end
|
||||
GILogger.info "install cmdline: #{cmdline.inspect}"
|
||||
if Process.respond_to? :spawn
|
||||
pid = Process.spawn(*cmdline)
|
||||
|
2
gemfile.attr
Normal file
2
gemfile.attr
Normal file
@ -0,0 +1,2 @@
|
||||
%__gemfile_requires %{_rpmconfigdir}/gemfile.rb --requires
|
||||
%__gemfile_path ^/.*\/Gemfile.lock$
|
42
gemfile.rb
Normal file
42
gemfile.rb
Normal file
@ -0,0 +1,42 @@
|
||||
#!/bin/sh
|
||||
=begin &>/dev/null
|
||||
# workaround for rubinius bug
|
||||
# https://github.com/rubinius/rubinius/issues/2732
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
export LANG="en_US.UTF-8"
|
||||
ruby=""
|
||||
for bundler in $(/usr/bin/ruby-find-versioned bundler) ; do
|
||||
if [ -x "$bundler" ] ; then
|
||||
ruby="${bundler//bundler/ruby}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
exec $ruby -x $0 "$@"
|
||||
=end
|
||||
#!/usr/bin/ruby
|
||||
# vim: set sw=2 sts=2 et tw=80 :
|
||||
require 'bundler'
|
||||
require 'yaml'
|
||||
|
||||
app_info_file=".appinfo.yml"
|
||||
gemfile_lock = STDIN.read.chomp
|
||||
|
||||
appdir = File.dirname(gemfile_lock)
|
||||
Dir.chdir(appdir)
|
||||
|
||||
unless File.exists? app_info_file then
|
||||
STDERR.puts "Warning: Skipping Gemfile.lock without appinfo.yaml file"
|
||||
exit 0
|
||||
end
|
||||
|
||||
app_config =YAML.load_file(app_info_file) || {}
|
||||
ruby_abi=app_config[:ruby_abi]
|
||||
|
||||
if ruby_abi.nil? then
|
||||
STDERR.puts "Error: Can not generate requires without a ruby abi. Skipping."
|
||||
exit 0
|
||||
end
|
||||
|
||||
Bundler.definition.specs.each do |dep|
|
||||
puts "rubygem(#{ruby_abi}:#{dep.name}) = #{dep.version}"
|
||||
end
|
@ -54,6 +54,8 @@
|
||||
end
|
||||
|
||||
rb_suffix = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby/, '')
|
||||
# TODO: "ruby" hardcoded here is wrong. it should support jruby/rubinius or so
|
||||
rb_abi = "ruby:#{RbConfig::CONFIG['ruby_version']}"
|
||||
rb_pkgname = RbConfig::CONFIG['ruby_install_name'].gsub(/^ruby\./, '')
|
||||
if rb_suffix =~ /\A\d+\.\d+\z/
|
||||
rb_suffix = '.ruby' + rb_suffix
|
||||
@ -70,6 +72,7 @@
|
||||
gem_spec = Gem::Specification.new
|
||||
gem_base_dir = patch_libdir(gem_spec.base_dir)
|
||||
gem_cache_dir = patch_libdir(gem_spec.cache_dir)
|
||||
gem_build_info_dir = patch_libdir(gem_spec.build_info_dir)
|
||||
gem_gems_dir = patch_libdir(gem_spec.gems_dir)
|
||||
gem_spec_dir = patch_libdir(gem_spec.spec_dir)
|
||||
gem_bin_dir = patch_libdir(patch_mod_full_name(gem_spec.bin_dir , mod_full_name ))
|
||||
@ -101,7 +104,7 @@ PreReq: update-alternatives
|
||||
%package -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||
Summary: RDoc documentation for <%= spec.name %>
|
||||
Group: Development/Languages/Ruby
|
||||
Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||||
Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||||
|
||||
%description -n <%= pkg_basename %>-doc<%= config[:version_suffix] %>
|
||||
Documentation generated at gem installation time.
|
||||
@ -146,7 +149,7 @@ Usually in RDoc and RI formats.
|
||||
%package -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||
Summary: Test suite for <%= spec.name %>
|
||||
Group: Development/Languages/Ruby
|
||||
Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||||
Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||||
|
||||
%description -n <%= pkg_basename %>-testsuite<%= config[:version_suffix] %>
|
||||
Test::Unit or RSpec files, useful for developers.
|
||||
@ -196,6 +199,7 @@ fi
|
||||
# cache file
|
||||
<%= gem_cache_dir %>/<%= mod_full_name %>.gem
|
||||
<%= gem_gem_dir %>
|
||||
<%= gem_build_info_dir %>
|
||||
<% unless spec.extensions.empty? or gem_extension_dir.nil? -%>
|
||||
<%= gem_extension_dir %>
|
||||
<% end -%>
|
||||
@ -231,7 +235,7 @@ fi
|
||||
Summary: <%= custom_pkg_name %> sub package for <%= spec.name %>
|
||||
Group: Development/Languages/Ruby
|
||||
<% end %>
|
||||
Requires: <%= pkg_basename %><%= config[:version_suffix] %> = <%= spec.version %>
|
||||
Requires: rubygem(<%= rb_abi %>:<%= spec.name %>) = <%= spec.version %>
|
||||
%description -n <%= pkg_basename %>-<%= custom_pkg_name %><%= config[:version_suffix] %>
|
||||
<% if data[:description] and data[:description] != '' -%>
|
||||
<%= data[:description] %>
|
||||
|
28
rails.macros
Normal file
28
rails.macros
Normal file
@ -0,0 +1,28 @@
|
||||
%rails_save_gemfile() \
|
||||
cp Gemfile{,.upstream} \
|
||||
mv Gemfile.lock{,.upstream} \
|
||||
%{nil}
|
||||
|
||||
%rails_regen_gemfile_lock() \
|
||||
find -type f -name .gitkeep -print -delete \
|
||||
bundle exec rails --version \
|
||||
diff -urN Gemfile.lock{.upstream,} ||: \
|
||||
%{nil}
|
||||
|
||||
%rails_write_appinfo() \
|
||||
echo -e "---\\\n:ruby_abi: %{rb_build_abi}\\\n" > .appinfo.yml \
|
||||
%{nil}
|
||||
|
||||
%rails_fix_ruby_suffix() \
|
||||
for S in $(grep -r -l '@RUBY_SUFFIX@' ${RPM_SOURCE_DIR}/ | grep -v '\.spec$') ; do \
|
||||
SB="${S}.backup" \
|
||||
cp ${S} ${SB} \
|
||||
perl -p -i -e 's|\\\@RUBY_SUFFIX\\\@|%{rb_suffix}|g' "${S}" \
|
||||
diff -urN ${SB} ${S} || : \
|
||||
rm ${SB} \
|
||||
done \
|
||||
%{nil}
|
||||
|
||||
%ruby_fix_shebang() \
|
||||
%{nil} \
|
||||
%{nil}
|
@ -1,3 +1,32 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 12 13:30:27 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
- switch requires of the autogenerated subpackages from
|
||||
rb_suffix-rubygem-gemname = version to
|
||||
rubygem(rb_abi:gemname) = version
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 30 03:40:08 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
- split our the rails part
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 30 03:25:39 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
- we need bundler now. given ruby 2.5 will have it intree anyway,
|
||||
this soon wont be a big burden.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 30 02:40:03 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
- add support to generate requires from Gemfile.lock
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Aug 7 10:20:07 UTC 2017 - mrueckert@suse.de
|
||||
|
||||
- package the buildinfo dir
|
||||
- allow passing options to extconf.rb
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 13 21:11:20 UTC 2017 - bwiedemann@suse.com
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package ruby-common
|
||||
#
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -38,6 +38,10 @@ Source9: ruby.rpm-macros
|
||||
Source10: gem_packages.sh
|
||||
Source11: opensuse.spec.erb
|
||||
Source12: ruby-find-versioned
|
||||
Source13: gemfile.attr
|
||||
Source14: gemfile.rb
|
||||
Source15: rails.macros
|
||||
Source16: g2r
|
||||
Summary: Collection of scripts and macros for ruby packaging
|
||||
License: MIT
|
||||
Group: Development/Languages/Ruby
|
||||
@ -59,6 +63,20 @@ Requires: rpm-with-ruby-provide-hook
|
||||
This package is needed for (generated) ruby gems. It provides hooks for
|
||||
automatic rpm provides and requires and macros that gem2rpm uses.
|
||||
|
||||
%package rails
|
||||
Requires: rubygem(bundler)
|
||||
Recommends: rubygem(%{rb_default_ruby_abi}:bundler)
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
Summary: Rails packaging support
|
||||
Group: Development/Languages/Ruby
|
||||
|
||||
%description rails
|
||||
This package is needed for (generated) ruby gems. It provides hooks for
|
||||
automatic rpm provides and requires and macros that gem2rpm uses.
|
||||
|
||||
Rails packaging support files.
|
||||
|
||||
%prep
|
||||
|
||||
%build
|
||||
@ -78,13 +96,17 @@ install -D -m 0755 %{S:7} %{buildroot}/usr/lib/rpm/generate_buildrequires.sh
|
||||
install -D -m 0755 %{S:10} %{buildroot}/usr/lib/rpm/gem_packages.sh
|
||||
install -D -m 0644 %{S:11} %{buildroot}/usr/lib/rpm/gem_packages.template
|
||||
install -D -m 0755 %{S:12} %{buildroot}%{_bindir}/ruby-find-versioned
|
||||
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 0644 %{S:15} %{buildroot}/etc/rpm/macros.rails
|
||||
install -D -m 0755 %{S:16} %{buildroot}%{_bindir}/g2r
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%if %{with ship_gemrc}
|
||||
%config /etc/gemrc
|
||||
%endif
|
||||
%config /etc/rpm/macros.*
|
||||
%config /etc/rpm/macros.*ruby*
|
||||
%dir /usr/lib/rpm/fileattrs
|
||||
/usr/lib/rpm/fileattrs/rubygems.attr
|
||||
/usr/lib/rpm/rubygemsdeps.rb
|
||||
@ -93,5 +115,12 @@ install -D -m 0755 %{S:12} %{buildroot}%{_bindir}/ruby-find-versioned
|
||||
/usr/lib/rpm/generate_buildrequires.sh
|
||||
/usr/lib/rpm/gem_packages.*
|
||||
%{_bindir}/ruby-find-versioned
|
||||
%{_bindir}/g2r
|
||||
|
||||
%files rails
|
||||
%defattr(-,root,root)
|
||||
%config /etc/rpm/macros.rails
|
||||
/usr/lib/rpm/fileattrs/gemfile.attr
|
||||
/usr/lib/rpm/gemfile.rb
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user