Skip to content

Commit

Permalink
gnu: ruby-safe-yaml: Add missing require 'time'.
Browse files Browse the repository at this point in the history
Patch ruby-safe-yaml to fix an issue that would lead to an error like this:
uninitialized constant SafeYAML::Parse::Date::DateTime

It's been reported upstream [1], and this patch was taken from the upstream Git
repository.

1: dtao/safe_yaml#80

* gnu/packages/ruby.scm (ruby-safe-yaml)[source]: Switch to the Git repository
so that applying patches works and add a patch.
[arguments]: Enable tests and add a phase to set the TZ environment variable,
as one of the tests depends on a certian timezone.
* gnu/packages/patches/ruby-safe-yaml-add-require-time.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add new patch file.
  • Loading branch information
Christopher Baines committed Feb 14, 2019
1 parent 17098a4 commit 28cf8da
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions gnu/local.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,7 @@ dist_patch_DATA = \
%D%/packages/patches/ruby-concurrent-ignore-broken-test.patch \
%D%/packages/patches/ruby-concurrent-test-arm.patch \
%D%/packages/patches/ruby-rack-ignore-failing-test.patch \
%D%/packages/patches/ruby-safe-yaml-add-require-time.patch \
%D%/packages/patches/ruby-tzinfo-data-ignore-broken-test.patch\
%D%/packages/patches/runc-CVE-2019-5736.patch \
%D%/packages/patches/rust-1.19-mrustc.patch \
Expand Down
19 changes: 19 additions & 0 deletions gnu/packages/patches/ruby-safe-yaml-add-require-time.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 9dd1e8d9ad0396a8c9092c2e9f17d498c58e0208 Mon Sep 17 00:00:00 2001
From: elifoster <[email protected]>
Date: Tue, 5 Dec 2017 14:30:13 -0800
Subject: [PATCH] Fix uninitialized constant DateTime Close #80

---
lib/safe_yaml/parse/date.rb | 2 ++
1 file changed, 2 insertions(+)

diff --git a/lib/safe_yaml/parse/date.rb b/lib/safe_yaml/parse/date.rb
index cd3c62a..3a30a8b 100644
--- a/lib/safe_yaml/parse/date.rb
+++ b/lib/safe_yaml/parse/date.rb
@@ -1,3 +1,5 @@
+require 'time'
+
module SafeYAML
class Parse
class Date
33 changes: 25 additions & 8 deletions gnu/packages/ruby.scm
Original file line number Diff line number Diff line change
Expand Up @@ -5849,19 +5849,36 @@ indentation will probably be an issue and hence this gem.")
(package
(name "ruby-safe-yaml")
(version "1.0.4")
(source (origin
(method url-fetch)
(uri (rubygems-uri "safe_yaml" version))
(sha256
(base32
"1hly915584hyi9q9vgd968x2nsi5yag9jyf5kq60lwzi5scr7094"))))
(source
(origin
;; TODO Fetch from the git repository so a patch can be applied
(method git-fetch)
(uri (git-reference
(url "https://github.com/dtao/safe_yaml.git")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
"1wnln8xdy8g6kwdj4amm8773xwffqxpf2sxslk6jjh2wxsy1lrig"))
(patches
(search-patches "ruby-safe-yaml-add-require-time.patch"))))
(build-system ruby-build-system)
(native-inputs
`(("ruby-rspec" ,ruby-rspec)
("ruby-hashie" ,ruby-hashie)
("ruby-heredoc-unindent" ,ruby-heredoc-unindent)))
(arguments `(#:test-target "spec"
#:tests? #f));; FIXME: one failure
(arguments
'(#:test-target "spec"
#:phases
(modify-phases %standard-phases
(add-before 'check 'set-TZ
(lambda _
;; This test is dependent on the timezone
;; spec/transform/to_date_spec.rb:35
;; # SafeYAML::Transform::ToDate converts times to the local
;; timezone
(setenv "TZ" "UTC-11")
#t)))))
(home-page "https://github.com/dtao/safe_yaml")
(synopsis "YAML parser")
(description "The SafeYAML gem provides an alternative implementation of
Expand Down

0 comments on commit 28cf8da

Please sign in to comment.