Project

General

Profile

« Previous | Next » 

Revision 8255b4d8

Added by Dominic Cleal over 8 years ago

Replace ruby-wrapper with tfm-runtime

View differences:

comps/comps-foreman-rhel6.xml
<packagereq type="default">ruby193-facter</packagereq>
<packagereq type="default">ruby193-mod_passenger</packagereq>
<packagereq type="default">ruby193-ruby-wrapper</packagereq>
<packagereq type="default">ruby193-rubygem-addressable</packagereq>
<packagereq type="default">ruby193-rubygem-ancestry</packagereq>
comps/comps-foreman-rhel7.xml
<packagereq type="default">ruby193-facter</packagereq>
<packagereq type="default">ruby193-mod_passenger</packagereq>
<packagereq type="default">ruby193-ruby-wrapper</packagereq>
<packagereq type="default">ruby193-rubygem-addressable</packagereq>
<packagereq type="default">ruby193-rubygem-ancestry</packagereq>
ruby-wrapper/LICENSE
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
ruby-wrapper/README
%{scl_prefix}-ruby-wrapper
This is just a tiny wrapper script to be used as a shim where useful. It is
used in OpenShift Origin for RHEL+RHSCL installs and it's been packaged
independently in hopes it might be useful for others.
You should find an example script in your docdir (most likely
/usr/share/doc/%{scl_prefix}-ruby-wrapper/)
ruby-wrapper/README.md
ruby-wrapper
============
Wrapper for RHSCL ruby
%{scl_prefix}-ruby-wrapper
This is just a tiny wrapper script to be used as a shim where useful. It is
used in OpenShift Origin for RHEL+RHSCL installs and it's been packaged
independently in hopes it might be useful for others.
You should find an example script in your docdir (most likely
/usr/share/doc/%{scl_prefix}-ruby-wrapper/)
Note: There some modifications happening in the rpm spec file to make this
SCL agnostic in an attempt to be ready for the future so if you use this at
face value it's not going to work and you need to change FIXMESCL in
ruby-wrapper and install it as /usr/bin/${SCL_NAME}-ruby (such that SCL_NAME
were treated like a shell variable).
ruby-wrapper/example_shim
export LD_LIBRARY_PATH=/opt/rh/ruby193/root/usr/local/lib64:/opt/rh/ruby193/root/usr/lib64
export GEM_HOME=/opt/rh/ruby193/root/usr/share/gems
export GEM_PATH=/opt/rh/ruby193/root/usr/local/share/gems:/opt/rh/ruby193/root/usr/share/gems
ruby193-ruby $@
ruby-wrapper/ruby-wrapper
#!/bin/bash
COMMAND="ruby"
SCL=FIXMESCL
# Execute a single script with no arguments with 'scl', else it fails to
# pass spaces/quotes in arguments through correctly (RHBZ#1248418).
TMP=$(mktemp)
trap "rm -f $TMP" EXIT
echo -n $COMMAND > $TMP
for arg in "$@"; do
printf " %q" "$arg" >> $TMP
done
scl enable $SCL "bash $TMP"
ruby-wrapper/ruby-wrapper-rails
#!/bin/bash
COMMAND="rails"
SCL=FIXMESCL
# Execute a single script with no arguments with 'scl', else it fails to
# pass spaces/quotes in arguments through correctly (RHBZ#1248418).
TMP=$(mktemp)
trap "rm -f $TMP" EXIT
echo -n $COMMAND > $TMP
for arg in "$@"; do
printf " %q" "$arg" >> $TMP
done
scl enable $SCL "bash $TMP"
ruby-wrapper/ruby-wrapper-rake
#!/bin/bash
COMMAND="rake"
SCL=FIXMESCL
# Execute a single script with no arguments with 'scl', else it fails to
# pass spaces/quotes in arguments through correctly (RHBZ#1248418).
TMP=$(mktemp)
trap "rm -f $TMP" EXIT
echo -n $COMMAND > $TMP
for arg in "$@"; do
printf " %q" "$arg" >> $TMP
done
scl enable $SCL "bash $TMP"
ruby-wrapper/ruby-wrapper.spec
%{!?scl:%global pkg_name %{name}}
%{?scl:%scl_package %{name}}
%define wrapper_doc_dir %{_root_datadir}/doc/%{name}-%{version}
%global rubyabi 1.9.1
Summary: Wrapper for %{scl_prefix} ruby.
Name: %{?scl:%scl_prefix}ruby-wrapper
Version: 0.0.2
Release: 6%{?dist}
Group: Development/Languages
License: ASL 2.0
URL: https://github.com/maxamillion/ruby-wrapper
Requires: %{?scl:%scl_prefix}ruby(abi) = %{rubyabi}
Requires: %{?scl:%scl_prefix}ruby
Requires: %{?scl:%scl_prefix}rubygems
Source0: ruby-wrapper
Source1: ruby-wrapper-rake
Source2: ruby-wrapper-rails
Source3: LICENSE
Source4: README
Source5: example_shim
BuildArch: noarch
%description
Wrapper for %{scl_prefix} ruby so that other wrapper scripts can be
written with a "shim." Examples can be found in the doc directory.
%install
# Create the %%{_root_bindir} wrapper:
%if 0%{?scl:1}
mkdir -p %{buildroot}%{_root_bindir}
install -p -m0755 %{SOURCE0} %{buildroot}%{_root_bindir}/%{scl_prefix}ruby
install -p -m0755 %{SOURCE1} %{buildroot}%{_root_bindir}/%{scl_prefix}rake
install -p -m0755 %{SOURCE2} %{buildroot}%{_root_bindir}/%{scl_prefix}rails
# Modify the shim/wrapper to include the correct scl
%if "%{?scl}" == "ruby193"
sed -i 's/FIXMESCL/%{scl}\nif scl -l | grep -qw ^v8314$; then\nSCL="ruby193 v8314"\nfi/' %{buildroot}%{_root_bindir}/%{scl_prefix}ruby
sed -i 's/FIXMESCL/%{scl}\nif scl -l | grep -qw ^v8314$; then\nSCL="ruby193 v8314"\nfi/' %{buildroot}%{_root_bindir}/%{scl_prefix}rake
sed -i 's/FIXMESCL/%{scl}\nif scl -l | grep -qw ^v8314$; then\nSCL="ruby193 v8314"\nfi/' %{buildroot}%{_root_bindir}/%{scl_prefix}rails
%else
sed -i s/FIXMESCL/%{scl}/ %{buildroot}%{_root_bindir}/%{scl_prefix}ruby
sed -i s/FIXMESCL/%{scl}/ %{buildroot}%{_root_bindir}/%{scl_prefix}rake
sed -i s/FIXMESCL/%{scl}/ %{buildroot}%{_root_bindir}/%{scl_prefix}rails
%endif
mkdir -p %{buildroot}%{wrapper_doc_dir}
install -p -m0644 %{SOURCE3} %{buildroot}%{wrapper_doc_dir}/LICENSE
install -p -m0644 %{SOURCE4} %{buildroot}%{wrapper_doc_dir}/README
install -p -m0644 %{SOURCE5} %{buildroot}%{wrapper_doc_dir}/example_shim
%else
# Not SCL is an error, this should only build for SCL
exit 1
%endif
%files
%dir %{wrapper_doc_dir}
%{wrapper_doc_dir}/*
%{?scl:%{_root_bindir}/%{scl_prefix}ruby}
%{?scl:%{_root_bindir}/%{scl_prefix}rake}
%{?scl:%{_root_bindir}/%{scl_prefix}rails}
%changelog
* Wed Aug 05 2015 Dominic Cleal <dcleal@redhat.com> 0.0.2-6
- fixes #11275, #11170 - pass spaces/quotes in args through SCL wrappers
(dcleal@redhat.com)
- Fix changelog formatting (dcleal@redhat.com)
* Tue May 06 2014 Dominic Cleal <dcleal@redhat.com> 0.0.2-5
- Enable v8 collection too for SCL 1.1 (jmontleo@redhat.com)
* Tue Dec 03 2013 Eric D Helms <ehelms@redhat.com> 0.0.2-4
- new package built with tito
* Wed Sep 18 2013 Sam Kottler <shk@redhat.com> - 0.0.2-3
- Add a rails wrapper
* Mon Sep 9 2013 Sam Kottler <shk@redhat.com> - 0.0.2-2
- Move /usr/bin/ruby193-ruby-rake to /usr/bin/ruby193-rake
* Mon Sep 9 2013 Sam Kottler <shk@redhat.com> - 0.0.2-1
- Add prefixed rake wrapper
* Wed Jun 26 2013 Adam Miller <maxamillion@fedoraproject.org> - 0.0.1-2
- Fix rubyabi
* Wed Jun 26 2013 Adam Miller <maxamillion@fedoraproject.org> - 0.0.1-1
- First package of the ruby-wrapper
tfm/tfm.spec
Summary: Package that installs %scl
Name: %scl_name
Version: 1.0
Release: 2%{?dist}
Version: 1.1
Release: 1%{?dist}
License: GPLv2+
Group: Applications/File
Source0: README
......
Requires: %{scl_prefix_v8}runtime
Requires: %{_root_bindir}/scl_source
Requires(post): policycoreutils-python
Obsoletes: ruby193-ruby-wrapper
%description runtime
Package shipping essential scripts to work with %scl Software Collection.
......
mkdir -p %{buildroot}%{_rpmconfigdir}/fileattrs/
cp %{SOURCE2} %{buildroot}%{_rpmconfigdir}/fileattrs/
# Install wrappers into system root to activate the SCL
%{__mkdir_p} %{buildroot}%{_root_bindir}
cat >> %{buildroot}%{_root_bindir}/%{scl_name}-ruby << EOF
#!/bin/bash
# Execute a single script with no arguments with 'scl', else it fails to
# pass spaces/quotes in arguments through correctly (RHBZ#1248418).
TMP=\$(mktemp)
trap "rm -f \$TMP" EXIT
echo -n ruby > \$TMP
for arg in "\$@"; do
printf " %q" "\$arg" >> \$TMP
done
scl enable %{scl_name} "bash \$TMP"
EOF
# compatibility symlink
ln -s %{scl_name}-ruby %{buildroot}%{_root_bindir}/ruby193-ruby
cat >> %{buildroot}%{_root_bindir}/%{scl_name}-rake << EOF
#!/bin/bash
# Execute a single script with no arguments with 'scl', else it fails to
# pass spaces/quotes in arguments through correctly (RHBZ#1248418).
TMP=\$(mktemp)
trap "rm -f \$TMP" EXIT
echo -n rake > \$TMP
for arg in "\$@"; do
printf " %q" "\$arg" >> \$TMP
done
scl enable %{scl_name} "bash \$TMP"
EOF
scl enable %{scl_ruby} - << \EOF
# Fake tfm SCL environment.
......
%dir %{_mandir}/man*
%config(noreplace) %{?_scl_scripts}/service-environment
%{_mandir}/man7/%{scl_name}.*
%attr(755,-,-) %{_root_bindir}/%{scl_name}-rake
%attr(755,-,-) %{_root_bindir}/%{scl_name}-ruby
%{_root_bindir}/ruby193-ruby
%files build
%doc LICENSE
......
%{_root_sysconfdir}/rpm/macros.%{scl_name}-scldevel
%changelog
* Tue Apr 28 2015 Dominic Cleal <dcleal@redhat.com> - 1.1-1
- Add tfm-ruby/rake wrappers to bindir
* Wed Feb 04 2015 Dominic Cleal <dcleal@redhat.com> - 1.0-2
- Provide changed vendor/dir prefix macros in tfm-build

Also available in: Unified diff