fix dependencies

This commit is contained in:
Dimitris Zlatanidis 2015-01-12 15:29:51 +02:00
parent 57b62e07a4
commit ff9583ef0e
4 changed files with 45 additions and 43 deletions

View file

@ -48,7 +48,7 @@ from greps import SBoGrep
from remove import delete
from compressed import SBoLink
from search import sbo_search_pkg
from dependency import sbo_dependencies_pkg
from dependency import Requires
class SBoCheck(object):
@ -175,7 +175,7 @@ def deps(upgrade_names):
file .info.
'''
for upg in upgrade_names:
dependencies = sbo_dependencies_pkg(upg)
dependencies = Requires().sbo(upg)
return dependencies

View file

@ -28,31 +28,34 @@ from slpkg.blacklist import BlackList
from greps import SBoGrep
dep_results = []
class Requires(object):
def sbo_dependencies_pkg(name):
'''
Build all dependencies of a package
'''
try:
dependencies = []
blacklist = BlackList().packages()
requires = SBoGrep(name).requires()
toolbar_width, index = 2, 0
if requires:
for req in requires:
index += 1
toolbar_width = status(index, toolbar_width, 1)
# avoid to add %README% as dependency and
# if require in blacklist
if "%README%" not in req and req not in blacklist:
dependencies.append(req)
if dependencies:
dep_results.append(dependencies)
for dep in dependencies:
sbo_dependencies_pkg(dep)
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
def __init__(self):
self.dep_results = []
def sbo(self, name):
'''
Build all dependencies of a package
'''
try:
dependencies = []
blacklist = BlackList().packages()
requires = SBoGrep(name).requires()
toolbar_width, index = 2, 0
if requires:
for req in requires:
index += 1
toolbar_width = status(index, toolbar_width, 1)
# avoid to add %README% as dependency and
# if require in blacklist
if "%README%" not in req and req not in blacklist:
dependencies.append(req)
if dependencies:
self.dep_results.append(dependencies)
for dep in dependencies:
self.sbo(dep)
return self.dep_results
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)

View file

@ -24,8 +24,15 @@
import os
import sys
from downloader import Download
from slpkg.downloader import Download
from slpkg.toolbar import status
from slpkg.splitting import split_package
from slpkg.messages import (
template,
pkg_found,
build_FAILED
)
from slpkg.__metadata__ import (
tmp,
color,
@ -43,13 +50,7 @@ from greps import SBoGrep
from remove import delete
from compressed import SBoLink
from search import sbo_search_pkg
from splitting import split_package
from dependency import sbo_dependencies_pkg
from messages import (
template,
pkg_found,
build_FAILED
)
from dependency import Requires
class SBoInstall(object):
@ -69,8 +70,7 @@ class SBoInstall(object):
sys.stdout.flush()
def start(self):
self.slackbuilds = ['brasero', 'pysed', 'Flask']
self.slackbuilds = ['Flask', 'pip']
dependencies, tagc = [], ''
count_ins = count_upg = count_uni = 0
for sbo in self.slackbuilds:
@ -78,7 +78,7 @@ class SBoInstall(object):
self.index += 1
self.toolbar_width = status(self.index, self.toolbar_width, 4)
if sbo_search_pkg(sbo):
sbo_deps = sbo_dependencies_pkg(sbo)
sbo_deps = Requires().sbo(sbo)
self.deps += sbo_deps
self.deps_dict[sbo] = self.one_for_all(sbo_deps)
self.package_found.append(sbo)
@ -345,8 +345,7 @@ class SBoInstall(object):
Write dependencies in a log file
into directory `/var/log/slpkg/dep/`
'''
for name in self.master_packages:
dependencies = sbo_dependencies_pkg('-'.join(name.split('-')[:-1]))
for name, dependencies in self.deps_dict.iteritems():
if find_package(name + '-', pkg_path):
dep_path = log_path + "dep/"
if not os.path.exists(dep_path):

View file

@ -35,7 +35,7 @@ from __metadata__ import (
from pkg.find import find_package
from sbo.search import sbo_search_pkg
from sbo.dependency import sbo_dependencies_pkg
from sbo.dependency import Requires
from others.search import search_pkg
from others.dependency import dependencies_pkg
@ -52,7 +52,7 @@ def track_dep(name, repo):
color['ENDC']))
sys.stdout.flush()
if repo == "sbo":
dependencies_list = sbo_dependencies_pkg(name)
dependencies_list = Requires().sbo(name)
find_pkg = sbo_search_pkg(name)
else:
dependencies_list = dependencies_pkg(name, repo)