Clean up some more python3 things

Because system commands are bytes not strings. Because yay.

Change-Id: Ib54b5717c2e2051addc2d7208a70b82a66ca8ccb
This commit is contained in:
Monty Taylor 2020-03-22 10:40:08 -05:00
parent 90b98698c3
commit 086a9bf6e3

View File

@ -82,10 +82,10 @@ def git_command_output(repo_dir, sub_cmd, env=None):
def make_ssh_wrapper(gerrit_user, gerrit_key):
(fd, name) = tempfile.mkstemp(text=True)
os.write(fd, '#!/bin/bash\n')
os.write(fd, b'#!/bin/bash\n')
os.write(fd,
'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
(gerrit_key, gerrit_user))
b'ssh -i %s -l %s -o "StrictHostKeyChecking no" $@\n' %
(gerrit_key.encode('utf-8'), gerrit_user.encode('utf-8')))
os.close(fd)
os.chmod(name, 0o755)
return dict(GIT_SSH=name)
@ -171,7 +171,7 @@ def fsck_repo(repo_path):
# Check for non zero return code or warnings which should
# be treated as errors. In this case zeroPaddedFilemodes
# will not be accepted by Gerrit/jgit but are accepted by C git.
if rc != 0 or 'zeroPaddedFilemode' in out:
if rc != 0 or b'zeroPaddedFilemode' in out:
log.error('git fsck of %s failed:\n%s' % (repo_path, out))
raise Exception('git fsck failed not importing')