[opensuse-ruby] rubygem macros
Hi guys, I've had fun with patching some rubygems lately, and wasn't entirely fond of how we do it currently. Thus, I'd like to propose a little addition to our rubygem macros we provide to packagers. Currently we only have the %gem_install macro, which has several shortcomings. Not only does everything happen within %buildroot (with %prep and %build sections unused), it also makes patching unpacked sources tedious. You have to provide patches as 'SourceX' and cd into the gem install path in the buildroot in order to patch in the %install section... Last but not least, this only works by the help of a openSUSE-specific patch for rubygems (adding buildroot support for 'gem install'), thus the ugly "Buildrequires: rubygems_with_buildroot_patch" everywhere. What we actually want to have instead is something like this: %setup %gem_unpack %{SOURCE0} # or now possible (if we package a source tarball): %setup -q # and now possible: %patch1 ... %build %gem_build %install %gem_install %clean %gem_cleanup I hacked something together in 'home:saschpe:ruby', there's a new 'rubygems' package which adds the above macros and two example packages: rubygem-gem2rpm - has a gemspec in it's gem file rubygem-yard - build from source tarball (the gem ships no gemspec) Without much ado, here are the current macro definitions: %gem_unpack() \ if [ %# -eq 0 ]; then \ /usr/bin/gem unpack --verbose %{SOURCE0} \ else \ /usr/bin/gem unpack --verbose %1 \ fi \ cd %{mod_name}-%{version} \ %{nil} %gem_build() \ GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name "*.gemspec" | xargs dirname` \ cd $GEMSPEC_SOURCE_DIR && /usr/bin/gem build --verbose *.gemspec \ %{nil} %gem_install() \ if [ %# -eq 1 ]; then \ /usr/bin/gem install --verbose --local --build-root=%{buildroot} \ else \ GEM_FILE=`find . -maxdepth 2 -type f -name "%{mod_name}-%{version}.gem"` \ /usr/bin/gem install --verbose --local --bindir %{buildroot}%{_bindir} --install-dir %{buildroot}%{_libdir}/ruby/gems/%{rb_ver} $GEM_FILE \ fi \ %{nil} The %gem_unpack macro is only useful if your gem actually has a gemspec, otherwise plain old %setup and a source tarball will do. As you can see, the %gem_install macro still has the old behavior when one parameter is provided. Currently, the %gem_build macro tries to find the gemspec, because 'gem build' wants to be in the same directory. Lastly, the %gem_install macro searches the resulting gem, as git source tarballs tend to have funny directory names As a next step, I would like to adjust gem2rpm-opensuse to generate spec files accordingly. If we decide to use this in d:l:r:e, we hopefully can get away with that buildroot patch eventually. I'm sure there's a lot of room for improvement, so what do you think? p.s.: Please CC me, I'm not subscribed to this list! -- Viele Grüße, Sascha Peilicke
On 30.05.2012 09:16, Sascha Peilicke wrote:
As a next step, I would like to adjust gem2rpm-opensuse to generate spec files accordingly. If we decide to use this in d:l:r:e, we hopefully can get away with that buildroot patch eventually.
I'm sure there's a lot of room for improvement, so what do you think?
p.s.: Please CC me, I'm not subscribed to this list!
Hi Sascha, I find the current way also highly unpractical and yours is much more in line with how other stuff is packaged, so I welcome your patches. But I would leave out the rubygems package from it. I suggest to maintain all macros in the ruby package and provide a ruby-macros backport package for older distros just as we did with perl-macros in devel:languages:perl. The rubygems package is dead for ruby 1.9 and as such you would need two places to maintain the macros anyway, so better maintain a 100% copy. The macros do not change that often. Greetings, Stephan -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
On 05/30/2012 09:30 AM, Stephan Kulow wrote:
On 30.05.2012 09:16, Sascha Peilicke wrote:
As a next step, I would like to adjust gem2rpm-opensuse to generate spec files accordingly. If we decide to use this in d:l:r:e, we hopefully can get away with that buildroot patch eventually.
I'm sure there's a lot of room for improvement, so what do you think?
p.s.: Please CC me, I'm not subscribed to this list!
Hi Sascha,
I find the current way also highly unpractical and yours is much more in line with how other stuff is packaged, so I welcome your patches.
But I would leave out the rubygems package from it. I suggest to maintain all macros in the ruby package and provide a ruby-macros backport package for older distros just as we did with perl-macros in devel:languages:perl. Yep, in the meantime I found out that much happened during my vacation regarding our Ruby packages ;-) Your idea sounds reasonable, so if nobody objects here, I'll proceed as Stephan recommended.
The rubygems package is dead for ruby 1.9 and as such you would need two places to maintain the macros anyway, so better maintain a 100% copy. The macros do not change that often. Agreed -- Viele Grüße, Sascha Peilicke
hi, why make things more complicated than needed? most of our patches are pure ruby and can be applied without any issues. darix -- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
On Wed, 30 May 2012 13:05:43 +0200 Marcus Rueckert <darix@opensu.se> wrote:
hi,
why make things more complicated than needed? most of our patches are pure ruby and can be applied without any issues.
darix
One of possible reason is that if we apply after gem installation, then gem check will not work correct ( report modified files ). Josef -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
On 30.05.2012 13:05, Marcus Rueckert wrote:
hi,
why make things more complicated than needed? most of our patches are pure ruby and can be applied without any issues.
It would also simplify patching sources for more than one ruby version. Right now you need to pushd and popd around a lot ;( Greetings, Stephan -- To unsubscribe, e-mail: opensuse-ruby+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-ruby+owner@opensuse.org
participants (4)
-
Josef Reidinger
-
Marcus Rueckert
-
Sascha Peilicke
-
Stephan Kulow