~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to lib/rubygems/syck_hack.rb

  • Committer: Package Import Robot
  • Author(s): Antonio Terceiro, Lucas Nussbaum, Daigo Moriwaki, James Healy, Antonio Terceiro
  • Date: 2012-06-02 07:42:28 UTC
  • mfrom: (21.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120602074228-09t2jgg1ozrsnnfo
Tags: 1.9.3.194-1
[ Lucas Nussbaum ]
* Add hurd-path-max.diff. Fixes FTBFS on Hurd. (Closes: #648055)

[ Daigo Moriwaki ]
* Removed debian/patches/debian/patches/sparc-continuations.diff,
  which the upstream has applied.
* debian/rules:
  - Bumped up tcltk_ver to 8.5.
  - Used chrpath for tcltklib.so to fix a lintian error,
    binary-or-shlib-defines-rpath.
* debian/control:
  - Suggests ruby-switch. (Closes: #654312)
  - Build-Depends: chrpath.
* debian/libruby1.9.1.symbols: Added a new symbol for
  rb_str_modify_expand@Base.
* debian/run-test-suites.bash:
  - Corrected options for test-all.
  - Enabled timeout to allow hang tests to be aborted.

[ James Healy ]
* New upstream release: 1.9.3p194 (Closes: #669582)
  + This release includes a fix for CVE-2011-0188 (Closes: #628451)
  + This release also does not segfault when running the test suite under
    amd64 (Closes: #674347)
* Enable hardened build flags (Closes: #667964)
* debian/control:
  - depend on specific version on coreutils
  - update policy version (no changes)

[ Antonio Terceiro ]
* debian/ruby1.9.1.postinst:
  + bump alternatives priority for `ruby` to 51 so that Ruby 1.9 has a
    higher priority than Ruby 1.8 (50).
  + bump alternatives priority for `gem` to 181 so that the Rubygems
    provided by Ruby 1.9 has priority over the one provided by the rubygems
    package.
* debian/control: added myself to Uploaders:
* debian/libruby1.9.1.symbols: update with new symbols added in 1.9.3p194
  upstream release.
* debian/manpages/*: fix references to command names with s/1.9/1.9.1/
* debian/rules: skip running DRB tests, since they seem to make the build
  hang. This should close #647296, but let's way and see. Also, with this do
  not need to timeout the test suite anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# :stopdoc:
 
2
 
 
3
# Hack to handle syck's DefaultKey bug
 
4
#
 
5
# This file is always loaded AFTER either syck or psych are already
 
6
# loaded. It then looks at what constants are available and creates
 
7
# a consistent view on all rubys.
 
8
#
 
9
# All this is so that there is always a YAML::Syck::DefaultKey
 
10
# class no matter if the full yaml library has loaded or not.
 
11
#
 
12
 
 
13
module YAML
 
14
  # In newer 1.9.2, there is a Syck toplevel constant instead of it
 
15
  # being underneith YAML. If so, reference it back under YAML as
 
16
  # well.
 
17
  if defined? ::Syck
 
18
    # for tests that change YAML::ENGINE
 
19
    # 1.8 does not support the second argument to const_defined?
 
20
    remove_const :Syck rescue nil
 
21
 
 
22
    Syck = ::Syck
 
23
 
 
24
  # JRuby's "Syck" is called "Yecht"
 
25
  elsif defined? YAML::Yecht
 
26
    Syck = YAML::Yecht
 
27
 
 
28
  # Otherwise, if there is no YAML::Syck, then we've got just psych
 
29
  # loaded, so lets define a stub for DefaultKey.
 
30
  elsif !defined? YAML::Syck
 
31
    module Syck
 
32
      class DefaultKey
 
33
      end
 
34
    end
 
35
  end
 
36
 
 
37
  # Now that we've got something that is always here, define #to_s
 
38
  # so when code tries to use this, it at least just shows up like it
 
39
  # should.
 
40
  module Syck
 
41
    class DefaultKey
 
42
      remove_method :to_s rescue nil
 
43
 
 
44
      def to_s
 
45
        '='
 
46
      end
 
47
    end
 
48
  end
 
49
end
 
50
 
 
51
# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
 
52
# to be a toplevel constant. So gemspecs created under these versions of Syck
 
53
# will have references to Syck::DefaultKey.
 
54
#
 
55
# So we need to be sure that we reference Syck at the toplevel too so that
 
56
# we can always load these kind of gemspecs.
 
57
#
 
58
if !defined?(Syck)
 
59
  Syck = YAML::Syck
 
60
end
 
61
 
 
62
# Now that we've got Syck setup in all the right places, store
 
63
# a reference to the DefaultKey class inside Gem. We do this so that
 
64
# if later on YAML, etc are redefined, we've still got a consistent
 
65
# place to find the DefaultKey class for comparison.
 
66
 
 
67
module Gem
 
68
  # for tests that change YAML::ENGINE
 
69
  remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey
 
70
 
 
71
  SyckDefaultKey = YAML::Syck::DefaultKey
 
72
end
 
73
 
 
74
# :startdoc:
 
75
# :stopdoc:
 
76
 
 
77
# Hack to handle syck's DefaultKey bug
 
78
#
 
79
# This file is always loaded AFTER either syck or psych are already
 
80
# loaded. It then looks at what constants are available and creates
 
81
# a consistent view on all rubys.
 
82
#
 
83
# All this is so that there is always a YAML::Syck::DefaultKey
 
84
# class no matter if the full yaml library has loaded or not.
 
85
#
 
86
 
 
87
module YAML
 
88
  # In newer 1.9.2, there is a Syck toplevel constant instead of it
 
89
  # being underneith YAML. If so, reference it back under YAML as
 
90
  # well.
 
91
  if defined? ::Syck
 
92
    # for tests that change YAML::ENGINE
 
93
    remove_const :Syck if const_defined? :Syck, false
 
94
    
 
95
    Syck = ::Syck
 
96
 
 
97
  # JRuby's "Syck" is called "Yecht"
 
98
  elsif defined? YAML::Yecht
 
99
    Syck = YAML::Yecht
 
100
 
 
101
  # Otherwise, if there is no YAML::Syck, then we've got just psych
 
102
  # loaded, so lets define a stub for DefaultKey.
 
103
  elsif !defined? YAML::Syck
 
104
    module Syck
 
105
      class DefaultKey
 
106
      end
 
107
    end
 
108
  end
 
109
 
 
110
  # Now that we've got something that is always here, define #to_s
 
111
  # so when code tries to use this, it at least just shows up like it
 
112
  # should.
 
113
  module Syck
 
114
    class DefaultKey
 
115
      def to_s
 
116
        '='
 
117
      end
 
118
    end
 
119
  end
 
120
end
 
121
 
 
122
# Sometime in the 1.9 dev cycle, the Syck constant was moved from under YAML
 
123
# to be a toplevel constant. So gemspecs created under these versions of Syck
 
124
# will have references to Syck::DefaultKey.
 
125
#
 
126
# So we need to be sure that we reference Syck at the toplevel too so that
 
127
# we can always load these kind of gemspecs.
 
128
#
 
129
if !defined?(Syck)
 
130
  Syck = YAML::Syck
 
131
end
 
132
 
 
133
# Now that we've got Syck setup in all the right places, store
 
134
# a reference to the DefaultKey class inside Gem. We do this so that
 
135
# if later on YAML, etc are redefined, we've still got a consistent
 
136
# place to find the DefaultKey class for comparison.
 
137
 
 
138
module Gem
 
139
  # for tests that change YAML::ENGINE
 
140
  remove_const :SyckDefaultKey if const_defined? :SyckDefaultKey
 
141
 
 
142
  SyckDefaultKey = YAML::Syck::DefaultKey
 
143
end
 
144
 
 
145
# :startdoc: