From agrimm at rpath.com Wed Mar 16 10:49:06 2011
From: agrimm at rpath.com (Andy Grimm)
Date: Wed, 16 Mar 2011 14:49:06 +0000
Subject: mirrorball: change a string None to python None
Message-ID: <201103161449.p2GEn6uk032430@scc.eng.rpath.com>
changeset: eb0f4e9a8b67
user: Andy Grimm
date: Wed, 16 Mar 2011 10:49:01 -0400
change a string None to python None
diff --git a/updatebot/ordered.py b/updatebot/ordered.py
--- a/updatebot/ordered.py
+++ b/updatebot/ordered.py
@@ -153,6 +153,8 @@
"""
group = self._groupmgr.getGroup()
+ if group.errataState == 'None':
+ group.errataState = None
# Make sure this platform has not already been imported.
if group.errataState is not None:
From agrimm at rpath.com Wed Mar 16 10:50:56 2011
From: agrimm at rpath.com (Andy Grimm)
Date: Wed, 16 Mar 2011 14:50:56 +0000
Subject: mirrorball: add mapgroupmodel script
Message-ID: <201103161450.p2GEou3n032533@scc.eng.rpath.com>
changeset: 1967b38a491d
user: Andy Grimm
date: Wed, 16 Mar 2011 10:50:51 -0400
add mapgroupmodel script
diff --git a/scripts/mapgroupmodel.py b/scripts/mapgroupmodel.py
new file mode 100755
--- /dev/null
+++ b/scripts/mapgroupmodel.py
@@ -0,0 +1,98 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2010 rPath, Inc.
+#
+# This program is distributed under the terms of the Common Public License,
+# version 1.0. A copy of this license should have been distributed with this
+# source file in a file called LICENSE. If it is not present, the license
+# is always available at http://www.rpath.com/permanent/licenses/CPL-1.0.
+#
+# This program is distributed in the hope that it will be useful, but
+# without any warranty; without even the implied warranty of merchantability
+# or fitness for a particular purpose. See the Common Public License for
+# full details.
+#
+
+import os
+import sys
+import traceback
+
+if __name__ == '__main__':
+ mirrorballDir = os.path.abspath('../')
+ sys.path.insert(0, mirrorballDir)
+
+ if 'CONARY_PATH' in os.environ:
+ sys.path.insert(0, os.environ['CONARY_PATH'])
+
+ import rmake
+ import conary
+ import updatebot
+
+ print >>sys.stderr, 'using conary from', os.path.dirname(conary.__file__)
+ print >>sys.stderr, 'using rmake from', os.path.dirname(rmake.__file__)
+ print >>sys.stderr, 'using updatebot from', os.path.dirname(updatebot.__file__)
+
+ from conary.lib import util
+ sys.excepthook = util.genExcepthook()
+
+ from updatebot import log as logSetup
+ logSetup.addRootLogger()
+
+import logging
+
+from updatebot import OrderedBot
+
+log = logging.getLogger('create group')
+
+class Bot(OrderedBot):
+ def mapGroup(self, currentLabel, targetLabel):
+ """
+ Generate config for standard group contents based on repository history.
+ """
+
+ # Get the latest group model.
+ self._pkgSource.load()
+ group = self._groupmgr.getGroup()
+
+ # oldLabel = the label that should *not* be referenced
+ # clonedFromInfo = dict([ (k, v) for (k, v) in self._updater._conaryhelper.getClonedFromForLabel(conary.versions.Label(currentLabel)).iteritems() ])
+ clonedFromInfo = dict([ (k, v) for (k, v) in self._updater._conaryhelper.getClonedFromForLabel(conary.versions.Label(targetLabel)).iteritems() ])
+ packagelist = [ x for x in group.iterpackages() if (not x.version.startswith('/' + targetLabel) and
+ x.version.startswith('/' + currentLabel)) ]
+ newpackagelist = [ clonedFromInfo[(p0.name, conary.versions.ThawVersion(p0.version), conary.deps.deps.ThawFlavor(str(p0.flavor)))] for p0 in packagelist ]
+
+ assert len(newpackagelist) == len([x for x in newpackagelist if x[1].asString().startswith('/' + targetLabel) ])
+ # for RHEL5C add: or x[1].asString().startswith('/rhel.rpath.com at rpath:rhel-5-server-devel') ])
+ newtrovelist = self._updater._conaryhelper.findTroves(newpackagelist)
+ for val in newtrovelist.values():
+ assert len(val) == 1
+ newpackagelist = [ x[0] for x in newtrovelist.values() ]
+
+ pkgs = {}
+ for n, v, f in newpackagelist:
+ pkgs.setdefault(n, dict()).setdefault(v, set()).add(f)
+ for n, vMap in pkgs.iteritems():
+ assert len(vMap) == 1
+ group.removePackage(n)
+ for v, flvs in vMap.iteritems():
+ group.addPackage(n, v, flvs)
+
+ import epdb; epdb.st()
+ group._readOnly = False
+ try:
+ group = group.commit()
+ except AssertionError:
+ print traceback.format_exc(sys.exc_info()[2])
+
+ return group
+
+if __name__ == '__main__':
+ from updatebot import config
+
+ cfg = config.UpdateBotConfig()
+ cfg.read(mirrorballDir + '/config/%s/updatebotrc' % sys.argv[1])
+
+ bot = Bot(cfg, None)
+ model = bot.mapGroup(sys.argv[2], sys.argv[3])
+
+ import epdb; epdb.st()
From elliot at rpath.com Wed Mar 23 13:21:32 2011
From: elliot at rpath.com (Elliot Peele)
Date: Wed, 23 Mar 2011 17:21:32 +0000
Subject: mirrorball: add script for querying all repositories for a given
package
Message-ID: <201103231721.p2NHLWCQ007049@scc.eng.rpath.com>
changeset: d7f4cae651df
user: Elliot Peele
date: Wed, 23 Mar 2011 13:21:30 -0400
add script for querying all repositories for a given package
diff --git a/scripts/getlatest.py b/scripts/getlatest.py
new file mode 100755
--- /dev/null
+++ b/scripts/getlatest.py
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2011 rPath, Inc.
+#
+# This program is distributed under the terms of the Common Public License,
+# version 1.0. A copy of this license should have been distributed with this
+# source file in a file called LICENSE. If it is not present, the license
+# is always available at http://www.rpath.com/permanent/licenses/CPL-1.0.
+#
+# This program is distributed in the hope that it will be useful, but
+# without any warranty; without even the implied warranty of merchantability
+# or fitness for a particular purpose. See the Common Public License for
+# full details.
+#
+
+"""
+Script for querying latest version of a package from each platform.
+"""
+
+import os
+import sys
+
+mirrorballDir = os.path.abspath('../')
+sys.path.insert(0, mirrorballDir)
+
+if 'CONARY_PATH' in os.environ:
+ sys.path.insert(0, os.environ['CONARY_PATH'])
+
+import conary
+import updatebot
+
+print >>sys.stderr, 'using conary from', os.path.dirname(conary.__file__)
+print >>sys.stderr, 'using updatebot from', os.path.dirname(updatebot.__file__)
+
+from conary.lib import util
+sys.excepthook = util.genExcepthook()
+
+from updatebot import log
+from updatebot import config
+from updatebot import conaryhelper
+
+def usage():
+ print 'usage: %s ' % sys.argv[0]
+ sys.exit(1)
+
+def getPlatformConfigs(cfgDir):
+ platformConfigs = []
+ for dname in os.listdir(cfgDir):
+ conf = os.path.join(cfgDir, dname, 'updatebotrc')
+ if os.path.exists(conf):
+ cfg = config.UpdateBotConfig()
+ cfg.read(conf)
+ platformConfigs.append(cfg)
+ return platformConfigs
+
+def display(cfg, pkg, nvfs):
+ print cfg.platformName, cfg.upstreamProductVersion
+ for nvf in nvfs:
+ print ' %s=%s[%s]' % nvf
+
+if len(sys.argv) != 2:
+ usage()
+
+log.addRootLogger()
+
+pkgName = sys.argv[1]
+platforms = getPlatformConfigs(os.path.join(mirrorballDir, 'config'))
+
+results = []
+for cfg in platforms:
+ helper = conaryhelper.ConaryHelper(cfg)
+ spec = (pkgName, cfg.targetLabel, None)
+
+ try:
+ nvf = helper.findTrove(spec)
+ except:
+ nvf = []
+
+ if nvf:
+ results.append((cfg, pkgName, nvf))
+
+for res in results:
+ display(*res)