From: "Gilles Dartiguelongue" <eva@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gnome:master commit in: scripts/
Date: Wed, 23 Mar 2011 10:39:03 +0000 (UTC) [thread overview]
Message-ID: <8bb3e59a8c562be082a926bc3bdb7deddd183f3f.eva@gentoo> (raw)
commit: 8bb3e59a8c562be082a926bc3bdb7deddd183f3f
Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 10:38:12 2011 +0000
Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 10:38:48 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=8bb3e59a
scripts: add slot_rindex2.py
---
scripts/slot_rindex2.py | 72 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/scripts/slot_rindex2.py b/scripts/slot_rindex2.py
new file mode 100644
index 0000000..e3db2fc
--- /dev/null
+++ b/scripts/slot_rindex2.py
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+""" Checks what slots are used for a package in its reverse dependencies. """
+
+import portage
+
+import sys
+#from pprint import pprint
+
+def main():
+ trees = portage.create_trees()
+ trees["/"]["porttree"].settings = portage.settings
+ portdb = trees["/"]["porttree"]
+ portdb.dbapi.settings = portage.settings
+ portdb.dbapi.porttrees = [portage.portdb.porttree_root]
+
+ # does it make sense to remove _all_ useless stuff or just leave it as it is?
+ #portdb.dbapi._aux_cache_keys.clear()
+ #portdb.dbapi._aux_cache_keys.update(["EAPI", "KEYWORDS", "SLOT"])
+
+ res_slots = {}
+
+ # Loop through all package names
+ for cp in portdb.dbapi.cp_all():
+ #print(cp)
+
+ # Get versions
+ cpvrs = portdb.dbapi.match(cp)
+
+ # Group by slots
+ slots = {}
+ for cpvr in cpvrs:
+ slot = portdb.dbapi.aux_get(cpvr, ["SLOT"])[0]
+ if slot is None:
+ slot = 0
+ if not slot in slots:
+ slots[slot] = []
+ slots[slot].append(cpvr)
+
+ # XXX: Walk through slots (walk twice for ~arch and arch)
+ for slot in sorted(slots):
+ cpvr = portage.versions.best(slots[slot])
+ depends = portdb.dbapi.aux_get(cpvr, ['DEPEND', 'RDEPEND', 'PDEPEND'])
+ depends = set(portage.dep.use_reduce(' '.join(depends), matchall=True, flat=True))
+ depends = [dep for dep in depends if portage.dep.isvalidatom(dep)]
+
+ #print('DEPEND:')
+ #pprint(depends)
+
+ for depend in depends:
+ if portage.dep.dep_getkey(depend) == sys.argv[1]:
+ mypkg_slot = portage.dep.dep_getslot(depend)
+ if mypkg_slot is None:
+ mypkg_slot = "unset"
+
+ if mypkg_slot not in res_slots:
+ res_slots[mypkg_slot] = [cpvr]
+ else:
+ res_slots[mypkg_slot].append(cpvr)
+ #print(portage.dep.dep_getkey(depend) + ' uses ' + sys.argv[1] + ' slot ' + portage.dep.dep_getslot(depend))
+
+ for slot in sorted(res_slots):
+ print('%s:%s' % (sys.argv[1], slot))
+ for rescpv in res_slots[slot]:
+ print(' ' + rescpv)
+
+
+if __name__ == "__main__":
+ main()
+
+## vim:set sts=4 ts=4 sw=4 expandtab:
next reply other threads:[~2011-03-23 10:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 10:39 Gilles Dartiguelongue [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-03 19:42 [gentoo-commits] proj/gnome:master commit in: scripts/ Matt Turner
2020-04-03 19:42 Matt Turner
2020-03-28 8:31 Mart Raudsepp
2020-03-10 22:05 Matt Turner
2019-02-07 11:58 Mart Raudsepp
2018-04-25 10:32 Mart Raudsepp
2018-01-10 3:25 Mart Raudsepp
2012-04-01 21:14 Nirbheek Chauhan
2012-04-01 19:12 Nirbheek Chauhan
2011-08-18 6:23 Nirbheek Chauhan
2011-07-12 21:15 Nirbheek Chauhan
2011-05-21 18:38 Nirbheek Chauhan
2011-05-19 12:35 Gilles Dartiguelongue
2011-04-13 9:57 Nirbheek Chauhan
2011-04-09 6:29 Nirbheek Chauhan
2011-03-28 16:15 Nirbheek Chauhan
2011-03-28 15:04 Nirbheek Chauhan
2011-03-26 1:58 Nirbheek Chauhan
2011-03-23 21:59 Nirbheek Chauhan
2011-03-23 21:59 Nirbheek Chauhan
2011-03-23 21:59 Nirbheek Chauhan
2011-03-23 19:21 Gilles Dartiguelongue
2011-03-20 8:11 Nirbheek Chauhan
2011-03-18 9:59 Nirbheek Chauhan
2011-03-18 8:23 Nirbheek Chauhan
2011-03-17 17:12 Nirbheek Chauhan
2011-03-15 13:08 Nirbheek Chauhan
2011-03-14 18:41 Nirbheek Chauhan
2011-03-12 20:10 Nirbheek Chauhan
2011-03-04 15:40 Nirbheek Chauhan
2011-02-18 4:40 Nirbheek Chauhan
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=8bb3e59a8c562be082a926bc3bdb7deddd183f3f.eva@gentoo \
--to=eva@gentoo.org \
--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