Compare commits
8 Commits
master
...
rebase-sta
Author | SHA1 | Date | |
---|---|---|---|
242dcee217 | |||
3f8a2a16b9 | |||
c24fa67677 | |||
cd00f3f47f | |||
b4f9a2237d | |||
9df51aa79f | |||
013e5c94d6 | |||
f04bd1e3b8 |
24
.github/ISSUE_TEMPLATE/config.yml
vendored
24
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,24 +0,0 @@
|
|||||||
## @file
|
|
||||||
# GitHub issue configuration file.
|
|
||||||
#
|
|
||||||
# This file is meant to direct contributors familiar with GitHub's issue tracker
|
|
||||||
# to the external resources used by TianoCore.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
##
|
|
||||||
|
|
||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Bugs and Feature Requests
|
|
||||||
url: https://bugzilla.tianocore.org/
|
|
||||||
about: Submit bug reports and feature requests here
|
|
||||||
- name: Reporting Security Issues
|
|
||||||
url: https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Security-Issues
|
|
||||||
about: Read the wiki page that describes the process here
|
|
||||||
- name: EDK II Development Mailing List
|
|
||||||
url: https://edk2.groups.io/g/devel
|
|
||||||
about: Submit code patches and ask questions on the mailing list (devel@edk2.groups.io)
|
|
||||||
- name: EDK II Discussions
|
|
||||||
url: https://github.com/tianocore/edk2/discussions
|
|
||||||
about: You can also reach out on the Discussion section of this repository
|
|
36
.github/dependabot.yml
vendored
36
.github/dependabot.yml
vendored
@ -1,36 +0,0 @@
|
|||||||
## @file
|
|
||||||
# Dependabot configuration file to enable GitHub services for managing and updating
|
|
||||||
# dependencies.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
||||||
##
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
commit-message:
|
|
||||||
prefix: "pip"
|
|
||||||
reviewers:
|
|
||||||
- "makubacki"
|
|
||||||
- "mdkinney"
|
|
||||||
- "spbrogan"
|
|
||||||
rebase-strategy: "disabled"
|
|
||||||
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "weekly"
|
|
||||||
day: "monday"
|
|
||||||
commit-message:
|
|
||||||
prefix: "GitHub Action"
|
|
||||||
reviewers:
|
|
||||||
- "makubacki"
|
|
||||||
- "mdkinney"
|
|
||||||
- "spbrogan"
|
|
||||||
rebase-strategy: "disabled"
|
|
361
.github/workflows/codeql.yml
vendored
361
.github/workflows/codeql.yml
vendored
@ -1,361 +0,0 @@
|
|||||||
# This workflow runs CodeQL against the repository.
|
|
||||||
#
|
|
||||||
# Results are uploaded to GitHub Code Scanning.
|
|
||||||
#
|
|
||||||
# Due to a known issue with the CodeQL extractor when building the edk2
|
|
||||||
# codebase on Linux systems, only Windows agents are used for build with
|
|
||||||
# the VS toolchain.
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '!**.c'
|
|
||||||
- '!**.h'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: windows-2019
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- Package: "ArmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "CryptoPkg"
|
|
||||||
ArchList: "IA32"
|
|
||||||
- Package: "CryptoPkg"
|
|
||||||
ArchList: "X64"
|
|
||||||
- Package: "DynamicTablesPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "FatPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "FmpDevicePkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "IntelFsp2Pkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "IntelFsp2WrapperPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "MdeModulePkg"
|
|
||||||
ArchList: "IA32"
|
|
||||||
- Package: "MdeModulePkg"
|
|
||||||
ArchList: "X64"
|
|
||||||
- Package: "MdePkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "PcAtChipsetPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "PrmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "SecurityPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "ShellPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "SourceLevelDebugPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "StandaloneMmPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "UefiCpuPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
- Package: "UnitTestFrameworkPkg"
|
|
||||||
ArchList: "IA32,X64"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.11'
|
|
||||||
cache: 'pip'
|
|
||||||
cache-dependency-path: 'pip-requirements.txt'
|
|
||||||
|
|
||||||
- name: Use Git Long Paths on Windows
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
git config --system core.longpaths true
|
|
||||||
|
|
||||||
- name: Install/Upgrade pip Modules
|
|
||||||
run: pip install -r pip-requirements.txt --upgrade requests sarif-tools
|
|
||||||
|
|
||||||
- name: Determine CI Settings File Supported Operations
|
|
||||||
id: get_ci_file_operations
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import importlib
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from edk2toolext.invocables.edk2_ci_setup import CiSetupSettingsManager
|
|
||||||
from edk2toolext.invocables.edk2_setup import SetupSettingsManager
|
|
||||||
|
|
||||||
# Find the repo CI Settings file
|
|
||||||
ci_settings_file = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('.pytool/CISettings.py'))
|
|
||||||
|
|
||||||
# Note: At this point, submodules have not been pulled, only one CI Settings file should exist
|
|
||||||
if len(ci_settings_file) != 1 or not ci_settings_file[0].is_file():
|
|
||||||
print("::error title=Workspace Error!::Failed to find CI Settings file!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
ci_settings_file = ci_settings_file[0]
|
|
||||||
|
|
||||||
# Try Finding the Settings class in the file
|
|
||||||
module_name = 'ci_settings'
|
|
||||||
|
|
||||||
spec = importlib.util.spec_from_file_location(module_name, ci_settings_file)
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
|
||||||
spec.loader.exec_module(module)
|
|
||||||
|
|
||||||
try:
|
|
||||||
settings = getattr(module, 'Settings')
|
|
||||||
except AttributeError:
|
|
||||||
print("::error title=Workspace Error!::Failed to find Settings class in CI Settings file!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Determine Which Operations Are Supported by the Settings Class
|
|
||||||
ci_setup_supported = issubclass(settings, CiSetupSettingsManager)
|
|
||||||
setup_supported = issubclass(settings, SetupSettingsManager)
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'ci_setup_supported={str(ci_setup_supported).lower()}', file=fh)
|
|
||||||
print(f'setup_supported={str(setup_supported).lower()}', file=fh)
|
|
||||||
|
|
||||||
- name: Convert Arch to Log Format
|
|
||||||
id: convert_arch_hyphen
|
|
||||||
env:
|
|
||||||
ARCH_LIST: ${{ matrix.ArchList }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'arch_list={os.environ["ARCH_LIST"].replace(",", "-")}', file=fh)
|
|
||||||
|
|
||||||
- name: Setup
|
|
||||||
if: steps.get_ci_file_operations.outputs.setup_supported == 'true'
|
|
||||||
run: stuart_setup -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload Setup Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: (success() || failure()) && steps.get_ci_file_operations.outputs.setup_supported == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-${{ steps.convert_arch_hyphen.outputs.arch_list }}-Setup-Log
|
|
||||||
path: |
|
|
||||||
**/SETUPLOG.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: CI Setup
|
|
||||||
if: steps.get_ci_file_operations.outputs.ci_setup_supported == 'true'
|
|
||||||
run: stuart_ci_setup -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload CI Setup Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: (success() || failure()) && steps.get_ci_file_operations.outputs.ci_setup_supported == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-${{ steps.convert_arch_hyphen.outputs.arch_list }}-CI-Setup-Log
|
|
||||||
path: |
|
|
||||||
**/CISETUP.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Update
|
|
||||||
run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019
|
|
||||||
|
|
||||||
- name: Upload Update Log As An Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-${{ steps.convert_arch_hyphen.outputs.arch_list }}-Update-Log
|
|
||||||
path: |
|
|
||||||
**/UPDATE_LOG.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Build Tools From Source
|
|
||||||
run: python BaseTools/Edk2ToolsBuild.py -t VS2019
|
|
||||||
|
|
||||||
- name: Find CodeQL Plugin Directory
|
|
||||||
id: find_dir
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Find the plugin directory that contains the CodeQL plugin
|
|
||||||
plugin_dir = list(Path(os.environ['GITHUB_WORKSPACE']).rglob('BaseTools/Plugin/CodeQL'))
|
|
||||||
|
|
||||||
# This should only be found once
|
|
||||||
if len(plugin_dir) == 1:
|
|
||||||
plugin_dir = str(plugin_dir[0])
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'codeql_plugin_dir={plugin_dir}', file=fh)
|
|
||||||
else:
|
|
||||||
print("::error title=Workspace Error!::Failed to find CodeQL plugin directory!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
- name: Get CodeQL CLI Cache Data
|
|
||||||
id: cache_key_gen
|
|
||||||
env:
|
|
||||||
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
codeql_cli_ext_dep_name = 'codeqlcli_windows_ext_dep'
|
|
||||||
codeql_plugin_file = os.path.join(os.environ['CODEQL_PLUGIN_DIR'], codeql_cli_ext_dep_name + '.yaml')
|
|
||||||
|
|
||||||
with open (codeql_plugin_file) as pf:
|
|
||||||
codeql_cli_ext_dep = yaml.safe_load(pf)
|
|
||||||
|
|
||||||
cache_key_name = codeql_cli_ext_dep['name']
|
|
||||||
cache_key_version = codeql_cli_ext_dep['version']
|
|
||||||
cache_key = f'{cache_key_name}-{cache_key_version}'
|
|
||||||
|
|
||||||
codeql_plugin_cli_ext_dep_dir = os.path.join(os.environ['CODEQL_PLUGIN_DIR'], codeql_cli_ext_dep['name'].strip() + '_extdep')
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
print(f'codeql_cli_cache_key={cache_key}', file=fh)
|
|
||||||
print(f'codeql_cli_ext_dep_dir={codeql_plugin_cli_ext_dep_dir}', file=fh)
|
|
||||||
|
|
||||||
- name: Attempt to Load CodeQL CLI From Cache
|
|
||||||
id: codeqlcli_cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ steps.cache_key_gen.outputs.codeql_cli_ext_dep_dir }}
|
|
||||||
key: ${{ steps.cache_key_gen.outputs.codeql_cli_cache_key }}
|
|
||||||
|
|
||||||
- name: Download CodeQL CLI
|
|
||||||
if: steps.codeqlcli_cache.outputs.cache-hit != 'true'
|
|
||||||
run: stuart_update -c .pytool/CISettings.py -t DEBUG -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019 --codeql
|
|
||||||
|
|
||||||
- name: Remove CI Plugins Irrelevant to CodeQL
|
|
||||||
shell: python
|
|
||||||
env:
|
|
||||||
CODEQL_PLUGIN_DIR: ${{ steps.find_dir.outputs.codeql_plugin_dir }}
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
# Only these two plugins are needed for CodeQL
|
|
||||||
plugins_to_keep = ['CompilerPlugin']
|
|
||||||
|
|
||||||
plugin_dir = Path('.pytool/Plugin').absolute()
|
|
||||||
if plugin_dir.is_dir():
|
|
||||||
for dir in plugin_dir.iterdir():
|
|
||||||
if str(dir.stem) not in plugins_to_keep:
|
|
||||||
shutil.rmtree(str(dir.absolute()), ignore_errors=True)
|
|
||||||
|
|
||||||
- name: CI Build
|
|
||||||
env:
|
|
||||||
STUART_CODEQL_PATH: ${{ steps.cache_key_gen.outputs.codeql_cli_ext_dep_dir }}
|
|
||||||
run: stuart_ci_build -c .pytool/CISettings.py -t DEBUG -p ${{ matrix.Package }} -a ${{ matrix.ArchList }} TOOL_CHAIN_TAG=VS2019 --codeql
|
|
||||||
|
|
||||||
- name: Build Cleanup
|
|
||||||
id: build_cleanup
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
dirs_to_delete = ['ia32', 'x64', 'arm', 'aarch64']
|
|
||||||
|
|
||||||
def delete_dirs(path: Path):
|
|
||||||
if path.exists() and path.is_dir():
|
|
||||||
if path.name.lower() in dirs_to_delete:
|
|
||||||
print(f'Removed {str(path)}')
|
|
||||||
shutil.rmtree(path)
|
|
||||||
return
|
|
||||||
|
|
||||||
for child_dir in path.iterdir():
|
|
||||||
delete_dirs(child_dir)
|
|
||||||
|
|
||||||
build_path = Path(os.environ['GITHUB_WORKSPACE'], 'Build')
|
|
||||||
delete_dirs(build_path)
|
|
||||||
|
|
||||||
- name: Upload Build Logs As An Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: success() || failure()
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-${{ steps.convert_arch_hyphen.outputs.arch_list }}-Build-Logs
|
|
||||||
path: |
|
|
||||||
**/BUILD_REPORT.TXT
|
|
||||||
**/OVERRIDELOG.TXT
|
|
||||||
**/BUILDLOG_*.md
|
|
||||||
**/BUILDLOG_*.txt
|
|
||||||
**/CI_*.md
|
|
||||||
**/CI_*.txt
|
|
||||||
retention-days: 7
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: Prepare Env Data for CodeQL Upload
|
|
||||||
id: env_data
|
|
||||||
env:
|
|
||||||
PACKAGE_NAME: ${{ matrix.Package }}
|
|
||||||
shell: python
|
|
||||||
run: |
|
|
||||||
import logging
|
|
||||||
import os
|
|
||||||
from edk2toollib.utility_functions import RunCmd
|
|
||||||
from io import StringIO
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
package = os.environ['PACKAGE_NAME'].strip().lower()
|
|
||||||
directory_name = 'codeql-analysis-' + package + '-debug'
|
|
||||||
file_name = 'codeql-db-' + package + '-debug-0.sarif'
|
|
||||||
sarif_path = Path('Build', directory_name, file_name)
|
|
||||||
|
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
|
|
||||||
if sarif_path.is_file():
|
|
||||||
emacs_file_path = sarif_path.with_name(sarif_path.stem + "-emacs.txt")
|
|
||||||
out_stream_buffer = StringIO()
|
|
||||||
exit_code = RunCmd("sarif", f"emacs {sarif_path} --output {emacs_file_path} --no-autotrim",
|
|
||||||
outstream=out_stream_buffer,
|
|
||||||
logging_level=logging.NOTSET)
|
|
||||||
print(f'upload_sarif_file=true', file=fh)
|
|
||||||
print(f'emacs_file_path={emacs_file_path}', file=fh)
|
|
||||||
print(f'sarif_file_path={sarif_path}', file=fh)
|
|
||||||
else:
|
|
||||||
print(f'upload_sarif_file=false', file=fh)
|
|
||||||
|
|
||||||
- name: Upload CodeQL Results (SARIF) As An Artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: steps.env_data.outputs.upload_sarif_file == 'true'
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.Package }}-${{ steps.convert_arch_hyphen.outputs.arch_list }}-CodeQL-SARIF
|
|
||||||
path: |
|
|
||||||
${{ steps.env_data.outputs.emacs_file_path }}
|
|
||||||
${{ steps.env_data.outputs.sarif_file_path }}
|
|
||||||
retention-days: 14
|
|
||||||
if-no-files-found: warn
|
|
||||||
|
|
||||||
- name: Upload CodeQL Results (SARIF) To GitHub Code Scanning
|
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
|
||||||
if: steps.env_data.outputs.upload_sarif_file == 'true'
|
|
||||||
with:
|
|
||||||
# Path to SARIF file relative to the root of the repository.
|
|
||||||
sarif_file: ${{ steps.env_data.outputs.sarif_file_path }}
|
|
||||||
# Optional category for the results. Used to differentiate multiple results for one commit.
|
|
||||||
# Each package is a separate category.
|
|
||||||
category: ${{ matrix.Package }}
|
|
44
.github/workflows/stale.yml
vendored
44
.github/workflows/stale.yml
vendored
@ -1,44 +0,0 @@
|
|||||||
# This workflow warns and then closes issues and PRs that have had no activity
|
|
||||||
# for a specified amount of time.
|
|
||||||
#
|
|
||||||
# For more information, see:
|
|
||||||
# https://github.com/actions/stale
|
|
||||||
#
|
|
||||||
# Copyright (c) Microsoft Corporation.
|
|
||||||
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
||||||
#
|
|
||||||
|
|
||||||
name: Stale Check
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# At 23:35 on every day-of-week from Sunday through Saturday
|
|
||||||
# https://crontab.guru/#35_23_*_*_0-6
|
|
||||||
- cron: '35 23 * * 0-6'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
name: Stale
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
issues: write
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check for Stale Items
|
|
||||||
uses: actions/stale@v8
|
|
||||||
with:
|
|
||||||
days-before-issue-close: -1
|
|
||||||
days-before-issue-stale: -1
|
|
||||||
days-before-pr-stale: 60
|
|
||||||
days-before-pr-close: 7
|
|
||||||
stale-pr-message: >
|
|
||||||
This PR has been automatically marked as stale because it has not had
|
|
||||||
activity in 60 days. It will be closed if no further activity occurs within
|
|
||||||
7 days. Thank you for your contributions.
|
|
||||||
close-pr-message: >
|
|
||||||
This pull request has been automatically been closed because it did not have any
|
|
||||||
activity in 60 days and no follow up within 7 days after being marked stale.
|
|
||||||
Thank you for your contributions.
|
|
||||||
stale-pr-label: stale
|
|
@ -34,7 +34,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
_double_star_after_invalid_regex = re.compile(r'[^/\\]\*\*')
|
_double_star_after_invalid_regex = re.compile(r'[^/\\]\*\*')
|
||||||
_double_star_first_before_invalid_regex = re.compile('^\\*\\*[^/]')
|
_double_star_first_before_invalid_regex = re.compile(r'^\\*\\*[^/]')
|
||||||
_double_star_middle_before_invalid_regex = re.compile(r'[^\\]\*\*[^/]')
|
_double_star_middle_before_invalid_regex = re.compile(r'[^\\]\*\*[^/]')
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,12 +89,12 @@ class parser_lst(object):
|
|||||||
return structs_file
|
return structs_file
|
||||||
|
|
||||||
def struct(self):#struct:{offset:name}
|
def struct(self):#struct:{offset:name}
|
||||||
unit_num = re.compile('(\d+)')
|
unit_num = re.compile(r'(\d+)')
|
||||||
offset1_re = re.compile('(\d+)\[')
|
offset1_re = re.compile(r'(\d+)\[')
|
||||||
pcdname_num_re = re.compile('\w+\[(\S+)\]')
|
pcdname_num_re = re.compile(r'\w+\[(\S+)\]')
|
||||||
pcdname_re = re.compile('\](.*)\<')
|
pcdname_re = re.compile(r'\](.*)\<')
|
||||||
pcdname2_re = re.compile('(\w+)\[')
|
pcdname2_re = re.compile(r'(\w+)\[')
|
||||||
uint_re = re.compile('\<(\S+)\>')
|
uint_re = re.compile(r'\<(\S+)\>')
|
||||||
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
|
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
|
||||||
name=name_format.findall(self.text)
|
name=name_format.findall(self.text)
|
||||||
info={}
|
info={}
|
||||||
@ -214,8 +214,8 @@ class Config(object):
|
|||||||
|
|
||||||
#Parser .config file,return list[offset,name,guid,value,help]
|
#Parser .config file,return list[offset,name,guid,value,help]
|
||||||
def config_parser(self):
|
def config_parser(self):
|
||||||
ids_re =re.compile('_ID:(\d+)',re.S)
|
ids_re =re.compile(r'_ID:(\d+)',re.S)
|
||||||
id_re= re.compile('\s+')
|
id_re= re.compile(r'\s+')
|
||||||
info = []
|
info = []
|
||||||
info_dict={}
|
info_dict={}
|
||||||
with open(self.config, 'r') as text:
|
with open(self.config, 'r') as text:
|
||||||
@ -435,7 +435,7 @@ class PATH(object):
|
|||||||
|
|
||||||
def header(self,struct):
|
def header(self,struct):
|
||||||
header={}
|
header={}
|
||||||
head_re = re.compile('typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
|
head_re = re.compile(r'typedef.*} %s;[\n]+(.*)(?:typedef|formset)'%struct,re.M|re.S)
|
||||||
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
|
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
|
||||||
for i in list(self.lstinf.keys()):
|
for i in list(self.lstinf.keys()):
|
||||||
with open(i,'r') as lst:
|
with open(i,'r') as lst:
|
||||||
|
@ -528,7 +528,7 @@ class EfiSectionHeader(BinaryItem):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
rMapEntry = re.compile('^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
|
rMapEntry = re.compile(r'^(\w+)[ \(\w\)]* \(BaseAddress=([0-9a-fA-F]+), EntryPoint=([0-9a-fA-F]+), GUID=([0-9a-fA-F\-]+)')
|
||||||
class EfiFvMapFile(object):
|
class EfiFvMapFile(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._mapentries = {}
|
self._mapentries = {}
|
||||||
|
@ -237,7 +237,7 @@ class CommitMessageCheck:
|
|||||||
if sigtype == 'Cc' and len(sigs) == 0:
|
if sigtype == 'Cc' and len(sigs) == 0:
|
||||||
self.error('No Cc: tags for maintainers/reviewers found!')
|
self.error('No Cc: tags for maintainers/reviewers found!')
|
||||||
|
|
||||||
cve_re = re.compile('CVE-[0-9]{4}-[0-9]{5}[^0-9]')
|
cve_re = re.compile(r'CVE-[0-9]{4}-[0-9]{5}[^0-9]')
|
||||||
|
|
||||||
def check_overall_format(self):
|
def check_overall_format(self):
|
||||||
lines = self.msg.splitlines()
|
lines = self.msg.splitlines()
|
||||||
|
@ -54,7 +54,7 @@ gHexPattern = re.compile(r'0[xX]{}+'.format(_HexChar))
|
|||||||
gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
|
gHexPatternAll = re.compile(r'0[xX]{}+$'.format(_HexChar))
|
||||||
|
|
||||||
## Regular expressions for string identifier checking
|
## Regular expressions for string identifier checking
|
||||||
gIdentifierPattern = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
|
gIdentifierPattern = re.compile(r'^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE)
|
||||||
## Regular expression for GUID c structure format
|
## Regular expression for GUID c structure format
|
||||||
_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
|
_GuidCFormatPattern = r"{{\s*0[xX]{Hex}{{1,8}}\s*,\s*0[xX]{Hex}{{1,4}}\s*,\s*0[xX]{Hex}{{1,4}}" \
|
||||||
r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
|
r"\s*,\s*{{\s*0[xX]{Hex}{{1,2}}\s*,\s*0[xX]{Hex}{{1,2}}" \
|
||||||
|
@ -1926,4 +1926,4 @@ def CopyDict(ori_dict):
|
|||||||
# Remove the c/c++ comments: // and /* */
|
# Remove the c/c++ comments: // and /* */
|
||||||
#
|
#
|
||||||
def RemoveCComments(ctext):
|
def RemoveCComments(ctext):
|
||||||
return re.sub('//.*?\n|/\\*.*?\\*/', '\n', ctext, flags=re.S)
|
return re.sub(r'//.*?\n|/\\*.*?\\*/', '\n', ctext, flags=re.S)
|
||||||
|
@ -21,7 +21,7 @@ from CommonDataClass.Exceptions import *
|
|||||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||||
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
from Common.MultipleWorkspace import MultipleWorkspace as mws
|
||||||
|
|
||||||
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
|
gHexVerPatt = re.compile(r'0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
|
||||||
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
|
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
|
||||||
|
|
||||||
## GetSplitValueList
|
## GetSplitValueList
|
||||||
|
@ -1112,7 +1112,7 @@ class Check(object):
|
|||||||
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
|
||||||
for Record in RecordSet:
|
for Record in RecordSet:
|
||||||
Path = Record[1]
|
Path = Record[1]
|
||||||
Path = Path.upper().replace('\X64', '').replace('\IA32', '').replace('\EBC', '').replace('\IPF', '').replace('\ARM', '')
|
Path = Path.upper().replace('\\X64', '').replace('\\IA32', '').replace('\\EBC', '').replace('\\IPF', '').replace('\\ARM', '')
|
||||||
if Path in InfPathList:
|
if Path in InfPathList:
|
||||||
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
|
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, Record[2]):
|
||||||
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
|
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_MODULE_FILE_NO_USE, OtherMsg="The source file [%s] is existing in module directory but it is not described in INF file." % (Record[2]), BelongsToTable='File', BelongsToItem=Record[0])
|
||||||
|
@ -435,7 +435,7 @@ class Configuration(object):
|
|||||||
# test that our dict and out class still match in contents.
|
# test that our dict and out class still match in contents.
|
||||||
#
|
#
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
myconfig = Configuration("BaseTools\Source\Python\Ecc\config.ini")
|
myconfig = Configuration("BaseTools\\Source\\Python\\Ecc\\config.ini")
|
||||||
for each in myconfig.__dict__:
|
for each in myconfig.__dict__:
|
||||||
if each == "Filename":
|
if each == "Filename":
|
||||||
continue
|
continue
|
||||||
|
@ -1841,14 +1841,14 @@ class DecParser(MetaFileParser):
|
|||||||
|
|
||||||
if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
|
if EccGlobalData.gConfig.UniCheckPCDInfo == '1' or EccGlobalData.gConfig.UniCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
|
||||||
# check Description, Prompt information
|
# check Description, Prompt information
|
||||||
PatternDesc = re.compile('##\s*([\x21-\x7E\s]*)', re.S)
|
PatternDesc = re.compile(r'##\s*([\x21-\x7E\s]*)', re.S)
|
||||||
PatternPrompt = re.compile('#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
PatternPrompt = re.compile(r'#\s+@Prompt\s+([\x21-\x7E\s]*)', re.S)
|
||||||
Description = None
|
Description = None
|
||||||
Prompt = None
|
Prompt = None
|
||||||
# check @ValidRange, @ValidList and @Expression format valid
|
# check @ValidRange, @ValidList and @Expression format valid
|
||||||
ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
|
ErrorCodeValid = '0x0 <= %s <= 0xFFFFFFFF'
|
||||||
PatternValidRangeIn = '(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
PatternValidRangeIn = r'(NOT)?\s*(\d+\s*-\s*\d+|0[xX][a-fA-F0-9]+\s*-\s*0[xX][a-fA-F0-9]+|LT\s*\d+|LT\s*0[xX][a-fA-F0-9]+|GT\s*\d+|GT\s*0[xX][a-fA-F0-9]+|LE\s*\d+|LE\s*0[xX][a-fA-F0-9]+|GE\s*\d+|GE\s*0[xX][a-fA-F0-9]+|XOR\s*\d+|XOR\s*0[xX][a-fA-F0-9]+|EQ\s*\d+|EQ\s*0[xX][a-fA-F0-9]+)'
|
||||||
PatternValidRng = re.compile('^' + '(NOT)?\s*' + PatternValidRangeIn + '$')
|
PatternValidRng = re.compile(r'^' + r'(NOT)?\s*' + PatternValidRangeIn + '$')
|
||||||
for Comment in self._Comments:
|
for Comment in self._Comments:
|
||||||
Comm = Comment[0].strip()
|
Comm = Comment[0].strip()
|
||||||
if not Comm:
|
if not Comm:
|
||||||
@ -2071,7 +2071,7 @@ class UniParser(object):
|
|||||||
def CheckKeyValid(self, Key, Contents=None):
|
def CheckKeyValid(self, Key, Contents=None):
|
||||||
if not Contents:
|
if not Contents:
|
||||||
Contents = self.FileIn
|
Contents = self.FileIn
|
||||||
KeyPattern = re.compile('#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
KeyPattern = re.compile(r'#string\s+%s\s+.*?#language.*?".*?"' % Key, re.S)
|
||||||
if KeyPattern.search(Contents):
|
if KeyPattern.search(Contents):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -43,7 +43,7 @@ def GetArrayPattern():
|
|||||||
return p
|
return p
|
||||||
|
|
||||||
def GetTypedefFuncPointerPattern():
|
def GetTypedefFuncPointerPattern():
|
||||||
p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
p = re.compile(r'[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def GetDB():
|
def GetDB():
|
||||||
|
@ -11,7 +11,7 @@ from Common.LongFilePathSupport import OpenLongFilePath as open
|
|||||||
gEFI_SOURCE = ''
|
gEFI_SOURCE = ''
|
||||||
gEDK_SOURCE = ''
|
gEDK_SOURCE = ''
|
||||||
gWORKSPACE = ''
|
gWORKSPACE = ''
|
||||||
gSHELL_INF = 'Application\Shell'
|
gSHELL_INF = 'Application\\Shell'
|
||||||
gMAKE_FILE = ''
|
gMAKE_FILE = ''
|
||||||
gDSC_FILE = ''
|
gDSC_FILE = ''
|
||||||
gFV_FILE = []
|
gFV_FILE = []
|
||||||
|
@ -54,7 +54,7 @@ def GetArrayPattern():
|
|||||||
# @return p: the pattern of function pointer
|
# @return p: the pattern of function pointer
|
||||||
#
|
#
|
||||||
def GetTypedefFuncPointerPattern():
|
def GetTypedefFuncPointerPattern():
|
||||||
p = re.compile('[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
p = re.compile(r'[_\w\s]*\([\w\s]*\*+\s*[_\w]+\s*\)\s*\(.*\)', re.DOTALL)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
## GetDB() method
|
## GetDB() method
|
||||||
|
@ -238,7 +238,7 @@ def ParseDecPcdGenericComment (GenericComment, ContainerFile, TokenSpaceGuidCNam
|
|||||||
#
|
#
|
||||||
# To replace Macro
|
# To replace Macro
|
||||||
#
|
#
|
||||||
MACRO_PATTERN = '[\t\s]*\$\([A-Z][_A-Z0-9]*\)'
|
MACRO_PATTERN = r'[\t\s]*\$\([A-Z][_A-Z0-9]*\)'
|
||||||
MatchedStrs = re.findall(MACRO_PATTERN, Comment)
|
MatchedStrs = re.findall(MACRO_PATTERN, Comment)
|
||||||
for MatchedStr in MatchedStrs:
|
for MatchedStr in MatchedStrs:
|
||||||
if MatchedStr:
|
if MatchedStr:
|
||||||
|
@ -66,13 +66,13 @@ class _ExprError(Exception):
|
|||||||
## _ExprBase
|
## _ExprBase
|
||||||
#
|
#
|
||||||
class _ExprBase:
|
class _ExprBase:
|
||||||
HEX_PATTERN = '[\t\s]*0[xX][a-fA-F0-9]+'
|
HEX_PATTERN = r'[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
INT_PATTERN = '[\t\s]*[0-9]+'
|
INT_PATTERN = r'[\t\s]*[0-9]+'
|
||||||
MACRO_PATTERN = '[\t\s]*\$\(([A-Z][_A-Z0-9]*)\)'
|
MACRO_PATTERN = r'[\t\s]*\$\(([A-Z][_A-Z0-9]*)\)'
|
||||||
PCD_PATTERN = \
|
PCD_PATTERN = \
|
||||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*'
|
r'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*'
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
BOOL_PATTERN = '[\t\s]*(true|True|TRUE|false|False|FALSE)'
|
BOOL_PATTERN = r'[\t\s]*(true|True|TRUE|false|False|FALSE)'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
self.Token = Token
|
self.Token = Token
|
||||||
self.Index = 0
|
self.Index = 0
|
||||||
@ -303,9 +303,9 @@ class _LogicalExpressionParser(_ExprBase):
|
|||||||
## _ValidRangeExpressionParser
|
## _ValidRangeExpressionParser
|
||||||
#
|
#
|
||||||
class _ValidRangeExpressionParser(_ExprBase):
|
class _ValidRangeExpressionParser(_ExprBase):
|
||||||
INT_RANGE_PATTERN = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
INT_RANGE_PATTERN = r'[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
||||||
HEX_RANGE_PATTERN = \
|
HEX_RANGE_PATTERN = \
|
||||||
'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
r'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
_ExprBase.__init__(self, Token)
|
_ExprBase.__init__(self, Token)
|
||||||
self.Parens = 0
|
self.Parens = 0
|
||||||
@ -407,7 +407,7 @@ class _ValidRangeExpressionParser(_ExprBase):
|
|||||||
## _ValidListExpressionParser
|
## _ValidListExpressionParser
|
||||||
#
|
#
|
||||||
class _ValidListExpressionParser(_ExprBase):
|
class _ValidListExpressionParser(_ExprBase):
|
||||||
VALID_LIST_PATTERN = '(0[xX][0-9a-fA-F]+|[0-9]+)([\t\s]*,[\t\s]*(0[xX][0-9a-fA-F]+|[0-9]+))*'
|
VALID_LIST_PATTERN = r'(0[xX][0-9a-fA-F]+|[0-9]+)([\t\s]*,[\t\s]*(0[xX][0-9a-fA-F]+|[0-9]+))*'
|
||||||
def __init__(self, Token):
|
def __init__(self, Token):
|
||||||
_ExprBase.__init__(self, Token)
|
_ExprBase.__init__(self, Token)
|
||||||
self.NUM = 1
|
self.NUM = 1
|
||||||
|
@ -69,11 +69,11 @@ def GuidStringToGuidStructureString(Guid):
|
|||||||
def CheckGuidRegFormat(GuidValue):
|
def CheckGuidRegFormat(GuidValue):
|
||||||
## Regular expression used to find out register format of GUID
|
## Regular expression used to find out register format of GUID
|
||||||
#
|
#
|
||||||
RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-"
|
RegFormatGuidPattern = re.compile(r"^\s*([0-9a-fA-F]){8}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){12}\s*$")
|
r"([0-9a-fA-F]){12}\s*$")
|
||||||
|
|
||||||
if RegFormatGuidPattern.match(GuidValue):
|
if RegFormatGuidPattern.match(GuidValue):
|
||||||
return True
|
return True
|
||||||
@ -837,8 +837,8 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo):
|
|||||||
ST.ERR_FILE_OPEN_FAILURE,
|
ST.ERR_FILE_OPEN_FAILURE,
|
||||||
File=FullFileName)
|
File=FullFileName)
|
||||||
|
|
||||||
ReFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
FileLinesList = ProcessLineExtender(FileLinesList)
|
FileLinesList = ProcessLineExtender(FileLinesList)
|
||||||
|
|
||||||
@ -978,7 +978,7 @@ def ValidateUNIFilePath(Path):
|
|||||||
#
|
#
|
||||||
# Check if the file name is valid according to the DEC and INF specification
|
# Check if the file name is valid according to the DEC and INF specification
|
||||||
#
|
#
|
||||||
Pattern = '[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
|
Pattern = r'[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*'
|
||||||
FileName = Path.replace(Suffix, '')
|
FileName = Path.replace(Suffix, '')
|
||||||
InvalidCh = re.sub(Pattern, '', FileName)
|
InvalidCh = re.sub(Pattern, '', FileName)
|
||||||
if InvalidCh:
|
if InvalidCh:
|
||||||
|
@ -23,7 +23,7 @@ from Logger import StringTable as ST
|
|||||||
#
|
#
|
||||||
# Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
# Regular expression for matching macro used in DSC/DEC/INF file inclusion
|
||||||
#
|
#
|
||||||
gMACRO_PATTERN = re.compile("\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
gMACRO_PATTERN = re.compile(r"\$\(([_A-Z][_A-Z0-9]*)\)", re.UNICODE)
|
||||||
|
|
||||||
## GetSplitValueList
|
## GetSplitValueList
|
||||||
#
|
#
|
||||||
@ -167,7 +167,7 @@ def ReplaceMacro(String, MacroDefinitions=None, SelfReplacement=False, Line=None
|
|||||||
if not Flag:
|
if not Flag:
|
||||||
MacroUsed = gMACRO_PATTERN.findall(String)
|
MacroUsed = gMACRO_PATTERN.findall(String)
|
||||||
else:
|
else:
|
||||||
ReQuotedString = re.compile('\"')
|
ReQuotedString = re.compile(r'\"')
|
||||||
QuotedStringList = ReQuotedString.split(String)
|
QuotedStringList = ReQuotedString.split(String)
|
||||||
if len(QuotedStringList) >= 3:
|
if len(QuotedStringList) >= 3:
|
||||||
HaveQuotedMacroFlag = True
|
HaveQuotedMacroFlag = True
|
||||||
|
@ -611,10 +611,10 @@ def ValidatePcdValueOnDatumType(Value, Type):
|
|||||||
|
|
||||||
elif Type == 'UINT8' or Type == 'UINT16' or Type == 'UINT32' or Type == 'UINT64':
|
elif Type == 'UINT8' or Type == 'UINT16' or Type == 'UINT32' or Type == 'UINT64':
|
||||||
|
|
||||||
ReIsValidUint8z = re.compile('^0[x|X][a-fA-F0-9]{2}$')
|
ReIsValidUint8z = re.compile(r'^0[x|X][a-fA-F0-9]{2}$')
|
||||||
ReIsValidUint16z = re.compile('^0[x|X][a-fA-F0-9]{4}$')
|
ReIsValidUint16z = re.compile(r'^0[x|X][a-fA-F0-9]{4}$')
|
||||||
ReIsValidUint32z = re.compile('^0[x|X][a-fA-F0-9]{8}$')
|
ReIsValidUint32z = re.compile(r'^0[x|X][a-fA-F0-9]{8}$')
|
||||||
ReIsValidUint64z = re.compile('^0[x|X][a-fA-F0-9]{16}$')
|
ReIsValidUint64z = re.compile(r'^0[x|X][a-fA-F0-9]{16}$')
|
||||||
|
|
||||||
if not ReIsValidUint8z.match(Value) and Type == 'UINT8':
|
if not ReIsValidUint8z.match(Value) and Type == 'UINT8':
|
||||||
return False
|
return False
|
||||||
|
@ -25,10 +25,10 @@ from Library.ExpressionValidate import IsValidStringTest
|
|||||||
from Library.Misc import CheckGuidRegFormat
|
from Library.Misc import CheckGuidRegFormat
|
||||||
|
|
||||||
TOOL_NAME = 'DecParser'
|
TOOL_NAME = 'DecParser'
|
||||||
VERSION_PATTERN = '[0-9]+(\.[0-9]+)?'
|
VERSION_PATTERN = r'[0-9]+(\.[0-9]+)?'
|
||||||
CVAR_PATTERN = '[_a-zA-Z][a-zA-Z0-9_]*'
|
CVAR_PATTERN = r'[_a-zA-Z][a-zA-Z0-9_]*'
|
||||||
PCD_TOKEN_PATTERN = '(0[xX]0*[a-fA-F0-9]{1,8})|([0-9]+)'
|
PCD_TOKEN_PATTERN = r'(0[xX]0*[a-fA-F0-9]{1,8})|([0-9]+)'
|
||||||
MACRO_PATTERN = '[A-Z][_A-Z0-9]*'
|
MACRO_PATTERN = r'[A-Z][_A-Z0-9]*'
|
||||||
|
|
||||||
## FileContent
|
## FileContent
|
||||||
# Class to hold DEC file information
|
# Class to hold DEC file information
|
||||||
|
@ -53,12 +53,12 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
|
|||||||
#
|
#
|
||||||
# To deal with library instance specified by GUID and version
|
# To deal with library instance specified by GUID and version
|
||||||
#
|
#
|
||||||
RegFormatGuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
|
RegFormatGuidPattern = re.compile(r"\s*([0-9a-fA-F]){8}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){4}-"
|
r"([0-9a-fA-F]){4}-"
|
||||||
"([0-9a-fA-F]){12}\s*")
|
r"([0-9a-fA-F]){12}\s*")
|
||||||
VersionPattern = re.compile('[\t\s]*\d+(\.\d+)?[\t\s]*')
|
VersionPattern = re.compile(r'[\t\s]*\d+(\.\d+)?[\t\s]*')
|
||||||
GuidMatchedObj = RegFormatGuidPattern.search(String)
|
GuidMatchedObj = RegFormatGuidPattern.search(String)
|
||||||
|
|
||||||
if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
|
if String.upper().startswith('GUID') and GuidMatchedObj and 'Version' in String:
|
||||||
@ -75,8 +75,8 @@ def GetLibInstanceInfo(String, WorkSpace, LineNo, CurrentInfFileName):
|
|||||||
FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OriginalString)
|
FileLinesList = GetFileLineContent(String, WorkSpace, LineNo, OriginalString)
|
||||||
|
|
||||||
|
|
||||||
ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFindFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReFindVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
for Line in FileLinesList:
|
for Line in FileLinesList:
|
||||||
if ReFindFileGuidPattern.match(Line):
|
if ReFindFileGuidPattern.match(Line):
|
||||||
@ -106,8 +106,8 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
|
|||||||
|
|
||||||
FileLinesList = GetFileLineContent(FileNameString, WorkSpace, LineNo, '')
|
FileLinesList = GetFileLineContent(FileNameString, WorkSpace, LineNo, '')
|
||||||
|
|
||||||
RePackageHeader = re.compile('^\s*\[Packages.*\].*$')
|
RePackageHeader = re.compile(r'^\s*\[Packages.*\].*$')
|
||||||
ReDefineHeader = re.compile('^\s*\[Defines].*$')
|
ReDefineHeader = re.compile(r'^\s*\[Defines].*$')
|
||||||
|
|
||||||
PackageHederFlag = False
|
PackageHederFlag = False
|
||||||
DefineHeaderFlag = False
|
DefineHeaderFlag = False
|
||||||
@ -255,8 +255,8 @@ def GetGuidVerFormLibInstance(Guid, Version, WorkSpace, CurrentInfFileName):
|
|||||||
FileLinesList = InfFileObj.readlines()
|
FileLinesList = InfFileObj.readlines()
|
||||||
FileLinesList = ProcessLineExtender(FileLinesList)
|
FileLinesList = ProcessLineExtender(FileLinesList)
|
||||||
|
|
||||||
ReFindFileGuidPattern = re.compile("^\s*FILE_GUID\s*=.*$")
|
ReFindFileGuidPattern = re.compile(r"^\s*FILE_GUID\s*=.*$")
|
||||||
ReFindVerStringPattern = re.compile("^\s*VERSION_STRING\s*=.*$")
|
ReFindVerStringPattern = re.compile(r"^\s*VERSION_STRING\s*=.*$")
|
||||||
|
|
||||||
for Line in FileLinesList:
|
for Line in FileLinesList:
|
||||||
if ReFindFileGuidPattern.match(Line):
|
if ReFindFileGuidPattern.match(Line):
|
||||||
|
@ -40,7 +40,7 @@ def GetValidateArchList(LineContent):
|
|||||||
|
|
||||||
TempArch = GetSplitValueList(TempArch, '(', 1)[0]
|
TempArch = GetSplitValueList(TempArch, '(', 1)[0]
|
||||||
|
|
||||||
ArchList = re.split('\s+', TempArch)
|
ArchList = re.split(r'\s+', TempArch)
|
||||||
NewArchList = []
|
NewArchList = []
|
||||||
for Arch in ArchList:
|
for Arch in ArchList:
|
||||||
if IsValidArch(Arch):
|
if IsValidArch(Arch):
|
||||||
|
@ -109,7 +109,7 @@ def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Fla
|
|||||||
return Content
|
return Content
|
||||||
else:
|
else:
|
||||||
for Macro in MacroUsed:
|
for Macro in MacroUsed:
|
||||||
gQuotedMacro = re.compile(".*\".*\$\(%s\).*\".*"%(Macro))
|
gQuotedMacro = re.compile(r".*\".*\$\(%s\).*\".*"%(Macro))
|
||||||
if not gQuotedMacro.match(Content):
|
if not gQuotedMacro.match(Content):
|
||||||
#
|
#
|
||||||
# Still have MACROs can't be expanded.
|
# Still have MACROs can't be expanded.
|
||||||
@ -130,8 +130,8 @@ def IsBinaryInf(FileLineList):
|
|||||||
if not FileLineList:
|
if not FileLineList:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
ReIsSourcesSection = re.compile("^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
|
ReIsSourcesSection = re.compile(r"^\s*\[Sources.*\]\s.*$", re.IGNORECASE)
|
||||||
ReIsBinarySection = re.compile("^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
|
ReIsBinarySection = re.compile(r"^\s*\[Binaries.*\]\s.*$", re.IGNORECASE)
|
||||||
BinarySectionFoundFlag = False
|
BinarySectionFoundFlag = False
|
||||||
|
|
||||||
for Line in FileLineList:
|
for Line in FileLineList:
|
||||||
@ -155,7 +155,7 @@ def IsBinaryInf(FileLineList):
|
|||||||
# @return Flag
|
# @return Flag
|
||||||
#
|
#
|
||||||
def IsLibInstanceInfo(String):
|
def IsLibInstanceInfo(String):
|
||||||
ReIsLibInstance = re.compile("^\s*##\s*@LIB_INSTANCES\s*$")
|
ReIsLibInstance = re.compile(r"^\s*##\s*@LIB_INSTANCES\s*$")
|
||||||
if ReIsLibInstance.match(String):
|
if ReIsLibInstance.match(String):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@ -171,7 +171,7 @@ def IsLibInstanceInfo(String):
|
|||||||
# @return Flag
|
# @return Flag
|
||||||
#
|
#
|
||||||
def IsAsBuildOptionInfo(String):
|
def IsAsBuildOptionInfo(String):
|
||||||
ReIsAsBuildInstance = re.compile("^\s*##\s*@AsBuilt\s*$")
|
ReIsAsBuildInstance = re.compile(r"^\s*##\s*@AsBuilt\s*$")
|
||||||
if ReIsAsBuildInstance.match(String):
|
if ReIsAsBuildInstance.match(String):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
@ -747,12 +747,12 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
|
# deal with "NOT EQ", "NOT LT", "NOT GT", "NOT LE", "NOT GE", "NOT NOT"
|
||||||
#
|
#
|
||||||
NOTNOT_Pattern = '[\t\s]*NOT[\t\s]+NOT[\t\s]*'
|
NOTNOT_Pattern = r'[\t\s]*NOT[\t\s]+NOT[\t\s]*'
|
||||||
NOTGE_Pattern = '[\t\s]*NOT[\t\s]+GE[\t\s]*'
|
NOTGE_Pattern = r'[\t\s]*NOT[\t\s]+GE[\t\s]*'
|
||||||
NOTLE_Pattern = '[\t\s]*NOT[\t\s]+LE[\t\s]*'
|
NOTLE_Pattern = r'[\t\s]*NOT[\t\s]+LE[\t\s]*'
|
||||||
NOTGT_Pattern = '[\t\s]*NOT[\t\s]+GT[\t\s]*'
|
NOTGT_Pattern = r'[\t\s]*NOT[\t\s]+GT[\t\s]*'
|
||||||
NOTLT_Pattern = '[\t\s]*NOT[\t\s]+LT[\t\s]*'
|
NOTLT_Pattern = r'[\t\s]*NOT[\t\s]+LT[\t\s]*'
|
||||||
NOTEQ_Pattern = '[\t\s]*NOT[\t\s]+EQ[\t\s]*'
|
NOTEQ_Pattern = r'[\t\s]*NOT[\t\s]+EQ[\t\s]*'
|
||||||
ReplaceValue = re.compile(NOTNOT_Pattern).sub('', ReplaceValue)
|
ReplaceValue = re.compile(NOTNOT_Pattern).sub('', ReplaceValue)
|
||||||
ReplaceValue = re.compile(NOTLT_Pattern).sub('x >= ', ReplaceValue)
|
ReplaceValue = re.compile(NOTLT_Pattern).sub('x >= ', ReplaceValue)
|
||||||
ReplaceValue = re.compile(NOTGT_Pattern).sub('x <= ', ReplaceValue)
|
ReplaceValue = re.compile(NOTGT_Pattern).sub('x <= ', ReplaceValue)
|
||||||
@ -785,7 +785,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
|
if ReplaceValue.find('!') >= 0 and ReplaceValue[ReplaceValue.index('!') + 1] != '=':
|
||||||
ReplaceValue = ReplaceValue.replace('!', ' not ')
|
ReplaceValue = ReplaceValue.replace('!', ' not ')
|
||||||
if '.' in ReplaceValue:
|
if '.' in ReplaceValue:
|
||||||
Pattern = '[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
|
Pattern = r'[a-zA-Z0-9]{1,}\.[a-zA-Z0-9]{1,}'
|
||||||
MatchedList = re.findall(Pattern, ReplaceValue)
|
MatchedList = re.findall(Pattern, ReplaceValue)
|
||||||
for MatchedItem in MatchedList:
|
for MatchedItem in MatchedList:
|
||||||
if MatchedItem not in self.PcdDefaultValueDict:
|
if MatchedItem not in self.PcdDefaultValueDict:
|
||||||
@ -814,7 +814,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
||||||
#
|
#
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
QuotedMatchedObj = re.search(QUOTED_PATTERN, Expression)
|
QuotedMatchedObj = re.search(QUOTED_PATTERN, Expression)
|
||||||
if QuotedMatchedObj:
|
if QuotedMatchedObj:
|
||||||
MatchedStr = QuotedMatchedObj.group().strip()
|
MatchedStr = QuotedMatchedObj.group().strip()
|
||||||
@ -847,7 +847,7 @@ class DecPomAlignment(PackageObject):
|
|||||||
#
|
#
|
||||||
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
# Delete the 'L' prefix of a quoted string, this operation is for eval()
|
||||||
#
|
#
|
||||||
QUOTED_PATTERN = '[\t\s]*L?"[^"]*"'
|
QUOTED_PATTERN = r'[\t\s]*L?"[^"]*"'
|
||||||
QuotedMatchedObj = re.search(QUOTED_PATTERN, DefaultValue)
|
QuotedMatchedObj = re.search(QUOTED_PATTERN, DefaultValue)
|
||||||
if QuotedMatchedObj:
|
if QuotedMatchedObj:
|
||||||
MatchedStr = QuotedMatchedObj.group().strip()
|
MatchedStr = QuotedMatchedObj.group().strip()
|
||||||
|
@ -200,9 +200,9 @@ def ValidateRegValues(Key, Value):
|
|||||||
('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}'
|
('[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}'
|
||||||
'-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}',
|
'-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}',
|
||||||
ST.ERR_GUID_VALUE % Value),
|
ST.ERR_GUID_VALUE % Value),
|
||||||
'Version' : ('[0-9]+(\.[0-9]+)?', ST.ERR_VERSION_VALUE % \
|
'Version' : (r'[0-9]+(\.[0-9]+)?', ST.ERR_VERSION_VALUE % \
|
||||||
(Key, Value)),
|
(Key, Value)),
|
||||||
'XmlSpecification' : ('1\.1', ST.ERR_VERSION_XMLSPEC % Value)
|
'XmlSpecification' : (r'1\.1', ST.ERR_VERSION_XMLSPEC % Value)
|
||||||
}
|
}
|
||||||
if Key not in ValidateMap:
|
if Key not in ValidateMap:
|
||||||
return True, ''
|
return True, ''
|
||||||
|
@ -100,11 +100,11 @@ class PcdErrorXml(object):
|
|||||||
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
def TransferValidRange2Expr(self, TokenSpaceGuidCName, CName, ValidRange):
|
||||||
if self.Expression:
|
if self.Expression:
|
||||||
pass
|
pass
|
||||||
INT_RANGE_PATTERN1 = '[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
INT_RANGE_PATTERN1 = r'[\t\s]*[0-9]+[\t\s]*-[\t\s]*[0-9]+'
|
||||||
INT_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
INT_RANGE_PATTERN2 = r'[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||||
HEX_RANGE_PATTERN1 = \
|
HEX_RANGE_PATTERN1 = \
|
||||||
'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
r'[\t\s]*0[xX][a-fA-F0-9]+[\t\s]*-[\t\s]*0[xX][a-fA-F0-9]+'
|
||||||
HEX_RANGE_PATTERN2 = '[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][a-fA-F0-9]+[\t\s]*'
|
HEX_RANGE_PATTERN2 = r'[\t\s]*(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][a-fA-F0-9]+[\t\s]*'
|
||||||
IntMatch1 = re.compile(INT_RANGE_PATTERN1)
|
IntMatch1 = re.compile(INT_RANGE_PATTERN1)
|
||||||
IntMatch2 = re.compile(INT_RANGE_PATTERN2)
|
IntMatch2 = re.compile(INT_RANGE_PATTERN2)
|
||||||
HexMatch1 = re.compile(HEX_RANGE_PATTERN1)
|
HexMatch1 = re.compile(HEX_RANGE_PATTERN1)
|
||||||
@ -158,18 +158,18 @@ class PcdErrorXml(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
PCD_PATTERN = \
|
PCD_PATTERN = \
|
||||||
'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
r'[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*\.[\t\s]*[_a-zA-Z][a-zA-Z0-9_]*[\t\s]*'
|
||||||
IntPattern1 = \
|
IntPattern1 = \
|
||||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+\d+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
r'[\t\s]*\([\t\s]*'+PCD_PATTERN+r'[\t\s]+GE[\t\s]+\d+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
PCD_PATTERN+r'[\t\s]+LE[\t\s]+\d+[\t\s]*\)'
|
||||||
IntPattern1 = IntPattern1.replace(' ', '')
|
IntPattern1 = IntPattern1.replace(' ', '')
|
||||||
IntPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
IntPattern2 = r'[\t\s]*'+PCD_PATTERN+r'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+\d+[\t\s]*'
|
||||||
|
|
||||||
HexPattern1 = \
|
HexPattern1 = \
|
||||||
'[\t\s]*\([\t\s]*'+PCD_PATTERN+'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
r'[\t\s]*\([\t\s]*'+PCD_PATTERN+r'[\t\s]+GE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)[\t\s]+AND[\t\s]+\([\t\s]*'+\
|
||||||
PCD_PATTERN+'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
PCD_PATTERN+r'[\t\s]+LE[\t\s]+0[xX][0-9a-fA-F]+[\t\s]*\)'
|
||||||
HexPattern1 = HexPattern1.replace(' ', '')
|
HexPattern1 = HexPattern1.replace(' ', '')
|
||||||
HexPattern2 = '[\t\s]*'+PCD_PATTERN+'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
HexPattern2 = r'[\t\s]*'+PCD_PATTERN+r'[\t\s]+(LT|GT|LE|GE|XOR|EQ)[\t\s]+0[xX][0-9a-zA-Z]+[\t\s]*'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Do the Hex1 conversion
|
# Do the Hex1 conversion
|
||||||
@ -180,7 +180,7 @@ class PcdErrorXml(object):
|
|||||||
#
|
#
|
||||||
# To match items on both sides of '-'
|
# To match items on both sides of '-'
|
||||||
#
|
#
|
||||||
RangeItemList = re.compile('[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
RangeItemList = re.compile(r'[\t\s]*0[xX][0-9a-fA-F]+[\t\s]*').findall(HexMatchedItem)
|
||||||
if RangeItemList and len(RangeItemList) == 2:
|
if RangeItemList and len(RangeItemList) == 2:
|
||||||
HexRangeDict[HexMatchedItem] = RangeItemList
|
HexRangeDict[HexMatchedItem] = RangeItemList
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ class PcdErrorXml(object):
|
|||||||
#
|
#
|
||||||
# To match items on both sides of '-'
|
# To match items on both sides of '-'
|
||||||
#
|
#
|
||||||
RangeItemList = re.compile('[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
RangeItemList = re.compile(r'[\t\s]*\d+[\t\s]*').findall(MatchedItem)
|
||||||
if RangeItemList and len(RangeItemList) == 2:
|
if RangeItemList and len(RangeItemList) == 2:
|
||||||
IntRangeDict[MatchedItem] = RangeItemList
|
IntRangeDict[MatchedItem] = RangeItemList
|
||||||
|
|
||||||
|
@ -281,33 +281,33 @@ class DistributionPackageXml(object):
|
|||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
re.sub(r'[\s\r\n]*SupArchList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
#
|
#
|
||||||
# Remove <SupArchList> COMMON </SupArchList>
|
# Remove <SupArchList> COMMON </SupArchList>
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*COMMON[\s\r\n]*'
|
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*COMMON[\s\r\n]*'
|
||||||
'</SupArchList>[\s\r\n]*', '', XmlContent)
|
r'</SupArchList>[\s\r\n]*', '', XmlContent)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove <SupArchList> common </SupArchList>
|
# Remove <SupArchList> common </SupArchList>
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*'
|
re.sub(r'[\s\r\n]*<SupArchList>[\s\r\n]*'
|
||||||
'common[\s\r\n]*</SupArchList>[\s\r\n]*', '', XmlContent)
|
r'common[\s\r\n]*</SupArchList>[\s\r\n]*', '', XmlContent)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Remove SupModList="COMMON" or "common"
|
# Remove SupModList="COMMON" or "common"
|
||||||
#
|
#
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*COMMON'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
XmlContent = \
|
XmlContent = \
|
||||||
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
re.sub(r'[\s\r\n]*SupModList[\s\r\n]*=[\s\r\n]*"[\s\r\n]*common'
|
||||||
'[\s\r\n]*"', '', XmlContent)
|
r'[\s\r\n]*"', '', XmlContent)
|
||||||
|
|
||||||
return XmlContent
|
return XmlContent
|
||||||
|
|
||||||
|
@ -29,7 +29,8 @@ typedef enum {
|
|||||||
EdkiiPlatformLogoDisplayAttributeCenterBottom,
|
EdkiiPlatformLogoDisplayAttributeCenterBottom,
|
||||||
EdkiiPlatformLogoDisplayAttributeLeftBottom,
|
EdkiiPlatformLogoDisplayAttributeLeftBottom,
|
||||||
EdkiiPlatformLogoDisplayAttributeCenterLeft,
|
EdkiiPlatformLogoDisplayAttributeCenterLeft,
|
||||||
EdkiiPlatformLogoDisplayAttributeCenter
|
EdkiiPlatformLogoDisplayAttributeCenter,
|
||||||
|
EdkiiPlatformLogoDisplayAttributeMicrosoft,
|
||||||
} EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
|
} EDKII_PLATFORM_LOGO_DISPLAY_ATTRIBUTE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +216,7 @@ TranslateBmpToGopBlt (
|
|||||||
|
|
||||||
if ((BmpHeader->Size != BmpImageSize) ||
|
if ((BmpHeader->Size != BmpImageSize) ||
|
||||||
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
(BmpHeader->Size < BmpHeader->ImageOffset) ||
|
||||||
(BmpHeader->Size - BmpHeader->ImageOffset != DataSize))
|
(BmpHeader->Size - BmpHeader->ImageOffset < DataSize))
|
||||||
{
|
{
|
||||||
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n"));
|
||||||
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size));
|
||||||
|
@ -196,6 +196,12 @@ BootLogoEnableLogo (
|
|||||||
DestY = SizeOfY - Image.Height;
|
DestY = SizeOfY - Image.Height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EdkiiPlatformLogoDisplayAttributeMicrosoft:
|
||||||
|
// Position the logo so that its center is 38.2% from the top.
|
||||||
|
DestX = (SizeOfX - Image.Width) / 2;
|
||||||
|
DestY = (SizeOfY * 382) / 1000 - Image.Height / 2;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
continue;
|
continue;
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 315 KiB |
@ -26,7 +26,7 @@ EFI_HII_HANDLE mHiiHandle;
|
|||||||
LOGO_ENTRY mLogos[] = {
|
LOGO_ENTRY mLogos[] = {
|
||||||
{
|
{
|
||||||
IMAGE_TOKEN (IMG_LOGO),
|
IMAGE_TOKEN (IMG_LOGO),
|
||||||
EdkiiPlatformLogoDisplayAttributeCenter,
|
EdkiiPlatformLogoDisplayAttributeMicrosoft,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
|
@ -297,6 +297,7 @@ PlatformBootManagerAfterConsole (
|
|||||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
EFI_GRAPHICS_OUTPUT_BLT_PIXEL White;
|
||||||
EDKII_PLATFORM_LOGO_PROTOCOL *PlatformLogo;
|
EDKII_PLATFORM_LOGO_PROTOCOL *PlatformLogo;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
CHAR16 *BootText = NULL;
|
||||||
|
|
||||||
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
Black.Blue = Black.Green = Black.Red = Black.Reserved = 0;
|
||||||
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
White.Blue = White.Green = White.Red = White.Reserved = 0xFF;
|
||||||
@ -314,23 +315,22 @@ PlatformBootManagerAfterConsole (
|
|||||||
//
|
//
|
||||||
// Register UEFI Shell
|
// Register UEFI Shell
|
||||||
//
|
//
|
||||||
PlatformRegisterFvBootOption (&gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE);
|
//PlatformRegisterFvBootOption (&gUefiShellFileGuid, L"UEFI Shell", LOAD_OPTION_ACTIVE);
|
||||||
|
|
||||||
if (FixedPcdGetBool (PcdBootManagerEscape)) {
|
if (FixedPcdGetBool (PcdBootManagerEscape)) {
|
||||||
Print (
|
BootText = L"Press ESC for Boot Options/Settings, or SPACE for Pop!_OS Recovery";
|
||||||
L"\n"
|
|
||||||
L" Esc or Down to enter Boot Manager Menu.\n"
|
|
||||||
L" ENTER to boot directly.\n"
|
|
||||||
L"\n"
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
Print (
|
BootText = L"Press F2 for Boot Options/Settings, or SPACE for Pop!_OS Recovery";
|
||||||
L"\n"
|
|
||||||
L" F2 or Down to enter Boot Manager Menu.\n"
|
|
||||||
L" ENTER to boot directly.\n"
|
|
||||||
L"\n"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BootLogoUpdateProgress (
|
||||||
|
White,
|
||||||
|
Black,
|
||||||
|
BootText,
|
||||||
|
White,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
144
UefiPayloadPkg/Library/System76EcLib/System76EcLib.c
Normal file
144
UefiPayloadPkg/Library/System76EcLib/System76EcLib.c
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
/** @file
|
||||||
|
System76 EC logging
|
||||||
|
|
||||||
|
Copyright (c) 2020 System76, Inc.
|
||||||
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include <Library/IoLib.h>
|
||||||
|
|
||||||
|
// From coreboot/src/drivers/system76_ec/system76_ec.c {
|
||||||
|
#define SYSTEM76_EC_BASE 0x0E00
|
||||||
|
|
||||||
|
static inline UINT8 system76_ec_read(UINT8 addr) {
|
||||||
|
return IoRead8(SYSTEM76_EC_BASE + (UINT16)addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void system76_ec_write(UINT8 addr, UINT8 data) {
|
||||||
|
IoWrite8(SYSTEM76_EC_BASE + (UINT16)addr, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void system76_ec_init(void) {
|
||||||
|
// Clear entire command region
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
system76_ec_write((UINT8)i, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void system76_ec_flush(void) {
|
||||||
|
// Send command
|
||||||
|
system76_ec_write(0, 4);
|
||||||
|
|
||||||
|
// Wait for command completion
|
||||||
|
while (system76_ec_read(0) != 0) {}
|
||||||
|
|
||||||
|
// Clear length
|
||||||
|
system76_ec_write(3, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void system76_ec_print(UINT8 byte) {
|
||||||
|
// Read length
|
||||||
|
UINT8 len = system76_ec_read(3);
|
||||||
|
// Write data at offset
|
||||||
|
system76_ec_write(len + 4, byte);
|
||||||
|
// Update length
|
||||||
|
system76_ec_write(3, len + 1);
|
||||||
|
|
||||||
|
// If we hit the end of the buffer, or were given a newline, flush
|
||||||
|
if (byte == '\n' || len >= 128) {
|
||||||
|
system76_ec_flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// } From coreboot/src/drivers/system76_ec/system76_ec.c
|
||||||
|
|
||||||
|
// Implement SerialPortLib {
|
||||||
|
#include <Library/SerialPortLib.h>
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SerialPortInitialize (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
system76_ec_init();
|
||||||
|
return RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
UINTN
|
||||||
|
EFIAPI
|
||||||
|
SerialPortWrite (
|
||||||
|
IN UINT8 *Buffer,
|
||||||
|
IN UINTN NumberOfBytes
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (Buffer == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NumberOfBytes == 0) {
|
||||||
|
system76_ec_flush();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(UINTN i = 0; i < NumberOfBytes; i++) {
|
||||||
|
system76_ec_print(Buffer[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NumberOfBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
EFIAPI
|
||||||
|
SerialPortPoll (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SerialPortGetControl (
|
||||||
|
OUT UINT32 *Control
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SerialPortSetControl (
|
||||||
|
IN UINT32 Control
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
SerialPortSetAttributes (
|
||||||
|
IN OUT UINT64 *BaudRate,
|
||||||
|
IN OUT UINT32 *ReceiveFifoDepth,
|
||||||
|
IN OUT UINT32 *Timeout,
|
||||||
|
IN OUT EFI_PARITY_TYPE *Parity,
|
||||||
|
IN OUT UINT8 *DataBits,
|
||||||
|
IN OUT EFI_STOP_BITS_TYPE *StopBits
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return RETURN_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
// } Implement SerialPortLib
|
||||||
|
|
||||||
|
// Implement PlatformHookLib {
|
||||||
|
#include <Library/PlatformHookLib.h>
|
||||||
|
|
||||||
|
RETURN_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformHookSerialPortInitialize (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
// } Implement PlatformHookLib
|
28
UefiPayloadPkg/Library/System76EcLib/System76EcLib.inf
Normal file
28
UefiPayloadPkg/Library/System76EcLib/System76EcLib.inf
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
## @file
|
||||||
|
# System76 EC logging.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2020, System76, Inc.
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
##
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = System76EcLib
|
||||||
|
MODULE_UNI_FILE = System76EcLib.uni
|
||||||
|
FILE_GUID = 76ECF0DD-148B-4E48-8589-FC998823F8C2
|
||||||
|
MODULE_TYPE = BASE
|
||||||
|
VERSION_STRING = 0.1
|
||||||
|
LIBRARY_CLASS = System76EcLib
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
UefiPayloadPkg/UefiPayloadPkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
IoLib
|
||||||
|
|
||||||
|
[Sources]
|
||||||
|
System76EcLib.c
|
||||||
|
|
||||||
|
[Pcd]
|
13
UefiPayloadPkg/Library/System76EcLib/System76EcLib.uni
Normal file
13
UefiPayloadPkg/Library/System76EcLib/System76EcLib.uni
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// /** @file
|
||||||
|
// System76 EC logging.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2020, System76, Inc.
|
||||||
|
// SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
//
|
||||||
|
// **/
|
||||||
|
|
||||||
|
|
||||||
|
#string STR_MODULE_ABSTRACT #language en-US "System76 EC logging"
|
||||||
|
|
||||||
|
#string STR_MODULE_DESCRIPTION #language en-US "System76 EC logging."
|
||||||
|
|
@ -63,6 +63,12 @@
|
|||||||
# GENERIC: GenericMemoryTestDxe
|
# GENERIC: GenericMemoryTestDxe
|
||||||
#
|
#
|
||||||
DEFINE MEMORY_TEST = NULL
|
DEFINE MEMORY_TEST = NULL
|
||||||
|
|
||||||
|
#
|
||||||
|
# Send logs to System76 EC
|
||||||
|
#
|
||||||
|
DEFINE SYSTEM76_EC_LOGGING = FALSE
|
||||||
|
|
||||||
#
|
#
|
||||||
# SBL: UEFI payload for Slim Bootloader
|
# SBL: UEFI payload for Slim Bootloader
|
||||||
# COREBOOT: UEFI payload for coreboot
|
# COREBOOT: UEFI payload for coreboot
|
||||||
@ -260,7 +266,10 @@
|
|||||||
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf
|
||||||
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf
|
||||||
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
ResetSystemLib|UefiPayloadPkg/Library/ResetSystemLib/ResetSystemLib.inf
|
||||||
!if $(USE_CBMEM_FOR_CONSOLE) == TRUE
|
!if $(SYSTEM76_EC_LOGGING) == TRUE
|
||||||
|
SerialPortLib|UefiPayloadPkg/Library/System76EcLib/System76EcLib.inf
|
||||||
|
PlatformHookLib|UefiPayloadPkg/Library/System76EcLib/System76EcLib.inf
|
||||||
|
!elseif $(USE_CBMEM_FOR_CONSOLE) == TRUE
|
||||||
SerialPortLib|UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.inf
|
SerialPortLib|UefiPayloadPkg/Library/CbSerialPortLib/CbSerialPortLib.inf
|
||||||
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
|
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
|
||||||
!else
|
!else
|
||||||
|
Reference in New Issue
Block a user