From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.10423.1587261059735027148 for ; Sat, 18 Apr 2020 18:50:59 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=HecA/g5e; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: nathaniel.l.desimone@intel.com) IronPort-SDR: 5BtGoOMvKNIf9arswLLGF5/rDkvQjAUaJ3+z/L5j2mIqdDKw/V/D7AlGPSpxikdG7BuYnO3zxQ fv19y+iYMJ1Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2020 18:50:58 -0700 IronPort-SDR: ZUk8JrZY2ot3SyL+Hlw0Qbruym+iwkqOJHsLtuGmw1SXAbg4QjdADuFBXQtoBMvKi2jk8o4xta TFJUbnqBRVhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,401,1580803200"; d="scan'208";a="272814627" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga002.jf.intel.com with ESMTP; 18 Apr 2020 18:50:58 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:50:55 -0700 Received: from FMSEDG001.ED.cps.intel.com (10.1.192.133) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:50:55 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.171) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 18 Apr 2020 18:50:55 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVm5sSD0JFg1RT7kinwPVl/TNXKmlyAS8hqDpNu68Wepj5oezbuHzv340VChQgnngga3QLphgs+orDfsSG4qPMKUkNzzQVeeiGIoa22ql1PcyZi88G2Rxc0BTHHrHMIGE+7Kj+uNtMWGZ9zKq4ub5hX66OiTZxi5TaetdAfzG0qeN829FWw/lxP+hVtwK5wIYXyc06k54Rs19NFVt6UL62gWeEQ14nLdvYvdXNvApp4KqGwjSm4n9/qaOxAz5TB+xiid9EVMVsdCHmEufmRz4X/+AKovFSN88zTo2XUvcDc6rMvfr8AcH3WEf871Bl7jJKn4xtYcJmVEbrCi1cYljw== 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=KyXeq7oJ7Z2ocFXVyydPtWwLg0c15BUjWVhXfzWVvQk=; b=X1eF1amWhBc0uDul6211fLjfuGWHW79wsuxPS2mWotreWxv/Yf9dENCVyEQjFl1HeMAIXr57aqZ/fk66/98tejDhU1TIR8unuoX2sowe/AEpY5J82hPax794aHDzDkOxzK6ise4dSFdxIVJk2y5mcC1Ka3yNqKcWYCJcJSoRZ+5LDaKqicAQrsjHa/fZeEYDdXVYWwC5IGU3XK/ZidoiLxAnpdFGF9kP+tmUeM5x8g2v/65QM86kbNJmZl6Ofm+D2HYZhCtDK1Lcxt4nVEyYr2vyNaTdqollY84jBX/t6DloA6QdqY18Rn76QUql8bLke7baAAAOXZnSv3ge1T3mOQ== 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=KyXeq7oJ7Z2ocFXVyydPtWwLg0c15BUjWVhXfzWVvQk=; b=HecA/g5eE6hYXDbwT1l9+GaXTZ2HihorBBHRv1dREbAHooxHkW4RIKyfE/T0+hiMJgwE1alFMRLlVYfWS9W1xM9aOWP3UOs5NsuLfznD9ofQbOCodb3rfW7nQiyj6dFXfvfuFd1UoR1e+z5mtDICvDQuQ/ujyKmJhsnIWVg4uk0= Received: from BL0PR11MB3489.namprd11.prod.outlook.com (2603:10b6:208:75::29) by BL0PR11MB3059.namprd11.prod.outlook.com (2603:10b6:208:30::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.29; Sun, 19 Apr 2020 01:50:52 +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:50:52 +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/szpg Date: Sun, 19 Apr 2020 01:50:52 +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: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzdkYWQ3NTItZGVlNy00NzdlLWIxZjUtMWY1NjY4NTI0NDM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoib1IrUWd5SEpmdEY4eEN1Tk5VdWo1WnlOaW5KTGFJZmFabFNoeklHTHNUMndDRW9TeEphamgySzRjRDE4MzFQQSJ9 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: b20e32f5-ccc8-42d8-f556-08d7e404178d x-ms-traffictypediagnostic: BL0PR11MB3059: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:252; 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)(366004)(136003)(376002)(346002)(396003)(39850400004)(71200400001)(55016002)(5660300002)(8936002)(81156014)(33656002)(2906002)(8676002)(86362001)(107886003)(4326008)(66476007)(53546011)(76116006)(52536014)(478600001)(186003)(9686003)(316002)(66446008)(64756008)(66556008)(66946007)(966005)(7696005)(6506007)(54906003)(110136005)(26005);DIR:OUT;SFP:1102; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: R4lDqDQXOPOtS0giXFAYVB0GVOyj90a+WdSO8nDAqZ7TBFb7n7nalT0L0P/L76to+ACDDrwrlJEYJiPjnyjYW7D52CqWkw8EU6zleFBsIxit6cRWRa+8z+iSIo6C70+fWxU5/a3KnW4o/wTT9m9sazlVzOggo3l7qxyVdlMIlqfCfpdfx6l6mCiiZGvv+Jb7MbcWWbtn1g/17dDeLD5Ml9V4MPaniL6I2qLF5xn0KFWAKuyf9Rjjgzq4EOEETNAwHS144crRpCm7mcJeRuLcXvZYnqbk/jM0KWzmOlsD+tsKV9NP2GmuCgPnPxRnx4PULlM4ZxitoM+bhihgtkaV/5dEiFsmjjwr62g/PA13k70PtMSuciCkQ6dTpRNw3ELBDXXl351+IA1A4RUz0Na0QK8OtIJ5g3AMaBrYHfOzP/zvyQynchT3y0R0pq2B6Ut3PbgP/b4p5/kF+6rvANo2DEqw75dGOymkMZYmkPHDzxogMBF+xpjvkS29JZ/KJfNcRV/9jx5WqdiHcvgV0TEqIA== x-ms-exchange-antispam-messagedata: h4Gmw7AuxDiCCAL2LTJWixvv8mFQEnBxAqCkGRElIySTdOK3rK5LJFRt2xmd/VQALxZT3wHuhF4N8sIGTMaVcPm1DLyTyMGEZD0Qwh9QBhvTYNsQZ+H4Q4xX6GUCtY2dDWRClqzGvLRHo1O2ZHa/YA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: b20e32f5-ccc8-42d8-f556-08d7e404178d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2020 01:50:52.0846 (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: 6MPP0XQAR51wvBEslpvuY1leANGrIStexJs7TL2R2PbS/2UdHa2Jbn6QwWGt+ubqcDPacAwPk9d0JZSYDWWO2YTbOuSNkwsiOka/ddeZXW0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3059 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 Pushed: https://github.com/tianocore/edk2-staging/commit/6964bf3d -----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