From 53dbe04f09bd9e1945df69534f534b8f0ccdbabf62c9fc982707322af39ae321 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 26 Jul 2012 07:25:42 +0000 Subject: [PATCH 1/3] Accepting request 128957 from openSUSE:Tools:Unstable - map the != operator to > - which might be wrong in 50% of all cases - require a patched rpm in case rpm does not have magic hooks - move the option parsing to a shell script that is able to do it rightly (rpm macros are just *BAD*) - make the rubygemdeps a ruby script much more clever about gemspecs - Another take on %gem_install, the version w/o passing parameters seemed to be wrong - avoid *.gemspec, we get problems if we there are two - remove too relaxing permissions from unpacked archive - add a provides for ruby-macros - Fix %gem_unpack: Fetch Gemspec from gem metadata for gems that don't package Gemspecs but generate them programatically OBS-URL: https://build.opensuse.org/request/show/128957 OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=42 --- gem_install.sh | 45 +++++++++++++++++++++++++++++++ ruby.changes | 49 ++++++++++++++++++++++++++++++++++ ruby.common-macros | 4 ++- ruby.macros | 38 +++++++------------------- ruby.spec | 24 +++++++++++------ rubygems.attr | 6 ++--- rubygemsdeps.rb | 66 ++++++++++++++++++++++++++++++++++++++++++++++ rubygemsdeps.sh | 33 ----------------------- 8 files changed, 192 insertions(+), 73 deletions(-) create mode 100644 gem_install.sh create mode 100644 rubygemsdeps.rb delete mode 100644 rubygemsdeps.sh diff --git a/gem_install.sh b/gem_install.sh new file mode 100644 index 0000000..e42a781 --- /dev/null +++ b/gem_install.sh @@ -0,0 +1,45 @@ +#! /bin/bash + +# options may be followed by one colon to indicate they have a required argument +if ! options=$(getopt -o dEf -l ignore-dependencies,force,no-rdoc,rdoc,no-ri,ri,env-shebang,no-env-shebang,default-gem:,build-root:,gem-binary: -- "$@") +then + # something went wrong, getopt will put out an error message for us + exit 1 +fi + +eval set -- "$options" + +gem_binary=gem +defaultgem= +gemfile= +otheropts= + +while [ $# -gt 0 ] +do + case $1 in + --default-gem) defaultgem=$2 ; shift;; + --gem-binary) gem_binary="$2" ; shift;; + --build-root) otheropts="$otheropts $1=$2"; shift;; + (--) ;; + (-*) otheropts="$otheropts $1";; + (*) gemfile=$1; otheropts="$otheropts $1"; break;; + esac + shift +done + +if [ "x$gemfile" = "x" ] ; then + gemfile=$(find . -maxdepth 2 -type f -name "$defaultgem") + otheropts="$otheropts $gemfile" +fi +set -x +$gem_binary install --verbose --local $otheropts +if test -d $RPM_BUILD_ROOT/usr/bin; then + cd $RPM_BUILD_ROOT/usr/bin + bins=`ls -1 *1.9 2> /dev/null` + if test -n "$bins"; then + for bin in $bins; do + mv -v $bin $(echo "$bin" | sed -e 's,1.9$,,') + done + fi +fi + diff --git a/ruby.changes b/ruby.changes index acf7244..74ea168 100644 --- a/ruby.changes +++ b/ruby.changes @@ -1,3 +1,52 @@ +------------------------------------------------------------------- +Wed Jul 25 14:52:49 UTC 2012 - coolo@suse.com + +- map the != operator to > - which might be wrong in 50% of all cases + +------------------------------------------------------------------- +Wed Jul 25 14:39:43 UTC 2012 - coolo@suse.com + +- require a patched rpm in case rpm does not have magic hooks + +------------------------------------------------------------------- +Wed Jul 25 12:17:02 UTC 2012 - coolo@suse.com + +- move the option parsing to a shell script that is able to do it + rightly (rpm macros are just *BAD*) + +------------------------------------------------------------------- +Wed Jul 25 11:09:28 UTC 2012 - coolo@suse.com + +- make the rubygemdeps a ruby script much more clever about gemspecs + +------------------------------------------------------------------- +Wed Jul 25 08:27:38 UTC 2012 - saschpe@suse.de + +- Another take on %gem_install, the version w/o passing parameters + seemed to be wrong + +------------------------------------------------------------------- +Wed Jul 25 05:54:25 UTC 2012 - coolo@suse.com + +- avoid *.gemspec, we get problems if we there are two + +------------------------------------------------------------------- +Tue Jul 24 15:24:43 UTC 2012 - coolo@suse.com + +- remove too relaxing permissions from unpacked archive + +------------------------------------------------------------------- +Tue Jul 24 14:55:31 UTC 2012 - coolo@suse.com + +- add a provides for ruby-macros + +------------------------------------------------------------------- +Tue Jul 24 14:36:38 UTC 2012 - saschpe@suse.de + +- Fix %gem_unpack: + Fetch Gemspec from gem metadata for gems that don't package Gemspecs + but generate them programatically + ------------------------------------------------------------------- Tue Jul 17 14:15:42 UTC 2012 - saschpe@suse.de diff --git a/ruby.common-macros b/ruby.common-macros index 0176d9e..acf3917 100644 --- a/ruby.common-macros +++ b/ruby.common-macros @@ -1,2 +1,4 @@ -%gem_cleanup /usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/ +%gem_cleanup() \ +/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \ +%{nil} diff --git a/ruby.macros b/ruby.macros index 0a02d8a..f9a9969 100644 --- a/ruby.macros +++ b/ruby.macros @@ -32,20 +32,19 @@ # %gem_unpack %{SOURCE0} # %patch1 -p1 # -%gem_unpack() \ -if [ %# -eq 0 ]; then \ - %{gem_binary} unpack --verbose %{SOURCE0} \ -else \ - %{gem_binary} unpack --verbose %1 \ -fi \ -cd %{mod_name}-%{version} \ +%gem_unpack(s:) \ + source=%{-s:%{-s*}}%{!-s:%{SOURCE0}} \ + %{gem_binary} unpack --verbose $source \ + cd %{mod_name}-%{version} \ + chmod og-w -R . \ + %{gem_binary} unpack --spec --verbose $source \ %{nil} # %%gem_build macro ... # %gem_build() \ -GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name "*.gemspec" | xargs dirname` \ -cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose *.gemspec \ +GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name %{mod_name}-%{version}.gemspec | xargs dirname` \ +cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose %{mod_name}-%{version}.gemspec \ %{nil} # %%gem_install macro ... @@ -53,26 +52,9 @@ cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose *.gemspec \ # When invoked with a single parameter, the macro retains the old macro behavior, i.e. # building the upstream gem directly in $RPM_BUILD_ROOT without unpacking to %{_builddir} first. # -%gem_install() \ -if [ %# -ge 1 ]; then \ - %{gem_binary} install --verbose --local --build-root=%{buildroot} %* ;\ -else \ - GEM_FILE=`find . -maxdepth 2 -type f -name "%{mod_name}-%{version}.gem"` \ - %{gem_binary} install --verbose --local --bindir %{buildroot}%{_bindir} --install-dir %{buildroot}%{_libdir}/ruby/gems/%{rb_ver} $GEM_FILE \ -fi; \ -if test -d $RPM_BUILD_ROOT/usr/bin; then \ - cd $RPM_BUILD_ROOT/usr/bin; \ - bins=`ls -1 *1.9 2> /dev/null`; \ - if test -n "$bins"; then \ - for bin in $bins; do \ - mv -v $bin $(echo "$bin" | sed -e 's,1.9$,,'); \ - done ;\ - fi ;\ -fi ;\ -%{nil} +%gem_install /usr/lib/rpm/gem_install.sh --default-gem %{mod_name}-%{version}.gem --build-root %{buildroot} --gem-binary %{gem_binary} %gem_cleanup() \ -/usr/bin/gem_build_cleanup %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \ +/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \ %{nil} - diff --git a/ruby.spec b/ruby.spec index 76f4eb6..2953f44 100644 --- a/ruby.spec +++ b/ruby.spec @@ -19,15 +19,14 @@ Name: ruby Version: 1.9.3 Release: 0 -# -# BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: ruby.macros Source1: gem_build_cleanup Source2: gemrc Source3: ruby.common-macros Source4: rubygems.attr -Source5: rubygemsdeps.sh +Source5: rubygemsdeps.rb +Source6: gem_install.sh Provides: /usr/bin/ruby Url: http://www.ruby-lang.org/ Summary: An Interpreted Object-Oriented Scripting Language @@ -36,6 +35,12 @@ Group: Development/Languages/Ruby Requires: ruby19 Provides: rubygems = 1.8.15 Obsoletes: rubygems < 1.8.15 +Provides: ruby-macros = 1 +Requires: ruby-common = %{version}-%{release} +%if %suse_version < 1140 +# we need a patched rpm +Requires: rpm-with-ruby-provide-hook +%endif %description Ruby is an interpreted scripting language for quick and easy @@ -79,6 +84,7 @@ Development files to link against Ruby. %package common Summary: Files needed by all ruby versions Group: Development/Languages/Ruby +Requires: /usr/bin/getopt %description common Development files to link against Ruby. @@ -88,7 +94,7 @@ Development files to link against Ruby. %build %install -install -D -m 0755 %{S:1} $RPM_BUILD_ROOT%_bindir/gem_build_cleanup +mkdir -p $RPM_BUILD_ROOT%_bindir for bin in erb gem irb rake rdoc ri ruby testrb; do ln -s %_bindir/"$bin"1.9 $RPM_BUILD_ROOT%_bindir/$bin done @@ -98,13 +104,14 @@ install -D -m 0644 %{S:0} $RPM_BUILD_ROOT/etc/rpm/macros.ruby install -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/rpm/macros.common-ruby install -D -m 0644 %{S:2} $RPM_BUILD_ROOT/etc/gemrc install -D -m 0644 %{S:4} $RPM_BUILD_ROOT/usr/lib/rpm/fileattrs/rubygems.attr -install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/usr/lib/rpm/rubygemsdeps.sh +install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/usr/lib/rpm/rubygemsdeps.rb +install -D -m 0755 %{S:6} $RPM_BUILD_ROOT/usr/lib/rpm/gem_install.sh +install -D -m 0755 %{S:1} $RPM_BUILD_ROOT/usr/lib/rpm/gem_build_cleanup.sh export NO_BRP_STALE_LINK_ERROR=yes %files %defattr(-,root,root) /etc/rpm/macros.ruby -%exclude %_bindir/gem_build_cleanup %{_bindir}/* %files devel @@ -117,7 +124,8 @@ export NO_BRP_STALE_LINK_ERROR=yes /etc/rpm/macros.common-ruby %dir /usr/lib/rpm/fileattrs /usr/lib/rpm/fileattrs/rubygems.attr -/usr/lib/rpm/rubygemsdeps.sh -%_bindir/gem_build_cleanup +/usr/lib/rpm/rubygemsdeps.rb +/usr/lib/rpm/gem_install.sh +/usr/lib/rpm/gem_build_cleanup.sh %changelog diff --git a/rubygems.attr b/rubygems.attr index 9e19801..6004aac 100644 --- a/rubygems.attr +++ b/rubygems.attr @@ -1,4 +1,4 @@ -%__rubygems_requires %{_rpmconfigdir}/rubygemsdeps.sh --requires -%__rubygems_provides %{_rpmconfigdir}/rubygemsdeps.sh --provides -%__rubygems_path ^%{_libdir}/ruby/gems/[^/]*/specifications +%__rubygems_requires %{_rpmconfigdir}/rubygemsdeps.rb --requires +%__rubygems_provides %{_rpmconfigdir}/rubygemsdeps.rb --provides +%__rubygems_path ^%{_libdir}/ruby/gems/[^/]*/specifications diff --git a/rubygemsdeps.rb b/rubygemsdeps.rb new file mode 100644 index 0000000..6e388c7 --- /dev/null +++ b/rubygemsdeps.rb @@ -0,0 +1,66 @@ +#!/usr/bin/ruby + +require 'optparse' +require 'rubygems/specification' + +opts = OptionParser.new("Usage: #{$0}") + +provides=false +opts.on("-P", "--provides", "Output the provides of the package") do |val| + provides=true +end +requires=false +opts.on("-R", "--requires", "Output the requires of the package") do |val| + requires=true +end +rest = opts.permute(ARGV) + +unless provides || requires + exit(0) +end + +gemspecs=Array.new + +$stdin.each_line do |line| + line.match(%r{.*/specifications/.*\.gemspec$}) do |m| + gemspecs << [m[0], Gem::Specification.load(m[0])] + end +end + +gemspecs.each do |file, spec| + rubyabi=nil + file.match(%r{.*/gems/([^/]*)/.*}) do |m| + rubyabi=m[1] + end + if provides + # old forms + puts "rubygem-#{spec.name} = #{spec.version}" + versions = spec.version.to_s.split('.') + puts "rubygem-#{spec.name}-#{versions[0]} = #{spec.version}" if versions.length > 0 + puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]} = #{spec.version}" if versions.length > 1 + puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = #{spec.version}" if versions.length > 2 + + # version without ruby version - asking for trouble + puts "rubygem(#{spec.name}) = #{spec.version}" + puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}" if rubyabi + end + + if requires + puts "ruby(abi) = #{rubyabi}" if rubyabi + spec.runtime_dependencies.each do |dep| + dep.requirement.requirements.each do |r| + if r.first == '~>' + next_version = Gem::Version.create(r.last).bump + puts "rubygem(#{rubyabi}:#{dep.name}) >= #{r.last}" + puts "rubygem(#{rubyabi}:#{dep.name}) < #{next_version}" + elsif r.first == '!=' + # this is purely guessing, but we can't generate conflicts here ;( + puts "rubygem(#{rubyabi}:#{dep.name}) > #{r.last}" + #puts "rubygem(#{rubyabi}:#{dep.name}) < #{r.last}" + else + puts "rubygem(#{rubyabi}:#{dep.name}) #{r.first} #{r.last}" + end + end + end + end +end diff --git a/rubygemsdeps.sh b/rubygemsdeps.sh deleted file mode 100644 index 90fd442..0000000 --- a/rubygemsdeps.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -[ $# -ge 1 ] || { - cat > /dev/null - exit 0 -} - -case $1 in --P|--provides) - shift - RPM_BUILD_ROOT="$1" - while read possible - do - case "$possible" in - *.gemspec) - possible=${possible##*/} - possible=${possible%.gemspec} - echo "$possible" | sed -e 's,^\(.*\)-,rubygem(\1) = ,' - ;; - esac - done - ;; --R|--requires) - while read possible ; do - case "$possible" in - *.gemspec) - echo "$possible" | sed -ne 's,.*/gems/,ruby(abi) = ,; s,/.*,,p' - ;; - esac - done - ;; -esac -exit 0 From 4b4c0dfe59dc0db0a907da2e3aba9d489808d39894818a0c8750b5fedbc6fadc Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 26 Jul 2012 07:36:40 +0000 Subject: [PATCH 2/3] - split out ruby-common into a package on its own OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=43 --- gem_build_cleanup | 14 ---------- gem_install.sh | 45 ------------------------------- ruby.changes | 5 ++++ ruby.common-macros | 4 --- ruby.macros | 33 ----------------------- ruby.spec | 38 +++----------------------- rubygems.attr | 4 --- rubygemsdeps.rb | 66 ---------------------------------------------- 8 files changed, 8 insertions(+), 201 deletions(-) delete mode 100644 gem_build_cleanup delete mode 100644 gem_install.sh delete mode 100644 ruby.common-macros delete mode 100644 rubygems.attr delete mode 100644 rubygemsdeps.rb diff --git a/gem_build_cleanup b/gem_build_cleanup deleted file mode 100644 index d3d49f3..0000000 --- a/gem_build_cleanup +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -if [ ${#*} = 1 ] ; then - if [ -d "$1" ] ; then - find $1 \ - \( -name \*.o -o -name Makefile -o -name config.log -o -name config.status -o -name Makefile.html -o -name gem_make.out -o -name mkmf.log -o -name \*.bak -o -name .deps -o -name .libs -o -name CVS \) \ - -print0 | xargs -r0 rm -rv || : - else - echo "'$1' does not exists or is not a directory! Exiting." >&2 - exit 1 - fi -else - echo "Please pass exact one argument to this script! Exiting." >&2 - exit 1 -fi diff --git a/gem_install.sh b/gem_install.sh deleted file mode 100644 index e42a781..0000000 --- a/gem_install.sh +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/bash - -# options may be followed by one colon to indicate they have a required argument -if ! options=$(getopt -o dEf -l ignore-dependencies,force,no-rdoc,rdoc,no-ri,ri,env-shebang,no-env-shebang,default-gem:,build-root:,gem-binary: -- "$@") -then - # something went wrong, getopt will put out an error message for us - exit 1 -fi - -eval set -- "$options" - -gem_binary=gem -defaultgem= -gemfile= -otheropts= - -while [ $# -gt 0 ] -do - case $1 in - --default-gem) defaultgem=$2 ; shift;; - --gem-binary) gem_binary="$2" ; shift;; - --build-root) otheropts="$otheropts $1=$2"; shift;; - (--) ;; - (-*) otheropts="$otheropts $1";; - (*) gemfile=$1; otheropts="$otheropts $1"; break;; - esac - shift -done - -if [ "x$gemfile" = "x" ] ; then - gemfile=$(find . -maxdepth 2 -type f -name "$defaultgem") - otheropts="$otheropts $gemfile" -fi -set -x -$gem_binary install --verbose --local $otheropts -if test -d $RPM_BUILD_ROOT/usr/bin; then - cd $RPM_BUILD_ROOT/usr/bin - bins=`ls -1 *1.9 2> /dev/null` - if test -n "$bins"; then - for bin in $bins; do - mv -v $bin $(echo "$bin" | sed -e 's,1.9$,,') - done - fi -fi - diff --git a/ruby.changes b/ruby.changes index 74ea168..5ba3af2 100644 --- a/ruby.changes +++ b/ruby.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Jul 26 07:36:15 UTC 2012 - coolo@suse.com + +- split out ruby-common into a package on its own + ------------------------------------------------------------------- Wed Jul 25 14:52:49 UTC 2012 - coolo@suse.com diff --git a/ruby.common-macros b/ruby.common-macros deleted file mode 100644 index acf3917..0000000 --- a/ruby.common-macros +++ /dev/null @@ -1,4 +0,0 @@ -%gem_cleanup() \ -/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \ -%{nil} - diff --git a/ruby.macros b/ruby.macros index f9a9969..0de951a 100644 --- a/ruby.macros +++ b/ruby.macros @@ -25,36 +25,3 @@ %rb_vendorlib %rb19_vendorlibdir %rb_vendorarch %rb19_vendorarchdir -# %%gem_unpack macro unpacks a gem file into %%{_builddir} -# -# example: -# %prep -# %gem_unpack %{SOURCE0} -# %patch1 -p1 -# -%gem_unpack(s:) \ - source=%{-s:%{-s*}}%{!-s:%{SOURCE0}} \ - %{gem_binary} unpack --verbose $source \ - cd %{mod_name}-%{version} \ - chmod og-w -R . \ - %{gem_binary} unpack --spec --verbose $source \ -%{nil} - -# %%gem_build macro ... -# -%gem_build() \ -GEMSPEC_SOURCE_DIR=`find . -maxdepth 2 -type f -name %{mod_name}-%{version}.gemspec | xargs dirname` \ -cd $GEMSPEC_SOURCE_DIR && %{gem_binary} build --verbose %{mod_name}-%{version}.gemspec \ -%{nil} - -# %%gem_install macro ... -# -# When invoked with a single parameter, the macro retains the old macro behavior, i.e. -# building the upstream gem directly in $RPM_BUILD_ROOT without unpacking to %{_builddir} first. -# -%gem_install /usr/lib/rpm/gem_install.sh --default-gem %{mod_name}-%{version}.gem --build-root %{buildroot} --gem-binary %{gem_binary} - -%gem_cleanup() \ -/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%{_libdir}/ruby/gems/%{rb_ver}/ \ -%{nil} - diff --git a/ruby.spec b/ruby.spec index 2953f44..87372df 100644 --- a/ruby.spec +++ b/ruby.spec @@ -21,12 +21,7 @@ Version: 1.9.3 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: ruby.macros -Source1: gem_build_cleanup Source2: gemrc -Source3: ruby.common-macros -Source4: rubygems.attr -Source5: rubygemsdeps.rb -Source6: gem_install.sh Provides: /usr/bin/ruby Url: http://www.ruby-lang.org/ Summary: An Interpreted Object-Oriented Scripting Language @@ -35,12 +30,7 @@ Group: Development/Languages/Ruby Requires: ruby19 Provides: rubygems = 1.8.15 Obsoletes: rubygems < 1.8.15 -Provides: ruby-macros = 1 -Requires: ruby-common = %{version}-%{release} -%if %suse_version < 1140 -# we need a patched rpm -Requires: rpm-with-ruby-provide-hook -%endif +Requires: ruby-common >= 1.0 %description Ruby is an interpreted scripting language for quick and easy @@ -81,14 +71,6 @@ Provides: rubygems_with_buildroot_patch %description devel Development files to link against Ruby. -%package common -Summary: Files needed by all ruby versions -Group: Development/Languages/Ruby -Requires: /usr/bin/getopt - -%description common -Development files to link against Ruby. - %prep %build @@ -101,31 +83,17 @@ done mkdir -p $RPM_BUILD_ROOT%_libdir ln -s %_libdir/libruby1.9.so $RPM_BUILD_ROOT%_libdir/libruby.so install -D -m 0644 %{S:0} $RPM_BUILD_ROOT/etc/rpm/macros.ruby -install -D -m 0644 %{S:3} $RPM_BUILD_ROOT/etc/rpm/macros.common-ruby install -D -m 0644 %{S:2} $RPM_BUILD_ROOT/etc/gemrc -install -D -m 0644 %{S:4} $RPM_BUILD_ROOT/usr/lib/rpm/fileattrs/rubygems.attr -install -D -m 0755 %{S:5} $RPM_BUILD_ROOT/usr/lib/rpm/rubygemsdeps.rb -install -D -m 0755 %{S:6} $RPM_BUILD_ROOT/usr/lib/rpm/gem_install.sh -install -D -m 0755 %{S:1} $RPM_BUILD_ROOT/usr/lib/rpm/gem_build_cleanup.sh export NO_BRP_STALE_LINK_ERROR=yes %files %defattr(-,root,root) -/etc/rpm/macros.ruby +%config /etc/gemrc +%config /etc/rpm/macros.ruby %{_bindir}/* %files devel %defattr(-,root,root) %_libdir/libruby.so -%files common -%defattr(-,root,root) -/etc/gemrc -/etc/rpm/macros.common-ruby -%dir /usr/lib/rpm/fileattrs -/usr/lib/rpm/fileattrs/rubygems.attr -/usr/lib/rpm/rubygemsdeps.rb -/usr/lib/rpm/gem_install.sh -/usr/lib/rpm/gem_build_cleanup.sh - %changelog diff --git a/rubygems.attr b/rubygems.attr deleted file mode 100644 index 6004aac..0000000 --- a/rubygems.attr +++ /dev/null @@ -1,4 +0,0 @@ -%__rubygems_requires %{_rpmconfigdir}/rubygemsdeps.rb --requires -%__rubygems_provides %{_rpmconfigdir}/rubygemsdeps.rb --provides -%__rubygems_path ^%{_libdir}/ruby/gems/[^/]*/specifications - diff --git a/rubygemsdeps.rb b/rubygemsdeps.rb deleted file mode 100644 index 6e388c7..0000000 --- a/rubygemsdeps.rb +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/ruby - -require 'optparse' -require 'rubygems/specification' - -opts = OptionParser.new("Usage: #{$0}") - -provides=false -opts.on("-P", "--provides", "Output the provides of the package") do |val| - provides=true -end -requires=false -opts.on("-R", "--requires", "Output the requires of the package") do |val| - requires=true -end -rest = opts.permute(ARGV) - -unless provides || requires - exit(0) -end - -gemspecs=Array.new - -$stdin.each_line do |line| - line.match(%r{.*/specifications/.*\.gemspec$}) do |m| - gemspecs << [m[0], Gem::Specification.load(m[0])] - end -end - -gemspecs.each do |file, spec| - rubyabi=nil - file.match(%r{.*/gems/([^/]*)/.*}) do |m| - rubyabi=m[1] - end - if provides - # old forms - puts "rubygem-#{spec.name} = #{spec.version}" - versions = spec.version.to_s.split('.') - puts "rubygem-#{spec.name}-#{versions[0]} = #{spec.version}" if versions.length > 0 - puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]} = #{spec.version}" if versions.length > 1 - puts "rubygem-#{spec.name}-#{versions[0]}_#{versions[1]}_#{versions[2]} = #{spec.version}" if versions.length > 2 - - # version without ruby version - asking for trouble - puts "rubygem(#{spec.name}) = #{spec.version}" - puts "rubygem(#{rubyabi}:#{spec.name}) = #{spec.version}" if rubyabi - end - - if requires - puts "ruby(abi) = #{rubyabi}" if rubyabi - spec.runtime_dependencies.each do |dep| - dep.requirement.requirements.each do |r| - if r.first == '~>' - next_version = Gem::Version.create(r.last).bump - puts "rubygem(#{rubyabi}:#{dep.name}) >= #{r.last}" - puts "rubygem(#{rubyabi}:#{dep.name}) < #{next_version}" - elsif r.first == '!=' - # this is purely guessing, but we can't generate conflicts here ;( - puts "rubygem(#{rubyabi}:#{dep.name}) > #{r.last}" - #puts "rubygem(#{rubyabi}:#{dep.name}) < #{r.last}" - else - puts "rubygem(#{rubyabi}:#{dep.name}) #{r.first} #{r.last}" - end - end - end - end -end From af87e266ae8fe4b5681bc670ba0111d2178f80d567f4b7f8151e00e80983c0f6 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 26 Jul 2012 07:39:28 +0000 Subject: [PATCH 3/3] add some great license :) OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby?expand=0&rev=44 --- ruby.macros | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ruby.macros b/ruby.macros index 0de951a..451c490 100644 --- a/ruby.macros +++ b/ruby.macros @@ -1,3 +1,26 @@ +# +# Copyright (c) 2012 SUSE Linux +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + %rubygems_requires %{rubygems19_requires} %rb_binary %{rb19_binary}