mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-31 10:26:39 +01:00
Improving code for Python 3
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
81c86a5620
commit
27d4ba5419
3 changed files with 29 additions and 17 deletions
|
@ -33,8 +33,7 @@ def search_pkg(name, repo):
|
|||
"""Search if package exists in PACKAGES.TXT file
|
||||
and return the name.
|
||||
"""
|
||||
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"
|
||||
"PACKAGES.TXT".format(repo))
|
||||
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
||||
names = Utils().package_name(PACKAGES_TXT)
|
||||
blacklist = BlackList().packages(pkgs=names, repo=repo)
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
|
|
|
@ -137,14 +137,17 @@ class Initialization:
|
|||
self.down(log, ChangeLog_txt, repo_name)
|
||||
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
|
||||
FILELIST_TXT, repo_name)
|
||||
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"])
|
||||
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"])
|
||||
|
||||
def sbo(self):
|
||||
"""Creating sbo local library
|
||||
|
@ -682,7 +685,17 @@ class Initialization:
|
|||
self.down(lib_path, FILELIST_TXT, repo)
|
||||
self.down(log_path, ChangeLog_txt, repo)
|
||||
|
||||
def merge(self, path, outfile, infiles):
|
||||
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):
|
||||
"""Merge files
|
||||
"""
|
||||
code = "utf-8"
|
||||
|
|
|
@ -38,17 +38,17 @@ def mirrors(name, location):
|
|||
repo = Repo().slack()
|
||||
if _meta_.arch == "x86_64":
|
||||
if rel == "stable":
|
||||
http = repo + "slackware64-{0}/{1}{2}".format(ver, location, name)
|
||||
http = f"{repo}slackware64-{ver}/{location}{name}"
|
||||
else:
|
||||
http = repo + "slackware64-{0}/{1}{2}".format(rel, location, name)
|
||||
http = f"{repo}slackware64-{rel}/{location}{name}"
|
||||
elif _meta_.arch.startswith("arm"):
|
||||
if rel == "stable":
|
||||
http = repo + "slackwarearm-{0}/{1}{2}".format(ver, location, name)
|
||||
http = f"{repo}slackwarearm-{ver}/{location}{name}"
|
||||
else:
|
||||
http = repo + "slackwarearm-{0}/{1}{2}".format(rel, location, name)
|
||||
http = f"{repo}slackwarearm-{rel}/{location}{name}"
|
||||
else:
|
||||
if rel == "stable":
|
||||
http = repo + "slackware-{0}/{1}{2}".format(ver, location, name)
|
||||
http = f"{repo}slackware-{ver}/{location}{name}"
|
||||
else:
|
||||
http = repo + "slackware-{0}/{1}{2}".format(rel, location, name)
|
||||
http = f"{repo}slackware-{rel}/{location}{name}"
|
||||
return http
|
||||
|
|
Loading…
Reference in a new issue