From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.10303.1587260722764655223 for ; Sat, 18 Apr 2020 18:45:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=SOLyyS/k; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: 1L9LDeGpGjz41tDJbNt5ygmNtTK2Bst+RConK6oOd/jv4n3YVo+BsP/1BpQ2K9jS/BxLdBWEAE pXZKN19hzgbQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2020 18:45:21 -0700 IronPort-SDR: RMSUrTKpQHBaiQYRpY35KCmA3x3R0A8ML9S3TxQm2N88o7pIAacrJsJ6ZMEbQTAqWPxPKZOObQ AcK8i2L6FGiw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,401,1580803200"; d="scan'208";a="364676048" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 18 Apr 2020 18:45:20 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:45:20 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:45:19 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.175) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:45:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E9bR2WT/gtCDIT4XGNx7PDvkboQqUJYsFKdnKhdz5xBU8JpmcdxI87IFsYeBUEm+LHOhFhLKsv1TSHmPTOrCrkcVJmc+vjke0F9HK2LmL4kr2GLC6HLKycCOe5a8IyDbSwpFALnWf/Kz1CYa/LNbytHyjoVvG9X5Sm/lFBVErdcJ40bkekosZJYmL0w07O8Oizk2Eoi12z7cjqGW76ascDBNV0bVxE5RMsPd/28At+7QCFPn85GMjomLQ2EHMMvXJ33whEt528m7I3fSfgsgy7iwHC/MzTsRuvI6xqcpcqFQDqO4Q2GlqJJDjR325JMc4mzPSAPG4TiBrHKXvwyqVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zPe95l6i8isC5EkbK3BPPFMWtoHKfx/vOHcuruZs60c=; b=g7y3IK2wZtJ0YOqvEtS/vrSmlxQIliZac/+Wype3cILReH+vF+3nOTWG6W3Zd6NhUmTyfEz4h2b1GV1pg4s8zH/9J8fEBdKV5YWr47I/4eusflpn60tliFGcYg6K4t7OKHWsjOULJZbi8y1VJqgFjdKzrzikV8x632qgp9u0n+sxnGkk8TSea+StT793jggTMhdJD+a1BrF5wsxL4jFcKQr6Y6Inqfud1VQmUbkTrUqU3x8Db4guXzL9bjB3VQPeoQMwlNB/rNLqBiJmi3u23blftuEGnHsXfzGvXe9OlRkAfesosUxnMsmewtUhlz9GZObHai0sFVzGk2QRQSuxug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zPe95l6i8isC5EkbK3BPPFMWtoHKfx/vOHcuruZs60c=; b=SOLyyS/kpGzSEX9O2XStUmMuiInWmzKtZqmCYnIyZeqXd4GeZxKGc1oNZD/7eKcdepCBtdjZ/hDZ7oaDkzFBwZ9/X3jZXHszEJxvmUjNeWgYaBNGA3TycSHcpZdjYyktY7J55894eZ+sijcXTPLDSUumc0Mf2Z/GprhVM1+oL20= Received: from BL0PR11MB3489.namprd11.prod.outlook.com (2603:10b6:208:75::29) by BL0PR11MB2977.namprd11.prod.outlook.com (2603:10b6:208:7d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.18; Sun, 19 Apr 2020 01:45:17 +0000 Received: from BL0PR11MB3489.namprd11.prod.outlook.com ([fe80::d0f8:bfd7:bae2:3e42]) by BL0PR11MB3489.namprd11.prod.outlook.com ([fe80::d0f8:bfd7:bae2:3e42%7]) with mapi id 15.20.2900.030; Sun, 19 Apr 2020 01:45:17 +0000 From: "Nate DeSimone" To: "Desimone, Ashley E" , "devel@edk2.groups.io" CC: "Pandya, Puja" , "Bjorge, Erik C" , Bret Barkelew , "Agyeman, Prince" Subject: Re: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Resolve UnboundLocalError in edkrepo.sync Thread-Topic: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Resolve UnboundLocalError in edkrepo.sync Thread-Index: AQHWE1NTdlFOYNO7I0KuRJJAYNF666h/sZsQ Date: Sun, 19 Apr 2020 01:45:17 +0000 Message-ID: References: <20200415182513.35448-1-ashley.e.desimone@intel.com> In-Reply-To: <20200415182513.35448-1-ashley.e.desimone@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOTM4M2ZkMGMtYjcyYy00ZGU2LWI1NjEtMjkyMjk0ZmU4YTdlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiOUZPVkN2TmY2eHdKNzNad24rZ0xrbWVCZEV4NkJrd2RcL2loTXczRVF6UklOMmFKUGVFRVdtcmk2dlpxdmJxZWgifQ== dlp-reaction: no-action dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-ctpclassification: CTP_NT authentication-results: spf=none (sender IP is ) smtp.mailfrom=nathaniel.l.desimone@intel.com; x-originating-ip: [134.134.136.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a972ecdb-c053-4755-3cf3-08d7e403501e x-ms-traffictypediagnostic: BL0PR11MB2977: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2803; x-forefront-prvs: 0378F1E47A x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR11MB3489.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(376002)(39850400004)(346002)(396003)(366004)(136003)(86362001)(2906002)(8676002)(186003)(316002)(5660300002)(478600001)(52536014)(81156014)(7696005)(107886003)(8936002)(4326008)(6506007)(64756008)(26005)(53546011)(54906003)(110136005)(55016002)(9686003)(66946007)(71200400001)(33656002)(66446008)(76116006)(66556008)(66476007);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4uoKihaZ1iHUZSIk21lC7e34PyorKnu/kiWzQaGI+gRAQn2aTVkn8/Mz8E7c5nI0F1LXM997QnG4ULA5Hq2LbChrkNk0t7MMbmiJWcRKIY+UB4JJ9HrdL0U/EdcqKV/+SdymLWgzTaSMYg32YykW7UYh2+EOZMaG4rCK9YM6ZOAdhuaAum9S08zs4EP65IV3m3y3ormPTtt3hGSuQoIAt5y5Wbe/6UR8/JCpGyfxWEvHgPohflSZH94KPw7ERFgaiu81Hn/Ahkw3oCFwYmeVDuz9ne34MQPHHAFLcbvkl1+4xnlCEuXso1fXt0DWQwJHKHz8DYXR698dBDlHGKPsxhIut3l5PeZu+FtGeN6GDiYZNguXgo4/KwmCEYRmgXV+d1b6o5PgRWCif8CdgWwWhQhA5I2B71nxWesNygXIf4V7lmhQqGCUIk6BfVycIIKa x-ms-exchange-antispam-messagedata: gPDGRtLehsI4FedkgsYlKJAxNWum4EM83oJGfHGwSMQBeum2WcaB6yNDf7cBFIYSUQTJbIQ0wntbdKIVYWW02dw2yO2dfFEyxLjHEG0WS2cyrh6HpFtlLnc2Euk2waVdz28Gtk//1H8UGmkn4gC9ug== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a972ecdb-c053-4755-3cf3-08d7e403501e X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2020 01:45:17.5858 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2NIj++8D5MKQxK8lF8mEvW27wmTbHZ1QCYD5Y7Lcteg/xHxKv4dDNGcyZFmqwOTr6CuX8hnM4uLs9MA2FlX+ea7HzddaL7qMsckDFVofHqo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB2977 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: Desimone, Ashley E =20 Sent: Wednesday, April 15, 2020 11:25 AM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Pandya, Puja ; Bjorge, Erik C ; Bret Barke= lew ; Agyeman, Prince Subject: [edk2-staging/EdkRepo] [PATCH] EdkRepo: Resolve UnboundLocalError = in edkrepo.sync Fix: 'Error: local variable 'repo_sources_to_sync' referenced before assignment' by adding the case where it is populated base= d on the current combo when not using the -u flag. Signed-off-by: Ashley E Desimone Cc: Nate DeSimone Cc: Puja Pandya Cc: Erik Bjorge Cc: Bret Barkelew Cc: Prince Agyeman --- edkrepo/commands/sync_command.py | 58 +++++++++++++++++++++---------------= ---- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/edkrepo/commands/sync_command.py b/edkrepo/commands/sync_comma= nd.py index 7e4c89d..cb9dc4b 100644 --- a/edkrepo/commands/sync_command.py +++ b/edkrepo/commands/sync_command.py @@ -29,7 +29,7 @@ from edkrepo.common.humble import SYNC_MANIFEST_DIFF_WARN= ING, SYNC_MANIFEST_UPDA from edkrepo.common.humble import SPARSE_RESET, SP= ARSE_CHECKOUT, SYNC_REPO_CHANGE, SYNCING, FETCHING, UPDATING_MANIFEST from= edkrepo.common.humble import NO_SYNC_DETACHED_HEAD, SYNC_COMMITS_ON_MASTER= , SYNC_ERROR from edkrepo.common.humble import MIRROR_BEHIND_PRIMARY_REPO,= SYNC_NEEDS_REBASE, INCLUDED_FILE_NAME -from edkrepo.common.humble import S= YNC_BRANCH_CHANGE_ON_LOCAL, SYNC_INCOMPATIBLE_COMBO +from edkrepo.common.humble import SYNC_BRANCH_CHANGE_ON_LOCAL,=20 +SYNC_INCOMPATIBLE_COMBO from edkrepo.common.humble import SYNC_REBASE_CALC_FAIL from edkrepo.comm= on.pathfix import get_actual_path from edkrepo.common.common_repo_function= s import pull_latest_manifest_repo, clone_repos, sparse_checkout_enabled @@= -104,15 +104,17 @@ class SyncCommand(EdkrepoCommand): if args.update_local_manifest: #NOTE: hyphens in arg name replaced= with underscores due to argparse self.__update_local_manifest(args, config, initial_manifest, w= orkspace_path) manifest =3D get_workspace_manifest() - if args.update_local_manifest: - try: - repo_sources_to_sync =3D manifest.get_repo_sources(current= _combo) - except ValueError: - # The manifest file was updated and the initial combo is n= o longer present so use the default combo - current_combo =3D manifest.general_config.default_combo - repo_sources_to_sync =3D manifest.get_repo_sources(current= _combo) + if args.update_local_manifest: + try: + repo_sources_to_sync =3D manifest.get_repo_sources(current= _combo) + except ValueError: + # The manifest file was updated and the initial combo is n= o longer present so use the default combo + current_combo =3D manifest.general_config.default_combo + repo_sources_to_sync =3D manifest.get_repo_sources(current= _combo) + else: + repo_sources_to_sync =3D=20 + manifest.get_repo_sources(current_combo) manifest.write_current_combo(current_combo) - + sync_error =3D False # Calculate the hooks which need to be updated, added or removed f= or the sync if args.update_local_manifest: @@ -218,26 +220,26 @@ class SyncCommand(EdkrepoCommand): ci_index_xml_rel_path =3D os.path.normpath(ci_index_xml.get_projec= t_xml(initial_manifest.project_info.codename)) global_manifest_path =3D os.path.join(global_manifest_directory, c= i_index_xml_rel_path) new_manifest_to_check =3D ManifestXml(global_manifest_path) - - # Does the current combo exist in the new manifest? If not check t= o see if you can use the repo sources from - # the default combo - initial_combos =3D combinations_in_manifest(initial_manifest) - new_combos =3D combinations_in_manifest(new_manifest_to_check) - if (current_combo not in new_combos) or (set(new_combos) !=3D set(= initial_combos)): - if initial_manifest.get_repo_sources(current_combo) =3D=3D new= _manifest_to_check.get_repo_sources(new_manifest_to_check.general_config.de= fault_combo): - new_sources_for_current_combo =3D new_manifest_to_check.ge= t_repo_sources(new_manifest_to_check.general_config.default_combo) - new_sources =3D new_sources_for_current_combo - else: - # Since asymetric combinations are not supported error out= with an IMCOMPATIBLE_COMBO warning - print(SYNC_COMBO_CHANGE.format(current_combo, initial_mani= fest.project_info.codename)) - raise EdkrepoManifestChangedException(SYNC_INCOMPATIBLE_CO= MBO) - else: - new_sources_for_current_combo =3D new_manifest_to_check.get_re= po_sources(current_combo) - new_sources =3D new_manifest_to_check.get_repo_sources(current= _combo) - + + # Does the current combo exist in the new manifest? If not check t= o see if you can use the repo sources from + # the default combo + initial_combos =3D combinations_in_manifest(initial_manifest) + new_combos =3D combinations_in_manifest(new_manifest_to_check) + if (current_combo not in new_combos) or (set(new_combos) !=3D set(= initial_combos)): + if initial_manifest.get_repo_sources(current_combo) =3D=3D new= _manifest_to_check.get_repo_sources(new_manifest_to_check.general_config.de= fault_combo): + new_sources_for_current_combo =3D new_manifest_to_check.ge= t_repo_sources(new_manifest_to_check.general_config.default_combo) + new_sources =3D new_sources_for_current_combo + else: + # Since asymetric combinations are not supported error out= with an IMCOMPATIBLE_COMBO warning + print(SYNC_COMBO_CHANGE.format(current_combo, initial_mani= fest.project_info.codename)) + raise EdkrepoManifestChangedException(SYNC_INCOMPATIBLE_CO= MBO) + else: + new_sources_for_current_combo =3D new_manifest_to_check.get_re= po_sources(current_combo) + new_sources =3D=20 + new_manifest_to_check.get_repo_sources(current_combo) + remove_included_config(initial_manifest.remotes, initial_manifest.= submodule_alternate_remotes, local_manifest_dir) write_included_config(new_manifest_to_check.remotes, new_manifest_= to_check.submodule_alternate_remotes, local_manifest_dir) - + self.__check_submodule_config(workspace_path, new_manifest_to_chec= k, new_sources_for_current_combo) new_manifest_remotes =3D {name:url for name, url in new_manifest_t= o_check.remotes} #check for changes to remote urls @@ -245,7 +247,7 @@ class SyncCo= mmand(EdkrepoCommand): if remote_name in new_manifest_remotes.keys(): if initial_manifest_remotes[remote_name] !=3D new_manifest= _remotes[remote_name]: raise EdkrepoManifestChangedException(SYNC_URL_CHANGE.= format(remote_name)) - + # Check that the repo sources lists are the same. If they are not = the same and the override flag is not set, throw an exception. if not args.override and set(initial_sources) !=3D set(new_sources= ): raise EdkrepoManifestChangedException(SYNC_REPO_CHANGE.format(= initial_manifest.project_info.codename)) -- 2.16.2.windows.1