added config option on/off resolve deps

This commit is contained in:
Dimitris Zlatanidis 2015-06-04 00:40:54 +03:00
parent a46cdc0b50
commit 521d47f45a
5 changed files with 57 additions and 42 deletions

View file

@ -66,6 +66,9 @@ REMOVE_DEPS_ANSWER=n
# If you want build UNSUPPORTED or UNTESTED packages choose 'y'. # If you want build UNSUPPORTED or UNTESTED packages choose 'y'.
SKIP_UNST=n SKIP_UNST=n
# If you want to disable resovle dependencies choose 'off'.
RSL_DEPS=on
# Delete package dependencies if DEL_DEPS is on. # Delete package dependencies if DEL_DEPS is on.
# You must be careful if you enable this option because it can remove # You must be careful if you enable this option because it can remove
# packages related to distribution. # packages related to distribution.

View file

@ -122,6 +122,7 @@ class MetaData(object):
'DEFAULT_ANSWER': 'n', 'DEFAULT_ANSWER': 'n',
'REMOVE_DEPS_ANSWER': 'n', 'REMOVE_DEPS_ANSWER': 'n',
'SKIP_UNST': 'n', 'SKIP_UNST': 'n',
'RSL_DEPS': 'on',
'DEL_DEPS': 'off', 'DEL_DEPS': 'off',
'USE_COLORS': 'on', 'USE_COLORS': 'on',
'WGET_OPTIONS': '-c -N', 'WGET_OPTIONS': '-c -N',
@ -159,6 +160,7 @@ class MetaData(object):
default_answer = _conf_slpkg['DEFAULT_ANSWER'] default_answer = _conf_slpkg['DEFAULT_ANSWER']
remove_deps_answer = _conf_slpkg['REMOVE_DEPS_ANSWER'] remove_deps_answer = _conf_slpkg['REMOVE_DEPS_ANSWER']
skip_unst = _conf_slpkg['SKIP_UNST'] skip_unst = _conf_slpkg['SKIP_UNST']
rsl_deps = _conf_slpkg['RSL_DEPS']
del_deps = _conf_slpkg['DEL_DEPS'] del_deps = _conf_slpkg['DEL_DEPS']
use_colors = _conf_slpkg['USE_COLORS'] use_colors = _conf_slpkg['USE_COLORS']
wget_options = _conf_slpkg['WGET_OPTIONS'] wget_options = _conf_slpkg['WGET_OPTIONS']

View file

@ -27,6 +27,7 @@ import sys
from slpkg.utils import Utils from slpkg.utils import Utils
from slpkg.toolbar import status from slpkg.toolbar import status
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _m
from greps import Requires from greps import Requires
@ -42,23 +43,27 @@ class Dependencies(object):
''' '''
Build all dependencies of a package Build all dependencies of a package
''' '''
try: if _m.rsl_deps in ['on', 'ON']:
sys.setrecursionlimit(10000) try:
dependencies = [] sys.setrecursionlimit(10000)
blacklist = BlackList().packages() dependencies = []
requires = Requires(name, self.repo).get_deps() blacklist = BlackList().packages()
toolbar_width, index = 2, 0 requires = Requires(name, self.repo).get_deps()
if requires: toolbar_width, index = 2, 0
for req in requires: if requires:
index += 1 for req in requires:
toolbar_width = status(index, toolbar_width, 7) index += 1
if (req and req in self.packages and req not in blacklist): toolbar_width = status(index, toolbar_width, 7)
dependencies.append(req) if (req and req in self.packages and
if dependencies: req not in blacklist):
self.dep_results.append(dependencies) dependencies.append(req)
for dep in dependencies: if dependencies:
self.binary(dep) self.dep_results.append(dependencies)
return self.dep_results for dep in dependencies:
except KeyboardInterrupt: self.binary(dep)
print("") # new line at exit return self.dep_results
sys.exit(0) except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
else:
return []

View file

@ -51,6 +51,7 @@ class Config(object):
'DEFAULT_ANSWER', 'DEFAULT_ANSWER',
'REMOVE_DEPS_ANSWER', 'REMOVE_DEPS_ANSWER',
'SKIP_UNST', 'SKIP_UNST',
'RSL_DEPS',
'DEL_DEPS', 'DEL_DEPS',
'USE_COLORS', 'USE_COLORS',
'WGET_OPTIONS', 'WGET_OPTIONS',

View file

@ -26,6 +26,7 @@ import sys
from slpkg.toolbar import status from slpkg.toolbar import status
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _m
from greps import SBoGrep from greps import SBoGrep
@ -39,25 +40,28 @@ class Requires(object):
''' '''
Build all dependencies of a package Build all dependencies of a package
''' '''
try: if _m.rsl_deps in ['on', 'ON']:
sys.setrecursionlimit(10000) try:
dependencies = [] sys.setrecursionlimit(10000)
blacklist = BlackList().packages() dependencies = []
requires = SBoGrep(name).requires() blacklist = BlackList().packages()
toolbar_width, index = 2, 0 requires = SBoGrep(name).requires()
if requires: toolbar_width, index = 2, 0
for req in requires: if requires:
index += 1 for req in requires:
toolbar_width = status(index, toolbar_width, 1) index += 1
# avoid to add %README% as dependency and toolbar_width = status(index, toolbar_width, 1)
# if require in blacklist # avoid to add %README% as dependency and
if "%README%" not in req and req not in blacklist: # if require in blacklist
dependencies.append(req) if "%README%" not in req and req not in blacklist:
if dependencies: dependencies.append(req)
self.dep_results.append(dependencies) if dependencies:
for dep in dependencies: self.dep_results.append(dependencies)
self.sbo(dep) for dep in dependencies:
return self.dep_results self.sbo(dep)
except KeyboardInterrupt: return self.dep_results
print("") # new line at exit except KeyboardInterrupt:
sys.exit(0) print("") # new line at exit
sys.exit(0)
else:
return []