Merge Fedora master.
This commit is contained in:
parent
bd3bd56439
commit
a1be14bf44
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,7 +1,4 @@
|
||||
*~
|
||||
*.swp
|
||||
*.rpm
|
||||
*.xz
|
||||
*.tgz
|
||||
*.gem
|
||||
/*/
|
||||
/ruby-2.*.tar.bz2
|
||||
/ruby-2.*.tar.xz
|
||||
/*.rpm
|
||||
|
61
config.h
61
config.h
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This config.h is a wrapper include file for the original ruby/config.h,
|
||||
* which has been renamed to ruby/config-<arch>.h. There are conflicts for the
|
||||
* original ruby/config.h on multilib systems, which result from arch-specific
|
||||
* configuration options. Please do not use the arch-specific file directly.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This wrapped is addpated from SDL's one:
|
||||
* http://pkgs.fedoraproject.org/cgit/SDL.git/tree/SDL_config.h
|
||||
*/
|
||||
|
||||
#ifdef ruby_config_wrapper_h
|
||||
#error "ruby_config_wrapper_h should not be defined!"
|
||||
#endif
|
||||
#define ruby_config_wrapper_h
|
||||
|
||||
#if defined(__i386__)
|
||||
#include "ruby/config-i386.h"
|
||||
#elif defined(__ia64__)
|
||||
#include "ruby/config-ia64.h"
|
||||
#elif defined(__powerpc64__)
|
||||
#include <endian.h>
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#include "ruby/config-ppc64.h"
|
||||
#else
|
||||
#include "ruby/config-ppc64le.h"
|
||||
#endif
|
||||
#elif defined(__powerpc__)
|
||||
#include "ruby/config-ppc.h"
|
||||
#elif defined(__s390x__)
|
||||
#include "ruby/config-s390x.h"
|
||||
#elif defined(__s390__)
|
||||
#include "ruby/config-s390.h"
|
||||
#elif defined(__x86_64__)
|
||||
#include "ruby/config-x86_64.h"
|
||||
#elif defined(__arm__)
|
||||
#include "ruby/config-arm.h"
|
||||
#elif defined(__alpha__)
|
||||
#include "ruby/config-alpha.h"
|
||||
#elif defined(__sparc__) && defined (__arch64__)
|
||||
#include "ruby/config-sparc64.h"
|
||||
#elif defined(__sparc__)
|
||||
#include "ruby/config-sparc.h"
|
||||
#elif defined(__aarch64__)
|
||||
#include "ruby/config-aarch64.h"
|
||||
#elif defined(__mips64) && defined(__MIPSEL__)
|
||||
#include "ruby/config-mips64el.h"
|
||||
#elif defined(__mips64)
|
||||
#include "ruby/config-mips64.h"
|
||||
#elif defined(__mips) && defined(__MIPSEL__)
|
||||
#include "ruby/config-mipsel.h"
|
||||
#elif defined(__mips)
|
||||
#include "ruby/config-mips.h"
|
||||
#elif defined(__riscv64)
|
||||
#include "ruby/config-riscv64.h"
|
||||
#else
|
||||
#error "The ruby-devel package is not usable with the architecture."
|
||||
#endif
|
||||
|
||||
#undef ruby_config_wrapper_h
|
30
load.inc
30
load.inc
@ -1,30 +0,0 @@
|
||||
%{lua:
|
||||
|
||||
function source_macros(file)
|
||||
local macro = nil
|
||||
|
||||
for line in io.lines(file) do
|
||||
if not macro and line:match("^%%") then
|
||||
macro = line:match("^%%(.*)$")
|
||||
line = nil
|
||||
end
|
||||
|
||||
if macro then
|
||||
if line and macro:match("^.-%s*\\%s*$") then
|
||||
macro = macro .. '\n' .. line
|
||||
end
|
||||
|
||||
if not macro:match("^.-%s*\\%s*$") then
|
||||
rpm.define(macro)
|
||||
macro = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
}
|
||||
|
||||
# Include the constants defined in macros files. Could be dropped as soon as
|
||||
# RPM supports the %%load macro (RPM 4.12+ probably).
|
||||
# http://lists.rpm.org/pipermail/rpm-maint/2014-February/003659.html
|
||||
%define load() %{lua:source_macros(rpm.expand("%1"))}
|
@ -1,10 +1,10 @@
|
||||
%ruby_libdir %{_datadir}/%{pkg_name}
|
||||
%ruby_libarchdir %{_libdir}/%{pkg_name}
|
||||
%ruby_libdir %{_datadir}/%{name}
|
||||
%ruby_libarchdir %{_libdir}/%{name}
|
||||
|
||||
# This is the local lib/arch and should not be used for packaging.
|
||||
%ruby_sitedir site_ruby
|
||||
%ruby_sitelibdir %{_prefix}/local/share/%{pkg_name}/%{ruby_sitedir}
|
||||
%ruby_sitearchdir %{_prefix}/local/%{_lib}/%{pkg_name}/%{ruby_sitedir}
|
||||
%ruby_sitelibdir %{_prefix}/local/share/%{name}/%{ruby_sitedir}
|
||||
%ruby_sitearchdir %{_prefix}/local/%{_lib}/%{name}/%{ruby_sitedir}
|
||||
|
||||
# This is the general location for libs/archs compatible with all
|
||||
# or most of the Ruby versions available in the Fedora repositories.
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# Common gem locations and files.
|
||||
%gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{?prerelease}
|
||||
%gem_extdir_mri %{gem_archdir}/ruby/%{gem_name}-%{version}%{?prerelease}
|
||||
%gem_extdir_mri %{gem_archdir}/%{name}/%{gem_name}-%{version}%{?prerelease}
|
||||
%gem_libdir %{gem_instdir}/lib
|
||||
%gem_cache %{gem_dir}/cache/%{gem_name}-%{version}%{?prerelease}.gem
|
||||
%gem_spec %{gem_dir}/specifications/%{gem_name}-%{version}%{?prerelease}.gemspec
|
||||
|
@ -38,53 +38,6 @@ module Gem
|
||||
end
|
||||
private :rpmbuild?
|
||||
|
||||
##
|
||||
# Get enabled SCLs in order of (most) dependent SCL to base SCL
|
||||
|
||||
def x_scls
|
||||
@x_scls ||= if ENV['X_SCLS'].kind_of?(String)
|
||||
ENV['X_SCLS'].split(' ').reverse!
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
private :x_scls
|
||||
|
||||
##
|
||||
# Additional default locations for enabled software collections
|
||||
# Dependent scls needs to add themselves on $GEM_PATH
|
||||
|
||||
def default_locations_added_for_scls
|
||||
if ENV['GEM_PATH']
|
||||
gem_paths = ENV['GEM_PATH'].split(':')
|
||||
|
||||
x_scls.each do |scl|
|
||||
next if scl == '@SCL@'
|
||||
|
||||
regexp = /#{scl}\/root\/usr\/share\/gems/
|
||||
scl_gem_path = gem_paths.grep(regexp)[0]
|
||||
if scl_gem_path
|
||||
prefix = scl_gem_path.gsub(/\A(.*)#{regexp}\z/, "\\1")
|
||||
@default_locations["#{scl}_system".to_sym] = "#{prefix}#{scl}/root/usr"
|
||||
@default_locations["#{scl}_local".to_sym] = "#{prefix}#{scl}/root/usr/local"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@default_locations
|
||||
end
|
||||
private :default_locations_added_for_scls
|
||||
|
||||
##
|
||||
# SCL prefix genereatd from first detected SCL except own SCL.
|
||||
|
||||
def scl_prefix
|
||||
prefix = x_scls.detect {|c| c != '@SCL@'}
|
||||
prefix = prefix ? prefix + '_': nil
|
||||
prefix
|
||||
end
|
||||
private :scl_prefix
|
||||
|
||||
##
|
||||
# Default gems locations allowed on FHS system (/usr, /usr/share).
|
||||
# The locations are derived from directories specified during build
|
||||
@ -95,8 +48,6 @@ module Gem
|
||||
:system => previous_but_one_dir_to(RbConfig::CONFIG['vendordir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']),
|
||||
:local => previous_but_one_dir_to(RbConfig::CONFIG['sitedir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
|
||||
}
|
||||
|
||||
default_locations_added_for_scls
|
||||
end
|
||||
|
||||
##
|
||||
@ -162,12 +113,7 @@ module Gem
|
||||
# RubyGems default overrides.
|
||||
|
||||
def default_dir
|
||||
prefix = scl_prefix
|
||||
if Gem.default_dirs.key?(:"#{prefix}system")
|
||||
Gem.default_dirs[:"#{prefix}system"][:gem_dir]
|
||||
else
|
||||
Gem.default_dirs[:"system"][:gem_dir]
|
||||
end
|
||||
Gem.default_dirs[:system][:gem_dir]
|
||||
end
|
||||
|
||||
def default_path
|
||||
@ -177,10 +123,9 @@ module Gem
|
||||
|
||||
def default_ext_dir_for base_dir
|
||||
dir = if rpmbuild?
|
||||
prefix = scl_prefix
|
||||
build_dir = base_dir.chomp Gem.default_dirs[:"#{prefix}system"][:gem_dir]
|
||||
build_dir = base_dir.chomp Gem.default_dirs[:system][:gem_dir]
|
||||
if build_dir != base_dir
|
||||
File.join build_dir, Gem.default_dirs[:"#{prefix}system"][:ext_dir]
|
||||
File.join build_dir, Gem.default_dirs[:system][:ext_dir]
|
||||
end
|
||||
else
|
||||
dirs = Gem.default_dirs.detect {|location, paths| paths[:gem_dir] == base_dir}
|
||||
|
177
ruby-2.6.0-library-options-to-MAINLIBS.patch
Normal file
177
ruby-2.6.0-library-options-to-MAINLIBS.patch
Normal file
@ -0,0 +1,177 @@
|
||||
From bb3db69e2a0c210cc3a63940622db96a97eb7947 Mon Sep 17 00:00:00 2001
|
||||
From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
|
||||
Date: Fri, 2 Mar 2018 01:37:53 +0000
|
||||
Subject: [PATCH] configure.ac: library options to MAINLIBS
|
||||
|
||||
* configure.ac (MAINLIBS): moved library options for main program
|
||||
and static libruby, and append MAINLIBS to LIBRUBYARG_STATIC, as
|
||||
these libraries are not needed for linking to shared libruby.
|
||||
[ruby-core:85882] [Bug #14422]
|
||||
|
||||
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
||||
---
|
||||
configure.ac | 33 +++++++++++++++------------------
|
||||
template/ruby.pc.in | 1 +
|
||||
win32/Makefile.sub | 6 ++++--
|
||||
3 files changed, 20 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index aebbae1969a5..733a0c992fd7 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -10,6 +10,7 @@ AC_DISABLE_OPTION_CHECKING
|
||||
AC_ARG_VAR([cflags], [additional CFLAGS])
|
||||
AC_ARG_VAR([cppflags], [additional CPPFLAGS])
|
||||
AC_ARG_VAR([cxxflags], [additional CXXFLAGS])
|
||||
+ORIG_LIBS=$LIBS
|
||||
|
||||
AC_DEFUN([RUBY_RM_RECURSIVE], [
|
||||
m4_version_prereq([2.70], [-1], [
|
||||
@@ -2937,13 +2938,11 @@ AS_IF([test x"$enable_pthread" = xyes], [
|
||||
AC_DEFINE(_THREAD_SAFE)
|
||||
AC_DEFINE(HAVE_LIBPTHREAD)
|
||||
AC_CHECK_HEADERS(pthread_np.h, [], [], [@%:@include <pthread.h>])
|
||||
- AS_CASE([$pthread_lib],
|
||||
- [c], [],
|
||||
- [root], [],
|
||||
- [c_r], [MAINLIBS="-pthread $MAINLIBS"],
|
||||
- [AS_CASE(["$target_os"],
|
||||
- [openbsd*|mirbsd*], [LIBS="-pthread $LIBS"],
|
||||
- [LIBS="-l$pthread_lib $LIBS"])])
|
||||
+ AS_CASE(["$pthread_lib:$target_os"],
|
||||
+ [c:*], [],
|
||||
+ [root:*], [],
|
||||
+ [c_r:*|*:openbsd*|*:mirbsd*], [LIBS="-pthread $LIBS"],
|
||||
+ [LIBS="-l$pthread_lib $LIBS"])
|
||||
], [
|
||||
AC_MSG_WARN("Don't know how to find pthread library on your system -- thread support disabled")
|
||||
])
|
||||
@@ -3622,7 +3621,7 @@ LIBRUBY_A='lib$(RUBY_SO_NAME)-static.a'
|
||||
LIBRUBY='$(LIBRUBY_A)'
|
||||
LIBRUBYARG_STATIC='-l$(RUBY_SO_NAME)-static'
|
||||
LIBRUBYARG='$(LIBRUBYARG_STATIC)'
|
||||
-SOLIBS=
|
||||
+SOLIBS='$(MAINLIBS)'
|
||||
|
||||
AS_CASE(["$target_os"],
|
||||
[cygwin*|mingw*|haiku*|darwin*], [
|
||||
@@ -3688,9 +3687,6 @@ AS_CASE("$enable_shared", [yes], [
|
||||
LIBRUBY_RELATIVE=no
|
||||
test -z "$CCDLFLAGS" || CFLAGS="$CFLAGS $CCDLFLAGS"
|
||||
ENABLE_SHARED=yes
|
||||
- AS_IF([test "$rb_cv_binary_elf" = yes], [
|
||||
- SOLIBS='$(LIBS)'
|
||||
- ])
|
||||
|
||||
# libdir can be overridden in config.site file (on OpenSUSE at least).
|
||||
libdir_basename=lib
|
||||
@@ -3725,7 +3721,6 @@ AS_CASE("$enable_shared", [yes], [
|
||||
])
|
||||
],
|
||||
[freebsd*|dragonfly*], [
|
||||
- SOLIBS='$(LIBS)'
|
||||
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)'
|
||||
LIBRUBY_SONAME='$(LIBRUBY_SO)'
|
||||
AS_IF([test "$rb_cv_binary_elf" != "yes" ], [
|
||||
@@ -3734,7 +3729,6 @@ AS_CASE("$enable_shared", [yes], [
|
||||
])
|
||||
],
|
||||
[netbsd*], [
|
||||
- SOLIBS='$(LIBS)'
|
||||
LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)$(MINOR)'
|
||||
LIBRUBY_SO="${LIBRUBY_SONAME}"'.$(TEENY)'
|
||||
RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ['-Wl,-soname,$(LIBRUBY_SONAME)' "$LDFLAGS_OPTDIR"])
|
||||
@@ -3745,11 +3739,9 @@ AS_CASE("$enable_shared", [yes], [
|
||||
])
|
||||
],
|
||||
[openbsd*|mirbsd*], [
|
||||
- SOLIBS='$(LIBS)'
|
||||
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
|
||||
],
|
||||
[solaris*], [
|
||||
- SOLIBS='$(LIBS)'
|
||||
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT).$(MAJOR)'
|
||||
LIBRUBY_SONAME='lib$(RUBY_SO_NAME).$(SOEXT).$(RUBY_PROGRAM_VERSION)'
|
||||
LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_SO_NAME).$(SOEXT)'
|
||||
@@ -3767,7 +3759,7 @@ AS_CASE("$enable_shared", [yes], [
|
||||
[aix*], [
|
||||
RUBY_APPEND_OPTIONS(LIBRUBY_DLDFLAGS, ["${linker_flag}-bnoentry" "$XLDFLAGS" "$LDFLAGS_OPTDIR"])
|
||||
LIBRUBYARG_SHARED='-L${libdir} -l${RUBY_SO_NAME}'
|
||||
- SOLIBS='-lm -lc'
|
||||
+ LIBS="$LIBS -lm -lc"
|
||||
],
|
||||
[darwin*], [
|
||||
LIBRUBY_LDSHARED='$(CC) -dynamiclib'
|
||||
@@ -3787,7 +3779,6 @@ AS_CASE("$enable_shared", [yes], [
|
||||
LIBRUBY_SO='lib$(RUBY_SO_NAME).$(SOEXT)'
|
||||
LIBRUBY_SONAME='lib$(RUBY_BASE_NAME).$(RUBY_API_VERSION).$(SOEXT)'
|
||||
LIBRUBY_ALIASES='$(LIBRUBY_SONAME) lib$(RUBY_INSTALL_NAME).$(SOEXT)'
|
||||
- SOLIBS='$(LIBS)'
|
||||
],
|
||||
[interix*], [
|
||||
LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
|
||||
@@ -4030,7 +4021,6 @@ AS_CASE(["$target_os"],
|
||||
])
|
||||
LIBRUBY_ALIASES=''
|
||||
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
|
||||
- SOLIBS='$(LIBS)'
|
||||
AS_IF([test x"$enable_shared" = xyes], [
|
||||
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
|
||||
], [
|
||||
@@ -4130,6 +4120,13 @@ AS_IF([test "${universal_binary-no}" = yes ], [
|
||||
[rb_cv_architecture_available=yes], [rb_cv_architecture_available=no]))
|
||||
])
|
||||
|
||||
+MAINLIBS="$LIBS"
|
||||
+LIBS=$ORIG_LIBS
|
||||
+AS_IF([test -n "${LIBS}"], [
|
||||
+ libspat=`echo "${LIBS}" | sed 's/[[][|.*$^]]/\\&/g;s/^ */ /;s/^ *$/ /'`
|
||||
+ MAINFLAGS=`echo " $MAINLIBS " | sed "s|$libspat"'||;s/^ *//;s/ *$//'`
|
||||
+])
|
||||
+LIBRUBYARG_STATIC="${LIBRUBYARG_STATIC} \$(MAINLIBS)"
|
||||
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
|
||||
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
|
||||
AS_IF([test -n "${cflags+set}"], [
|
||||
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
|
||||
index d874f92c3b20..7ce4461c05df 100644
|
||||
--- a/template/ruby.pc.in
|
||||
+++ b/template/ruby.pc.in
|
||||
@@ -39,6 +39,7 @@ sitehdrdir=@sitehdrdir@
|
||||
rubyarchhdrdir=@rubyarchhdrdir@
|
||||
vendorarchhdrdir=@vendorarchhdrdir@
|
||||
sitearchhdrdir=@sitearchhdrdir@
|
||||
+MAINLIBS=@MAINLIBS@
|
||||
SOEXT=@SOEXT@
|
||||
LIBPATH=@LIBPATH@
|
||||
LIBRUBY_A=@LIBRUBY_A@
|
||||
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
|
||||
index 8673c121641e..f8316cccb68e 100644
|
||||
--- a/win32/Makefile.sub
|
||||
+++ b/win32/Makefile.sub
|
||||
@@ -279,6 +279,7 @@ MJIT_DEBUGFLAGS = $(DEBUGFLAGS)
|
||||
CPPFLAGS = $(DEFS) $(ARCHDEFS) $(CPPFLAGS)
|
||||
|
||||
DLDFLAGS = $(LDFLAGS) -dll
|
||||
+MAINLIBS = $(LIBS)
|
||||
SOLIBS =
|
||||
RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc
|
||||
!ifndef RCFLAGS
|
||||
@@ -821,7 +822,8 @@ s,@CPPFLAGS@,$(CPPFLAGS),;t t
|
||||
s,@CXXFLAGS@,$(CXXFLAGS),;t t
|
||||
s,@FFLAGS@,$(FFLAGS),;t t
|
||||
s,@LDFLAGS@,$(LDFLAGS),;t t
|
||||
-s,@LIBS@,$(LIBS),;t t
|
||||
+s,@LIBS@,,;t t
|
||||
+s,@MAINLIBS@,$(MAINLIBS),;t t
|
||||
s,@exec_prefix@,$${prefix},;t t
|
||||
s,@prefix@,$(prefix),;t t
|
||||
s,@program_transform_name@,s,.*,$(PROGRAM_PREFIX)&$(PROGRAM_SUFFIX),,;t t
|
||||
@@ -909,7 +911,7 @@ s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t
|
||||
s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),;t t
|
||||
s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,;t t
|
||||
s,@LIBRUBYARG@,$$(LIBRUBYARG_SHARED),;t t
|
||||
-s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A),;t t
|
||||
+s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A) $$(MAINLIBS),;t t
|
||||
s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t
|
||||
s,@SOLIBS@,$(SOLIBS),;t t
|
||||
s,@DLDLIBS@,$(DLDLIBS),;t t
|
2349
rubygems-2.5.0-multiple-vulnerabilities.patch
Normal file
2349
rubygems-2.5.0-multiple-vulnerabilities.patch
Normal file
File diff suppressed because it is too large
Load Diff
6
rubygems.attr
Normal file
6
rubygems.attr
Normal file
@ -0,0 +1,6 @@
|
||||
%__rubygems_requires %{_rpmconfigdir}/rubygems.req
|
||||
%__rubygems_provides %{_rpmconfigdir}/rubygems.prov
|
||||
%__rubygems_conflicts %{_rpmconfigdir}/rubygems.con
|
||||
# In non-gem packages, the %%{gem_name} macro is not available and the macro
|
||||
# stays unexpanded which leads to "invalid regex" error (rhbz#1154067).
|
||||
%__rubygems_path ^%{?gem_name:%{gem_spec}}%{!?gem_name:this_should_never_match_anything}$
|
52
rubygems.con
Normal file
52
rubygems.con
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require 'rubygems/package'
|
||||
|
||||
module RubyGemsReq
|
||||
module Helpers
|
||||
# Keep only '!=' requirements.
|
||||
def self.conflicts(requirements)
|
||||
conflicts = requirements.select {|r| r.first == '!='}
|
||||
end
|
||||
|
||||
# Converts Gem::Requirement into array of requirements strings compatible
|
||||
# with RPM .spec file.
|
||||
def self.requirement_versions_to_rpm(requirement)
|
||||
self.conflicts(requirement.requirements).map do |op, version|
|
||||
version == Gem::Version.new(0) ? "" : "= #{version}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Report conflicting gem dependencies including their version.
|
||||
def self.gem_depenencies(specification)
|
||||
specification.runtime_dependencies.each do |dependency|
|
||||
conflict_strings = Helpers::requirement_versions_to_rpm(dependency.requirement).map do |requirement|
|
||||
requirement_string = "rubygem(#{dependency.name}) #{requirement}"
|
||||
end
|
||||
if conflict_strings.length > 0
|
||||
conflict_string = conflict_strings.join(' with ')
|
||||
conflict_string.prepend('(').concat(')') if conflict_strings.length > 1
|
||||
puts conflict_string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Reports all conflicts specified by all provided .gemspec files.
|
||||
def self.conflicts
|
||||
while filename = gets
|
||||
filename.strip!
|
||||
begin
|
||||
specification = Gem::Specification.load filename
|
||||
|
||||
gem_depenencies(specification)
|
||||
rescue => e
|
||||
# Ignore all errors.
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
RubyGemsReq::conflicts
|
||||
end
|
36
rubygems.prov
Normal file
36
rubygems.prov
Normal file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require 'rubygems/package'
|
||||
|
||||
module RubyGemsProv
|
||||
module Helpers
|
||||
# If there is some prelease version files, such as rc1 (i.e. non-numeric
|
||||
# field), prepend this field by tilde instead of dot.
|
||||
def self.normalize_prerelease(version)
|
||||
if version.prerelease?
|
||||
prerelease = version.version.sub /^#{version.release}\./, ''
|
||||
"#{version.release}-0.1.#{prerelease}"
|
||||
else
|
||||
"#{version.release}-1"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Reports all functionality gem provides.
|
||||
def self.provides
|
||||
while filename = gets
|
||||
filename.strip!
|
||||
begin
|
||||
specification = Gem::Specification.load filename
|
||||
|
||||
puts "rubygem(#{specification.name}) = #{Helpers::normalize_prerelease(specification.version)}"
|
||||
rescue => e
|
||||
# Ignore all errors.
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
RubyGemsProv::provides
|
||||
end
|
78
rubygems.req
Normal file
78
rubygems.req
Normal file
@ -0,0 +1,78 @@
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require 'rubygems/package'
|
||||
|
||||
module RubyGemsReq
|
||||
module Helpers
|
||||
# Expands '~>' and '!=' gem requirements.
|
||||
def self.expand_requirement(requirements)
|
||||
requirements.inject([]) do |output, r|
|
||||
output.concat case r.first
|
||||
when '~>'
|
||||
expand_pessimistic_requirement(r)
|
||||
when '!='
|
||||
[]
|
||||
else
|
||||
[r]
|
||||
end
|
||||
end.reject {|r| r.empty? }
|
||||
end
|
||||
|
||||
# Expands the pessimistic version operator '~>' into equivalent '>=' and
|
||||
# '<' pair.
|
||||
def self.expand_pessimistic_requirement(requirement)
|
||||
next_version = Gem::Version.create(requirement.last).bump
|
||||
return ['>=', requirement.last], ['<', next_version]
|
||||
end
|
||||
|
||||
# Converts Gem::Requirement into array of requirements strings compatible
|
||||
# with RPM .spec file.
|
||||
def self.requirement_versions_to_rpm(requirement)
|
||||
self.expand_requirement(requirement.requirements).map do |op, version|
|
||||
version == Gem::Version.new(0) ? "" : "#{op} #{version}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Report RubyGems dependency, versioned if required.
|
||||
def self.rubygems_dependency(specification)
|
||||
Helpers::requirement_versions_to_rpm(specification.required_rubygems_version).each do |requirement|
|
||||
dependency_string = "ruby(rubygems)"
|
||||
dependency_string += " #{specification.required_rubygems_version}" if requirement&.length > 0
|
||||
puts dependency_string
|
||||
end
|
||||
end
|
||||
|
||||
# Report all gem dependencies including their version.
|
||||
def self.gem_depenencies(specification)
|
||||
specification.runtime_dependencies.each do |dependency|
|
||||
dependency_strings = Helpers::requirement_versions_to_rpm(dependency.requirement).map do |requirement|
|
||||
requirement_string = "rubygem(#{dependency.name})"
|
||||
requirement_string += " #{requirement}" if requirement&.length > 0
|
||||
requirement_string
|
||||
end
|
||||
dependency_string = dependency_strings.join(' with ')
|
||||
dependency_string.prepend('(').concat(')') if dependency_strings.length > 1
|
||||
puts dependency_string
|
||||
end
|
||||
end
|
||||
|
||||
# Reports all requirements specified by all provided .gemspec files.
|
||||
def self.requires
|
||||
while filename = gets
|
||||
filename.strip!
|
||||
begin
|
||||
specification = Gem::Specification.load filename
|
||||
|
||||
rubygems_dependency(specification)
|
||||
gem_depenencies(specification)
|
||||
rescue => e
|
||||
# Ignore all errors.
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
RubyGemsReq::requires
|
||||
end
|
@ -1,91 +0,0 @@
|
||||
require 'test/unit'
|
||||
require 'rbconfig'
|
||||
require 'rubygems'
|
||||
require 'rubygems/defaults/operating_system'
|
||||
|
||||
class TestDependentSCLS < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
# TODO: Different bin dir during build ("/builddir/build/BUILD/ruby-2.0.0-p247")
|
||||
@bin_dir = Gem::ConfigMap[:bindir].split(File::SEPARATOR).last
|
||||
@scl_root = '/opt/rh/@SCL@/root'
|
||||
|
||||
@env_orig = ['X_SCLS', 'GEM_PATH'].inject({}) do |env_orig, key|
|
||||
env_orig[key] = ENV[key].dup
|
||||
env_orig
|
||||
end
|
||||
end
|
||||
|
||||
def teardown
|
||||
# Avoid caching
|
||||
Gem.class_eval("@x_scls, @default_locations, @default_dirs, @get_default_dirs = nil, nil, nil, nil")
|
||||
|
||||
@env_orig.each { |key, val| ENV[key] = val }
|
||||
end
|
||||
|
||||
def test_default_paths
|
||||
ENV['X_SCLS'] = '@SCL@' # enabled scls
|
||||
|
||||
default_locations = { :system => "#{@scl_root}/usr",
|
||||
:local => "#{@scl_root}/usr/local" }
|
||||
assert_equal default_locations, Gem.default_locations
|
||||
|
||||
default_dirs = { :system => { :bin_dir => "#{@scl_root}/usr/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/lib64/gems" },
|
||||
:local => { :bin_dir => "#{@scl_root}/usr/local/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/local/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/local/lib64/gems" } }
|
||||
assert_equal default_dirs, Gem.default_dirs
|
||||
end
|
||||
|
||||
# Gem.default_locations and Gem.default_dirs
|
||||
# should contain paths to dependent scls binary extensions
|
||||
# if the dependent scl adds itself on $GEM_PATH
|
||||
#
|
||||
# See rhbz#1034639
|
||||
def test_paths_with_dependent_scl
|
||||
test_scl = 'ruby_x'
|
||||
test_root = "/some/prefix/#{test_scl}/root"
|
||||
|
||||
ENV['X_SCLS'] = "@SCL@ #{test_scl}" # enabled scls
|
||||
ENV['GEM_PATH'] = "#{test_root}/usr/share/gems"
|
||||
|
||||
default_locations = { :system => "#{@scl_root}/usr",
|
||||
:local => "#{@scl_root}/usr/local",
|
||||
:"#{test_scl}_system" => "#{test_root}/usr",
|
||||
:"#{test_scl}_local" => "#{test_root}/usr/local" }
|
||||
assert_equal default_locations, Gem.default_locations
|
||||
|
||||
default_dirs = { :system => { :bin_dir => "#{@scl_root}/usr/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/lib64/gems" },
|
||||
:local => { :bin_dir => "#{@scl_root}/usr/local/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/local/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/local/lib64/gems" },
|
||||
:"#{test_scl}_system" => { :bin_dir => "#{test_root}/usr/#{@bin_dir}",
|
||||
:gem_dir => "#{test_root}/usr/share/gems",
|
||||
:ext_dir => "#{test_root}/usr/lib64/gems" },
|
||||
:"#{test_scl}_local" => { :bin_dir => "#{test_root}/usr/local/#{@bin_dir}",
|
||||
:gem_dir => "#{test_root}/usr/local/share/gems",
|
||||
:ext_dir => "#{test_root}/usr/local/lib64/gems" } }
|
||||
assert_equal default_dirs, Gem.default_dirs
|
||||
end
|
||||
|
||||
def test_empty_x_scls
|
||||
ENV['X_SCLS'] = nil # no enabled scls
|
||||
|
||||
default_locations = { :system => "#{@scl_root}/usr",
|
||||
:local => "#{@scl_root}/usr/local" }
|
||||
assert_equal default_locations, Gem.default_locations
|
||||
|
||||
default_dirs = { :system => { :bin_dir => "#{@scl_root}/usr/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/lib64/gems" },
|
||||
:local => { :bin_dir => "#{@scl_root}/usr/local/#{@bin_dir}",
|
||||
:gem_dir => "#{@scl_root}/usr/local/share/gems",
|
||||
:ext_dir => "#{@scl_root}/usr/local/lib64/gems" } }
|
||||
assert_equal default_dirs, Gem.default_dirs
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user