From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.1602.1589409209994526341 for ; Wed, 13 May 2020 15:33:30 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: ashley.e.desimone@intel.com) IronPort-SDR: 1HMHbX0WfLUt/v/39syWl44T9jzTE4Xx9Zmb+lKPsy39UhHq57jkxd0+Qzde4ohRRBnnltit9a 2YhFZ5Oztm6g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2020 15:33:29 -0700 IronPort-SDR: H+HcK7Th87ghz0/5wXp1ThdfEd7rmvVWdZ5sXFWkkuulcivzuoYY+lf7AfXwW2mp13t+tAGkqh +KBivb7OW7Gw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,389,1583222400"; d="scan'208";a="280654590" Received: from aedesimo-desk.amr.corp.intel.com ([10.212.87.126]) by orsmga002.jf.intel.com with ESMTP; 13 May 2020 15:33:27 -0700 From: "Ashley E Desimone" To: devel@edk2.groups.io Cc: Nate DeSimone , Puja Pandya , Erik Bjorge , Bret Barkelew , Prince Agyeman Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Only process the checkout command if a valid combo is used Date: Wed, 13 May 2020 15:33:20 -0700 Message-Id: <20200513223320.19904-1-ashley.e.desimone@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/checkout_command.py | 18 ++++++++++++------ edkrepo/commands/humble/checkout_humble.py | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 edkrepo/commands/humble/checkout_humble.py diff --git a/edkrepo/commands/checkout_command.py b/edkrepo/commands/checkout_command.py index 7d65eb8..bc8a080 100644 --- a/edkrepo/commands/checkout_command.py +++ b/edkrepo/commands/checkout_command.py @@ -14,8 +14,11 @@ import os # Our modules from edkrepo.commands.edkrepo_command import EdkrepoCommand, OverrideArgument -import edkrepo.commands.arguments.checkout_args as arguments -from edkrepo.common.common_repo_functions import checkout +import edkrepo.commands.arguments.checkout_args as arguments +import edkrepo.command.humble.checkout_humble as humble +from edkrepo.common.common_repo_functions import checkout, combination_is_in_manifest +from edkrepo.common.edkrepo_exception import EdkrepoInvalidParametersException +from edkrepo.config.config_factory import get_workspace_manifest class CheckoutCommand(EdkrepoCommand): @@ -25,17 +28,20 @@ class CheckoutCommand(EdkrepoCommand): def get_metadata(self): metadata = {} metadata['name'] = 'checkout' - metadata['help-text'] = arguments.COMMAND_DESCRIPTION + metadata['help-text'] = arguments.COMMAND_DESCRIPTION args = [] metadata['arguments'] = args args.append({'name' : 'Combination', 'positional' : True, 'position' : 0, 'required': True, - 'description' : arguments.COMBINATION_DESCRIPTION, - 'help-text' : arguments.COMBINATION_HELP}) + 'description' : arguments.COMBINATION_DESCRIPTION, + 'help-text' : arguments.COMBINATION_HELP}) args.append(OverrideArgument) return metadata def run_command(self, args, config): - checkout(args.Combination, args.verbose, args.override) + if combination_is_in_manifest(args.Combination, get_workspace_manifest()): + checkout(args.Combination, args.verbose, args.override) + else: + raise EdkrepoInvalidParametersException(humble.NO_COMBO) diff --git a/edkrepo/commands/humble/checkout_humble.py b/edkrepo/commands/humble/checkout_humble.py new file mode 100644 index 0000000..ec0ffc1 --- /dev/null +++ b/edkrepo/commands/humble/checkout_humble.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +# +## @file +# checkout_humble.py +# +# Copyright (c) 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +CHP_EXIT = 'Exiting without checkout out PIN data.' +NOT_FOUND = 'The selected PIN file was not found.' +MANIFEST_MISMATCH = ('The selected PIN file does not refer to the same project ' + 'as the local manifest file. {}'.format(CHP_EXIT)) +COMMIT_NOT_FOUND = 'The commit referenced by the PIN file does not exist. {}'.format(CHP_EXIT) +PIN_COMBO = 'Pin: {}' +COMBO_NOT_FOUND = ('Warning: The combo listed in PIN file: {} is no longer ' + 'listed in the project manifest file.') -- 2.16.2.windows.1