diff options
| author | Yi Zhao <yi.zhao@windriver.com> | 2020-03-13 11:48:42 +0800 |
|---|---|---|
| committer | Jia Zhang <zhang.jia@linux.alibaba.com> | 2020-03-13 20:29:08 +0800 |
| commit | b0d0273ae273f2052a40f6ddcfee28df6179adfd (patch) | |
| tree | 2029de0c72ea02e100e2927ac8fffc8781fee55a | |
| parent | 7db0fc79dfa6ddab3939f1fd1a6956ca61179284 (diff) | |
| download | meta-secure-core-b0d0273ae273f2052a40f6ddcfee28df6179adfd.tar.gz | |
tpm2-tools: fix yaml.load warning in test scripts
The yaml.load(f) is deprecated since pyyaml 5.1.
Use yaml.load(f, Loader=yaml.BaseLoader) instead of it.
See https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation
Fixes warning:
YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
| -rw-r--r-- | meta-tpm2/recipes-tpm/tpm2-tools/files/0001-test-fix-yaml.load-warning.patch | 92 | ||||
| -rw-r--r-- | meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.2.1.bb | 1 |
2 files changed, 93 insertions, 0 deletions
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-test-fix-yaml.load-warning.patch b/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-test-fix-yaml.load-warning.patch new file mode 100644 index 0000000..1d9e256 --- /dev/null +++ b/meta-tpm2/recipes-tpm/tpm2-tools/files/0001-test-fix-yaml.load-warning.patch | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | From 0de180698bc992420fa8670d1ecce24008a4e3b9 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
| 3 | Date: Tue, 10 Mar 2020 11:18:51 +0800 | ||
| 4 | Subject: [PATCH] test: fix yaml.load warning | ||
| 5 | |||
| 6 | The yaml.load(f) is deprecated since pyyaml 5.1. | ||
| 7 | Use yaml.load(f, Loader=yaml.BaseLoader) instead of it. | ||
| 8 | See https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation | ||
| 9 | |||
| 10 | Fixes warning: | ||
| 11 | YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, | ||
| 12 | as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. | ||
| 13 | |||
| 14 | Upstream-Status: Submitted [https://github.com/tpm2-software/tpm2-tools/pull/1944] | ||
| 15 | |||
| 16 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
| 17 | --- | ||
| 18 | test/system/test_tpm2_activecredential.sh | 2 +- | ||
| 19 | test/system/test_tpm2_create.sh | 2 +- | ||
| 20 | test/system/test_tpm2_createprimary.sh | 2 +- | ||
| 21 | test/system/test_tpm2_nv.sh | 2 +- | ||
| 22 | test/system/test_tpm2_pcrevent.sh | 2 +- | ||
| 23 | 5 files changed, 5 insertions(+), 5 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/test/system/test_tpm2_activecredential.sh b/test/system/test_tpm2_activecredential.sh | ||
| 26 | index d8cadf5..3c9cf6e 100755 | ||
| 27 | --- a/test/system/test_tpm2_activecredential.sh | ||
| 28 | +++ b/test/system/test_tpm2_activecredential.sh | ||
| 29 | @@ -61,7 +61,7 @@ from __future__ import print_function | ||
| 30 | import yaml | ||
| 31 | |||
| 32 | with open('ak.out', 'r') as f: | ||
| 33 | - doc = yaml.load(f) | ||
| 34 | + doc = yaml.load(f, Loader=yaml.BaseLoader) | ||
| 35 | print(doc['loaded-key']['name']) | ||
| 36 | pyscript` | ||
| 37 | |||
| 38 | diff --git a/test/system/test_tpm2_create.sh b/test/system/test_tpm2_create.sh | ||
| 39 | index d0bf031..ff192ca 100755 | ||
| 40 | --- a/test/system/test_tpm2_create.sh | ||
| 41 | +++ b/test/system/test_tpm2_create.sh | ||
| 42 | @@ -59,7 +59,7 @@ import yaml | ||
| 43 | |||
| 44 | with open("$2") as f: | ||
| 45 | try: | ||
| 46 | - y = yaml.load(f) | ||
| 47 | + y = yaml.load(f, Loader=yaml.BaseLoader) | ||
| 48 | found = "$1" in y | ||
| 49 | if (not found): | ||
| 50 | sys.stderr.write('Could not find index 0x%X\n' % ("$1")) | ||
| 51 | diff --git a/test/system/test_tpm2_createprimary.sh b/test/system/test_tpm2_createprimary.sh | ||
| 52 | index 83bdad4..cc4dce0 100755 | ||
| 53 | --- a/test/system/test_tpm2_createprimary.sh | ||
| 54 | +++ b/test/system/test_tpm2_createprimary.sh | ||
| 55 | @@ -73,7 +73,7 @@ import yaml | ||
| 56 | |||
| 57 | with open("$2") as f: | ||
| 58 | try: | ||
| 59 | - y = yaml.load(f) | ||
| 60 | + y = yaml.load(f, Loader=yaml.BaseLoader) | ||
| 61 | found = "$1" in y | ||
| 62 | if (not found): | ||
| 63 | sys.stderr.write('Could not find index 0x%X\n' % ("$1")) | ||
| 64 | diff --git a/test/system/test_tpm2_nv.sh b/test/system/test_tpm2_nv.sh | ||
| 65 | index 2db6522..756d7ea 100755 | ||
| 66 | --- a/test/system/test_tpm2_nv.sh | ||
| 67 | +++ b/test/system/test_tpm2_nv.sh | ||
| 68 | @@ -69,7 +69,7 @@ import yaml | ||
| 69 | |||
| 70 | with open("$2") as f: | ||
| 71 | try: | ||
| 72 | - y = yaml.load(f) | ||
| 73 | + y = yaml.load(f, Loader=yaml.BaseLoader) | ||
| 74 | found = $1 in y | ||
| 75 | if (not found): | ||
| 76 | sys.stderr.write('Could not find index 0x%X\n' % ($1)) | ||
| 77 | diff --git a/test/system/test_tpm2_pcrevent.sh b/test/system/test_tpm2_pcrevent.sh | ||
| 78 | index 30ec932..74f640b 100755 | ||
| 79 | --- a/test/system/test_tpm2_pcrevent.sh | ||
| 80 | +++ b/test/system/test_tpm2_pcrevent.sh | ||
| 81 | @@ -59,7 +59,7 @@ import yaml | ||
| 82 | with open("$1", 'r') as stream: | ||
| 83 | |||
| 84 | try: | ||
| 85 | - y = yaml.load(stream) | ||
| 86 | + y = yaml.load(stream, Loader=yaml.BaseLoader) | ||
| 87 | alg = y["$2"] | ||
| 88 | value = alg[$3] | ||
| 89 | print(value) | ||
| 90 | -- | ||
| 91 | 2.7.4 | ||
| 92 | |||
diff --git a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.2.1.bb b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.2.1.bb index a47e371..77811a5 100644 --- a/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.2.1.bb +++ b/meta-tpm2/recipes-tpm/tpm2-tools/tpm2-tools_3.2.1.bb | |||
| @@ -2,6 +2,7 @@ include ${BPN}.inc | |||
| 2 | 2 | ||
| 3 | SRC_URI = "\ | 3 | SRC_URI = "\ |
| 4 | https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \ | 4 | https://github.com/tpm2-software/${BPN}/releases/download/${PV}/${BPN}-${PV}.tar.gz \ |
| 5 | file://0001-test-fix-yaml.load-warning.patch \ | ||
| 5 | " | 6 | " |
| 6 | SRC_URI[md5sum] = "17f22e9b47682f4601eb55324282ad6e" | 7 | SRC_URI[md5sum] = "17f22e9b47682f4601eb55324282ad6e" |
| 7 | SRC_URI[sha256sum] = "568ff32f99e0835db5d8cea2dce781b6cd6c1034026514240995dae5d9e728b0" | 8 | SRC_URI[sha256sum] = "568ff32f99e0835db5d8cea2dce781b6cd6c1034026514240995dae5d9e728b0" |
