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

View file

@ -28,10 +28,13 @@ from slpkg.blacklist import BlackList
from greps import SBoGrep from greps import SBoGrep
dep_results = []
class Requires(object):
def sbo_dependencies_pkg(name): def __init__(self):
self.dep_results = []
def sbo(self, name):
''' '''
Build all dependencies of a package Build all dependencies of a package
''' '''
@ -49,10 +52,10 @@ def sbo_dependencies_pkg(name):
if "%README%" not in req and req not in blacklist: if "%README%" not in req and req not in blacklist:
dependencies.append(req) dependencies.append(req)
if dependencies: if dependencies:
dep_results.append(dependencies) self.dep_results.append(dependencies)
for dep in dependencies: for dep in dependencies:
sbo_dependencies_pkg(dep) self.sbo(dep)
return dep_results return self.dep_results
except KeyboardInterrupt: except KeyboardInterrupt:
print("") # new line at exit print("") # new line at exit
sys.exit(0) sys.exit(0)

View file

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

View file

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