From elliot at rpath.com Mon Oct 19 13:37:45 2009 From: elliot at rpath.com (Elliot Peele) Date: Mon, 19 Oct 2009 17:37:45 +0000 Subject: mirrorball: add support for new elements Message-ID: <200910191737.n9JHbjQg024689@scc.eng.rpath.com> changeset: e7db11d3d6b8 user: Elliot Peele date: Mon, 19 Oct 2009 13:36:14 -0400 add support for new elements diff --git a/repomd/patchxml.py b/repomd/patchxml.py --- a/repomd/patchxml.py +++ b/repomd/patchxml.py @@ -25,7 +25,7 @@ __slots__ = ('name', 'summary', 'description', 'version', 'release', 'requires', 'recommends', 'rebootNeeded', 'licenseToConfirm', 'packageManager', 'category', - 'packages') + 'packages', 'provides', 'supplements', 'conflicts',) # All attributes are defined in __init__ by iterating over __slots__, # this confuses pylint. @@ -54,10 +54,16 @@ self.release = child.getAttribute('rel') elif n == 'rpm:requires': self.requires = child.getChildren('entry', namespace='rpm') + elif n == 'rpm:provides': + self.provides = child.getChildren('entry', namespace='rpm') + elif n == 'rpm:supplements': + self.supplements = child.getChildren('entry', namespace='rpm') elif n == 'rpm:recommends': self.recommends = child.getChildren('entry', namespace='rpm') elif n == 'rpm:obsoletes': self.obsoletes = child.getChildren('entry', namespace='rpm') + elif n == 'rpm:conflicts': + self.conflicts = child.getChildren('entry', namespace='rpm') elif n == 'reboot-needed': self.rebootNeeded = True elif n == 'license-to-confirm': From johnsonm at rpath.com Wed Oct 28 16:54:42 2009 From: johnsonm at rpath.com (Michael K. Johnson) Date: Wed, 28 Oct 2009 20:54:42 +0000 Subject: mirrorball: add findprefixpackages to help discover dynamic dep providers Message-ID: <200910282054.n9SKsgQE006408@scc.eng.rpath.com> changeset: fe58797da03d user: Michael K. Johnson date: Wed, 28 Oct 2009 16:53:10 -0400 add findprefixpackages to help discover dynamic dep providers diff --git a/scripts/findprefixpackages b/scripts/findprefixpackages new file mode 100755 --- /dev/null +++ b/scripts/findprefixpackages @@ -0,0 +1,71 @@ +#!/usr/bin/python +# +# Copyright (c) 2009 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. +# +# This script finds all packages that include paths starting with the +# prefixes specified on the command line. It takes a long time. For +# example, given a mirrorball config called "boots", you can run: +# ./findprefixpackages boots /usr/lib/python2.6 /usr/lib64/python2.6 /usr/lib/perl5 /usr/lib64/perl5 + +import os +import sys + +sys.path.insert(0, os.environ['HOME'] + '/hg/mirrorball') + +from conary.lib import util +sys.excepthook = util.genExcepthook() + +import copy +import logging + +from updatebot import log +from updatebot import bot +from updatebot import errors +from updatebot import config +from updatebot import conaryhelper + +from conary.deps import deps + +log.addRootLogger() + +slog = logging.getLogger('findprefixpackages') + +cfg = config.UpdateBotConfig() +cfg.read(os.environ['HOME'] + '/hg/mirrorball/config/%s/updatebotrc' % sys.argv[1]) + +prefixes = set(sys.argv[2:]) + +bot = bot.Bot(cfg) +helper = bot._updater._conaryhelper + +def findPrefixInPaths(pathSet): + for path in pathSet: + for prefix in prefixes: + if path.startswith(prefix): + return True + return False + +label = helper._ccfg.buildLabel +trvMap = helper._repos.getTroveLeavesByLabel({None: {label: None}}) +troveSpecList = [] +for troveName in sorted(trvMap.keys()): + for v in trvMap[troveName]: + for flv in trvMap[troveName][v]: + troveSpecList.append((troveName, v, flv)) + +reportedTroves = set() +for troveName, pathSet in helper._iterPathsByTrove(troveSpecList): + if troveName not in reportedTroves: + if findPrefixInPaths(pathSet): + print troveName + reportedTroves.add(troveName) diff --git a/updatebot/conaryhelper.py b/updatebot/conaryhelper.py --- a/updatebot/conaryhelper.py +++ b/updatebot/conaryhelper.py @@ -143,6 +143,24 @@ return latest + def _iterPathsByTrove(self, troveSpecList): + """ + Generates (name, set of paths) tuples representing the paths + contained in troves mentioned in the troveSpecList + @param troveSpecList: troves to inspect + @type troveSpecList: [(name, versionObj, flavorObj), ...] + @yield (name, frozenset(path, path, ...)) + """ + cl = [ (x, (None, None), (y, z), True) for x, y, z in troveSpecList ] + cs = self._client.createChangeSet(cl, withFiles=True, + withFileContents=False, + recurse=False) + for trvCs in cs.iterNewTroveList(): + trv = trove.Trove(trvCs) + paths = frozenset(path for _, path, _, _ in trv.iterFileList()) + if paths: + yield trv.name(), paths + def _getSourceTroves(self, troveSpec): """ Iterate over the contents of a trv to find all of source troves From elliot at rpath.com Thu Oct 29 18:30:51 2009 From: elliot at rpath.com (Elliot Peele) Date: Thu, 29 Oct 2009 22:30:51 +0000 Subject: mirrorball: add an example interface that needs to be implemented for advisory ordered Message-ID: <200910292230.n9TMUpMQ029323@scc.eng.rpath.com> changeset: cec0f8a436af user: Elliot Peele date: Thu, 29 Oct 2009 18:29:04 -0400 add an example interface that needs to be implemented for advisory ordered imports to work diff --git a/extra/advisory_interface.py b/extra/advisory_interface.py new file mode 100644 --- /dev/null +++ b/extra/advisory_interface.py @@ -0,0 +1,82 @@ +# +# Copyright (c) 2009 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. +# + +""" +This module is here as an example of the data model and interfaces that +mirrorball is looking for when importing and updating platforms in advisory +order. These are not meant as superclasses for any sort of implementation. The +variables and methods that are defined below must be available. +""" + + +class Package(object): + """ + Class to represent a package. + """ + + # List of channel objects that this package can be found in. + channels = [ Channel ] + + def getNevra(self): + """ + Returns a tuple of (name, epoch, version, release, arch) for + this package. + """ + +class Repository(object): + """ + Class to represent a repository. + """ + + # Unique key for the name of a repository. + label = str + + +class Advisory(object): + """ + Class to represent an errata or advisory. + """ + + # Date the advisory was issued in the following format. (format characters + # are defined in the python time module). '%Y-%m-%d %H:%M:%S' + issue_date = str + + # List of package objects. + packages = [ Package ] + + # Unique key for the advisory + advisory = str + + # Brief description of the advisory. + synopsis = str + +class AdvisoryManager(object): + def getRepositories(self): + """ + Returns a list of repository labels that have been fetched. + """ + + def iterByIssueDate(self): + """ + Yields Errata objects by the issue date of the errata. + """ + + def fetch(self): + """ + Retrieve all required advisory data. + + This is probably going to cache any data, probably in a database, that + is being fetched from the internet somewhere so that we don't cause + excesive load for anyone's servers. + """ From elliot at rpath.com Thu Oct 29 18:30:51 2009 From: elliot at rpath.com (Elliot Peele) Date: Thu, 29 Oct 2009 22:30:51 +0000 Subject: mirrorball: branch merge Message-ID: <200910292230.n9TMUpQR029341@scc.eng.rpath.com> changeset: c0edfd3a9cf1 user: Elliot Peele date: Thu, 29 Oct 2009 18:29:19 -0400 branch merge diff --git a/extra/advisory_interface.py b/extra/advisory_interface.py new file mode 100644 --- /dev/null +++ b/extra/advisory_interface.py @@ -0,0 +1,82 @@ +# +# Copyright (c) 2009 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. +# + +""" +This module is here as an example of the data model and interfaces that +mirrorball is looking for when importing and updating platforms in advisory +order. These are not meant as superclasses for any sort of implementation. The +variables and methods that are defined below must be available. +""" + + +class Package(object): + """ + Class to represent a package. + """ + + # List of channel objects that this package can be found in. + channels = [ Channel ] + + def getNevra(self): + """ + Returns a tuple of (name, epoch, version, release, arch) for + this package. + """ + +class Repository(object): + """ + Class to represent a repository. + """ + + # Unique key for the name of a repository. + label = str + + +class Advisory(object): + """ + Class to represent an errata or advisory. + """ + + # Date the advisory was issued in the following format. (format characters + # are defined in the python time module). '%Y-%m-%d %H:%M:%S' + issue_date = str + + # List of package objects. + packages = [ Package ] + + # Unique key for the advisory + advisory = str + + # Brief description of the advisory. + synopsis = str + +class AdvisoryManager(object): + def getRepositories(self): + """ + Returns a list of repository labels that have been fetched. + """ + + def iterByIssueDate(self): + """ + Yields Errata objects by the issue date of the errata. + """ + + def fetch(self): + """ + Retrieve all required advisory data. + + This is probably going to cache any data, probably in a database, that + is being fetched from the internet somewhere so that we don't cause + excesive load for anyone's servers. + """