summaryrefslogtreecommitdiffstats
path: root/BaseTools/Scripts/PatchCheck.py
Commit message (Collapse)AuthorAgeFilesLines
* BaseTools/Scripts: Fix PatchCheck commit rangeMichael D Kinney9 days1-2/+0
| | | | | | | Fix logic error that changes the commit range checked depending on the verbosity level set. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools/Scripts: Remove Cc: tag check from PatchCheck.pyMichael D Kinney2024-05-281-2/+0
| | | | | | | | | The commit message format requirements have been updated for GitHub PR based code reviews and no longer required Cc: tags for the maintainers and reviewers. Remove the Cc: tag check from PatchCheck.py. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools/Scripts/PatchCheck: Error if commit modifies multiple packagesMichael D Kinney2024-02-271-1/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4679 Update PatchCheck.py to evaluate all the files modified in each commit and generate an error if: * A commit adds/modifies files in multiple package directories * A commit adds/modifies files in multiple non-package directories * A commit adds/modifies files in both a package and a non-package directory * A commit deletes files from multiple package directories * A commit deletes files from multiple non-package directories * A commit deletes files from both a package and a non-package directory Modifications to files in the root of the repository are not evaluated. This check is skipped if PatchCheck.py is run on a patch file or input from stdin because this multiple package commit check depends on information from a git repository. If --ignore-multi-package option is set, then reduce the multiple package commit check from an error to a warning for all commits in the commit range provided to PatchCheck.py. Add check for a 'Continuous-integration-options:' commit message tag that allows one or more options to be specified at the individual commit scope to enable/disable continuous integration checks. This tag must start at the beginning of a commit message line and may appear more than once in a commit message. Add support for a Continuous-integration-options tag value of 'PatchCheck.ignore-multi-package' that reduces the multiple package commit check from an error to a warning for the specific commits that specify this option. Example: Continuous-integration-options: PatchCheck.ignore-multi-package The set of packages are found by searching for DEC files in a git repository. The list of DEC files in a git repository is collected with the following git command: git ls-files *.dec The set of files added/modified by each commit is found using the following git command: git diff-tree --no-commit-id --name-only --diff-filter=AM -r <commit> The set of files deleted by each commit is found using the following git command: git diff-tree --no-commit-id --name-only --diff-filter=D -r <commit> Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* BaseTools/Scripts/PatchCheck: Error if no Cc tags are presentMichael D Kinney2024-02-271-2/+4
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4694 If no Cc tags are detected in a commit message, then generate an error. All patches sent for review are required to provide the set of maintainers and reviewers responsible for the directories/files modified. The set of maintainers and reviewers are documented in Maintainers.txt and can be retrieved using the script BaseTools/Scripts/GetMaintainer.py. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* BaseTools/Scripts/PatchCheck: Return CommitMessageCheck errorsMichael D Kinney2024-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4693 Commit signatures are checked and error messages are logged but errors are not captured and returned from find_signatures() in the CommitMessageCheck class. This causes signature errors to be silently ignored by CI. Update logic in CommitMessageCheck class to return errors detected in commit message signatures. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* BaseTools/Scripts/PatchCheck: Update Author checksMichael D Kinney2024-02-271-1/+5
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4680 * Reject patches that match Author email "devel@edk2.groups.io" * Update the current check for " via Groups.Io" to perform a case insensitive match. It appears that groups.io has changed the format of this string to use all lower case. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* BaseTools/Scripts/PatchCheck.py: Check for Change-idPierreGondois2024-02-041-1/+17
| | | | | | | | | | | | | | | | Code review tools like gerrit might use a 'Change-id' tag to track the evolution of patches. This tag should be removed before submitting a patch to the mailing-list. It has been observed that contributors sometimes forget to remove this tag. Add a check in PatchCheck.py to automate this. Also add a '--ignore-change-id' command line parameter to ignore the above check. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Acked-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
* BaseTools: Update PatchCheck.py to allow whitespace issues in .rtf filesRebecca Cran2023-11-061-1/+4
| | | | | | | | | | Allow .rtf files created by applications such as Notepad to be committed as-is without further manual editing by skipping the requirements for CRLF, no tabs and no trailing whitespace. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Laszlo Ersek <lersek@redhat.com>
* BaseTools: Update PatchCheck.py to check for __FUNCTION__Rebecca Cran2023-04-141-0/+6
| | | | | | | | | New code should use the C99 macro __func__ instead of the pre-Standard macro __FUNCTION__. Update PatchCheck.py to reject patches with the latter. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* BaseTools/PatchCheck.py: Add PCCTS to tab exemption listMichael Kubacki2023-04-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Purdue Compiler Construction Tool Set (PCCTS) source code was copied/ pasted into BaseTools/Source/C/VfrCompile/Pccts/. The code contains tab characters instead of spaces. PatchCheck.py gives an error on modifications to files that contain tabs. The goal of my upcoming change there is not to mix tabs and spaces but to fix a bug while preserving its current formatting characters. This change adds that directory to the pre-existing list of directories in which tab checks are ignored in PatchCheck.py and also updates the check for makefiles to check for *.makefile: this allows {header,footer,app,lib}.makefile in BaseTools/Source/C/Makefiles to be detected and avoid having PatchCheck.py complain about tab characters. The check for "Makefile" is updated to be case-insensitive since there are some Makefiles named 'makefile' instead of 'Makefile'. Co-authored-by: Rebecca Cran <rebecca@bsdio.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
* BaseTools: Remove CYGWIN_NT-5.1-i686 ref from Scripts/PatchCheck.pyRebecca Cran2023-01-301-1/+0
| | | | | | | | | | | With the removal of RVCT support and the related Bin/CYGWIN_NT-5.1-i686 and Darwin-i386 directories, remove a leftover reference to CYGWIN_NT-5.1-i686 from Scripts/PatchCheck.py. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Scripts/PatchCheck.py: Allow tab in MakefileBob Feng2022-10-221-0/+3
| | | | | | | | | | | | | The syntax for Makefiles requires that indented lines s tart with a tab, but not a space. This change of PatchCheck.py make the patch for Makefile/GNUmakefile pass the PatchCheck.py. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools/Scripts: Ignore Mergify merge commits in PatchCheck.pyMichael D Kinney2021-07-091-6/+12
| | | | | | | | | | | | | | | | Mergify adds merge commits to a PR when processing PRs using the queue feature with auto rebase. Update PatchCheck.py to ignore commit message issues with these merge commits. These merge commits are not added to the base branch when the PR is merged by Mergify. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Use pip module if available, CI uses it by defaultMatthew Carlson2021-02-091-0/+1
| | | | | | | | | | | | | | | Use the new edk2-basetools pip module. Includes a helpful message in setup to let users know which has been selected. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei <Chen<yuwei.chen@intel.com> Signed-off-by: Matthew Carlson <matthewfcarlson@gmail.com>
* Revert "BaseTools/PatchCheck.py: Add LicenseCheck"Leif Lindholm2020-07-311-50/+0
| | | | | | | | | | | | | This reverts commit a4cfb842fca9693a330cb5435284c1ee8bfbbace. This commit suggests inclusion of non-edk2+license content without a contribution agreement is something the community has made a decision on, which is incorrect. Cc: Shenglei Zhang <shenglei.zhang@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif@nuviainc.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Scripts: Ignore the CRLF check when upgrade submodule.Jiang, Guomin2020-07-241-1/+1
| | | | | | | | | | | If the submodule is upgraded, skip the CRLF check as it isn't change for file. Signed-off-by: Guomin Jiang <guomin.jiang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PatchCheck.py: Skip length check for user name in xxx-byShenglei Zhang2020-07-201-1/+8
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2836 Current PatchCheck.py checks each line to ensure line's length is not larger than 76. But there's a case that length of user's name is much longer than that number. So enhance the script to handle this case. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: explicitly import email.header PatchCheck.pyLeif Lindholm2020-07-031-0/+2
| | | | | | | | | | | | | | | | | | | | | On Debian 10 (Buster), when running PatchCheck.py with python2, a backtrace is printed, starting from: File "../edk2/BaseTools/Scripts/PatchCheck.py", line 595, in find_patch_pieces parts = email.header.decode_header(pmail.get('subject')) AttributeError: 'module' object has no attribute 'header' When using python3, this backtrace does not appear. Explicitly importing email.header resolves this for python2 and does not appear to cause any issues with python3. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif@nuviainc.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PatchCheck.py: add exception for diff orderfileLeif Lindholm2020-07-031-4/+5
| | | | | | | | | | | | | | | SetupGit.py adds BaseTools/Conf/diff.order as a diff orderfile, but that file currently has CRLF line endings, which causes all pattern matches to fail and the ordering remaining unaffected. Add an exception to PatchCheck.py (to the existing .gitmodules clause), so that we can merge the fix to the config file. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif@nuviainc.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: PatchCheck: Exclude bash scripts from CRLF checkPierre Gondois2020-07-021-1/+7
| | | | | | | | | | | | | | | | | | | Bash scripts require LF line endings to work. PatchCheck.py checks that the files added in a patch have CRLF line endings. It excludes files ending with the ".sh" extension from this check. Some bash script don't have a ".sh" extension. Most of them are located in: - BaseTools/BinWrappers/PosixLike/ - BaseTools/Bin/CYGWIN_NT-5.1-i686/ This patch excludes these folder plus BaseTools/BuildEnv from this CRLF check. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PatchCheck.py: Add LicenseCheckShenglei Zhang2020-06-121-0/+50
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2691 For files to be added to the tree, this feature will check whether it has BSD plus patent license. If not, licenses listed in Readme are also accepted but warning will be reported. Otherwise, it should be error. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Scripts/PatchCheck.py: Do not use mailmapPhilippe Mathieu-Daude2020-02-061-2/+4
| | | | | | | | | | | | | | | We check the author/committer name/email are properly displayed since commits 8ffa47fb3ab..c0328cf3803. However if PatchCheck.py uses the mailmap, it will check sanitized names/emails. Use the --no-use-mailmap option so PatchCheck.py will check unsanitized input. Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Scripts/PatchCheck.py: Detect emails rewritten by Groups.IoPhilippe Mathieu-Daude2020-02-061-0/+4
| | | | | | | | | | | | | Due to strict DMARC / DKIM / SPF rules, Groups.Io sometimes rewrite the author email. See for example commit df851da3ceff5b6bcf5e12616. Add a check to detect these rewrites with PatchCheck.py. Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/Scripts/PatchCheck.py: Remove submodule false positivesMichael D Kinney2020-01-241-2/+21
| | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2484 https://bugzilla.tianocore.org/show_bug.cgi?id=2485 Update PatchCheck to not enforce no tabs and not enforce CR/LF line endings for .gitmodules files. These files are updated by git when a git submodule command is used and the updates by git use tab characters and LF line endings. Also update patch check to not enforce CR/LF line endings for patch lines that create a submodule directory. These patch lines use LF line endings. The git submodule directory is added as a new file with attributes 160000 that can be detected by looking for the pattern "new file mode 160000". Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* BaseTools/Scripts/PatchCheck: Address false error conditionsMichael D Kinney2020-01-131-6/+51
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2406 * Always print subject line after the git commit id to make it easier to know the context of warnings or errors. * Allow UTF-8 characters in subject line * Error if subject line length > 75 without CVE-xxx-xxxxx present * Error if subject line length > 92 with CVE-xxxx-xxxxx present * If body line length is > 75, then print warning instead of error. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com>
* BaseTools/PatchCheck.py: Check the patch author email addressPhilippe Mathieu-Daude2020-01-101-1/+6
| | | | | | | | | | | | | | | | | | To avoid patches committed with incorrect email address, use the EmailAddressCheck class on the author email too. Example: $ python BaseTools/Scripts/PatchCheck.py 1a04951309f Checking git commit: 1a04951309f The 'Author' email address is not valid: * The email address cannot contain a space: /o=Intel/ou=External \ (FYDIBOHF25SPDLT)/cn=Recipients/cn=fe425ca7e5f4401abed22b904fe5d964 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/PatchCheck.py: Let EmailAddressCheck describe email checkedPhilippe Mathieu-Daude2020-01-101-3/+7
| | | | | | | | | | | We are checking different emails from the signature list. We are going to check more. To be able to differency, add a description field, so the error reported is clearer. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/PatchCheck.py: Check the committer email addressPhilippe Mathieu-Daude2020-01-101-0/+6
| | | | | | | | | | To avoid patches committed with incorrect email address, use the EmailAddressCheck class on the committer email too. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/PatchCheck.py: Extract email check code to EmailAddressCheckPhilippe Mathieu-Daude2020-01-101-29/+54
| | | | | | | | | | As we are going to reuse this code out of the CommitMessageCheck class, extract it in a new class: EmailAddressCheck. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/PatchCheck.py: Ignore CR and LF characters in subject lengthPhilippe Mathieu-Daud?2020-01-091-1/+1
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=113 Strip the trailing characters before checking the subject line is less than 72 characters. Fixes: e61406708c83f Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools/PatchCheck: Disable text conversion in 'git show'Michael D Kinney2019-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2044 'git show' is used to extract the patch contents for analysis. Add the flag '--no-textconv' to the 'git show' command to disable the conversion from some binary file types to text content. Without this change, binary files such as .pdf files are converted to text in the show command and PatchCheck complains that the wrong line endings are used in the patch. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com>
* BaseTools/PatchCheck: Add copy from/to keywordsMichael D Kinney2019-08-071-0/+2
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2044 When files are very similar, git will copy an existing file to a new location and then apply differences. This is operation identified in the diff with 'copy from' and 'copy to' lines that need to be ignored. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools/PatchCheck: Ignore blank lines in diffMichael D Kinney2019-08-071-0/+3
| | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2044 When fixes are made for incorrect line endings, there are cases where the diff contains blank lines. Ignore these blank lines. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools/PatchCheck: Generate error if Contributed-under foundMichael D Kinney2019-04-091-8/+11
| | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1655 With the change to BSD+Patent License, the TianoCore Contributor's Agreement has been removed and as a result, a Contributed-under tag is no longer appropriate in patches. Remove the check for the TianoCore Contributor's Agreement and instead, generate an error if a patch contains a Contributed-under tag in the commit message. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-8/+1
| | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PatchCheck.py: Fix error when run with Python3Dandan Bi2018-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1145 Currently run PatchCheck.py with Python3 will meet following error: ..... File "PatchCheck.py", line 554, in run_git return Result[0].decode('utf-8', 'ignore') if Result[0] and Result[0].find("fatal")!=0 else None TypeError: a bytes-like object is required, not 'str' This issue was introduce by commit:5ac4548cdf654. This patch is to convert the str object of "fatal" to byte object to fix this failure. Cc: Liming Gao <liming.gao@intel.com> Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* PatchCheck - add error message for invalid parameterJaben Carsey2018-08-081-3/+6
| | | | | | | | | | | | Currently if an invalid parameter is passed, it gives a stack trace. This changes it to an error message. Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com> Tested-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Adjust the spaces around commas and colonsGary Lin2018-06-271-1/+1
| | | | | | | | | | Based on "futurize -f lib2to3.fixes.fix_ws_comma" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/PatchCheck: Support Contribution Agreement 1.1Michael D Kinney2017-08-031-3/+6
| | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=628 Update PatchCheck.py to support either "Contributed-under: TianoCore Contribution Agreement 1.0" or "Contributed-under: TianoCore Contribution Agreement 1.1" in the commit message. Temporarily continue to allow the TianoCore Contribution Agreement 1.0 agreement. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Andrew Fish <afish@apple.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* BaseTools/PatchCheck.py: Add warning info for new binary filesHao Wu2017-06-261-13/+21
| | | | | | | | | | | | | | | | | The commit adds the detection of adding new binary files in a patch file or in a commit. The following warning messages will be appended at the end of the script output: WARNING - The following binary files will be added into the repository: <BinaryFile1> <BinaryFile2> ... Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/PatchCheck.py: Fix misreport for binary changes in patchHao Wu2017-06-261-3/+3
| | | | | | | | | | | | | | | | For a patch file that: 1. Contains a binary change 2. Contains any other changes after the binary change PatchCheck.py will complains with the following error: * Patch format error: diff found after end of patch Line: literal XXXX This commit resolves this misreport. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/PatchCheck.py: Update to report error for EFI_D_*Yonghong Zhu2016-10-211-0/+14
| | | | | | | | | | | | In EDK2, DEBUG_* is recommended to be used instead of EFI_D_*. For new code, they should use DEBUG_* macro. Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=143 Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools/PatchCheck.py: Update to handle the two [] as prefixYonghong Zhu2016-10-211-8/+9
| | | | | | | | | | | | The bug is that only remove the first [] when it does the char count, however sometimes we use [edk2][patch] as prefix, this patch fix this bug. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools/PatchCheck.py: Update for max length of subject and message lineYonghong Zhu2016-10-211-4/+4
| | | | | | | | | | | | | This patch update PatchCheck.py: 1. The subject line of the commit message should be < 72 characters. 2. The other lines of the commit message should be < 76 characters. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=113 Cc: Liming Gao <liming.gao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* BaseTools PatchCheck.py: Support binary diffJordan Justen2015-12-031-0/+6
| | | | | | | | | | | This allows a patch with binary data that is generated with --binary to be parsed by the PatchCheck.py script. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19104 6f19259b-4bc3-4df7-8a09-765794883524
* BaseTools/Scripts: Add PatchCheck.py scriptJordan Justen2015-10-221-0/+607
This script can be used to check some expected rules for EDK II patches. It only works on git formatted patches. It checks both the commit message and the lines that are added in the patch diff. In the commit message it verifies line lengths, signature formats, and the Contributed-under tag. In the patch, it checks that line endings are CRLF for all files that don't have a .sh extension. It verifies that no trailing whitespace is present and that tab characters are not used. Patch contributors should use this script prior to submitting their patches. Package maintainers can also use it to verify incoming patches. It can also be run by specifying a git revision list, so actual patch files are not always required. For example, to checkout this last 5 patches in your git branch you can run: python PatchCheck.py HEAD~5.. Or, a shortcut (like git log): python PatchCheck.py -5 The --oneline option works similar to git log --oneline. The --silent option enables silent operation. The script supports python 2.7 and python 3. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Cc: Erik Bjorge <erik.c.bjorge@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18652 6f19259b-4bc3-4df7-8a09-765794883524