Noticed this while looking at #5744 because he had lines ending in &&\
Signed-off-by: Doug Davis <dug@us.ibm.com>
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"io" |
| 7 | 7 |
"regexp" |
| 8 | 8 |
"strings" |
| 9 |
+ "unicode" |
|
| 9 | 10 |
) |
| 10 | 11 |
|
| 11 | 12 |
// Node is a structure used to represent a parse tree. |
| ... | ... |
@@ -96,14 +97,14 @@ func Parse(rwc io.Reader) (*Node, error) {
|
| 96 | 96 |
scanner := bufio.NewScanner(rwc) |
| 97 | 97 |
|
| 98 | 98 |
for scanner.Scan() {
|
| 99 |
- line, child, err := parseLine(strings.TrimSpace(scanner.Text())) |
|
| 99 |
+ line, child, err := parseLine(strings.TrimLeftFunc(scanner.Text(), unicode.IsSpace)) |
|
| 100 | 100 |
if err != nil {
|
| 101 | 101 |
return nil, err |
| 102 | 102 |
} |
| 103 | 103 |
|
| 104 | 104 |
if line != "" && child == nil {
|
| 105 | 105 |
for scanner.Scan() {
|
| 106 |
- newline := strings.TrimSpace(scanner.Text()) |
|
| 106 |
+ newline := scanner.Text() |
|
| 107 | 107 |
|
| 108 | 108 |
if newline == "" {
|
| 109 | 109 |
continue |
| ... | ... |
@@ -71,8 +71,8 @@ func TestTestData(t *testing.T) {
|
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 | 73 |
if ast.Dump()+"\n" != string(content) {
|
| 74 |
- fmt.Fprintln(os.Stderr, ast.Dump()) |
|
| 75 |
- fmt.Fprintln(os.Stderr, string(content)) |
|
| 74 |
+ fmt.Fprintln(os.Stderr, "Result:\n"+ast.Dump()) |
|
| 75 |
+ fmt.Fprintln(os.Stderr, "Expected:\n"+string(content)) |
|
| 76 | 76 |
t.Fatalf("%s: AST dump of dockerfile does not match result", dir.Name())
|
| 77 | 77 |
} |
| 78 | 78 |
|
| ... | ... |
@@ -2,4 +2,4 @@ |
| 2 | 2 |
(maintainer "brimstone@the.narro.ws") |
| 3 | 3 |
(env "GOPATH" "/go") |
| 4 | 4 |
(entrypoint "/usr/local/bin/consuldock") |
| 5 |
-(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends git golang ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists && go get -v github.com/brimstone/consuldock && mv $GOPATH/bin/consuldock /usr/local/bin/consuldock && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.* && rm -rf $GOPATH")
|
|
| 5 |
+(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends git golang ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists && go get -v github.com/brimstone/consuldock && mv $GOPATH/bin/consuldock /usr/local/bin/consuldock && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.* && rm -rf $GOPATH")
|
| ... | ... |
@@ -2,8 +2,8 @@ |
| 2 | 2 |
(cmd) |
| 3 | 3 |
(entrypoint "/usr/bin/consul" "agent" "-server" "-data-dir=/consul" "-client=0.0.0.0" "-ui-dir=/webui") |
| 4 | 4 |
(expose "8500" "8600" "8400" "8301" "8302") |
| 5 |
-(run "apt-get update && apt-get install -y unzip wget && apt-get clean && rm -rf /var/lib/apt/lists") |
|
| 6 |
-(run "cd /tmp && wget https://dl.bintray.com/mitchellh/consul/0.3.1_web_ui.zip -O web_ui.zip && unzip web_ui.zip && mv dist /webui && rm web_ui.zip") |
|
| 7 |
-(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends unzip wget && apt-get clean && rm -rf /var/lib/apt/lists && cd /tmp && wget https://dl.bintray.com/mitchellh/consul/0.3.1_web_ui.zip -O web_ui.zip && unzip web_ui.zip && mv dist /webui && rm web_ui.zip && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.*")
|
|
| 5 |
+(run "apt-get update && apt-get install -y unzip wget && apt-get clean && rm -rf /var/lib/apt/lists") |
|
| 6 |
+(run "cd /tmp && wget https://dl.bintray.com/mitchellh/consul/0.3.1_web_ui.zip -O web_ui.zip && unzip web_ui.zip && mv dist /webui && rm web_ui.zip") |
|
| 7 |
+(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends unzip wget && apt-get clean && rm -rf /var/lib/apt/lists && cd /tmp && wget https://dl.bintray.com/mitchellh/consul/0.3.1_web_ui.zip -O web_ui.zip && unzip web_ui.zip && mv dist /webui && rm web_ui.zip && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.*")
|
|
| 8 | 8 |
(env "GOPATH" "/go") |
| 9 |
-(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends git golang ca-certificates build-essential && apt-get clean && rm -rf /var/lib/apt/lists && go get -v github.com/hashicorp/consul && mv $GOPATH/bin/consul /usr/bin/consul && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.* && rm -rf $GOPATH")
|
|
| 9 |
+(run "apt-get update && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.clean && apt-get install -y --no-install-recommends git golang ca-certificates build-essential && apt-get clean && rm -rf /var/lib/apt/lists && go get -v github.com/hashicorp/consul && mv $GOPATH/bin/consul /usr/bin/consul && dpkg -l | awk '/^ii/ {print $2}' > /tmp/dpkg.dirty && apt-get remove --purge -y $(diff /tmp/dpkg.clean /tmp/dpkg.dirty | awk '/^>/ {print $2}') && rm /tmp/dpkg.* && rm -rf $GOPATH")
|
| 10 | 10 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,28 @@ |
| 0 |
+FROM ubuntu:14.04 |
|
| 1 |
+ |
|
| 2 |
+RUN echo hello\ |
|
| 3 |
+ world\ |
|
| 4 |
+ goodnight \ |
|
| 5 |
+ moon\ |
|
| 6 |
+ light\ |
|
| 7 |
+ning |
|
| 8 |
+RUN echo hello \ |
|
| 9 |
+ world |
|
| 10 |
+RUN echo hello \ |
|
| 11 |
+world |
|
| 12 |
+RUN echo hello \ |
|
| 13 |
+goodbye\ |
|
| 14 |
+frog |
|
| 15 |
+RUN echo hello \ |
|
| 16 |
+RUN echo hi \ |
|
| 17 |
+ \ |
|
| 18 |
+ world \ |
|
| 19 |
+\ |
|
| 20 |
+ good\ |
|
| 21 |
+\ |
|
| 22 |
+night |
|
| 23 |
+RUN echo goodbye\ |
|
| 24 |
+frog |
|
| 25 |
+RUN echo good\ |
|
| 26 |
+bye\ |
|
| 27 |
+frog |
| 0 | 28 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,9 @@ |
| 0 |
+(from "ubuntu:14.04") |
|
| 1 |
+(run "echo hello world goodnight moon lightning") |
|
| 2 |
+(run "echo hello world") |
|
| 3 |
+(run "echo hello world") |
|
| 4 |
+(run "echo hello goodbyefrog") |
|
| 5 |
+(run "echo hello \\") |
|
| 6 |
+(run "echo hi world goodnight") |
|
| 7 |
+(run "echo goodbyefrog") |
|
| 8 |
+(run "echo goodbyefrog") |
| ... | ... |
@@ -25,7 +25,7 @@ |
| 25 | 25 |
(run "echo \"cfg_dir=${NAGIOS_HOME}/etc/conf.d\" >> ${NAGIOS_HOME}/etc/nagios.cfg")
|
| 26 | 26 |
(run "echo \"cfg_dir=${NAGIOS_HOME}/etc/monitor\" >> ${NAGIOS_HOME}/etc/nagios.cfg")
|
| 27 | 27 |
(run "download-mibs && echo \"mibs +ALL\" > /etc/snmp/snmp.conf") |
| 28 |
-(run "sed -i 's,/bin/mail,/usr/bin/mail,' /opt/nagios/etc/objects/commands.cfg && sed -i 's,/usr/usr,/usr,' /opt/nagios/etc/objects/commands.cfg") |
|
| 28 |
+(run "sed -i 's,/bin/mail,/usr/bin/mail,' /opt/nagios/etc/objects/commands.cfg && sed -i 's,/usr/usr,/usr,' /opt/nagios/etc/objects/commands.cfg") |
|
| 29 | 29 |
(run "cp /etc/services /var/spool/postfix/etc/") |
| 30 | 30 |
(run "mkdir -p /etc/sv/nagios && mkdir -p /etc/sv/apache && rm -rf /etc/sv/getty-5 && mkdir -p /etc/sv/postfix") |
| 31 | 31 |
(add "nagios.init" "/etc/sv/nagios/run") |
| ... | ... |
@@ -1,14 +1,14 @@ |
| 1 | 1 |
(docker-version "0.6.1") |
| 2 | 2 |
(from "ubuntu:14.04") |
| 3 | 3 |
(maintainer "Tianon Gravi <admwiggin@gmail.com> (@tianon)") |
| 4 |
-(run "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils aufs-tools automake btrfs-tools build-essential curl dpkg-sig git iptables libapparmor-dev libcap-dev libsqlite3-dev lxc=1.0* mercurial pandoc parallel reprepro ruby1.9.1 ruby1.9.1-dev s3cmd=1.1.0* --no-install-recommends") |
|
| 4 |
+(run "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-utils aufs-tools automake btrfs-tools build-essential curl dpkg-sig git iptables libapparmor-dev libcap-dev libsqlite3-dev lxc=1.0* mercurial pandoc parallel reprepro ruby1.9.1 ruby1.9.1-dev s3cmd=1.1.0* --no-install-recommends") |
|
| 5 | 5 |
(run "git clone --no-checkout https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2 && cd /usr/local/lvm2 && git checkout -q v2_02_103") |
| 6 | 6 |
(run "cd /usr/local/lvm2 && ./configure --enable-static_link && make device-mapper && make install_device-mapper") |
| 7 | 7 |
(run "curl -sSL https://golang.org/dl/go1.3.src.tar.gz | tar -v -C /usr/local -xz") |
| 8 | 8 |
(env "PATH" "/usr/local/go/bin:$PATH") |
| 9 | 9 |
(env "GOPATH" "/go:/go/src/github.com/docker/docker/vendor") |
| 10 | 10 |
(run "cd /usr/local/go/src && ./make.bash --no-clean 2>&1") |
| 11 |
-(env "DOCKER_CROSSPLATFORMS" "linux/386 linux/arm darwin/amd64 darwin/386 freebsd/amd64 freebsd/386 freebsd/arm") |
|
| 11 |
+(env "DOCKER_CROSSPLATFORMS" "linux/386 linux/arm darwin/amd64 darwin/386 freebsd/amd64 freebsd/386 freebsd/arm") |
|
| 12 | 12 |
(env "GOARM" "5") |
| 13 | 13 |
(run "cd /usr/local/go/src && bash -xc 'for platform in $DOCKER_CROSSPLATFORMS; do GOOS=${platform%/*} GOARCH=${platform##*/} ./make.bash --no-clean 2>&1; done'")
|
| 14 | 14 |
(run "go get code.google.com/p/go.tools/cmd/cover") |
| ... | ... |
@@ -1,5 +1,5 @@ |
| 1 | 1 |
(from "ubuntu:14.04") |
| 2 | 2 |
(maintainer "Erik \\\\Hollensbe <erik@hollensbe.org>\\\"") |
| 3 |
-(run "apt-get \\update && apt-get \\\"install znc -y") |
|
| 3 |
+(run "apt-get \\update && apt-get \\\"install znc -y") |
|
| 4 | 4 |
(add "\\conf\\\\\"" "/.znc") |
| 5 | 5 |
(cmd "/usr\\\"/bin/znc" "-f" "-r") |
| ... | ... |
@@ -7,8 +7,8 @@ |
| 7 | 7 |
(run "echo" "'1234'") |
| 8 | 8 |
(run "echo \"1234\"") |
| 9 | 9 |
(run "echo 1234") |
| 10 |
-(run "echo '1234' && echo \"456\" && echo 789") |
|
| 11 |
-(run "sh -c 'echo root:testpass > /tmp/passwd'") |
|
| 10 |
+(run "echo '1234' && echo \"456\" && echo 789") |
|
| 11 |
+(run "sh -c 'echo root:testpass > /tmp/passwd'") |
|
| 12 | 12 |
(run "mkdir -p /test /test2 /test3/test") |
| 13 | 13 |
(env "SCUBA" "1 DUBA 3") |
| 14 | 14 |
(env "SCUBA" "\"1 DUBA 3\"") |