From 0efbf69fec5e29ccf7cd974e216d0c1704f545d8 Mon Sep 17 00:00:00 2001 From: Christoph Dwertmann Date: Fri, 17 May 2013 17:22:31 +1000 Subject: [PATCH] Truncated history --- README | 22 ++++ rpm/create_rpm_from_here | 31 +++++ rpm/rvm-ruby.spec | 254 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 307 insertions(+) create mode 100644 README create mode 100755 rpm/create_rpm_from_here create mode 100644 rpm/rvm-ruby.spec diff --git a/README b/README new file mode 100644 index 0000000..b654394 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +This is a fork of . I added branches `rpm` and `rpmtest`. The main branch to use is `rpm`. + +I do not plan to work on RVM. I simply added a `rpm` folder which contains a `rvm-ruby.spec` and a script to create the RPM from the sources. + +Just clone this repo, customize the rubies and gems needed as indicated below, go at the root, and launch: + + ./rpm/create_rpm_from_here + +The `rvm-ruby.spec` file is based on . I applied some customizations to make it compatibe with the small script i made to create the RPM. What i added is at the end of the `%install` section, beginning at + + # At this point, install of RVM is finished + # Now install some rubies + (...) + ruby_tag=ruby-1.9.3-p0 + rvm install $ruby_tag + rvm use $ruby_tag + gem install bundler --no-ri --no-rdoc + (...) + +There, i added instructions to build and packages some rubies and gems i want to deploy on all my servers. Up to you to modify that for your own needs. + +Last time i checked, it did not work on the `master` branch or RVM. It works with the `stable` branch. diff --git a/rpm/create_rpm_from_here b/rpm/create_rpm_from_here new file mode 100755 index 0000000..9e62023 --- /dev/null +++ b/rpm/create_rpm_from_here @@ -0,0 +1,31 @@ +#!/bin/bash + +# This script will build a RPM from the files in the current directory, given that there is a rpm/file.spec +# Its primary purpose is to be used by Jenkins + +set -e +set -x + +specfile=`find rpm -name \*.spec |head -1` +test -z "$specfile" && exit -1 + +specfile=`basename $specfile` + +name=`grep -P '^Name:\s+' rpm/$specfile |awk '{print $2}'` +commitdate=`git log -1 --format="%ct"` +version=`grep -P '^Version:\s+' rpm/$specfile |awk '{print $2}'`.$commitdate +#release=`grep -P '^Release:\s+' rpm/$specfile |awk '{print $2}'` + +rm -rf rpmbuild +mkdir -p rpmbuild/{BUILD,RPMS,SOURCES/$name-$version,SPECS,SRPMS,tmp} +cp -a rpm/$specfile rpmbuild/SPECS +sed -i "s/^[\t ]*Version:.*\$/Version: ${version}/" rpmbuild/SPECS/$specfile +tar --exclude-vcs --exclude='rpmbuild' --exclude='rpm' -cp * | (cd rpmbuild/SOURCES/$name-$version ; tar xp) + +pushd rpmbuild/SOURCES +tar cf $name-$version.tar $name-$version # Best not to use cpu on our small ec2 instances +#sed -i "s/^[\t ]*Source0:.*/Source0: $name-$version.tar/g" rpmbuild/SPECS/*.spec +#sed -i "s/^[\t ]*%setup[\t ]\+-n[\t ]\+.*/%setup -n $name-$version/g" rpmbuild/SPECS/*.spec +popd + +rpmbuild --define "_topdir %(pwd)/rpmbuild" -ba rpmbuild/SPECS/$specfile diff --git a/rpm/rvm-ruby.spec b/rpm/rvm-ruby.spec new file mode 100644 index 0000000..68c3e02 --- /dev/null +++ b/rpm/rvm-ruby.spec @@ -0,0 +1,254 @@ +%global rvm_dir /usr/lib/rvm +%global rvm_group rvm + +# RVM can not be sourced with default /bin/sh +%define _buildshell /bin/bash + +Name: rvm-ruby +Summary: Ruby Version Manager +Version: 3 # Version will be appended the commit date +Release: 1.el6_CS +License: ASL 2.0 +URL: http://rvm.beginrescueend.com/ +Group: Applications/System + +Source: %{name}-%{version}.tar + +#BuildArch: noarch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) + +BuildRequires: bash curl git +BuildRequires: gcc-c++ patch chrpath readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel +BuildRequires: sed grep tar gzip bzip2 make file + +Requires(pre): shadow-utils +# For rvm +Requires: bash curl git +# Basics for building ruby 1.8/1.9 +Requires: gcc-c++ patch readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel +# Used by the scripts +Requires: sed grep tar gzip bzip2 make file + +%description +RVM is the Ruby Version Manager (rvm). It manages Ruby interpreter environments +and switching between them. + +This package is meant for use by multiple users maintaining a shared copy of +RVM. Users added to the '%{rvm_group}' group will be able to modify all aspects +of RVM. These users will also have their default umask modified ("g+w") to allow +group write permission (usually resulting in a umask of "0002") in order to +ensure correct permissions for the shared RVM content. + +RVM is activated for all logins by default. To disable remove +%{_sysconfdir}/profile.d/rvm.sh and source rvm from each users shell. + +Rubies in this package: +ruby-1.9.3-p0 + bundler + bluepill + whenever + +ruby-1.9.2-p290 + bundler + bluepill + whenever + + +%prep +%setup -q + +%build + +%install +rm -rf %{buildroot} + +# Clean the env +for i in `env | grep ^rvm_ | cut -d"=" -f1`; do + unset $i; +done + +# Install everything into one directory +rvm_ignore_rvmrc=1 \ + rvm_user_install_flag=0 \ + rvm_path="%{buildroot}%{rvm_dir}" \ + rvm_bin_path="%{buildroot}%{_bindir}" \ + rvm_man_path="%{buildroot}%{_mandir}" \ + ./install + +# So members of the rvm group can write to it +find %{buildroot}%{rvm_dir} -exec chmod ug+w {} \; +find %{buildroot}%{rvm_dir} -type d -exec chmod g+s {} \; + +mkdir -p %{buildroot}%{_sysconfdir} + +# We use selfcontained so binaries end up in rvm/bin +cat > %{buildroot}%{_sysconfdir}/rvmrc < %{buildroot}%{_sysconfdir}/profile.d/rvm.sh </dev/null || groupadd -r %{rvm_group} +exit 0 + +%files +%defattr(-,root,root) +%config(noreplace) /etc/rvmrc +%config(noreplace) /etc/profile.d/rvm.sh +%attr(-,root,%{rvm_group}) %{rvm_dir} +%{_bindir} +%{_mandir}/man1/* + +%changelog +* Fri Mar 30 2012 Alexandre Fouche - 3.xxx +Add some rubies and gems to compile: +- 1.9.2-p290 + bundler, bluepill, whenever +- 1.9.3-p0 + bundler, bluepill, whenever + +* Thu Mar 29 2012 Alexandre Fouche - 2.xxx +- Adapt to make it work from RVM git source directly +- Strip binaries, libraries, ... + +* Thu Mar 29 2012 Alexandre Fouche - 1.xxx +- Adapt to make it work from RVM git source directly + +* Tue Dec 13 2011 Matthew Kent - 1.10.0-2 +- New upstream release +- Drop rvm_prefix +- Rename rvm_user_install to rvm_user_install_flag +- Rename rake wrapper to rvm-rake +- Add file dependency + +* Thu Aug 4 2011 Matthew Kent - 1.6.32-1 +- New upstream release + +* Tue Apr 19 2011 Matthew Kent - 1.6.3-1 +- Initial package based off Gentoo work -- 2.43.0