Fixed encoding bugs in update methods

migration_mirror 3.7.1
idziubenko 3 years ago
parent e6b5f2e11b
commit 7e4d754690

@ -75,12 +75,15 @@ class CommandExecutor():
def get_command(self):
return [self.cmd] + list(self.params)
#TODO make sure pexpect encoding doesn't mess up anything
#if it does, instead put log file as binary maybe?
def execute(self):
if self.child is None:
command_data = self.get_command()
self.child = pexpect.spawn(command_data[0], command_data[1:],
logfile=open(self.logfile, 'w'),
env=self.env, cwd=self.cwd, timeout=None)
env=self.env, cwd=self.cwd, timeout=None,
encoding="UTF-8")
return self.child
def close(self):
@ -718,7 +721,7 @@ class EmergeParser(InfoBlockInterface):
while True:
index = child.expect_exact(self.elements.keys())
element = self.elements.values()[index]
element = list(self.elements.values())[index]
element.get_block(child)
if element.action:
if element.action(child) is False:

@ -605,8 +605,8 @@ class Update(MethodsInterface):
if path.exists(previous_eix):
os.unlink(previous_eix)
try:
with writeFile(previous_eix) as f:
f.write(readFile(portage_eix))
with writeFile(previous_eix, binary=True) as f:
f.write(readFile(portage_eix, binary=True))
portage_eix_stat = os.stat(portage_eix)
os.chmod(previous_eix, portage_eix_stat.st_mode)
os.chown(previous_eix, portage_eix_stat.st_uid,
@ -1473,7 +1473,7 @@ class Update(MethodsInterface):
Binhosts.check_packages_signature(
url_binhost, orig_packages, gpg)
with writeFile(packages_sign_fn) as f:
f.write(Binhosts.fetch_packages_sign(url_binhost))
f.write(Binhosts.fetch_packages_sign(url_binhost).decode("UTF-8"))
except BinhostSignError:
for fn in (packages_fn, packages_sign_fn):
if path.exists(fn):
@ -1636,7 +1636,7 @@ class Update(MethodsInterface):
packages_fn = self.clVars.Get('update.cl_update_package_cache')
packages_sign_fn = self.clVars.Get('update.cl_update_package_cache_sign')
if path.exists(packages_fn) and path.exists(packages_sign_fn):
packages_sign = readFile(packages_sign_fn)
packages_sign = readFile(packages_sign_fn, binary=True)
pi = PackagesIndex(readFile(packages_fn))
pi.clean()
try:

@ -219,7 +219,7 @@ class VariableClUpdateRepRev(Variable):
cp = ConfigParser()
revisions = self.Get('update.cl_update_binhost_revisions')
if revisions:
cp.read_string(unicode(revisions[0]))
cp.read_string(revisions[0])
branch = self.Get('cl_update_branch')

Loading…
Cancel
Save