From patchwork Wed Aug 17 12:48:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Tunnicliffe X-Patchwork-Id: 3484 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D800823F46 for ; Wed, 17 Aug 2011 12:48:15 +0000 (UTC) Received: from mail-ey0-f170.google.com (mail-ey0-f170.google.com [209.85.215.170]) by fiordland.canonical.com (Postfix) with ESMTP id AF9D3A18663 for ; Wed, 17 Aug 2011 12:48:14 +0000 (UTC) Received: by eyd10 with SMTP id 10so728114eyd.29 for ; Wed, 17 Aug 2011 05:48:14 -0700 (PDT) Received: by 10.213.29.147 with SMTP id q19mr1212268ebc.132.1313585294379; Wed, 17 Aug 2011 05:48:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.213.102.5 with SMTP id e5cs15959ebo; Wed, 17 Aug 2011 05:48:14 -0700 (PDT) Received: from mr.google.com ([10.216.238.87]) by 10.216.238.87 with SMTP id z65mr1466746weq.15.1313585294215 (num_hops = 1); Wed, 17 Aug 2011 05:48:14 -0700 (PDT) Received: by 10.216.238.87 with SMTP id z65mr1023346weq.15.1313585293903; Wed, 17 Aug 2011 05:48:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id h5si2861723wee.88.2011.08.17.05.48.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Aug 2011 05:48:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1QtfXZ-0004um-ET for ; Wed, 17 Aug 2011 12:48:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id 64281E0205 for ; Wed, 17 Aug 2011 12:48:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: linaro-image-tools X-Launchpad-Branch: ~linaro-image-tools/linaro-image-tools/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 408 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-image-tools/linaro-image-tools/trunk] Rev 408: Improve error reporting when linaro-fetch-image is passed a set of options that don't match any a... Message-Id: <20110817124813.27648.23309.launchpad@ackee.canonical.com> Date: Wed, 17 Aug 2011 12:48:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13697"; Instance="initZopeless config overlay" X-Launchpad-Hash: e4e631ca9830844cbfb1d8362bdc82c98870665c Merge authors: James Tunnicliffe (dooferlad) Related merge proposals: https://code.launchpad.net/~dooferlad/linaro-image-tools/improve_fetch_image_error_reporting/+merge/71393 proposed by: James Tunnicliffe (dooferlad) review: Approve - James Westby (james-w) ------------------------------------------------------------ revno: 408 [merge] committer: James Tunnicliffe branch nick: linaro-image-tools timestamp: Wed 2011-08-17 13:46:05 +0100 message: Improve error reporting when linaro-fetch-image is passed a set of options that don't match any available builds. User will now receive helpful information on what doesn't match up. modified: linaro_image_tools/fetch_image.py --- lp:linaro-image-tools https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk You are subscribed to branch lp:linaro-image-tools. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-image-tools/linaro-image-tools/trunk/+edit-subscription === modified file 'linaro_image_tools/fetch_image.py' --- linaro_image_tools/fetch_image.py 2011-08-15 16:57:07 +0000 +++ linaro_image_tools/fetch_image.py 2011-08-17 12:46:05 +0000 @@ -1383,6 +1383,8 @@ HW Pack: platform, hardware, date, build""" image_url = None hwpack_url = None + old_image = args['image'] + build_bits = None if(args['release_or_snapshot'] == "snapshot"): count = 0 @@ -1458,7 +1460,7 @@ else: break # Got a URL, go. - else: + elif args['release_or_snapshot'] == "release": image_url = self.get_url("release_binaries", [ ("image", args['image']), @@ -1471,14 +1473,86 @@ ("build", args['build']), ("platform", args['platform'])]) + else: + assert(0, "Unexpected args['release_or_snapshot']: {0}".format( + args['release_or_snapshot'])) + if(not image_url): # If didn't get an image URL set up something so the return line # doesn't crash image_url = [None] + if args['release_or_snapshot'] == "snapshot": + table = "snapshot_binaries" + else: + table = "release_binaries" + + if not (self.get_url(table, [("image", old_image)]) or + self.get_url(table, [("image", args['image'])])): + msg = "{0} does not match any OS indexed".format(old_image) + logging.error(msg) + + if args['release_or_snapshot'] == "snapshot": + if not self.get_url("snapshot_binaries", + [("date", build_bits[0])]): + msg = "Can not find requested OS on date {0}".format( + build_bits[0]) + logging.error(msg) + + elif not self.get_url("snapshot_binaries", + [("build", build_bits[1])]): + msg = "Can not find build {0} of requested OS".format( + build_bits[1]) + logging.error(msg) + + else: # Release... + if not self.get_url("release_binaries", + [("build", args['build'])]): + msg = "Can not find build {0} of selected OS".format( + args['build']) + logging.error(msg) + + if not self.get_url("release_binaries", + [("platform", args['platform'])]): + msg = "Can not find OS for platform {0}".format( + args['platform']) + logging.error(msg) + if(not hwpack_url): # If didn't get a hardware pack URL set up something so the return # line doesn't crash hwpack_url = [None] + table = None + if args['release_or_snapshot'] == "snapshot": + table = "snapshot_hwpacks" + build = build_bits[1] + + elif args['release_or_snapshot'] == "release": + table = "release_hwpacks" + build = args['build'] + + if not self.get_url(table, [("hardware", args['hwpack'])]): + msg = "{0} does not match any hardware pack indexed".format( + args['hwpack']) + logging.error(msg) + + if args['release_or_snapshot'] == "snapshot": + if not self.get_url("snapshot_hwpacks", + [("date", build_bits[0])]): + msg = "Hardware pack does not exist on date {0}".format( + build_bits[0]) + logging.error(msg) + + else: # Release... + if not self.get_url("release_hwpacks", + [("platform", args['platform'])]): + msg = "Hardware pack unavailable for platform {0}".format( + args['platform']) + + if not self.get_url(table, [("build", build)]): + msg = ("Build {0} doesn't exist for any hardware " + "pack indexed".format(build)) + logging.error(msg) + return(image_url[0], hwpack_url[0])