summaryrefslogtreecommitdiffstats
path: root/BaseTools/Scripts
Commit message (Collapse)AuthorAgeFilesLines
...
* 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: Add log.mailmap to SetupGit.pyPhilippe Mathieu-Daude2020-02-061-0/+1
| | | | | | | | | | | | | We added .mailmap to the repository in commit 4a1aeca3bd02d04e01c2d to display commit mistakes fixed. Use this option by default in our git setup. 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/Scripts: Add sendemail.transferEncoding to SetupGit.pyDesimone, Nathaniel L2019-12-241-18/+20
| | | | | | | | | | | | | | | | | If git finds a '\r' character in the message, then it converts the entire message content into Quoted-Printable encoding. It appears that when groups.io converts the QP encoding back to text format, the '\r' characters somehow become '\n'. To workaround this, the SetupGit.py script will now explicitly set the sendemail.transferEncoding git config option to '8bit' Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: correct line endings for ConvertFce Python scriptLeif Lindholm2019-10-041-5/+5
| | | | | | | | | | Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools:"--exclude" don't apply if parameter ends with separatorFan, ZhijuX2019-09-271-0/+1
| | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1944 FormatDosFiles.py Intel\ServerSiliconPkg --exclude Library\SimRegisters\ Its parameter "Library\SimRegisters\" ends with '\' but I can't seem to get it to exclude the SimRegisters directory This patch is going to fix this issue Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
* BaseTools/Scripts: Add GetUtcDateTime script.Chasel Chiu2019-08-151-0/+44
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2067 A script that can return UTC date and time in ascii format which is convenient for patching build time information in any binary. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Leif Lindholm <leif.lindholm@linaro.org>
* BaseTools:Add the Judgment Method of "--exclude"Fan, ZhijuX2019-08-081-1/+17
| | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1944 --exclude cannot be used under certain circumstances 1.The value of the parameter USES an absolute path 2.The value of Exclude parameters is based on the value of the Path parameter Neither of these approaches currently works This patch is going to fix that issue. Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.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: add GetMaintainer.py scriptLeif Lindholm2019-07-241-0/+190
| | | | | | | | | | | | Add a new script GetMaintainer.py that uses the new Maintainer.txt format to determine which addresses to cc on patch submission. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Tested-by: Philippe Mathieu-Daude <philmd@redhat.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix various typosAntoine Cœur2019-07-082-2/+2
| | | | | | | Fix various typos in BaseTools. Signed-off-by: Cœur <coeur@gmx.fr> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools:Add DetectNotUsedItem.py to Edk2\BaseTools\ScriptsFan, ZhijuX2019-06-251-0/+198
| | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1850 This script is used to Detect unreferenced PCD and GUID/Protocols/PPIs. The input parameters are Dec file and package directory. This script can be run in both Py2 and Py3. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: add script to configure local git optionsLeif Lindholm2019-06-121-0/+204
| | | | | | | | | | | | | Patch contribution and review is greatly simplified by following the steps described in "Laszlo's unkempt guide": https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers but there are a lot of tedious manual steps in there, so here is a python script that configures all options I am aware of *for the repository the script is executed from*. Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools:update ConvertFceToStructurePcd.py with the char order PCD name.Fan, ZhijuX2019-04-181-0/+5
| | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1718 BaseTools\Scripts\ConvertFceToStructurePcd.py Update script to sort the PCD order base on PcdName, then base on Pcd field name. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Liming Gao <liming.gao@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-0935-247/+35
| | | | | | | | | | | | | | | | | | | | 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:Run packagedoc_cli.py to generate doc failedFan, ZhijuX2019-03-061-3/+4
| | | | | | | | | | The reason for this problem is that the file was opened incorrectly. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools:PackageDocumentTools import lib error occurs.Fan, ZhijuX2019-02-269-26/+26
| | | | | | | | | | | | | | | | | Steps: 1. Download edk2 tree 2. Build BaseTools 3. Go to edk2\BaseTools\Scripts\PackageDocumentTools to run packagedoc_cli.py An error occurs if relative imports are used when running a file alone Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Various typoAntoine Coeur2019-02-141-2/+2
| | | | | | | | Various typo in BaseTools. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Coeur <coeur@gmx.fr> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Scripts: Porting PackageDocumentTools code to use Python3Zhijux Fan2019-02-0110-39/+39
| | | | | | | | | | | | | | Porting PackageDocumentTools code to support python2 and python3 Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools Script: Update ConvertFceToStructurePcd to report warning messagesLiming Gao2018-11-291-1/+1
| | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1297 When the header files are not found for the used C structure, this script will report the warning, let user know there is no header file to define C structure. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wang BinX A <binx.a.wang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools ConvertFceToStructurePcd: Fix the array value with empty stringLiming Gao2018-10-311-2/+15
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools: Remove the step to freeze python toolLiming Gao2018-10-191-1/+0
| | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1257 Binary python tool is not supported anymore. So, the freeze python tool step is not required. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* Revert BaseTools: PYTHON3 migrationLiming Gao2018-10-1512-62/+67
| | | | | | | | | | | | | | This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52.. 678f85131238622e576705117e299d81cff755c9. Python3 migration is the fundamental change. It requires every developer to install Python3. Before this migration, the well communication and wide verification must be done. But now, most people is not aware of this change, and not try it. So, Python3 migration is reverted and be moved to edk2-staging Python3 branch for the edk2 user evaluation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
* BaseTools/Scripts: Porting PackageDocumentTools code to use Python3Yunhua Feng2018-10-1312-67/+62
| | | | | | | | | | | | Porting PackageDocumentTools code to Python3 DoxyGen 1.8.6 wxpython 4.0.3 Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@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/BinToPcd: Open output file as text fileKinney, Michael D2018-08-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1069 Undo changes from following commit: https://github.com/tianocore/edk2/commit/83964ebc5e74549d6efc7134af19150a0b2079aa Change the open mode for the output file from 'wb' to 'w' so the output file is written as a text file and not a binary file. This resolves the issue where the text file was not writable from Python 3.x and also removes b'' from output file when the string was encoded as a bytearray. Cc: YanYan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@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> Tested-by:YanYan Sun <yanyan.sun@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/BinToPcd: Encode string returned from ByteArray()Kinney, Michael D2018-08-021-1/+2
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1069 The ByteArray() method returns a string with the hex bytes of a PCD value. Make sure the string is always encoded as a string, so it can be used to build a complete PCD statement string and be written out to a file. This change is required for Python 3.x compatibility. Cc: YanYan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@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: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/BinToPcd: Fix Python 2.7.x compatibility issueKinney, Michael D2018-08-011-1/+1
| | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=1042 Convert Buffer to type bytearray before converting to a string of hex byte values so the type of items in Buffer is consistent for both Python 2.7.x and Python 3.x. Cc: YanYan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@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: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools Script: Add the script to generate Structure PCD settingLiming Gao2018-07-251-0/+675
| | | | | | | | | | | | | | | | | Here is this script usage. 1. Build one platform. 2. Use FCE tool to read HII config from the generated FD image. FCE read -i Platform.fd > Config.txt 3. Call the script to generate StructurePcd setting. ConvertFceToStructurePcd.py -p Build\PlatformPkg\DEBUG_VS2015x86 \ -c Config.txt -o OutputDir OutputDir directory has StructurePcd.dec, StructurePcd.dsc, StructurePcd.inf. 4. Refer to wiki https://github.com/lgao4/edk2/wiki/StructurePcd-Enable-Steps to enable structure pcd in this platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools: Use absolute import in ScriptsGary Lin2018-07-162-2/+4
| | | | | | | | | | Based on "futurize -f libfuturize.fixes.fix_absolute_import 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: Jaben Carsey <jaben.carsey@intel.com>
* BaseTools: Clean up source filesLiming Gao2018-07-091-6/+6
| | | | | | | | | | | 1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools: Replace StringIO.StringIO with io.BytesIOGary Lin2018-06-271-5/+0
| | | | | | | | | | | | Replace StringIO.StringIO with io.BytesIO to be compatible with python3. This commit also removes "import StringIO" from those python scripts that don't really use it. 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: Fix old python2 idiomsGary Lin2018-06-272-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on "futurize -f lib2to3.fixes.fix_idioms" * Change some type comparisons to isinstance() calls: type(x) == T -> isinstance(x, T) type(x) is T -> isinstance(x, T) type(x) != T -> not isinstance(x, T) type(x) is not T -> not isinstance(x, T) * Change "while 1:" into "while True:". * Change both v = list(EXPR) v.sort() foo(v) and the more general v = EXPR v.sort() foo(v) into v = sorted(EXPR) foo(v) 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: Adjust the spaces around commas and colonsGary Lin2018-06-276-11/+11
| | | | | | | | | | 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: Remove the deprecated hash_key()Gary Lin2018-06-273-8/+8
| | | | | | | | | | | Replace "has_key()" with "in" to be compatible with python3. Based on "futurize -f lib2to3.fixes.fix_has_key" 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: Refactor python print statementsGary Lin2018-06-277-53/+60
| | | | | | | | | | | Refactor print statements to be compatible with python 3. Based on "futurize -f libfuturize.fixes.fix_print_with_import" 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: Refactor python except statementsGary Lin2018-06-274-8/+12
| | | | | | | | | | | Convert "except ... ," to "except ... as" to be compatible with python3. Based on "futurize -f lib2to3.fixes.fix_except" 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: Fix a typo in ini.pyGary Lin2018-06-271-1/+1
| | | | | | | | | | | "if mis not None:" => "if m is not None:" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Jaben Carsey <jaben.carsey@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
* BaseTools/BinToPcd: Follow PEP-8 indent of 4 spacesKinney, Michael D2018-06-141-178/+178
| | | | | | | | | | | https://www.python.org/dev/peps/pep-0008/ Cc: Yanyan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
* BaseTools/BinToPcd: Update for Python 3 compatibilityKinney, Michael D2018-06-141-41/+40
| | | | | | | | | | | | | Update to be compatible with both Python 2.x and Python 3.x. Also return error code 1 when an error is detected to support use of this tool in scripts. Cc: Yanyan Sun <yanyan.sun@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>