From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, alex.bennee@linaro.org,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH v2 2/8] docker.py/build: support binary files in --extra-files
Date: Thu, 21 May 2020 08:45:29 -0400 [thread overview]
Message-ID: <20200521124535.5329-3-pbonzini@redhat.com> (raw)
In-Reply-To: <20200521124535.5329-1-pbonzini@redhat.com>
Read the --extra-files in binary mode to avoid encoding errors.
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tests/docker/docker.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index ad61747bae..85e1dda10f 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -56,15 +56,19 @@ class EngineEnum(enum.IntEnum):
USE_ENGINE = EngineEnum.AUTO
+def _bytes_checksum(bytes):
+ """Calculate a digest string unique to the text content"""
+ return hashlib.sha1(bytes).hexdigest()
+
def _text_checksum(text):
"""Calculate a digest string unique to the text content"""
- return hashlib.sha1(text.encode('utf-8')).hexdigest()
+ return _bytes_checksum(text.encode('utf-8'))
def _read_dockerfile(path):
return open(path, 'rt', encoding='utf-8').read()
def _file_checksum(filename):
- return _text_checksum(_read_dockerfile(filename))
+ return _bytes_checksum(open(filename, 'rb').read())
def _guess_engine_command():
--
2.26.2
next prev parent reply other threads:[~2020-05-21 12:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 12:45 [PATCH v2 0/8] run-coverity-scan: misc improvements, especially for docker mode Paolo Bonzini
2020-05-21 12:45 ` [PATCH v2 1/8] docker.py/build: support -t and -f arguments Paolo Bonzini
2020-05-21 12:45 ` Paolo Bonzini [this message]
2020-05-21 12:45 ` [PATCH v2 3/8] run-coverity-scan: get Coverity token and email from special git config section Paolo Bonzini
2020-05-21 12:45 ` [PATCH v2 4/8] run-coverity-scan: use docker.py Paolo Bonzini
2020-05-21 12:55 ` Peter Maydell
2020-05-21 12:45 ` [PATCH v2 5/8] run-coverity-scan: add --no-update-tools option Paolo Bonzini
2020-05-21 12:45 ` [PATCH v2 6/8] run-coverity-scan: use --no-update-tools in docker run Paolo Bonzini
2020-05-21 12:45 ` [PATCH v2 7/8] run-coverity-scan: download tools outside the container Paolo Bonzini
2020-05-21 12:45 ` [PATCH v2 8/8] run-coverity-scan: support --update-tools-only --docker Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200521124535.5329-3-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).