[augeas/f15] Add patches for bugs 247 and 248 (JSON lens)

David Lutterkort lutter at fedoraproject.org
Tue Jan 10 01:09:54 UTC 2012


commit 89b9cdeacb7c74dfa95a223ca68023c7506918c9
Author: David Lutterkort <lutter at redhat.com>
Date:   Mon Jan 9 16:53:50 2012 -0800

    Add patches for bugs 247 and 248 (JSON lens)

 augeas-0.10.0-01-055382d8.patch |   56 +++++++++++++++++++++++++++++++++++++++
 augeas-0.10.0-02-075f8d35.patch |   49 ++++++++++++++++++++++++++++++++++
 augeas.spec                     |    9 +++++-
 3 files changed, 113 insertions(+), 1 deletions(-)
---
diff --git a/augeas-0.10.0-01-055382d8.patch b/augeas-0.10.0-01-055382d8.patch
new file mode 100644
index 0000000..e263001
--- /dev/null
+++ b/augeas-0.10.0-01-055382d8.patch
@@ -0,0 +1,56 @@
+From 075f8d35497fb36d9193e5364c055049c66fa5eb Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lubo.rintel at gooddata.com>
+Date: Mon, 9 Jan 2012 18:52:11 +0100
+Subject: [PATCH 1/2] Allow JSON number literals to be followed by whitespace
+
+Add a test case.
+
+Fixes https://fedorahosted.org/augeas/ticket/247
+---
+ AUTHORS                    |    1 +
+ lenses/json.aug            |    2 +-
+ lenses/tests/test_json.aug |    3 +++
+ 3 files changed, 5 insertions(+), 1 deletions(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index df63f95..e7870f2 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -44,6 +44,7 @@ Contributions by:
+   Bill Pemberton              <wfp5p at virginia.edu>
+   Alan Pevec                  <apevec at redhat.com>
+   Robin Lee Powell            <rlpowell at digitalkingdom.org>
++  Lubomir Rintel              <lubo.rintel at gooddata.com>
+   Roman Rakus                 <rrakus at redhat.com>
+   Satoru SATOH                <satoru.satoh at gmail.com>
+   Nicolas Valcárcel Scerpella <nvalcarcel at ubuntu.com>
+diff --git a/lenses/json.aug b/lenses/json.aug
+index c22ad90..6ceab09 100644
+--- a/lenses/json.aug
++++ b/lenses/json.aug
+@@ -29,7 +29,7 @@ let str_store =
+   let q =  del "\"" "\"" in
+   q . store /[^"]*/ . q . ws             (* " Emacs, relax *)
+ 
+-let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ ]
++let number = [ label "number" . store /-?[0-9]+(\.[0-9]+)?([eE][+-]?[0-9]+)?/ . ws ]
+ let str = [ label "string" . str_store ]
+ 
+ let const (r:regexp) = [ label "const" . store r . ws ]
+diff --git a/lenses/tests/test_json.aug b/lenses/tests/test_json.aug
+index 0bcd25d..d8b7fa8 100644
+--- a/lenses/tests/test_json.aug
++++ b/lenses/tests/test_json.aug
+@@ -8,6 +8,9 @@ test lns get "true" = { "const" = "true" }
+ 
+ test lns get "3.141" = { "number" = "3.141" }
+ 
++test lns get "{ \"key\" : 666 }" =
++  { "dict" { "entry" = "key" { "number" = "666" } } }
++
+ test lns get "[true, 0, \"yo\"]" =
+   { "array" { "const" = "true" } { "number" = "0" } { "string" = "yo" } }
+ 
+-- 
+1.7.7.5
+
diff --git a/augeas-0.10.0-02-075f8d35.patch b/augeas-0.10.0-02-075f8d35.patch
new file mode 100644
index 0000000..743ccfd
--- /dev/null
+++ b/augeas-0.10.0-02-075f8d35.patch
@@ -0,0 +1,49 @@
+From 100a7b38222a63c6435a72b4974b55f39a28989e Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lubo.rintel at gooddata.com>
+Date: Mon, 9 Jan 2012 19:24:41 +0100
+Subject: [PATCH 2/2] Correctly parse empty object and arrays in JSON
+
+Add a test case.
+Fix from David Lutterkort <lutter at redhat.com>.
+
+https://fedorahosted.org/augeas/ticket/248
+---
+ lenses/json.aug            |    4 ++--
+ lenses/tests/test_json.aug |    5 +++++
+ 2 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/lenses/json.aug b/lenses/json.aug
+index 6ceab09..2645806 100644
+--- a/lenses/json.aug
++++ b/lenses/json.aug
+@@ -37,9 +37,9 @@ let const (r:regexp) = [ label "const" . store r . ws ]
+ let value0 = str | number | const /true|false|null/
+ 
+ let fix_value (value:lens) =
+-  let array = [ label "array" . lbrack . Build.opt_list value comma . rbrack ] in
++  let array = [ label "array" . lbrack . (Build.opt_list value comma)? . rbrack ] in
+   let pair = [ label "entry" . str_store . colon . value ] in
+-  let obj = [ label "dict" . lbrace . Build.opt_list pair comma . rbrace ] in
++  let obj = [ label "dict" . lbrace . (Build.opt_list pair comma)? . rbrace ] in
+   (str | number | obj | array | const /true|false|null/)
+ 
+ (* Typecheck finitely deep nesting *)
+diff --git a/lenses/tests/test_json.aug b/lenses/tests/test_json.aug
+index d8b7fa8..aec7d4c 100644
+--- a/lenses/tests/test_json.aug
++++ b/lenses/tests/test_json.aug
+@@ -30,6 +30,11 @@ test lns get "{ \"0\": true, \"1\":false }" =
+ test lns get "{\"menu\": \"entry one\"}" =
+   { "dict" { "entry" = "menu" { "string" = "entry one" } } }
+ 
++test lns get "[ ]" =
++  { "array" }
++
++test lns get "{}" =
++  { "dict" }
+ 
+ let s = "{\"menu\": {
+   \"id\": \"file\",
+-- 
+1.7.7.5
+
diff --git a/augeas.spec b/augeas.spec
index 4d60e04..ceaab08 100644
--- a/augeas.spec
+++ b/augeas.spec
@@ -1,6 +1,6 @@
 Name:           augeas
 Version:        0.10.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        A library for changing configuration files
 
 Group:          System Environment/Libraries
@@ -14,6 +14,8 @@ Patch0:         0001-pkg-config-Augeas-requires-libxml2.patch
 # Format of the patch name is augeas-VERSION-NUMBER-HASH where VERSION
 # gives the first version where this patch was applied, NUMBER orders patches
 # against the same version, and HASH is the git commit hash from upstream
+Patch1:         augeas-0.10.0-01-055382d8.patch
+Patch2:         augeas-0.10.0-02-075f8d35.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -52,6 +54,8 @@ The libraries for %{name}.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 %configure --disable-static
@@ -94,6 +98,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/pkgconfig/augeas.pc
 
 %changelog
+* Tue Jan 10 2012 David Lutterkort <lutter at redhat.com> - 0.10.0-3
+- Add patches for bugs 247 and 248 (JSON lens)
+
 * Sat Dec  3 2011 Richard W.M. Jones <rjones at redhat.com> - 0.10.0-2
 - Add patch to resolve missing libxml2 requirement in augeas.pc.
 


More information about the scm-commits mailing list