Bugfix merge files for slack repository

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-01-15 23:40:15 +01:00
parent 6c09177ea5
commit 95b53cc51c

View file

@ -137,17 +137,14 @@ class Initialization:
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
merge = self.merge_stable
if self.meta.slack_rel == "current":
merge = self.merge_current
merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT",
"extra/PACKAGES.TXT",
"pasture/PACKAGES.TXT",
"patches/PACKAGES.TXT"])
merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5",
"extra/CHECKSUMS.md5",
"pasture/CHECKSUMS.md5",
"patches/CHECKSUMS_md5"])
self.merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT",
"extra/PACKAGES.TXT",
"pasture/PACKAGES.TXT",
"patches/PACKAGES.TXT"])
self.merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5",
"extra/CHECKSUMS.md5",
"pasture/CHECKSUMS.md5",
"patches/CHECKSUMS_md5"])
def sbo(self):
"""Creating sbo local library
@ -685,23 +682,13 @@ class Initialization:
self.down(lib_path, FILELIST_TXT, repo)
self.down(log_path, ChangeLog_txt, repo)
def merge_stable(self, path, outfile, infiles):
"""Merge files
"""
with open(path + outfile, 'w') as out_f:
for i in infiles:
if os.path.isfile(f"{path}{i}"):
with open(path + i, "r") as in_f:
for line in in_f:
out_f.write(line)
def merge_current(self, path, outfile, infiles):
def merge(self, path, outfile, infiles):
"""Merge files
"""
code = "utf-8"
with open(path + outfile, 'w', encoding=code) as out_f:
for f in infiles:
if os.path.isfile("f{path}{f}"):
if os.path.isfile(f"{path}{f}"):
# checking the encoding before read the file
code = Utils.check_encoding(path, f)
with open(path + f, "r", encoding=code) as in_f: