From: "Александр Берсенев" <bay@hackerdom.ru>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/autodep:master commit in: portage_with_autodep/pym/_emerge/, src/autodep/
Date: Thu, 25 Aug 2011 13:22:13 +0000 (UTC) [thread overview]
Message-ID: <d4367ca0b5cdcccfb3d51b7868d15e1104b8b30c.bay@gentoo> (raw)
commit: d4367ca0b5cdcccfb3d51b7868d15e1104b8b30c
Author: Alexander Bersenev <bay <AT> hackerdom <DOT> ru>
AuthorDate: Thu Aug 25 19:20:42 2011 +0000
Commit: Александр Берсенев <bay <AT> hackerdom <DOT> ru>
CommitDate: Thu Aug 25 19:20:42 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/autodep.git;a=commit;h=d4367ca0
allowing to access to rdepends of system packages
---
portage_with_autodep/pym/_emerge/EventsAnalyser.py | 23 ++++++++++++++++++-
src/autodep/autodep | 15 +++++++++---
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/portage_with_autodep/pym/_emerge/EventsAnalyser.py b/portage_with_autodep/pym/_emerge/EventsAnalyser.py
index f0aa7f8..2dc2d35 100644
--- a/portage_with_autodep/pym/_emerge/EventsAnalyser.py
+++ b/portage_with_autodep/pym/_emerge/EventsAnalyser.py
@@ -154,6 +154,7 @@ class PortageUtils:
runtime_deps=runtime_deps.union(self.get_deps(dep,["RDEPEND"]))
ret=buildtime_deps.union(runtime_deps)
+
return ret
def get_system_packages_list(self):
@@ -169,7 +170,19 @@ class PortageUtils:
for pkg in self.vartree.dep_match(unvirt_pkg):
ret.append(pkg)
return ret
-
+
+ def get_system_packages_rdeps(self):
+ """
+ returns runtime dependencies of packages from system set
+
+ :returns: **list** of package names
+ """
+ ret=set()
+
+ for pkg in self.get_system_packages_list():
+ ret=ret.union(self.get_deps(pkg,["RDEPEND"]))
+ return list(ret)
+
class GentoolkitUtils:
"""
@@ -266,13 +279,15 @@ class FilterProcGenerator:
deps_portage=portageutils.get_dep('sys-apps/portage',["RDEPEND"])
system_packages=portageutils.get_system_packages_list()
+ system_deps=portageutils.get_system_packages_rdeps()
allfiles=GentoolkitUtils().get_all_packages_files()
portage.util.writemsg("All files list recieved, waiting for " \
"a list of allowed files\n")
- allowedpkgs=system_packages+list(deps_portage)+list(deps_all)
+ allowedpkgs=system_packages+system_deps
+ allowedpkgs+=list(deps_portage)+list(deps_all)
allowedpkgs+=["app-portage/autodep"]
allowedfiles=GentoolkitUtils().getfilesbypackages(allowedpkgs)
@@ -308,6 +323,7 @@ class EventsAnalyser:
self.deps_portage=self.portageutils.get_dep('sys-apps/portage',["RDEPEND"])
self.system_packages=self.portageutils.get_system_packages_list()
+ self.system_deps=self.portageutils.get_system_packages_rdeps()
# All analyse work is here
# get unique filenames
@@ -387,6 +403,7 @@ class EventsAnalyser:
is_pkg_in_dep=package in self.deps_all
is_pkg_in_portage_dep=package in self.deps_portage
is_pkg_in_system=package in self.system_packages
+ is_pkg_in_system_dep=package in self.system_deps
is_pkg_python="dev-lang/python" in package
is_pkg_self="app-portage/autodep" in package
@@ -427,6 +444,8 @@ class EventsAnalyser:
portage.util.writemsg("[SYSTEM]")
elif is_pkg_in_portage_dep:
portage.util.writemsg("[PORTAGE DEP]")
+ elif is_pkg_in_system_dep:
+ portage.util.writemsg("[SYSTEM DEP]")
elif is_pkg_self:
portage.util.writemsg("[AUTODEP]")
elif is_pkg_python:
diff --git a/src/autodep/autodep b/src/autodep/autodep
index 335cb2e..8d22e00 100755
--- a/src/autodep/autodep
+++ b/src/autodep/autodep
@@ -54,8 +54,9 @@ def parse_args():
def init_environment():
portage_api=portage_misc_functions.portage_api()
system_packages = portage_api.get_system_packages_list()
+ system_deps = portage_api.get_system_packages_rdeps()
- return portage_api, system_packages
+ return portage_api, system_packages, system_deps
def init_runtime_vars(portage_api, options,args):
runtime_vars={} # This is here mainly for grouping. We are trying to
@@ -108,7 +109,7 @@ def init_runtime_vars(portage_api, options,args):
return runtime_vars
-def get_filter_function(options,args,system_packages,portage_api):
+def get_filter_function(options,args,system_packages,system_deps,portage_api):
# handling --block
# exits if package name is bad
if not options.packages and not options.strict_block:
@@ -138,6 +139,8 @@ def get_filter_function(options,args,system_packages,portage_api):
allfiles=portage_utils.get_all_packages_files()
allowedpkgs=[]
allowedpkgs+=system_packages
+ allowedpkgs+=system_deps
+
if runtime_vars["is_emerge"]: # blocking logic for emerge
print "Notice: you can use emerge_strict command instead of autodep emerge."
print "Using this command allows to build any number of a packages.\n"
@@ -192,13 +195,13 @@ def get_filter_function(options,args,system_packages,portage_api):
return True
return filter
-portage_api, system_packages=init_environment()
+portage_api, system_packages, system_deps=init_environment()
options,args=parse_args()
runtime_vars=init_runtime_vars(portage_api,options,args)
color_printer=colorize_output.color_printer(not options.nocolor)
-filter_function=get_filter_function(options,args,system_packages,portage_api)
+filter_function=get_filter_function(options,args,system_packages,system_deps,portage_api)
# launching program
events=logfs.fstracer.getfsevents(args[0], args,approach=options.approach,filterproc=filter_function)
@@ -319,6 +322,8 @@ for package in sorted(packagesinfo):
is_pkg_in_dep=package in runtime_vars["deps_all"]
is_pkg_in_system=package in system_packages
+ is_pkg_in_system_deps=package in system_deps
+
is_pkg_in_portage_dep=runtime_vars["is_emerge"] and package in runtime_vars["deps_portage"]
is_pkg_self="app-portage/autodep" in package
is_pkg_python="dev-lang/python" in package
@@ -358,6 +363,8 @@ for package in sorted(packagesinfo):
color_printer.printmsg("text","[SYSTEM]")
elif is_pkg_in_portage_dep:
color_printer.printmsg("text","[PORTAGE DEP]")
+ elif is_pkg_in_system_deps:
+ color_printer.printmsg("text","[SYSTEM DEP]")
elif is_pkg_self:
color_printer.printmsg("text","[AUTODEP]")
elif is_pkg_python:
next reply other threads:[~2011-08-25 13:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 13:22 Александр Берсенев [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-08-21 18:50 [gentoo-commits] proj/autodep:master commit in: portage_with_autodep/pym/_emerge/, src/autodep/ Александр Берсенев
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d4367ca0b5cdcccfb3d51b7868d15e1104b8b30c.bay@gentoo \
--to=bay@hackerdom.ru \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox