1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 from portage.util import writemsg_level
7 def create_depgraph_params(myopts, myaction):
8 #configure emerge engine parameters
10 # self: include _this_ package regardless of if it is merged.
11 # selective: exclude the package if it is merged
12 # recurse: go into the dependencies
13 # deep: go into the dependencies of already merged packages
14 # empty: pretend nothing is merged
15 # complete: completely account for all known dependencies
16 # remove: build graph for use in removing packages
17 # rebuilt_binaries: replace installed packages with rebuilt binaries
18 myparams = {"recurse" : True}
20 if myaction == "remove":
21 myparams["remove"] = True
22 myparams["complete"] = True
23 myparams["selective"] = True
26 if "--update" in myopts or \
27 "--newuse" in myopts or \
28 "--reinstall" in myopts or \
29 "--noreplace" in myopts or \
30 myopts.get("--selective", "n") != "n":
31 myparams["selective"] = True
33 deep = myopts.get("--deep")
34 if deep is not None and deep != 0:
35 myparams["deep"] = deep
36 if "--complete-graph" in myopts:
37 myparams["complete"] = True
38 if "--emptytree" in myopts:
39 myparams["empty"] = True
40 myparams["deep"] = True
41 myparams.pop("selective", None)
43 if "--nodeps" in myopts:
44 myparams.pop("recurse", None)
45 myparams.pop("deep", None)
46 myparams.pop("complete", None)
48 rebuilt_binaries = myopts.get('--rebuilt-binaries')
49 if rebuilt_binaries is True or \
50 rebuilt_binaries != 'n' and \
51 '--usepkgonly' in myopts and \
52 myopts.get('--deep') is True and \
54 myparams['rebuilt_binaries'] = True
56 if myopts.get("--selective") == "n":
57 # --selective=n can be used to remove selective
58 # behavior that may have been implied by some
59 # other option like --update.
60 myparams.pop("selective", None)
62 if '--debug' in myopts:
63 writemsg_level('\n\nmyparams %s\n\n' % myparams,
64 noiselevel=-1, level=logging.DEBUG)