setup cache encoding fix

master
idziubenko 3 years ago
parent a228bd06e7
commit 329c8a46ba

@ -28,8 +28,8 @@ get_pkgname_by_filename = templateFunction.get_pkgname_by_filename
class Cache():
reMerge = re.compile("(merge|mergepkg)\(([-\w/]*)(?:\[[^\]]\])?\)[-!=<>]")
rePatch = re.compile("^#\s*Calculate.*ac_install_patch==on")
reMerge = re.compile(b"(merge|mergepkg)\(([-\w/]*)(?:\[[^\]]\])?\)[-!=<>]")
rePatch = re.compile(b"^#\s*Calculate.*ac_install_patch==on")
PATCH_TYPE = "patch"
MERGE_TYPE = "merge"
@ -54,7 +54,7 @@ class Cache():
patch_dirs = []
for root, dirs, files in os.walk(dn):
for fn in (path.join(root, x) for x in files):
data = readFile(fn)
data = readFile(fn, binary=True)
if self.rePatch.search(data):
if path.basename(fn) == self.DIRECTORY_TEMPLATE:
patch_dirs.append(path.dirname(fn))
@ -76,7 +76,7 @@ class Cache():
for root, dirs, files in os.walk(dn):
for fn in (path.join(root, x) for x in files
if x.endswith(self.CLT_SUFFIX)):
data = readFile(fn)
data = readFile(fn, binary=True)
for fname, pkg in self.reMerge.findall(data):
pkg = pkg or get_pkgname_by_filename(fn)
yield (self.MERGE_TYPE, pkg)

Loading…
Cancel
Save