mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
fix write dependencies if exist in repository
This commit is contained in:
parent
425fa236d4
commit
590f15e8bb
3 changed files with 24 additions and 10 deletions
|
@ -25,16 +25,27 @@ import sys
|
|||
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.splitting import split_package
|
||||
|
||||
from greps import Requires
|
||||
|
||||
|
||||
class Dependencies(object):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, PACKAGES_TXT, repo):
|
||||
self.repo = repo
|
||||
self.dep_results = []
|
||||
self.packages = []
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
# index += 1
|
||||
# toolbar_width = status(index, toolbar_width, step)
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
if repo == "slackr":
|
||||
self.packages.append(line[15:].strip())
|
||||
else:
|
||||
self.packages.append(split_package(line[15:].strip())[0])
|
||||
|
||||
def others(self, name, repo):
|
||||
def others(self, name):
|
||||
'''
|
||||
Build all dependencies of a package
|
||||
'''
|
||||
|
@ -42,18 +53,18 @@ class Dependencies(object):
|
|||
sys.setrecursionlimit(10000)
|
||||
dependencies = []
|
||||
blacklist = BlackList().packages()
|
||||
requires = Requires(name, repo).get_deps()
|
||||
requires = Requires(name, self.repo).get_deps()
|
||||
toolbar_width, index = 2, 0
|
||||
if requires:
|
||||
for req in requires:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 7)
|
||||
if req and req not in blacklist:
|
||||
if req and req in self.packages and req not in blacklist:
|
||||
dependencies.append(req)
|
||||
if dependencies:
|
||||
self.dep_results.append(dependencies)
|
||||
for dep in dependencies:
|
||||
self.others(dep, repo)
|
||||
self.others(dep)
|
||||
return self.dep_results
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
|
|
|
@ -208,7 +208,10 @@ class Requires(object):
|
|||
f.close()
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
pkg_name = split_package(line[14:].strip())[0]
|
||||
if self.repo == "slackr":
|
||||
pkg_name = fix_slackers_pkg(line[15:])
|
||||
else:
|
||||
pkg_name = split_package(line[14:].strip())[0]
|
||||
if line.startswith("PACKAGE REQUIRED:"):
|
||||
if pkg_name == self.name:
|
||||
if line[18:].strip():
|
||||
|
|
|
@ -222,8 +222,8 @@ class OthersInstall(object):
|
|||
sys.stdout.flush()
|
||||
for dep in self.packages:
|
||||
dependencies = []
|
||||
dependencies = dimensional_list(Dependencies().others(dep,
|
||||
self.repo))
|
||||
dependencies = dimensional_list(Dependencies(self.PACKAGES_TXT,
|
||||
self.repo).others(dep))
|
||||
requires += dependencies
|
||||
self.deps_dict[dep] = remove_dbs(dependencies)
|
||||
return remove_dbs(requires)
|
||||
|
@ -280,7 +280,7 @@ class OthersInstall(object):
|
|||
for pkg in packages:
|
||||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
if pkg == split_package(name)[0] and pkg not in black:
|
||||
if name and pkg == split_package(name)[0] and pkg not in black:
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
comp_sum.append(comp)
|
||||
|
@ -289,7 +289,7 @@ class OthersInstall(object):
|
|||
for pkg in packages:
|
||||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
if pkg in split_package(name)[0]:
|
||||
if name and pkg in split_package(name)[0]:
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
comp_sum.append(comp)
|
||||
|
|
Loading…
Reference in a new issue