diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-12-12 01:11:06 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-12-12 18:11:33 +0200 |
commit | 01cf06a63787747446ea4b86c62289702c98e694 (patch) | |
tree | 97ef8ae1ccd33b9d9c2fbb91930acccff14616e8 /main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch | |
parent | 6ef1728084d139a7ad7e47b2543211e1ebe4d74d (diff) | |
download | aports-01cf06a63787747446ea4b86c62289702c98e694.tar.bz2 aports-01cf06a63787747446ea4b86c62289702c98e694.tar.xz |
main/augeas: align patch set with upstream
Diffstat (limited to 'main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch')
-rw-r--r-- | main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch b/main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch new file mode 100644 index 0000000000..dc11176d87 --- /dev/null +++ b/main/augeas/0011-Shellvars-pattern-nodes-in-case-entries.patch @@ -0,0 +1,173 @@ +From 60a542a54819deee9a869815df40f99a4391a8fa Mon Sep 17 00:00:00 2001 +From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> +Date: Mon, 13 Jul 2015 14:43:09 +0300 +Subject: [PATCH 11/19] Shellvars: pattern nodes in case entries + +Breaking change: case entry values are now in a @pattern subnode. +--- + lenses/shellvars.aug | 10 +++++---- + lenses/tests/test_shellvars.aug | 48 +++++++++++++++++++++++++++-------------- + 2 files changed, 38 insertions(+), 20 deletions(-) + +diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug +index f681fcd..ed9cc9c 100644 +--- a/lenses/shellvars.aug ++++ b/lenses/shellvars.aug +@@ -34,12 +34,12 @@ module Shellvars = + let xchgs = Build.xchgs + let semicol = del /;?/ "" + +- let char = /[^`;()'"\n\\# \t]#*|\\\\(.|\n)/ ++ let char = /[^`;()'"|\n\\# \t]#*|\\\\(.|\n)/ + let dquot = + let char = /[^"\\]|\\\\./ | Rx.cl + in "\"" . char* . "\"" (* " Emacs, relax *) + let squot = /'[^']*'/ +- let bquot = /`[^`\n]*`/ ++ let bquot = /`[^`\n]+`/ + (* dbquot don't take spaces or semi-colons *) + let dbquot = /``[^` \t\n;]+``/ + let dollar_assign = /\$\([^\(\)#\n]*\)/ +@@ -148,8 +148,10 @@ module Shellvars = + generic_cond "select" "@select" "do" entry+ "done" + + let case (entry:lens) (entry_noeol:lens) = +- let case_entry = [ label "@case_entry" +- . Util.indent . sto_to_semicol ++ let pattern = [ label "@pattern" . sto_to_semicol . Sep.opt_space ] ++ in let case_entry = [ label "@case_entry" ++ . Util.indent . pattern ++ . (Util.del_str "|" . Sep.opt_space . pattern)* + . Util.del_str ")" . eol + . entry* . entry_noeol? + . Util.indent . Util.del_str ";;" . eol ] in +diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug +index 26aec25..d07918d 100644 +--- a/lenses/tests/test_shellvars.aug ++++ b/lenses/tests/test_shellvars.aug +@@ -261,11 +261,14 @@ done\n" = + ;; + esac\n" = + { "@case" = "$f" +- { "@case_entry" = "/tmp/file1" ++ { "@case_entry" ++ { "@pattern" = "/tmp/file1" } + { ".source" = "/tmp/file1" } } +- { "@case_entry" = "/tmp/file2" ++ { "@case_entry" ++ { "@pattern" = "/tmp/file2" } + { ".source" = "/tmp/file2" } } +- { "@case_entry" = "*" ++ { "@case_entry" ++ { "@pattern" = "*" } + { "@unset" + { "1" = "f" } } } } + +@@ -308,7 +311,8 @@ esac\n" = + + esac\n" = + { "@case" = "$f" +- { "@case_entry" = "a" ++ { "@case_entry" ++ { "@pattern" = "a" } + { "B" = "C" } } + } + +@@ -325,9 +329,11 @@ esac\n" = + ;; + esac\n" = + { "@case" = "$f" +- { "@case_entry" = "a" ++ { "@case_entry" ++ { "@pattern" = "a" } + { "B" = "C" } } +- { "@case_entry" = "b" ++ { "@case_entry" ++ { "@pattern" = "b" } + { "A" = "D" } } } + + +@@ -348,11 +354,13 @@ unset f + esac\n" = + { "@case" = "${INTERFACE}" + { "#comment" = "comment before" } +- { "@case_entry" = "eth0" ++ { "@case_entry" ++ { "@pattern" = "eth0" } + { "#comment" = "comment in" } + { "OPTIONS" = "()" } } + { "#comment" = "comment before 2" } +- { "@case_entry" = "*" ++ { "@case_entry" ++ { "@pattern" = "*" } + { "#comment" = "comment in 2" } + { "@unset" + { "1" = "f" } } } +@@ -364,7 +372,7 @@ esac\n" = + ;; + esac\n" = + { "@case" = "$a" +- { "@case_entry" = "*" } } ++ { "@case_entry" { "@pattern" = "*" } } } + + (* case variables can be surrounded by double quotes *) + test Shellvars.lns get "case \"${options}\" in +@@ -373,7 +381,8 @@ esac\n" = + ;; + esac\n" = + { "@case" = "\"${options}\"" +- { "@case_entry" = "*debug*" ++ { "@case_entry" ++ { "@pattern" = "*debug*" } + { "@builtin" = "shift" } } } + + (* Double quoted values can have newlines *) +@@ -473,9 +482,11 @@ test2\"\n" = + 1) TestVar=\"test1\" ;; + esac\n" = + { "@case" = "$ARG" +- { "@case_entry" = "0" ++ { "@case_entry" ++ { "@pattern" = "0" } + { "TestVar" = "\"test0\"" } } +- { "@case_entry" = "1" ++ { "@case_entry" ++ { "@pattern" = "1" } + { "TestVar" = "\"test1\"" } } } + + (* case: support ;; on the same line with multiple commands *) +@@ -486,11 +497,13 @@ esac\n" = + Bar=3; Baz=4;; + esac\n" = + { "@case" = "$ARG" +- { "@case_entry" = "0" ++ { "@case_entry" ++ { "@pattern" = "0" } + { "Foo" = "0" } + { "Bar" = "1" } + } +- { "@case_entry" = "1" ++ { "@case_entry" ++ { "@pattern" = "1" } + { "Foo" = "2" } + { "Bar" = "3" } + { "Baz" = "4" } +@@ -572,10 +585,13 @@ fi\n" = + ;; + esac\n" = + { "@case" = "$ARG" +- { "@case_entry" = "\"foo bar\"" ++ { "@case_entry" ++ { "@pattern" = "\"foo bar\"" } + { "Foo" = "0" } + } +- { "@case_entry" = "baz | quux" ++ { "@case_entry" ++ { "@pattern" = "baz" } ++ { "@pattern" = "quux" } + { "Foo" = "1" } + } + } +-- +2.5.0 + |