Fix tracking dependency resolving

This commit is contained in:
Dimitris Zlatanidis 2015-06-22 07:42:57 +03:00
parent bb1ab5f310
commit 60881fea14
5 changed files with 14 additions and 7 deletions

View file

@ -24,7 +24,6 @@
import sys
from slpkg.utils import Utils
from slpkg.toolbar import status
from slpkg.__metadata__ import MetaData as _meta_
@ -37,7 +36,6 @@ class Dependencies(object):
self.packages = PACKAGES_TXT
self.repo = repo
self.black = black
self.names = Utils().package_name(PACKAGES_TXT)
self.dep_results = []
self.meta = _meta_
@ -55,8 +53,7 @@ class Dependencies(object):
for req in requires:
index += 1
toolbar_width = status(index, toolbar_width, 7)
if (req and req in self.names and
req not in self.black):
if req and req not in self.black:
dependencies.append(req)
if dependencies:
self.dep_results.append(dependencies)

View file

@ -29,6 +29,7 @@ from slpkg.utils import Utils
from slpkg.sizes import units
from slpkg.messages import Msg
from slpkg.remove import delete
from slpkg.toolbar import status
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
@ -197,7 +198,10 @@ class BinaryInstall(object):
if (self.meta.rsl_deps in ["on", "ON"] and
self.flag != "--resolve-off"):
Msg().resolving()
toolbar_width, index = 2, 0
for dep in self.packages:
index += 1
toolbar_width = status(index, toolbar_width, 3)
dependencies = []
dependencies = Utils().dimensional_list(Dependencies(
self.PACKAGES_TXT, self.repo, self.blacklist).binary(

View file

@ -25,6 +25,7 @@
from utils import Utils
from splitting import split_package
from __metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
class BlackList(object):
@ -139,3 +140,8 @@ class BlackList(object):
if bl not in black and "*" not in bl:
black.append(bl)
return black
def installed(self):
"""Return all installed packages
"""
return find_package("", _meta_.pkg_path)

View file

@ -23,7 +23,7 @@
import os
from slpkg.blacklist import BlackList
# from slpkg.blacklist import BlackList
from slpkg.splitting import split_package
@ -33,7 +33,7 @@ def find_package(find_pkg, directory):
"""
pkgs = []
installed = sorted(os.listdir(directory))
blacklist = BlackList().packages(pkgs=installed, repo="local")
blacklist = ""
if os.path.exists(directory):
for pkg in installed:
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and

View file

@ -62,7 +62,7 @@ class Utils(object):
Returns list with all the names of packages repository
"""
packages = []
for line in PACKAGES_TXT:
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
packages.append(split_package(line[14:].strip())[0])
return packages