All pastes #1051804 Raw Edit

dirk

public diff v1 · immutable
#1051804 ·published 2008-06-20 09:20 UTC
rendered paste body
Index: clientlib/python/osc/osc/babysitter.py===================================================================--- clientlib/python/osc/osc/babysitter.py	(Revision 4150)+++ clientlib/python/osc/osc/babysitter.py	(Arbeitskopie)@@ -62,6 +62,10 @@ def run(prg):         print >>sys.stderr, 'aborted.'         return 1 +    except oscerr.APIError, e:+        print >>sys.stderr, 'BuildService API error:', e.msg+        return 1+     except oscerr.UnreadableFile, e:         print >>sys.stderr, e.msg         return 1Index: clientlib/python/osc/osc/fetch.py===================================================================--- clientlib/python/osc/osc/fetch.py	(Revision 4150)+++ clientlib/python/osc/osc/fetch.py	(Arbeitskopie)@@ -5,7 +5,7 @@ # and distributed under the terms of the GNU General Public Licence, # either version 2, or (at your option) any later version. -import sys, os+import sys, os, tempfile import urllib2 from urlgrabber.grabber import URLGrabber, URLGrabError from urlgrabber.mirror import MirrorGroup@@ -173,7 +173,7 @@ def verify_pacs(pac_list):                 print >>sys.stderr, """ - If the key is missing, install it first.   For example, do the following:-    gpg --keyserver pgp.mit.edu --recv-keys %(name)s+    gpg --recv-keys %(name)s     gpg --armor --export %(name)s > %(dir)s/keyfile-%(name)s   and, as root:     rpm --import %(dir)s/keyfile-%(name)s@@ -182,7 +182,8 @@ def verify_pacs(pac_list):  - If the key is unavailable, you may use --no-verify (which may pose a risk). """ % {'name': missing_key, -       'dir': os.path.expanduser('~')}+       'dir': tempfile.gettempdir()}+              else:                 print >>sys.stderr, """Index: clientlib/python/osc/osc/oscerr.py===================================================================--- clientlib/python/osc/osc/oscerr.py	(Revision 4150)+++ clientlib/python/osc/osc/oscerr.py	(Arbeitskopie)@@ -23,6 +23,12 @@ class ConfigError(OscBaseError):         OscBaseError.__init__(self)         self.msg = msg +class APIError(OscBaseError):+    """Exception raised when there is an error in the output from the API"""+    def __init__(self, msg):+        OscBaseError.__init__(self)+        self.msg = msg+ class NoConfigfile(OscBaseError):     """Exception raised when osc's configfile cannot be found"""     def __init__(self, fname, msg):Index: clientlib/python/osc/osc/build.py===================================================================--- clientlib/python/osc/osc/build.py	(Revision 4150)+++ clientlib/python/osc/osc/build.py	(Arbeitskopie)@@ -14,6 +14,7 @@ from tempfile import NamedTemporaryFile from osc.fetch import * from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig import osc.conf+import oscerr try:     from xml.etree import cElementTree as ET except ImportError:@@ -24,13 +25,15 @@ from conf import config change_personality = {             'i686': 'linux32',             'i586': 'linux32',+            'i386': 'linux32',             'ppc': 'powerpc32',             's390': 's390',         }  can_also_build = { -             'x86_64': ['i686', 'i586'],+             'x86_64': ['i686', 'i586', 'i386'],              'i686': ['i586'],+             'i386': ['i586'],              'ppc64': ['ppc'],              's390x': ['s390'],             }@@ -82,12 +85,23 @@ class Buildinfo:          self.deps = []         for node in root.findall('bdep'):-            p = Pac(node.get('name'),-                    node.get('version'),-                    node.get('release'),+            p_name = node.get('name')+            p_arch = node.get('arch')+            if not p_arch:+                p_arch = self.buildarch+            p_version = node.get('version')+            p_release = node.get('release')++            if not (p_name and p_arch and p_version and p_release):+                raise oscerr.APIError(+                    "buildinfo for package %s/%s/%s/%s is incomplete" % (p_name, p_arch, p_version, p_release))++            p = Pac(p_name,+                    p_version,+                    p_release,                     node.get('project'),                     node.get('repository'),-                    node.get('arch'),+                    p_arch,                     node.get('preinstall'),                     node.get('runscripts'),                     self.buildarch,       # buildarch is used only for the URL to access the full tree...@@ -390,7 +404,9 @@ def main(opts, argv):         # change personality, if needed         if bi.buildarch in can_also_build.get(hostarch, []):             cmd = change_personality[bi.buildarch] + ' ' + cmd-+        else:+            print >>sys.stderr, 'Error: hostarch \'%s\' cannot build \'%s\'.' % (hostarch, bi.buildarch)+            return 1      print cmd     rc = os.system(cmd)