public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-02-18  4:40 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-02-18  4:40 UTC (permalink / raw
  To: gentoo-commits

commit:     e8f8248dc43016a4ba518ad8bca716861f822065
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 18 03:48:04 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Fri Feb 18 03:48:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=e8f8248d

scripts: fix shebang to use python2

---
 scripts/bump-to-latest.py  |    2 +-
 scripts/find-keywordreq.py |    2 +-
 scripts/gen_archlist.py    |    2 +-
 scripts/gir-rebuilder.py   |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/bump-to-latest.py b/scripts/bump-to-latest.py
index 4eab4fd..acd4587 100755
--- a/scripts/bump-to-latest.py
+++ b/scripts/bump-to-latest.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # vim: set sw=4 sts=4 et :
 # Author(s): Nirbheek Chauhan <nirbheek@gentoo.org>
 #

diff --git a/scripts/find-keywordreq.py b/scripts/find-keywordreq.py
index 7f319f6..6b991a4 100644
--- a/scripts/find-keywordreq.py
+++ b/scripts/find-keywordreq.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
 
 """ Helper module to print a list of needed keywords provided a list of cpv.
 

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 2b68785..5d9dee5 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # vim: set sw=4 sts=4 et :
 # Author(s): Nirbheek Chauhan <nirbheek@gentoo.org>
 #

diff --git a/scripts/gir-rebuilder.py b/scripts/gir-rebuilder.py
index 7d4efd5..6cecd59 100755
--- a/scripts/gir-rebuilder.py
+++ b/scripts/gir-rebuilder.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 # vim: set sts=4 sw=4 et tw=90 :
 # 
 # Author(s): Nirbheek Chauhan <nirbheek@gentoo.org>



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-04 15:40 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-04 15:40 UTC (permalink / raw
  To: gentoo-commits

commit:     422cf4a4512baad41a5294f0e65dfd0e0112c99d
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  4 15:40:00 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Fri Mar  4 15:40:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=422cf4a4

Add scripts/slot_rindex.py

---
 scripts/slot_rindex.py |  121 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 121 insertions(+), 0 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
new file mode 100755
index 0000000..a8308ca
--- /dev/null
+++ b/scripts/slot_rindex.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python2
+# vim: set sts=4 sw=4 et :
+#
+# Author(s): Nirbheek Chauhan
+# License: MIT
+#
+# A small script which sorts the revdeps of a given library according to
+# which slot of the given library they depend on. Uses the tinderbox rindex for
+# speed, because of which results may be out of date.
+#
+# Currently prints out a list of revdeps which *don't* use a slot in the
+# dependency atom containing the given library
+#
+# TODO: Add a slower portage-only mode which calculates the required rindex
+#
+
+import sys
+import urllib2
+import os.path as osp
+
+import portage
+from portage.xml.metadata import MetaDataXML
+
+if len(sys.argv) < 2:
+    print "Usage: %s <cat/pkg>" % sys.argv[0]
+    sys.exit(1)
+
+portage.portdb.porttrees = [portage.settings['PORTDIR']]
+PORTDIR = portage.settings['PORTDIR']
+RINDEX = "http://tinderbox.dev.gentoo.org/misc/rindex"
+DEPSTR = ['RDEPEND', 'PDEPEND', 'DEPEND']
+KEY = sys.argv[1]
+
+def get_herds():
+    return osp.join(PORTDIR, 'metadata', 'herds.xml')
+
+def get_md_path(cpv):
+    """
+    x11-libs/gtk+-2.22.0-r1 -> <portdir>/x11-libs/gtk+/metadata.xml
+    """
+    path = osp.join(*portage.catpkgsplit(cpv)[0:2])
+    return osp.join(PORTDIR, path, 'metadata.xml')
+
+def rdeps_with_slot(slot_rdeps, slot=None):
+    """
+    Prints a list of rev-deps which depend on the specified package and slot
+    """
+    print "All packages:"
+    pkg_maints = {}
+    pkg_herds = {}
+    if not slot_rdeps.has_key(slot):
+        # No rdeps using the given slot
+        return
+    for pkg in slot_rdeps[slot]:
+        pkg_md = MetaDataXML(get_md_path(pkg), get_herds())
+        for herd in pkg_md.herds():
+            if not pkg_herds.has_key(herd):
+                pkg_herds[herd] = []
+            pkg_herds[herd].append(pkg)
+        for maint in pkg_md.maintainers():
+            if not pkg_maints.has_key(maint.email):
+                pkg_maints[maint.email] = []
+            pkg_maints[maint.email].append(pkg)
+        print '\t%s\therds: ' % pkg,
+        for i in pkg_md.herds():
+            print '%s' % i,
+        print '\tmaintainers: ',
+        for i in pkg_md.maintainers():
+            print '%s' % i.email,
+        print
+
+    print "Herd packages:"
+    for (herd, pkgs) in pkg_herds.iteritems():
+        print 'Herd: %s' % herd
+        for pkg in pkgs:
+            print '\t%s' % pkg
+
+    print "Maintainer packages:"
+    for (maint, pkgs) in pkg_maints.iteritems():
+        print 'Maintainer: %s' % maint
+        for pkg in pkgs:
+            print '\t%s' % pkg
+
+
+vrdeps = urllib2.urlopen('/'.join([RINDEX, KEY])).read().split()
+rdeps = []
+for i in vrdeps:
+    rdeps.append(i.split(':')[0])
+
+slot_rdeps = {}
+failed_rdeps = []
+for rdep in rdeps:
+    rdep = rdep.split(':')[0]
+    if not portage.isvalidatom('='+rdep):
+        print 'Invalid atom: ' + rdep
+        continue
+    try:
+        temp = portage.portdb.aux_get(rdep, DEPSTR)[0].split()
+    except KeyError:
+        failed_rdeps.append(rdep)
+    for dep in temp:
+        # Ignore ||, (, ), etc.
+        if not portage.isvalidatom(dep):
+            continue
+        # Categorize the dep into the slot it uses
+        if portage.dep.dep_getkey(dep) == KEY:
+            slot = portage.dep.dep_getslot(dep)
+            if not slot_rdeps.has_key(slot):
+                # We use a set here because atoms often get repeated
+                slot_rdeps[slot] = set()
+            slot_rdeps[slot].add(rdep)
+
+# Convert back to list, and sort the atoms
+for slot in slot_rdeps.keys():
+    slot_rdeps[slot] = list(slot_rdeps[slot])
+    slot_rdeps[slot].sort()
+
+if failed_rdeps:
+    print 'Failed: ' + str(failed_rdeps)
+
+rdeps_with_slot(slot_rdeps)



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-12 20:10 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-12 20:10 UTC (permalink / raw
  To: gentoo-commits

commit:     9047508d670f1be0481b9e4b8c133b96214fb54c
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 20:07:50 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 20:10:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=9047508d

scripts/gst-plugins-bump.py: add a script to bump gst-plugins-* packages

 * Automatic removal script coming soon

---
 scripts/gst-plugins-bump.py |  157 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 157 insertions(+), 0 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
new file mode 100755
index 0000000..998f536
--- /dev/null
+++ b/scripts/gst-plugins-bump.py
@@ -0,0 +1,157 @@
+#!/usr/bin/env python2
+# vim: set sts=4 sw=4 et tw=0 :
+#
+# Author(s): Nirbheek Chauhan <nirbheek@gentoo.org>
+# License: MIT
+#
+# Bump gstreamer plugins to the version specified
+# You must have your cvs directory as PORTDIR
+#
+
+import os
+import shutil
+import subprocess
+import sys
+
+import portage
+from portage.output import colorize
+
+def usage():
+    print "Usage: $0 <base|good|bad|ugly> <version> [core version] [base version]"
+    print ""
+    print "  If core/base version is unspecified or blank, it's assumed to be the same"
+
+if len(sys.argv) < 3 or len(sys.argv) > 5:
+    usage()
+    sys.exit(1)
+
+###################
+## Configuration ##
+###################
+GSTLIB = sys.argv[1]
+GSTLIBVER = sys.argv[2]
+GSTCOREVER = ''
+GSTBASEVER = ''
+if len(sys.argv) == 5:
+    GSTCOREVER = sys.argv[3]
+    GSTBASEVER = sys.argv[4]
+elif len(sys.argv) == 4:
+    GSTCOREVER = sys.argv[3]
+
+##################
+## Parse Config ##
+##################
+PORTDIR = portage.settings["PORTDIR"]
+portage.portdb.porttrees = [PORTDIR]
+GSTPREFIX = 'gst-plugins-'
+GSTECLASS = GSTPREFIX + GSTLIB
+GSTLIB = 'media-libs/' + GSTPREFIX + GSTLIB
+GSTPLUGIN_CPVS = []
+GSTCAT = 'media-plugins'
+GSTLIBS = {'media-libs/gstreamer': GSTCOREVER,
+           'media-libs/gst-plugins-base': GSTBASEVER,
+           GSTLIB: GSTLIBVER,}
+
+###############
+## Functions ##
+###############
+def print_colorize(color, text):
+    print colorize(color, " * ") + text
+
+def get_p(pkg):
+    "pkg must contain at least the package name"
+    if not portage.isjustname(pkg):
+        return portage.catpkgsplit(pkg)[1]
+    return portage.catsplit(pkg)[-1]
+
+def get_v(cpv):
+    "cpv can be anything"
+    if portage.isjustname(cpv):
+        raise Exception('Input (%s) has no version!' % cpv)
+    pv = portage.pkgsplit(cpv)[-2:]
+    if pv[1] == 'r0':
+        return pv[0]
+    else:
+        return '%s-%s' % (pv[0], pv[1])
+
+def get_cp(cpv):
+    "cpv must contain package and category"
+    return portage.pkgsplit(cpv)[0]
+
+def get_pv(cpv, ver=None):
+    if not ver:
+        return portage.catsplit(cpv)[-1]
+    else:
+        return get_p(cpv) + '-' + ver
+
+def get_cpv(cp, ver=None):
+    if ver:
+        return '%s-%s' % (cp, ver)
+    else:
+        # Return the latest one instead
+        return portage.portdb.xmatch('match-all', cp)[-1]
+
+def get_ebuild_dir(cpv):
+    return os.path.join(PORTDIR, get_cp(cpv))
+
+def get_ebuild(cpv):
+    return os.path.join(get_pv(cpv)+'.ebuild')
+
+def edit_gstdeps(ebuild):
+    # Editing files is hard, let's just use sed
+    sed_cmd = ''
+    for dep in GSTLIBS.keys():
+        # Ignore if wanted-version is empty
+        if not GSTLIBS[dep]:
+            continue
+        # FIXME: This is an approximate regexp for matching versions
+        old_dep = '%s-[-0-9._rpe]\+' % dep
+        new_dep = '%s-%s' % (dep, GSTLIBS[dep])
+        # We need a space at the end for further appending
+        sed_cmd += '-e "s|%s|%s|g" ' % (old_dep, new_dep)
+    if not sed_cmd:
+        # Nothing to do...
+        return
+    # In-place edit
+    sed_cmd = 'sed %s -i %s' % (sed_cmd, ebuild)
+    subprocess.check_call(sed_cmd, shell=True)
+
+def isgstplugin(cpv):
+    if not cpv.startswith('%s/%s' % (GSTCAT, GSTPREFIX)):
+        return False
+    # Does it inherit GSTECLASS?
+    if not GSTECLASS in portage.portdb.aux_get(cpv, ['INHERITED'])[0].split():
+        return False
+    return True
+
+################
+## Begin Work ##
+################
+
+print_colorize("green", "Getting a list of all gst-plugins ...")
+for cp in portage.portdb.cp_all(categories=[GSTCAT]):
+    cpv = get_cpv(cp)
+    if not isgstplugin(cpv):
+        continue
+    print_colorize("green", "Current package is %s" % cpv)
+    GSTPLUGIN_CPVS.append(cpv)
+    os.chdir(get_ebuild_dir(cpv))
+    old_ebuild = get_ebuild(cpv)
+    new_ebuild = get_ebuild(get_cpv(cp, GSTLIBVER))
+    print_colorize("green", "Copying %s to %s ..." % (old_ebuild, new_ebuild))
+    shutil.copyfile(old_ebuild, new_ebuild)
+    print_colorize("green", "Editing gstreamer deps and keywords. A diff will follow ...")
+    edit_gstdeps(new_ebuild)
+    subprocess.check_call('ekeyword ~all %s' % new_ebuild, shell=True, stdout=subprocess.PIPE)
+    try:
+        subprocess.check_call('diff -u %s %s' % (old_ebuild, new_ebuild), shell=True)
+    except subprocess.CalledProcessError as e:
+        # diff returns:
+        #   0 if files don't differ
+        #   1 if they differ
+        #   2 if something went wrong
+        if e.returncode == 2:
+            raise e
+    subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
+    print_colorize("green", "Running cvs add ...")
+    subprocess.check_call('cvs add %s' % new_ebuild, shell=True)



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-14 18:41 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-14 18:41 UTC (permalink / raw
  To: gentoo-commits

commit:     05728bccfe889008593f9c5a5f599b0459ce0863
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 14 17:32:39 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Mon Mar 14 17:32:39 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=05728bcc

obsolete_ebuilds.py: find obsolete ebuilds considering each SLOT separately

---
 scripts/gst-plugins-bump.py |    2 +-
 scripts/obsolete_ebuilds.py |   37 ++++++++++++++++++++++++-------------
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
index 4e2e490..1d6e5c1 100755
--- a/scripts/gst-plugins-bump.py
+++ b/scripts/gst-plugins-bump.py
@@ -138,7 +138,7 @@ eoutput.ebegin("Getting the next gst-plugin")
 # Does a first-time-expensive xmatch call
 cpv = get_cpv(cp_all[0])
 eoutput.eend(0)
-for cp in portdb.cp_all(categories=[GSTCAT]):
+for cp in cp_all:
     cpv = get_cpv(cp)
     if not isgstplugin(cpv):
         continue

diff --git a/scripts/obsolete_ebuilds.py b/scripts/obsolete_ebuilds.py
index d4cb6b5..23af29c 100755
--- a/scripts/obsolete_ebuilds.py
+++ b/scripts/obsolete_ebuilds.py
@@ -80,14 +80,14 @@ def get_obsolete(cp):
     @param check_kws: Which keywords to check for obsolete ebuilds, both/stable/unstable
     @type check_kws: String
     """
-    all_cpvs = portdb.xmatch('match-all', cp)
-    # Hashtable of unique {kws: cpv} pairs
-    all_kws = set()
+    cpvs = portdb.xmatch('match-all', cp)
     obsolete_cpvs = []
     not_pmasked = []
+    slot_cpvs = {}
+
     # This is copied from portage/dbapi/porttree.py:visible()
-    # Ignore PORTDIR package.mask cpv
-    for cpv in all_cpvs:
+    # Ignore PORTDIR package.masked cpvs
+    for cpv in cpvs:
         try:
             metadata = {'SLOT': portdb.aux_get(cpv, ['SLOT'])}
         except KeyError:
@@ -97,16 +97,27 @@ def get_obsolete(cp):
             continue
         # We skip the profile check because we don't care about that
         not_pmasked.append(cpv)
-    # We want the latest cpvs first so that we never mark newer ebuilds as obsolete
+    # We start with the latest cpvs first so that we never mark newer ebuilds as obsolete
     not_pmasked.reverse()
+    
+    # Generate a slot-sorted hashtable for cpvs
     for cpv in not_pmasked:
-        kws = set(get_kws(cpv, arches=ALL_ARCHES))
-        if cmp_kws(kws, all_kws):
-            # Keywords list is unique or better, so add it to the list
-            all_kws.update(kws)
-        else:
-            # Same or worse keywords (unstable and stable) => can be punted
-            obsolete_cpvs.append(cpv)
+        slot = portdb.aux_get(cpv, ['SLOT'])[0]
+        if not slot_cpvs.has_key(slot):
+            slot_cpvs[slot] = []
+        slot_cpvs[slot].append(cpv)
+
+    # Consider each slot separately for obsolete-detection
+    for (slot, cpvs) in slot_cpvs.iteritems():
+        all_kws = set()
+        for cpv in cpvs:
+            kws = set(get_kws(cpv, arches=ALL_ARCHES))
+            if cmp_kws(kws, all_kws):
+                # Keywords list is unique or better, so add it to the list
+                all_kws.update(kws)
+            else:
+                # Same or worse keywords (unstable and stable) => can be punted
+                obsolete_cpvs.append(cpv)
     return obsolete_cpvs
 
 if __name__ == "__main__":



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-15 13:08 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-15 13:08 UTC (permalink / raw
  To: gentoo-commits

commit:     ae3fc2ce3c9c674bb9fa197a9028ff885bf75fae
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 15 13:08:38 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Tue Mar 15 13:08:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=ae3fc2ce

slot_rindex.py: add missing continue

---
 scripts/slot_rindex.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index a8308ca..0612372 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -98,6 +98,7 @@ for rdep in rdeps:
         temp = portage.portdb.aux_get(rdep, DEPSTR)[0].split()
     except KeyError:
         failed_rdeps.append(rdep)
+        continue
     for dep in temp:
         # Ignore ||, (, ), etc.
         if not portage.isvalidatom(dep):



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-17 17:12 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-17 17:12 UTC (permalink / raw
  To: gentoo-commits

commit:     aa007a67109846a96f50fc06ca7bcba6d1f32055
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 17 17:04:13 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Thu Mar 17 17:04:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=aa007a67

scripts/slot_rindex.py: print nothing if there's no packages

---
 scripts/slot_rindex.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index 0612372..bf5f834 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -45,12 +45,12 @@ def rdeps_with_slot(slot_rdeps, slot=None):
     """
     Prints a list of rev-deps which depend on the specified package and slot
     """
-    print "All packages:"
     pkg_maints = {}
     pkg_herds = {}
     if not slot_rdeps.has_key(slot):
         # No rdeps using the given slot
         return
+    print "All packages:"
     for pkg in slot_rdeps[slot]:
         pkg_md = MetaDataXML(get_md_path(pkg), get_herds())
         for herd in pkg_md.herds():



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-18  8:23 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-18  8:23 UTC (permalink / raw
  To: gentoo-commits

commit:     5b082265220a2c7fc7b55061916f3d288100560b
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 18 07:28:40 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Fri Mar 18 07:28:40 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=5b082265

scripts/gst-plugins-bump: warn if filesdir exists

* Cosmetic change to obsolete_ebuilds.py

---
 scripts/gst-plugins-bump.py |    2 ++
 scripts/obsolete_ebuilds.py |    5 ++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
index 1d6e5c1..e4f18b3 100755
--- a/scripts/gst-plugins-bump.py
+++ b/scripts/gst-plugins-bump.py
@@ -174,4 +174,6 @@ for cp in cp_all:
             eoutput.ebegin("Running cvs rm -f %s" % ebuild)
             subprocess.check_call('cvs rm -f %s' % ebuild, shell=True, stderr=subprocess.PIPE)
             eoutput.eend(0)
+        if os.path.isdir('files'):
+            print portage.output.yellow(">>> Package has a files/ directory, please double-check obsolete files")
     print ">>> All done with %s!" % cp

diff --git a/scripts/obsolete_ebuilds.py b/scripts/obsolete_ebuilds.py
index 23af29c..558c2d4 100755
--- a/scripts/obsolete_ebuilds.py
+++ b/scripts/obsolete_ebuilds.py
@@ -8,12 +8,12 @@
 # based on the current keywords
 #
 
+import sys
 
 import portage
 
 def usage():
-    print "Usage: $0 <cpv>"
-    print ""
+    print "Usage: %s <cpv>" % sys.argv[0]
 
 ###############
 ## Constants ##
@@ -121,7 +121,6 @@ def get_obsolete(cp):
     return obsolete_cpvs
 
 if __name__ == "__main__":
-    import sys
     if len(sys.argv) < 2:
         usage()
         sys.exit(1)



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-18  9:59 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-18  9:59 UTC (permalink / raw
  To: gentoo-commits

commit:     5b8a707da43d5b4ee7b2642b21c7ec3d3ab60ffd
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 18 09:58:47 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Fri Mar 18 09:58:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=5b8a707d

gst-plugins-bump.py: misc small features/fixes

---
 scripts/gst-plugins-bump.py |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
index e4f18b3..f53bb66 100755
--- a/scripts/gst-plugins-bump.py
+++ b/scripts/gst-plugins-bump.py
@@ -19,7 +19,7 @@ from portage.output import EOutput
 def usage():
     print "Usage: $0 <base|good|bad|ugly> <version> [core version] [base version]"
     print ""
-    print "  If core/base version is unspecified or blank, it's assumed to be the same"
+    print "  If core/base version is unspecified or blank, it will not be changed"
 
 if len(sys.argv) < 3 or len(sys.argv) > 5:
     usage()
@@ -51,7 +51,6 @@ portdb.porttrees = [PORTDIR]
 GSTPREFIX = 'gst-plugins-'
 GSTECLASS = GSTPREFIX + GSTLIB
 GSTLIB = 'media-libs/' + GSTPREFIX + GSTLIB
-GSTPLUGIN_CPVS = []
 GSTCAT = 'media-plugins'
 GSTLIBS = {'media-libs/gstreamer': GSTCOREVER,
            'media-libs/gst-plugins-base': GSTBASEVER,
@@ -133,6 +132,7 @@ def isgstplugin(cpv):
 # We do this outside the loop so that we get notified while stuff gets cached
 eoutput.ebegin("Getting a list of all gst-plugins")
 cp_all = portdb.cp_all(categories=[GSTCAT])
+gst_cpv_all = []
 eoutput.eend(0)
 eoutput.ebegin("Getting the next gst-plugin")
 # Does a first-time-expensive xmatch call
@@ -142,11 +142,11 @@ for cp in cp_all:
     cpv = get_cpv(cp)
     if not isgstplugin(cpv):
         continue
+    new_cpv = get_cpv(cp, GSTLIBVER)
     print ">>> Current package is %s" % cpv
-    GSTPLUGIN_CPVS.append(cpv)
     os.chdir(get_ebuild_dir(cpv))
     old_ebuild = get_ebuild(cpv)
-    new_ebuild = get_ebuild(get_cpv(cp, GSTLIBVER))
+    new_ebuild = get_ebuild(new_cpv)
     eoutput.ebegin("Copying %s to %s" % (old_ebuild, new_ebuild))
     shutil.copyfile(old_ebuild, new_ebuild)
     eoutput.eend(0)
@@ -175,5 +175,10 @@ for cp in cp_all:
             subprocess.check_call('cvs rm -f %s' % ebuild, shell=True, stderr=subprocess.PIPE)
             eoutput.eend(0)
         if os.path.isdir('files'):
-            print portage.output.yellow(">>> Package has a files/ directory, please double-check obsolete files")
+            print portage.output.red(">>> Package has a files/ directory, please double-check obsolete files")
     print ">>> All done with %s!" % cp
+    gst_cpv_all.append(new_cpv)
+print ""
+print "Here's a list for emerge :-)"
+for cpv in gst_cpv_all:
+    print '=%s' % cpv,



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-20  8:11 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-20  8:11 UTC (permalink / raw
  To: gentoo-commits

commit:     4a42aeaf88adc0d5723b85f00c623fc5022e3379
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 07:50:41 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 07:50:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=4a42aeaf

scripts/gst-plugins-bump.py: make manifest the last operation

* So that cvs rm -f doesn't invalidate the manifest

---
 scripts/gst-plugins-bump.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
index f53bb66..7a70489 100755
--- a/scripts/gst-plugins-bump.py
+++ b/scripts/gst-plugins-bump.py
@@ -162,7 +162,6 @@ for cp in cp_all:
         #   2 if something went wrong
         if e.returncode == 2:
             raise e
-    subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
     eoutput.ebegin("Running cvs add %s" % new_ebuild)
     subprocess.check_call('cvs add %s' % new_ebuild, shell=True, stderr=subprocess.PIPE)
     eoutput.eend(0)
@@ -176,6 +175,7 @@ for cp in cp_all:
             eoutput.eend(0)
         if os.path.isdir('files'):
             print portage.output.red(">>> Package has a files/ directory, please double-check obsolete files")
+    subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
     print ">>> All done with %s!" % cp
     gst_cpv_all.append(new_cpv)
 print ""



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-23 10:39 Gilles Dartiguelongue
  0 siblings, 0 replies; 32+ messages in thread
From: Gilles Dartiguelongue @ 2011-03-23 10:39 UTC (permalink / raw
  To: gentoo-commits

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:



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-23 19:21 Gilles Dartiguelongue
  0 siblings, 0 replies; 32+ messages in thread
From: Gilles Dartiguelongue @ 2011-03-23 19:21 UTC (permalink / raw
  To: gentoo-commits

commit:     00b129cfbdea7536a2823563531799d62cd20bb9
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 19:20:55 2011 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 19:20:55 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=00b129cf

scripts/slot_rindex2.py: show atom used in ebuild

---
 scripts/slot_rindex2.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/slot_rindex2.py b/scripts/slot_rindex2.py
index e3db2fc..c9e4547 100644
--- a/scripts/slot_rindex2.py
+++ b/scripts/slot_rindex2.py
@@ -55,15 +55,15 @@ def main():
                         mypkg_slot = "unset"
 
                     if mypkg_slot not in res_slots:
-                        res_slots[mypkg_slot] = [cpvr]
+                        res_slots[mypkg_slot] = [(cpvr, depend)]
                     else:
-                        res_slots[mypkg_slot].append(cpvr)
+                        res_slots[mypkg_slot].append((cpvr, depend))
                     #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)
+            print('    %s (as %s)' % rescpv)
 
 
 if __name__ == "__main__":



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-23 21:59 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-23 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     2af0175847b6b8d097e7e3dbbe11228c724eaaf4
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 12:54:16 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 21:59:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=2af01758

slot_rindex.py: add slower portage-only mode, reorganize code

* Set PORTAGE_ONLY to True to use the slower code
* It's about 5x slower on hot cache

---
 scripts/slot_rindex.py |  123 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 84 insertions(+), 39 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index bf5f834..3610813 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -11,26 +11,31 @@
 # Currently prints out a list of revdeps which *don't* use a slot in the
 # dependency atom containing the given library
 #
-# TODO: Add a slower portage-only mode which calculates the required rindex
-#
 
 import sys
-import urllib2
 import os.path as osp
 
 import portage
 from portage.xml.metadata import MetaDataXML
 
+portdb = portage.portdb
+portdb.porttrees = [portage.settings['PORTDIR']]
+PORTDIR = portage.settings['PORTDIR']
+DEPVARS = ['RDEPEND', 'PDEPEND', 'DEPEND']
+
+#####################
+### Configuration ###
+#####################
 if len(sys.argv) < 2:
     print "Usage: %s <cat/pkg>" % sys.argv[0]
     sys.exit(1)
 
-portage.portdb.porttrees = [portage.settings['PORTDIR']]
-PORTDIR = portage.settings['PORTDIR']
-RINDEX = "http://tinderbox.dev.gentoo.org/misc/rindex"
-DEPSTR = ['RDEPEND', 'PDEPEND', 'DEPEND']
 KEY = sys.argv[1]
+PORTAGE_ONLY = False
 
+########################
+### Output Functions ###
+########################
 def get_herds():
     return osp.join(PORTDIR, 'metadata', 'herds.xml')
 
@@ -50,7 +55,9 @@ def rdeps_with_slot(slot_rdeps, slot=None):
     if not slot_rdeps.has_key(slot):
         # No rdeps using the given slot
         return
+    print "-------------------------------"
     print "All packages:"
+    print "-------------------------------"
     for pkg in slot_rdeps[slot]:
         pkg_md = MetaDataXML(get_md_path(pkg), get_herds())
         for herd in pkg_md.herds():
@@ -69,54 +76,92 @@ def rdeps_with_slot(slot_rdeps, slot=None):
             print '%s' % i.email,
         print
 
+    print "-------------------------------"
     print "Herd packages:"
+    print "-------------------------------"
     for (herd, pkgs) in pkg_herds.iteritems():
         print 'Herd: %s' % herd
         for pkg in pkgs:
             print '\t%s' % pkg
 
+    print "-------------------------------"
     print "Maintainer packages:"
+    print "-------------------------------"
     for (maint, pkgs) in pkg_maints.iteritems():
         print 'Maintainer: %s' % maint
         for pkg in pkgs:
             print '\t%s' % pkg
 
+#############################
+### Portage API Functions ###
+#############################
+def get_deps_both(cpv, depvars=DEPVARS):
+    """
+    Parses the dependency variables listed in depvars for cpv
 
-vrdeps = urllib2.urlopen('/'.join([RINDEX, KEY])).read().split()
-rdeps = []
-for i in vrdeps:
-    rdeps.append(i.split(':')[0])
-
-slot_rdeps = {}
-failed_rdeps = []
-for rdep in rdeps:
-    rdep = rdep.split(':')[0]
-    if not portage.isvalidatom('='+rdep):
-        print 'Invalid atom: ' + rdep
-        continue
+    returns (set(dep_cps), set(dep_strs))
+    """
+    dep_cps = set()
+    dep_strs = set()
+    raw_deps = []
     try:
-        temp = portage.portdb.aux_get(rdep, DEPSTR)[0].split()
+        raw_deps = portdb.aux_get(cpv, depvars)[0].split()
     except KeyError:
-        failed_rdeps.append(rdep)
+        return (dep_cps, dep_strs)
+    for dep in portage.dep.use_reduce(' '.join(raw_deps),
+                                      matchall=True, flat=True):
+        # Ignore blockers, etc
+        if portage.isvalidatom(dep):
+            dep_strs.add(dep)
+            dep_cps.add(portage.dep.dep_getkey(dep))
+    return (dep_cps, dep_strs)
+
+def get_revdeps_rindex(key):
+    """
+    Given a key, returns a reverse-dependency list of that key using the tinderbox rindex
+    """
+    import urllib2
+    RINDEX = "http://tinderbox.dev.gentoo.org/misc/rindex"
+    revdeps = []
+    rdeps_raw = urllib2.urlopen('/'.join([RINDEX, key])).read().split()
+    for i in rdeps_raw:
+        cpv = i.split(':')[0]
+        if portage.isvalidatom('='+cpv):
+            revdeps.append(cpv)
+    return revdeps
+
+def get_revdeps_portage(key):
+    """
+    Given a key, returns a reverse-dependency list of that key using portage API
+    """
+    revdeps = []
+    for cp in portdb.cp_all():
+        cpvrs = portdb.xmatch('match-all', cp)
+        for cpvr in cpvrs:
+            if key in get_deps_both(cpvr)[0]:
+                revdeps.append(cpvr)
+    return revdeps
+
+###################
+### Actual Work ###
+###################
+slot_rdeps = {}
+revdeps = []
+if PORTAGE_ONLY:
+    revdeps = get_revdeps_portage(KEY)
+else:
+    revdeps = get_revdeps_rindex(KEY)
+
+for rdep in revdeps:
+    (cps, deps) = get_deps_both(rdep)
+    if KEY not in cps:
         continue
-    for dep in temp:
-        # Ignore ||, (, ), etc.
-        if not portage.isvalidatom(dep):
+    for cpv in deps:
+        if cpv.find(KEY) == -1:
             continue
-        # Categorize the dep into the slot it uses
-        if portage.dep.dep_getkey(dep) == KEY:
-            slot = portage.dep.dep_getslot(dep)
-            if not slot_rdeps.has_key(slot):
-                # We use a set here because atoms often get repeated
-                slot_rdeps[slot] = set()
-            slot_rdeps[slot].add(rdep)
-
-# Convert back to list, and sort the atoms
-for slot in slot_rdeps.keys():
-    slot_rdeps[slot] = list(slot_rdeps[slot])
-    slot_rdeps[slot].sort()
-
-if failed_rdeps:
-    print 'Failed: ' + str(failed_rdeps)
+        slot = portage.dep.dep_getslot(cpv)
+        if not slot_rdeps.has_key(slot):
+            slot_rdeps[slot] = []
+        slot_rdeps[slot].append(rdep)
 
 rdeps_with_slot(slot_rdeps)



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-23 21:59 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-23 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     f060e709b2bef5594f458979f8e3a48d0b8cf94a
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 10:40:15 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 21:59:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=f060e709

scripts/obsolete_ebuilds.py: support '.' as an argument

---
 scripts/obsolete_ebuilds.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/scripts/obsolete_ebuilds.py b/scripts/obsolete_ebuilds.py
index 558c2d4..4413cf9 100755
--- a/scripts/obsolete_ebuilds.py
+++ b/scripts/obsolete_ebuilds.py
@@ -8,6 +8,7 @@
 # based on the current keywords
 #
 
+import os
 import sys
 
 import portage
@@ -124,5 +125,7 @@ if __name__ == "__main__":
     if len(sys.argv) < 2:
         usage()
         sys.exit(1)
+    if sys.argv[1] == '.':
+        sys.argv[1] = '/'.join((os.path.basename(os.path.dirname(os.getcwd())), os.path.basename(os.getcwd())))
     for i in get_obsolete(sys.argv[1]):
         print portage.catsplit(i)[-1]+'.ebuild',



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-23 21:59 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-23 21:59 UTC (permalink / raw
  To: gentoo-commits

commit:     5ea970fbdfa52f7e9f5a222ad99bfb228b57330f
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 21:55:21 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 21:59:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=5ea970fb

gir-rebuilder.py: add a --force option, use EOutput, fix small bugs

* Add --force to force rebuilding of all .girs
* Use EOutput and spinners to display status
* Fix a bug where an installed package was no longer in portage
* Use vartree dbapi for *all* API access

---
 scripts/gir-rebuilder.py |   63 +++++++++++++++++++++++++++++----------------
 1 files changed, 40 insertions(+), 23 deletions(-)

diff --git a/scripts/gir-rebuilder.py b/scripts/gir-rebuilder.py
index 6cecd59..db6458f 100755
--- a/scripts/gir-rebuilder.py
+++ b/scripts/gir-rebuilder.py
@@ -17,31 +17,37 @@ from xml.dom import minidom as dom
 
 import portage
 from portage.versions import vercmp
-from portage.output import colorize
+from portage.output import EOutput
+from _emerge.stdout_spinner import stdout_spinner
 
 ###############
 ## Variables ##
 ###############
 quiet = False
+force = False
 root = '/'
 gir_dirs = ['/usr/share/gir-1.0']
 girs = {}
 girversion = ''
 gi = 'gobject-introspection'
 settings = portage.settings
+eoutput = EOutput()
+spinner = stdout_spinner()
 
 ###############
 ## Functions ##
 ###############
 def usage():
-    print """
-gir-rebuilder: Rebuilds gobject-introspection typelibs and girs in the following directories:
+    print """gir-rebuilder: Rebuilds gobject-introspection typelibs and girs in the following directories:
  %s
 
-Usage: %s [ARGUMENTS TO EMERGE]
+Usage: %s [--force] [ARGUMENTS TO EMERGE]
 
 Arguments:
-  All arguments are passed to portage
+  --help            This text
+  --force           Force rebuilding of *all* girs and typelibs
+
+  All other arguments are passed to portage
     """ % ('\n '.join(gir_dirs), sys.argv[0])
 
 def get_version(gir):
@@ -51,26 +57,26 @@ def get_contents(cpv):
     cpv = portage.catsplit(cpv)
     return set(portage.dblink(cpv[0], cpv[1], root, settings).getcontents().keys())
 
-def print_colorize(color, text):
-    print colorize(color, " * ") + text
-
 ################
 ## Parse Args ##
 ################
 if '--help' in sys.argv:
     usage()
     exit(0)
+if '--force' in sys.argv:
+    force = True
+    sys.argv.remove('--force')
 
 ##############
 ## Set vars ##
 ##############
 if os.environ.has_key('ROOT'):
     root = os.environ['ROOT']
-portdb = portage.db[root]["vartree"].dbapi
+vardbapi = portage.vardbapi()
 # Find the latest g-i
 # XXX: Assumes there's only one slot for g-i
-print_colorize("green", "Finding current GIRepository version...")
-gi = portdb.match(gi)[0]
+eoutput.ebegin("Finding current GIRepository version")
+gi = vardbapi.match(gi)[0]
 for each in get_contents(gi):
     # Find GIRepository-$ver.gir, and get the internal version
     if re.match('.*GIRepository[^/]+\.gir$', each):
@@ -79,12 +85,16 @@ for each in get_contents(gi):
 else:
     raise Exception("GIRepository .gir not found")
 girversion = get_version(girepository)
-print_colorize("green", "Current GIRepository version is " + girversion)
+eoutput.eend(0)
+eoutput.einfo("Current GIRepository version is " + girversion)
 
 ##########
 ## Work ##
 ##########
-print_colorize("green", "Finding broken GIR files...")
+if force:
+    eoutput.ebegin("Finding GIR files")
+else:
+    eoutput.ebegin("Finding broken GIR files")
 files_list = set()
 for dir in gir_dirs:
     # Walk the gir directories to find files
@@ -92,38 +102,45 @@ for dir in gir_dirs:
         for f in files:
             if not f.endswith('.gir'):
                 continue
+            if force:
+                files_list.add(osp.join(path, f))
+                continue
+            spinner.update()
             # Get the .gir version
             version = get_version(osp.join(path, f))
             # If not the same version as GIRepository.gir, rebuild it
             if vercmp(girversion, version) != 0:
-                print_colorize("yellow", "GIR file to be rebuilt: " + \
+                eoutput.ewarn("GIR file to be rebuilt: " + \
                                          osp.join(path, f))
                 files_list.add(osp.join(path, f))
+eoutput.eend(0)
 
 # FIXME: Doesn't warn if it was unable to assign a file to a package
 rebuild_list = set()
 if files_list:
-    print_colorize("green", "Assigning files to packages...")
+    eoutput.ebegin("Assigning files to packages")
     files_assigned = set()
-    for cpv in portage.db[root]["vartree"].dbapi.cpv_all():
+    for cpv in vardbapi.cpv_all():
+        spinner.update()
         # If some of the files of this package are in the gir file list
         files_owned = get_contents(cpv).intersection(files_list)
         if files_owned:
-            files_assigned.add(files_owned)
-            slot = portage.portdb.aux_get(cpv, ['SLOT'])[0]
+            files_assigned.update(files_owned)
+            slot = vardbapi.aux_get(cpv, ['SLOT'])[0]
             # We strip the version, but maintain the slot (same as revdep-rebuild)
             rebuild_list.add(portage.pkgsplit(cpv)[0]+':'+slot)
     files_unassigned = files_list.symmetric_difference(files_assigned)
     if files_unassigned:
         for file in files_unassigned:
-            print_colorize("yellow", "Unable to assign file to package: " + \
+            eoutput.ewarn("Unable to assign file to package: " + \
                                      osp.join(path, file))
+eoutput.eend(0)
 
 if files_list and rebuild_list:
-    print_colorize("green", "All done, starting rebuild...")
-    command = "emerge -1 " + '\n'.join(sys.argv[1:]+list(rebuild_list))
+    eoutput.einfo("All done, starting rebuild")
+    command = "emerge --oneshot " + ' \\\n'.join(sys.argv[1:]+list(rebuild_list))
     print command
     # Run emerge
-    subprocess.check_call(command, shell=True)
+    subprocess.call(command, shell=True)
 else:
-    print_colorize("green", "Everything seems to be in order, nothing to be rebuilt")
+    eoutput.einfo("Everything seems to be in order, nothing to be rebuilt")



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-26  1:58 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-26  1:58 UTC (permalink / raw
  To: gentoo-commits

commit:     b243ed092dcdc3658ed75b9e1f0d73e7945e3031
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 26 01:40:29 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 01:52:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=b243ed09

slot_rindex.py: use os.environ to toggle PORTAGE_ONLY

---
 scripts/slot_rindex.py |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index 3610813..c77817f 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -13,6 +13,7 @@
 #
 
 import sys
+import os
 import os.path as osp
 
 import portage
@@ -32,6 +33,8 @@ if len(sys.argv) < 2:
 
 KEY = sys.argv[1]
 PORTAGE_ONLY = False
+if os.environ.has_key('PORTAGE_ONLY'):
+    PORTAGE_ONLY = os.environ['PORTAGE_ONLY']
 
 ########################
 ### Output Functions ###
@@ -119,27 +122,33 @@ def get_deps_both(cpv, depvars=DEPVARS):
 def get_revdeps_rindex(key):
     """
     Given a key, returns a reverse-dependency list of that key using the tinderbox rindex
+    list will be a sorted list of unique cpvs
     """
     import urllib2
     RINDEX = "http://tinderbox.dev.gentoo.org/misc/rindex"
-    revdeps = []
+    revdeps = set()
     rdeps_raw = urllib2.urlopen('/'.join([RINDEX, key])).read().split()
     for i in rdeps_raw:
         cpv = i.split(':')[0]
         if portage.isvalidatom('='+cpv):
-            revdeps.append(cpv)
+            revdeps.add(cpv)
+    revdeps = list(revdeps)
+    revdeps.sort()
     return revdeps
 
 def get_revdeps_portage(key):
     """
     Given a key, returns a reverse-dependency list of that key using portage API
+    list will be a sorted list of unique cpvs
     """
-    revdeps = []
+    revdeps = set()
     for cp in portdb.cp_all():
         cpvrs = portdb.xmatch('match-all', cp)
         for cpvr in cpvrs:
             if key in get_deps_both(cpvr)[0]:
-                revdeps.append(cpvr)
+                revdeps.add(cpvr)
+    revdeps = list(revdeps)
+    revdeps.sort()
     return revdeps
 
 ###################



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-28 15:04 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-28 15:04 UTC (permalink / raw
  To: gentoo-commits

commit:     3f1a22c12e3f6eb71f4df0a0f0bedfec0cde87a8
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 15:01:54 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 15:02:36 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=3f1a22c1

slot_rindex.py: add option to ignore obsolete ebuilds

---
 scripts/slot_rindex.py |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index c77817f..3ca50dc 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -33,8 +33,11 @@ if len(sys.argv) < 2:
 
 KEY = sys.argv[1]
 PORTAGE_ONLY = False
+IGNORE_OBSOLETE = False
 if os.environ.has_key('PORTAGE_ONLY'):
     PORTAGE_ONLY = os.environ['PORTAGE_ONLY']
+if os.environ.has_key('IGNORE_OBSOLETE'):
+    IGNORE_OBSOLETE = os.environ['IGNORE_OBSOLETE']
 
 ########################
 ### Output Functions ###
@@ -162,6 +165,10 @@ else:
     revdeps = get_revdeps_rindex(KEY)
 
 for rdep in revdeps:
+    if IGNORE_OBSOLETE:
+        from obsolete_ebuilds import get_obsolete
+        if rdep in get_obsolete(portage.pkgsplit(rdep)[0]):
+            continue
     (cps, deps) = get_deps_both(rdep)
     if KEY not in cps:
         continue



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-03-28 16:15 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-03-28 16:15 UTC (permalink / raw
  To: gentoo-commits

commit:     c35f4ec82c12d0f13c78b97ce9ba53907a520a0a
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 28 16:14:39 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Mon Mar 28 16:14:41 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=c35f4ec8

slot_rindex.py: take care of =cat/pkg-ver* deps

Earlier, categorization was done purely on the basis of the :slot dep.
Now, =cat/pkg-ver* deps are also taken into account while generating the
slot-rdep mapping

---
 scripts/slot_rindex.py |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index 3ca50dc..f66b599 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -122,6 +122,27 @@ def get_deps_both(cpv, depvars=DEPVARS):
             dep_cps.add(portage.dep.dep_getkey(dep))
     return (dep_cps, dep_strs)
 
+def get_dep_slot(dep):
+    """
+    If the dep atom contains a slot, return that
+    If the dep atom doesn't contain a slot, but is of the =cat/pkg-ver* type,
+    check which slots each satisfied cpv has, and return that if they're all the
+    same; return None if they're different
+    """
+    # FIXME: Use our own portdb so that we match atoms outside of PORTDIR too
+    slot = portage.dep.dep_getslot(dep)
+    if slot or not dep.startswith('='):
+        return slot
+    cp = portage.dep.dep_getkey(dep)
+    cpvrs = portage.dep.match_from_list(dep, portdb.xmatch('match-all', cp))
+    for cpvr in cpvrs:
+        my_slot = portdb.aux_get(cpvr, ['SLOT'])[0]
+        if slot and my_slot != slot:
+            # omg, one of the slots is different
+            return None
+        slot = my_slot
+    return slot
+
 def get_revdeps_rindex(key):
     """
     Given a key, returns a reverse-dependency list of that key using the tinderbox rindex
@@ -172,10 +193,10 @@ for rdep in revdeps:
     (cps, deps) = get_deps_both(rdep)
     if KEY not in cps:
         continue
-    for cpv in deps:
-        if cpv.find(KEY) == -1:
+    for dep in deps:
+        if dep.find(KEY) == -1:
             continue
-        slot = portage.dep.dep_getslot(cpv)
+        slot = get_dep_slot(dep)
         if not slot_rdeps.has_key(slot):
             slot_rdeps[slot] = []
         slot_rdeps[slot].append(rdep)



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-04-09  6:29 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-04-09  6:29 UTC (permalink / raw
  To: gentoo-commits

commit:     c43e76d5cd698d08295e9efa1100d9b56cad903d
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  9 06:22:12 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sat Apr  9 06:23:26 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=c43e76d5

slot_rindex.py: handle packages with no rdeps properly

---
 scripts/slot_rindex.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index f66b599..9816942 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -151,7 +151,12 @@ def get_revdeps_rindex(key):
     import urllib2
     RINDEX = "http://tinderbox.dev.gentoo.org/misc/rindex"
     revdeps = set()
-    rdeps_raw = urllib2.urlopen('/'.join([RINDEX, key])).read().split()
+    try:
+        rdeps_raw = urllib2.urlopen('/'.join([RINDEX, key])).read().split()
+    except urllib2.HTTPError as e:
+        if e.getcode() == 404:
+            return revdeps
+        raise
     for i in rdeps_raw:
         cpv = i.split(':')[0]
         if portage.isvalidatom('='+cpv):



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-04-13  9:57 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-04-13  9:57 UTC (permalink / raw
  To: gentoo-commits

commit:     4aa6649d7c53a4eeb89abe245fbda096ff08ef45
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 13 09:50:08 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Wed Apr 13 09:51:28 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=4aa6649d

gst-plugins-bump.py: manifest after every ebuild change

---
 scripts/gst-plugins-bump.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/gst-plugins-bump.py b/scripts/gst-plugins-bump.py
index 7a70489..3cd93cd 100755
--- a/scripts/gst-plugins-bump.py
+++ b/scripts/gst-plugins-bump.py
@@ -165,6 +165,7 @@ for cp in cp_all:
     eoutput.ebegin("Running cvs add %s" % new_ebuild)
     subprocess.check_call('cvs add %s' % new_ebuild, shell=True, stderr=subprocess.PIPE)
     eoutput.eend(0)
+    subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
     if REMOVE_OBSOLETE:
         from obsolete_ebuilds import get_obsolete
         print ">>> Removing obsolete ebuilds"
@@ -175,7 +176,7 @@ for cp in cp_all:
             eoutput.eend(0)
         if os.path.isdir('files'):
             print portage.output.red(">>> Package has a files/ directory, please double-check obsolete files")
-    subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
+        subprocess.check_call('ebuild %s manifest' % new_ebuild, shell=True)
     print ">>> All done with %s!" % cp
     gst_cpv_all.append(new_cpv)
 print ""



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-05-19 12:35 Gilles Dartiguelongue
  0 siblings, 0 replies; 32+ messages in thread
From: Gilles Dartiguelongue @ 2011-05-19 12:35 UTC (permalink / raw
  To: gentoo-commits

commit:     219443ba2b992b2a034348192a21bfb95cc97974
Author:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
AuthorDate: Thu May 19 12:35:01 2011 +0000
Commit:     Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
CommitDate: Thu May 19 12:35:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=219443ba

scripts/slot_rindex2.py: use xmatch to match even masked packages

Also matches packages available on another arch only

---
 scripts/slot_rindex2.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/slot_rindex2.py b/scripts/slot_rindex2.py
index c9e4547..121e278 100644
--- a/scripts/slot_rindex2.py
+++ b/scripts/slot_rindex2.py
@@ -26,7 +26,7 @@ def main():
         #print(cp)
 
         # Get versions
-        cpvrs = portdb.dbapi.match(cp)
+        cpvrs = portdb.dbapi.xmatch('match-all', cp)
 
         # Group by slots
         slots = {}



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-05-21 18:38 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-05-21 18:38 UTC (permalink / raw
  To: gentoo-commits

commit:     4d25e454daa3bd1925b10e73a9d18f63f355e376
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 18:38:02 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sat May 21 18:38:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=4d25e454

slot_rindex.py: use newstyle exception handling

---
 scripts/slot_rindex.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/slot_rindex.py b/scripts/slot_rindex.py
index 9816942..9098db8 100755
--- a/scripts/slot_rindex.py
+++ b/scripts/slot_rindex.py
@@ -153,7 +153,7 @@ def get_revdeps_rindex(key):
     revdeps = set()
     try:
         rdeps_raw = urllib2.urlopen('/'.join([RINDEX, key])).read().split()
-    except urllib2.HTTPError as e:
+    except urllib2.HTTPError, e:
         if e.getcode() == 404:
             return revdeps
         raise



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-07-12 21:15 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-07-12 21:15 UTC (permalink / raw
  To: gentoo-commits

commit:     65233c901564bdc33d220bd5210d6701bc18c61c
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 19:14:41 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 19:14:43 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=65233c90

scripts/gen_archlist.py: don't insert useless newlines when CHECK_DEPS

* If blocks of cpv-kw lists have just one item in them, don't separate them with
  newline. This avoids tons of useless space in the output.
* This code is surprisingly fragile...

---
 scripts/gen_archlist.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index e53f9cc..ffef7eb 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -390,6 +390,7 @@ def prettify(cpv_kws):
     max_len = 0
     kws_all = []
     pretty_list = []
+    cpv_block_size = 0
 
     for each in cpv_kws:
         # Ignore comments/whitespace carried over from original list
@@ -405,10 +406,18 @@ def prettify(cpv_kws):
     kws_all.sort()
 
     for each in cpv_kws:
-        # Ignore comments/whitespace carried over from original list
+        # Handle comments/whitespace carried over from original list
         if type(each) is not list:
+            # If the prev cpv block has just one line, don't print an extra \n
+            # XXX: This code relies on blocks of dep-cpvs being separated by \n
+            if CHECK_DEPS and cpv_block_size is 1:
+                cpv_block_size = 0
+                continue
             pretty_list.append([each, []])
+            cpv_block_size = 0
             continue
+        # The size of the current cpv list block
+        cpv_block_size += 1
         # Pad the cpvs with space
         each[0] += n_sep(max_len - len(each[0]))
         for i in range(0, len(kws_all)):



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2011-08-18  6:23 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2011-08-18  6:23 UTC (permalink / raw
  To: gentoo-commits

commit:     6810cce38ceb2bc44b1edbde3148ecc062f5c350
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 18 04:19:17 2011 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Thu Aug 18 04:19:17 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=6810cce3

obsolete_ebuilds.py: update to latest portage API

---
 scripts/obsolete_ebuilds.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/obsolete_ebuilds.py b/scripts/obsolete_ebuilds.py
index 4413cf9..818c207 100755
--- a/scripts/obsolete_ebuilds.py
+++ b/scripts/obsolete_ebuilds.py
@@ -90,7 +90,7 @@ def get_obsolete(cp):
     # Ignore PORTDIR package.masked cpvs
     for cpv in cpvs:
         try:
-            metadata = {'SLOT': portdb.aux_get(cpv, ['SLOT'])}
+            metadata = {'SLOT': portdb.aux_get(cpv, ['SLOT'])[0]}
         except KeyError:
             # masked by corruption
             continue



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2012-04-01 19:12 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2012-04-01 19:12 UTC (permalink / raw
  To: gentoo-commits

commit:     47392a028ee246f124d03f4c25851111dff5e2d5
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  1 19:12:23 2012 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sun Apr  1 19:12:29 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=47392a02

scripts/gen_archlist.py: add the ability to append slot info

* As requested by pacho

---
 scripts/gen_archlist.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index ffef7eb..8f0e9a8 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -44,6 +44,7 @@ LINE_SEP = ''
 DEBUG = False
 EXTREME_DEBUG = False
 CHECK_DEPS = False
+APPEND_SLOTS = False
 # Check for stable keywords
 STABLE = True
 
@@ -80,6 +81,9 @@ else:
 if os.environ.has_key('CHECK_DEPS'):
     CHECK_DEPS = os.environ['CHECK_DEPS']
 
+if os.environ.has_key('APPEND_SLOTS'):
+    APPEND_SLOTS = os.environ['APPEND_SLOTS']
+
 if not STABLE:
     print 'Currently broken for anything except STABLEREQ'
     print 'Please set STABLE to True'
@@ -384,6 +388,15 @@ def consolidate_dupes(cpv_kws):
 
     return deduped_cpv_kws
 
+def append_slots(cpv_kws):
+    "Append slots at the end of cpv atoms"
+    slotifyed_cpv_kws = []
+    for (cpv, kws) in cpv_kws:
+        slot = portage.portage.portdb.aux_get(cpv, ['SLOT'])[0]
+        cpv = "%s:%s" % (cpv, slot)
+        slotifyed_cpv_kws.append([cpv, kws])
+    return slotifyed_cpv_kws
+
 # FIXME: This is broken
 def prettify(cpv_kws):
     "Takes a list of [cpv, [kws]] and prettifies it"
@@ -468,6 +481,8 @@ if __name__ == "__main__":
             ALL_CPV_KWS.append(LINE_SEP)
 
     ALL_CPV_KWS = consolidate_dupes(ALL_CPV_KWS)
+    if APPEND_SLOTS:
+        ALL_CPV_KWS = append_slots(ALL_CPV_KWS)
 
     for i in prettify(ALL_CPV_KWS):
         print i[0], flatten(i[1])



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2012-04-01 21:14 Nirbheek Chauhan
  0 siblings, 0 replies; 32+ messages in thread
From: Nirbheek Chauhan @ 2012-04-01 21:14 UTC (permalink / raw
  To: gentoo-commits

commit:     74d3c3fe11a25f7413bd4f734a6fa5c839040178
Author:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  1 21:13:49 2012 +0000
Commit:     Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
CommitDate: Sun Apr  1 21:13:51 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=74d3c3fe

scripts/gen_archlist.py: implement what pacho actually wanted

* If the input has no SLOT information, use the latest cpv in *all* slots

---
 scripts/gen_archlist.py |   58 +++++++++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 22 deletions(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 8f0e9a8..fa26b90 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -388,6 +388,16 @@ def consolidate_dupes(cpv_kws):
 
     return deduped_cpv_kws
 
+def get_per_slot_cpvs(cpvs):
+    "Classify the given cpvs into slots, and yield the best atom for each slot"
+    slots = set()
+    for cpv in cpvs:
+        slot = portage.portage.portdb.aux_get(cpv, ['SLOT'])[0]
+        if slot in slots:
+            continue
+        slots.add(slot)
+        yield cpv
+
 def append_slots(cpv_kws):
     "Append slots at the end of cpv atoms"
     slotifyed_cpv_kws = []
@@ -453,32 +463,36 @@ if __name__ == "__main__":
     array = []
 
     for i in open(CP_FILE).readlines():
-        cpv = i[:-1]
-        if cpv.startswith('#') or cpv.isspace() or not cpv:
-            ALL_CPV_KWS.append(cpv)
+        cp = i[:-1]
+        if cp.startswith('#') or cp.isspace() or not cp:
+            ALL_CPV_KWS.append(cp)
             continue
-        if cpv.find('#') is not -1:
+        if cp.find('#') is not -1:
             raise Exception('Inline comments are not supported')
-        if not portage.catpkgsplit(cpv):
-            # It's actually a cp
-            cpv = match_wanted_atoms(cpv, release=NEW_REL)
-            if not cpv or not cpv[0]:
+        if portage.catpkgsplit(cp):
+            # categ/pkg is already a categ/pkg-ver
+            atoms = [cp]
+        else:
+            # Get all the atoms matching the given cp
+            cpvs = match_wanted_atoms(cp, release=NEW_REL)
+
+        for cpv in get_per_slot_cpvs(cpvs):
+            if not cpv:
                 debug('%s: Invalid cpv' % cpv)
                 continue
-            cpv = cpv[0]
-        kws_missing = max_kws(cpv, release=OLD_REL)
-        if kws_missing == []:
-            # Current cpv has the max keywords => nothing to do
-            nothing_to_be_done(cpv)
-            continue
-        elif kws_missing == None:
-            debug ('No versions with stable keywords for %s' % cpv)
-            # No cpv with stable keywords => select latest
-            arches = make_unstable(ARCHES)
-            kws_missing = [kw[1:] for kw in get_kws(cpv, arches)]
-        ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set()))
-        if CHECK_DEPS:
-            ALL_CPV_KWS.append(LINE_SEP)
+            kws_missing = max_kws(cpv, release=OLD_REL)
+            if kws_missing == []:
+                # Current cpv has the max keywords => nothing to do
+                nothing_to_be_done(cpv)
+                continue
+            elif kws_missing == None:
+                debug ('No versions with stable keywords for %s' % cpv)
+                # No cpv with stable keywords => select latest
+                arches = make_unstable(ARCHES)
+                kws_missing = [kw[1:] for kw in get_kws(cpv, arches)]
+            ALL_CPV_KWS += fix_nesting(gen_cpv_kws(cpv, kws_missing, set()))
+            if CHECK_DEPS:
+                ALL_CPV_KWS.append(LINE_SEP)
 
     ALL_CPV_KWS = consolidate_dupes(ALL_CPV_KWS)
     if APPEND_SLOTS:



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2018-01-10  3:25 Mart Raudsepp
  0 siblings, 0 replies; 32+ messages in thread
From: Mart Raudsepp @ 2018-01-10  3:25 UTC (permalink / raw
  To: gentoo-commits

commit:     db02b518fb0b9a0571578d8b4cb16efb5c7258d4
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 10 03:24:59 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Wed Jan 10 03:24:59 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=db02b518

scripts/gen_archlist.py: Add arm64

 scripts/gen_archlist.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index a9fdb87d..2d713180 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -37,11 +37,11 @@ logger = logging.getLogger('gen_archlist')
 #############
 # GNOME_OVERLAY = PORTDB.getRepositoryPath('gnome')
 portage.portdb.porttrees = [portage.settings['PORTDIR']]
-STABLE_ARCHES = ('alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64',
-                 'sparc', 'x86')
-UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~hppa', '~ia64', '~m68k',
-                   '~ppc', '~ppc64', '~s390', '~sh', '~sparc', '~x86',
-                   '~x86-fbsd')
+STABLE_ARCHES = ('alpha', 'amd64', 'arm', 'arm64', 'hppa', 'ia64',
+                 'ppc', 'ppc64', 'sparc', 'x86')
+UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~arm64', '~hppa', '~ia64',
+                   '~m68k', '~ppc', '~ppc64', '~s390', '~sh', '~sparc',
+                   '~x86', '~x86-fbsd')
 ALL_ARCHES = STABLE_ARCHES + UNSTABLE_ARCHES
 SYSTEM_PACKAGES = []
 


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2018-04-25 10:32 Mart Raudsepp
  0 siblings, 0 replies; 32+ messages in thread
From: Mart Raudsepp @ 2018-04-25 10:32 UTC (permalink / raw
  To: gentoo-commits

commit:     d78f89c5d2f0c86812bbf60cdd77d9bece5ec830
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 25 10:31:21 2018 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Wed Apr 25 10:32:17 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=d78f89c5

scripts/gen_archlist: Hack it to work with python3

As this is just a workaround, not a properly handled port, keep the
shebang to python2 for now, but can at least run it via
python3 ./gen_archlist.py now when not having python2 portage.

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 2d713180..746255f9 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -437,7 +437,7 @@ def main():
                              ' to be stabilized')
     args = parser.parse_args()
 
-    args.verbose = min(max(args.verbose, 0), 2)
+    args.verbose = min(max(args.verbose if args.verbose else 0, 0), 2)
     logging.config.dictConfig({
         'version': 1,
         'disable_existing_loggers': True,


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2019-02-07 11:58 Mart Raudsepp
  0 siblings, 0 replies; 32+ messages in thread
From: Mart Raudsepp @ 2019-02-07 11:58 UTC (permalink / raw
  To: gentoo-commits

commit:     09f3b3a5cd37a5880178137105132626361316e5
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  7 11:55:45 2019 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Thu Feb  7 11:58:07 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=09f3b3a5

scripts/gen_archlist.py: Add s390

s390 is somewhat doing stable again and keeping up with things,
so include it in package stabilization lists too now.

Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 746255f9..17fcd6f1 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -38,7 +38,7 @@ logger = logging.getLogger('gen_archlist')
 # GNOME_OVERLAY = PORTDB.getRepositoryPath('gnome')
 portage.portdb.porttrees = [portage.settings['PORTDIR']]
 STABLE_ARCHES = ('alpha', 'amd64', 'arm', 'arm64', 'hppa', 'ia64',
-                 'ppc', 'ppc64', 'sparc', 'x86')
+                 'ppc', 'ppc64', 's390', 'sparc', 'x86')
 UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~arm64', '~hppa', '~ia64',
                    '~m68k', '~ppc', '~ppc64', '~s390', '~sh', '~sparc',
                    '~x86', '~x86-fbsd')


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2020-03-10 22:05 Matt Turner
  0 siblings, 0 replies; 32+ messages in thread
From: Matt Turner @ 2020-03-10 22:05 UTC (permalink / raw
  To: gentoo-commits

commit:     1996134dee8de72911ddcebb55efdca395f7731f
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar  4 21:51:02 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Mar  4 21:52:25 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=1996134d

scripts/gen_archlist.py: Drop alpha from stable arches

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 17fcd6f1..e2b2a621 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -37,7 +37,7 @@ logger = logging.getLogger('gen_archlist')
 #############
 # GNOME_OVERLAY = PORTDB.getRepositoryPath('gnome')
 portage.portdb.porttrees = [portage.settings['PORTDIR']]
-STABLE_ARCHES = ('alpha', 'amd64', 'arm', 'arm64', 'hppa', 'ia64',
+STABLE_ARCHES = ('amd64', 'arm', 'arm64', 'hppa', 'ia64',
                  'ppc', 'ppc64', 's390', 'sparc', 'x86')
 UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~arm64', '~hppa', '~ia64',
                    '~m68k', '~ppc', '~ppc64', '~s390', '~sh', '~sparc',


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2020-03-28  8:31 Mart Raudsepp
  0 siblings, 0 replies; 32+ messages in thread
From: Mart Raudsepp @ 2020-03-28  8:31 UTC (permalink / raw
  To: gentoo-commits

commit:     2cd404b5ae2fabb6169f35735a72bbfce34f46cc
Author:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 28 08:31:22 2020 +0000
Commit:     Mart Raudsepp <leio <AT> gentoo <DOT> org>
CommitDate: Sat Mar 28 08:31:40 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=2cd404b5

scripts/gen_archlist.py: Drop ~sh completely (discontinued)

Signed-off-by: Mart Raudsepp <leio <AT> gentoo.org>

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index e2b2a621..8750b65b 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -40,7 +40,7 @@ portage.portdb.porttrees = [portage.settings['PORTDIR']]
 STABLE_ARCHES = ('amd64', 'arm', 'arm64', 'hppa', 'ia64',
                  'ppc', 'ppc64', 's390', 'sparc', 'x86')
 UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~arm64', '~hppa', '~ia64',
-                   '~m68k', '~ppc', '~ppc64', '~s390', '~sh', '~sparc',
+                   '~m68k', '~ppc', '~ppc64', '~s390', '~sparc',
                    '~x86', '~x86-fbsd')
 ALL_ARCHES = STABLE_ARCHES + UNSTABLE_ARCHES
 SYSTEM_PACKAGES = []


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2020-04-03 19:42 Matt Turner
  0 siblings, 0 replies; 32+ messages in thread
From: Matt Turner @ 2020-04-03 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     45069a2b9ae93325c6e94fd071abc90d877873ef
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 19:39:00 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 19:40:00 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=45069a2b

scripts/gen_archlist.py: Drop ia64 from stable arches

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 8750b65b..6a2ec837 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -37,7 +37,7 @@ logger = logging.getLogger('gen_archlist')
 #############
 # GNOME_OVERLAY = PORTDB.getRepositoryPath('gnome')
 portage.portdb.porttrees = [portage.settings['PORTDIR']]
-STABLE_ARCHES = ('amd64', 'arm', 'arm64', 'hppa', 'ia64',
+STABLE_ARCHES = ('amd64', 'arm', 'arm64', 'hppa',
                  'ppc', 'ppc64', 's390', 'sparc', 'x86')
 UNSTABLE_ARCHES = ('~alpha', '~amd64', '~arm', '~arm64', '~hppa', '~ia64',
                    '~m68k', '~ppc', '~ppc64', '~s390', '~sparc',


^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [gentoo-commits] proj/gnome:master commit in: scripts/
@ 2020-04-03 19:42 Matt Turner
  0 siblings, 0 replies; 32+ messages in thread
From: Matt Turner @ 2020-04-03 19:42 UTC (permalink / raw
  To: gentoo-commits

commit:     03664e2efda313a016be91ea34a38ffca7772bf7
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  3 19:40:32 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Fri Apr  3 19:40:32 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gnome.git/commit/?id=03664e2e

scripts/gen_archlist.py: Change shebang to python3

Commit d78f89c5d2f0 (scripts/gen_archlist: Hack it to work with python3)
made the script at least work in python3 but intentionally left the
shebang as python2. Today, portage doesn't have python2_7 in
PYTHON_COMPAT, so regardless of the quality of the python3 support in
this script it's the only option.

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 scripts/gen_archlist.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gen_archlist.py b/scripts/gen_archlist.py
index 6a2ec837..b3b6fb15 100755
--- a/scripts/gen_archlist.py
+++ b/scripts/gen_archlist.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
 # vim: set sw=4 sts=4 et :
 # Author(s): Nirbheek Chauhan <nirbheek@gentoo.org>
 #


^ permalink raw reply related	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2020-04-03 19:42 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-18  9:59 [gentoo-commits] proj/gnome:master commit in: scripts/ Nirbheek Chauhan
  -- strict thread matches above, loose matches on Subject: below --
2020-04-03 19:42 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-23 10:39 Gilles Dartiguelongue
2011-03-20  8:11 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox