- Handle LABEL statements with any whitespace
- Handle LABEL values containing "=" properly OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-docker_label_helper?expand=0&rev=11
This commit is contained in:
parent
155965c650
commit
490d2e1694
@ -22,6 +22,6 @@ fi
|
|||||||
# Note: Avoid assigning to $1 etc. as that converts whitespace (field separators) to single spaces.
|
# Note: Avoid assigning to $1 etc. as that converts whitespace (field separators) to single spaces.
|
||||||
gawk -i inplace '
|
gawk -i inplace '
|
||||||
match($0, /^# labelprefix=(.*)$/, m) { labelprefix=m[1]; next }
|
match($0, /^# labelprefix=(.*)$/, m) { labelprefix=m[1]; next }
|
||||||
labelprefix != "" && match($0, /^(PREFIXED)?LABEL .*\.([^.]*)=(.*)$/, m) { printf "LABEL %s.%s=%s\n", labelprefix, m[2], m[3]; gsub(/^PREFIXEDLABEL/, "LABEL") }
|
labelprefix != "" && match($0, /^(PREFIXED)?LABEL[[:space:]]+[^=]*\.([^.=]*)=(.*)$/, m) { printf "LABEL %s.%s=%s\n", labelprefix, m[2], m[3]; gsub(/^PREFIXEDLABEL/, "LABEL") }
|
||||||
match($0, /^# endlabelprefix/) { labelprefix=""; next }
|
match($0, /^# endlabelprefix/) { labelprefix=""; next }
|
||||||
1' Dockerfile
|
1' Dockerfile
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 1 07:54:19 UTC 2023 - Fabian Vogt <fvogt@suse.com>
|
||||||
|
|
||||||
|
- Handle LABEL statements with any whitespace
|
||||||
|
- Handle LABEL values containing "=" properly
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Dec 7 09:48:52 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
|
Wed Dec 7 09:48:52 UTC 2022 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package obs-service-docker_label_helper
|
# spec file for package obs-service-docker_label_helper
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2023 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
14
test.sh
14
test.sh
@ -12,7 +12,8 @@ cat >Dockerfile <<EOF
|
|||||||
# labelprefix=org.opensuse.nano
|
# labelprefix=org.opensuse.nano
|
||||||
PREFIXEDLABEL org.opencontainers.image.title="Example container."
|
PREFIXEDLABEL org.opencontainers.image.title="Example container."
|
||||||
PREFIXEDLABEL org.opencontainers.image.description="This contains nano"
|
PREFIXEDLABEL org.opencontainers.image.description="This contains nano"
|
||||||
PREFIXEDLABEL test.whitespace="Two spaces. One tab."
|
PREFIXEDLABEL org.opencontainers.image.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
|
PREFIXEDLABEL test.whitespace="Two spaces. One tab."
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
export BUILD_DIST=
|
export BUILD_DIST=
|
||||||
@ -23,8 +24,10 @@ LABEL org.opensuse.nano.title="Example container."
|
|||||||
LABEL org.opencontainers.image.title="Example container."
|
LABEL org.opencontainers.image.title="Example container."
|
||||||
LABEL org.opensuse.nano.description="This contains nano"
|
LABEL org.opensuse.nano.description="This contains nano"
|
||||||
LABEL org.opencontainers.image.description="This contains nano"
|
LABEL org.opencontainers.image.description="This contains nano"
|
||||||
|
LABEL org.opensuse.nano.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
|
LABEL org.opencontainers.image.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
LABEL org.opensuse.nano.whitespace="Two spaces. One tab."
|
LABEL org.opensuse.nano.whitespace="Two spaces. One tab."
|
||||||
LABEL test.whitespace="Two spaces. One tab."
|
LABEL test.whitespace="Two spaces. One tab."
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
rm -f Dockerfile
|
rm -f Dockerfile
|
||||||
@ -34,7 +37,8 @@ cat >Dockerfile <<EOF
|
|||||||
# labelprefix=org.opensuse.nano
|
# labelprefix=org.opensuse.nano
|
||||||
LABEL org.opencontainers.image.title="Example container."
|
LABEL org.opencontainers.image.title="Example container."
|
||||||
LABEL org.opencontainers.image.description="This contains nano"
|
LABEL org.opencontainers.image.description="This contains nano"
|
||||||
LABEL test.whitespace="Two spaces. One tab."
|
LABEL org.opencontainers.image.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
|
LABEL test.whitespace="Two spaces. One tab."
|
||||||
# endlabelprefix
|
# endlabelprefix
|
||||||
LABEL not.expanded.label="example"
|
LABEL not.expanded.label="example"
|
||||||
EOF
|
EOF
|
||||||
@ -47,7 +51,9 @@ LABEL org.opensuse.nano.title="Example container."
|
|||||||
LABEL org.opencontainers.image.title="Example container."
|
LABEL org.opencontainers.image.title="Example container."
|
||||||
LABEL org.opensuse.nano.description="This contains nano"
|
LABEL org.opensuse.nano.description="This contains nano"
|
||||||
LABEL org.opencontainers.image.description="This contains nano"
|
LABEL org.opencontainers.image.description="This contains nano"
|
||||||
|
LABEL org.opensuse.nano.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
|
LABEL org.opencontainers.image.source="https://build.opensuse.org/package/show/openSUSE:Factory/opensuse-tumbleweed-image?rev=1afbea7e9b8ecf976071564312c2db66"
|
||||||
LABEL org.opensuse.nano.whitespace="Two spaces. One tab."
|
LABEL org.opensuse.nano.whitespace="Two spaces. One tab."
|
||||||
LABEL test.whitespace="Two spaces. One tab."
|
LABEL test.whitespace="Two spaces. One tab."
|
||||||
LABEL not.expanded.label="example"
|
LABEL not.expanded.label="example"
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user