Puppet and Ruby 2.0

Vít Ondruch vondruch at redhat.com
Fri Mar 15 12:34:45 UTC 2013


Hi Michael,

So I committed the changes for Rawhide [1]. Here [2] is the scratch build.

And I just comment bellow on a few changes I did:

@@ -5,8 +5,8 @@
# Specifically not using systemd on F18 as it's technically a break between
# using SystemV on 2.7.x and Systemd on 3.1.0.
-%if 0%{?fedora} >= 17
-%global puppet_libdir %(ruby -rrbconfig -e 'puts 
RbConfig::CONFIG["vendorlibdir"]')
+%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
+%global puppet_libdir %{ruby_vendorlibdir}
%else
%global puppet_libdir %(ruby -rrbconfig -e 'puts 
RbConfig::CONFIG["sitelibdir"]')
%endif

RHEL7 will ship with Ruby 2.0, but anyway, even if Ruby 1.9.3 are 
shipped they do not differ in this point. I.e., there is macro 
%{ruby_vendorlibdir}, no need to query Ruby.



@@ -39,16 +38,19 @@ Group: System Environment/Base
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: facter >= 1.6.6
-BuildRequires: ruby >= 1.8.7
+BuildRequires: ruby-devel >= 1.8.7

ruby-devel provides the %{ruby_vendorlibdir}, so use the ruby-devel.



-%if 0%{?fedora} || 0%{?rhel} >= 5

Anything older then RHEL5 is unsupported, no need for the conditions.



BuildArch: noarch
-# Work around the lack of ruby in the default mock buildroot
-%if "%{ruby_version}"
-Requires: ruby(abi) = %{ruby_version}

Ruby in Fedora/RHEL versions are not changing. I prefer to hardcode 
them, to prevent builds accidental builds in wrong buildroots, etc.



+%if 0%{?rhel} <= 6
+Requires: ruby(abi) = 1.8
+%else
+%if 0%{?fedora} <= 18
+Requires: ruby(abi) = 1.9.1
+%else
+Requires: ruby(release)
%endif
-Requires: ruby(shadow)
%endif
+Requires: ruby(shadow)
# Pull in ruby selinux bindings where available
%if 0%{?fedora} || 0%{?rhel} >= 6
@@ -64,10 +66,6 @@ Requires: hiera >= 1.0.0
Obsoletes: hiera-puppet < 1.0.0-2
Provides: hiera-puppet = %{version}-%{release}
-# Puppet 3.x drops ruby 1.8.5 support and adds ruby 1.9 support
-%if "%{ruby_version}" == "1.8"
-Requires: ruby >= 1.8.7
-%endif

This effectively means that you will never build puppet for RHEL5 from 
this .spec file. Probably the conditions above could be adjusted a bit. 
Also note, that a few lines above, there is already "BuildRequires: 
ruby-devel >= 1.8.7" so since you cannot build, you have nothing to 
install IMO. Although somebody could try to install EPEL6 package on 
EPEL5, but that is silly idea anyway, IMO. So I dropped the condition.


Vít



[1] 
http://pkgs.fedoraproject.org/cgit/puppet.git/commit/?id=154f0443882cdf1004d276a0c90152944d527a8b
[2] http://koji.fedoraproject.org/koji/taskinfo?taskID=5125847
[3] https://fedoraproject.org/wiki/Packaging:Ruby#Macros


More information about the ruby-sig mailing list