Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2986 ecc check remove git revert v2 #2216

Merged

Conversation

mdkinney
Copy link
Member

@mdkinney mdkinney commented Nov 23, 2021

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986


New in V2

  • Change temp directory path from Build/ecctemp to
    Build/.pytool/Plugin/EccCheck to provide a unique
    temp directory location for any .pytool Plugin.
  • Set working directory when ECC runs to temp directory
    to guarantee all temp files created by EccCheck are
    cleaned up.

  • Use temp directory for all operations to prevent any
    changed to git state.
  • Remove git reset operation that could corrupt staged
    and local changes.
  • Improve performance by removing redundant directory scans
  • Improve performance and reduce log file sizes by using
    --output option of git diff to a temp file instead of
    using stdout.

Cc: Sean Brogan sean.brogan@microsoft.com
Cc: Bret Barkelew Bret.Barkelew@microsoft.com
Cc: Liming Gao gaoliming@byosoft.com.cn
Cc: Michael Kubacki michael.kubacki@microsoft.com
Signed-off-by: Michael D Kinney michael.d.kinney@intel.com

@mdkinney mdkinney force-pushed the Bug_2986_EccCheckRemoveGitRevert_V2 branch from e96e43a to a2f771f Compare Nov 26, 2021
mdkinney added 3 commits Nov 29, 2021
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986

The RevertCode() method uses git reset which can remove
local changes. Instead of modifying the local files, a
copy of the package passed into the EccCheck tool is
copied to a temp directory in Build/ecctemp.  This same
temp directory is also used for exception.xml. The working
directory used by ECC is also set to this same temp
directory. The combination of these changes eliminates
operations that that modified the git state.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986

Add try/except to RunBuildPlugin() to remove temporary
directory if a KeyboardInterrupt exception or an unexpected
exception is detected.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2986

Improve the performance of EccCheck by using a temp file
instead of stdout to capture the results of the git diff
commands. If a large patch set is passed into EccCheck,
using stdout could be slow and also added the large diff
content to the build log that is redundant information.

A second performance improvement is to filter the
modified directories to remove duplicate directories.
Complex libraries and modules that have subdirectories
with sources would be scanned twice if there were source
changes in both the main directory and subdirectories.
Filter out the subdirectories from the modified directory
list when this case is detected.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
@mdkinney mdkinney force-pushed the Bug_2986_EccCheckRemoveGitRevert_V2 branch from a2f771f to 0603fd2 Compare Nov 29, 2021
@mdkinney mdkinney added the push label Nov 29, 2021
@mergify mergify bot merged commit 3019f1b into tianocore:master Nov 29, 2021
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push
Projects
None yet
1 participant