From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.1211.1587386970784181006 for ; Mon, 20 Apr 2020 05:49:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G9iipX+f; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587386969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2xP3jV91DD7wuni3g+kgWBUHIvtdu6NUYs8MxtKVJYU=; b=G9iipX+f46a7vf3q9R1zJDFRdZeb7mnt8R6Z9GI+SJJo/XeEHA8dQaYOALLpsgO4NrU57Y 2uuv2aGIgVB/RlykaBrM7UZ/qXt4y3XDcKXfoZrg6Fvq2Ix8HDdDM0XvakDOqL03Gz67wy /ETtWwCEvzfKxhZb74fBJ7B3SRPKz/E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-qilyzp2qMYOnR15aKcyx_g-1; Mon, 20 Apr 2020 08:49:25 -0400 X-MC-Unique: qilyzp2qMYOnR15aKcyx_g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 598558017FE; Mon, 20 Apr 2020 12:49:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-228.ams2.redhat.com [10.36.114.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D1835C1B2; Mon, 20 Apr 2020 12:49:22 +0000 (UTC) Subject: Re: [edk2-devel] FW: Discussion: Basetools a separate repo To: Matthew Carlson References: <734D49CCEBEEF84792F5B80ED585239D5C4FEF0B@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C500738@SHSMSX104.ccr.corp.intel.com> <734D49CCEBEEF84792F5B80ED585239D5C5019CE@SHSMSX104.ccr.corp.intel.com> Cc: devel@edk2.groups.io, ray.ni@intel.com, "Ard Biesheuvel (ARM address)" From: "Laszlo Ersek" Message-ID: <61ac21f0-cba3-c899-0e8c-6b633644ef9a@redhat.com> Date: Mon, 20 Apr 2020 14:49:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <734D49CCEBEEF84792F5B80ED585239D5C5019CE@SHSMSX104.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 04/17/20 03:40, Ni, Ray wrote: > From: Matthew Carlson > > Sent: Wednesday, April 15, 2020 4:42 AM > To: Ni, Ray >; Sean Brogan > > Subject: Discussion: Basetools a separate repo > > Hello Ray, > > I sent this to the discuss list on tianocore, but I think I'm moderated. > > ---- > > I'm looking to discuss the movement of the basetools folder in edk2 to a separate repo and treated as a separate python project. BaseTools used to live in a separate repo (with periodic syncs into edk2), and it was an endless source of misery for edk2. Introducing new basetools features (or fixing critical bugs in existing features), and putting those features to actual use in edk2 content, should be interleaved in a single shared git history. Note: this applies at the module (INF) and package (DEC) level too, not just at the platform (DSC / FDF) level. For example, whenever new syntax is added to DEC or INF, universal edk2 modules in MdePkg or MdeModulePkg have to delay their utilization of that syntax until BaseTools actually implements the syntax (and important bugs related to parsing the syntax are fixed as well). Right now this happens naturally, due to the shared history. If we wanted to separate BaseTools out again, the bare minimum would be a git submodule (not pip). Even that way, bisectability would take a big hit. And that problem -- lack of bisectability -- used to be the most painful issue with the original out-of-tree BaseTools too. (You'd get a multi-thousand line code drop with each sync, things would break, and you'd have no way of programmatically / mechanically narrowing down the issue.) I understand that strict CI may help prevent such issues, and that's good. But (a) it's still no substitute for git-bisect, and (b) a user should *really* not have to install pip whatever in order to locally build edk2 proper. I can see myself somehow stomaching this change if it is proposed as a git submodule. (I'm not trying to prevent "pip"; I'm trying to prevent "pip" from being the primary, or exclusive, interface to consuming basetools.) With a git submodule: - only git tools are needed for a local source tree setup, for an upstream user; - at least *some* historical accuracy is preserved between the two projects (as the superproject, i.e. edk2, will still record *some* basetools states via the submodule reference); - an upstream user will still be given the chance to hack on both basetools and specific INF/DEC files at the same time (e.g. for bug reproduction or feature/bugfix testing). With BaseTools being consumed via a git submodule in edk2, I'd insist on very frequent submodule advances in edk2 superproject -- practically every time "master" were moved in the basetools subproject (after every BaseTools merge), the submodule ref would have to be bumped in edk2. That's the only way we'd get a halfway functional substitute for git-bisect. Thanks Laszlo > Why a separate repo? > The recent efforts in expanding the role of CI in the platform and core code of EDK2 will pay big dividends in the future, leading to higher quality code and easier integrations for everyone. Having basetools as it's own repo would simplify adding a similar CI/linting process and unit-tests to the basetools python code, leading to higher quality code. > > A second major benefit is it would allow others that write tools for UEFI and Edk2 to leverage this vast resource of python code using standard python package inclusion. It would allow those tools to be decoupled from edk2 source and provide a consistent and managed user experience. The python project would be published as a Pip module for those that want to leverage the basetools modules the same way they leverage the existing python ecosystem. Packing basetools as a pip module, would reach the most developers and provide the most flexibility and versatility. There are numerous way this could be used; Pip is just one method suggested here. Other ways to leverage this are described below. > > Why a pip module? > The investment into basetools is sizable and it has some amazing functionality that's difficult to reproduce. For example, the DSC, FDF, INF, and DEC parsers handle an incredible amount of edge cases. If I wanted to write a tool that could do a CI validation check or build a UEFI capsule, currently I would need to clone all of EDK2 to get basetools. If it was in a separate repo and available as a wheel, as a developer, I could include it via pip and have that dependency managed with virtual environment or just in the global cache. In addition, other tools that currently are difficult to build would become possible with access to the Basetools functionality. > > However, there have been some concerns expressed about having a global basetools and the impact this has on developers with multiple workspaces (potentially at different versions). There are several tools and strategies to consider for managing this dependency. Some outlined below. > > How will this change your workflow? > If this moved there would have to be a change for all platforms using edk2 and we have been evaluating options. These could become requirements a developer must do before building edk2 or with minimal effort could be added to the edksetup or build scripts. These can also be more easily isolated if python virtual environments are used. > > For those just consuming released versions of basetools python code: > Option A: leverage Python package management and install a released version from Pypi into a per project virtual environment. > Option B: leverage pip to install from the git repo at known tag/release (pip_requirements) > > For those wanting to do active development of basetools within an edk2 project: > Option C: Clone the python package source and install the package locally (pip install -e ./). All changes made in the local package are reflected into your python site packages. > > > We have a demo of what this would look like: https://github.com/matthewfcarlson/edk2-pytool-base/ > And the EDK2 that leverages it https://github.com/matthewfcarlson/edk2/tree/feature/pip-basetools > > What happens next? > Right now, we're gathering feedback and seeing if anyone has an concerns or platforms that this would not work for. We'd love to hear what you have to say. Baring any serious concerns, we'd move forward with: > > 1. Create new GitHub repo on tianocore for the basetools project > 2. Develop the testing, PR, and release process > 3. Release the initial version to pypi > 4. Delete the source folder in edk2 repo and replace with readme and method to get pip version installed > 5. Continually improve basetools and add more testing > > What's the long-term plan? > The current tentative long term plan is to merge some or all of basetools in with the existing edk2-pytool-library repo. This is still an active conversation, and we'd like to hear your thoughts. > > Matthew Carlson > Core UEFI > Microsoft > > > > > >