Skip to content

Commit

Permalink
Merge branch 'main' into gahan9-publish-package-poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
gahan9 authored Oct 22, 2024
2 parents 8788178 + 959e482 commit 07710a9
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 54 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
groups:
all-github:
patterns:
- "*"
11 changes: 7 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ on:
schedule:
- cron: '45 23 * * 0'

# Declare default permissions as read only.
permissions: read-all

jobs:
analyze:
name: Analyze
Expand All @@ -55,11 +58,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3.26.13
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -74,7 +77,7 @@ jobs:
# If this step fails, then you should remove it and run the build manually (see below)
- if: matrix.language == 'python'
name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3.26.13

- if: matrix.language == 'cpp'
name: Build C
Expand All @@ -93,6 +96,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3.26.13
with:
category: "/language:${{matrix.language}}"
8 changes: 4 additions & 4 deletions .github/workflows/ossf_scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
uses: actions/checkout@6b42224f41ee5dfe5395e27c8b2746f1f9955030 # v3.1.0
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -59,14 +59,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
uses: github/codeql-action/upload-sarif@b0b722f202d6f76a52f990a286c2b1eacfc5a9ff # v2.26.11
with:
sarif_file: results.sarif
4 changes: 4 additions & 0 deletions .github/workflows/pull-request-analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
report_date_end:
description: "Report date end(d/MM/yyyy)"
required: false

# Declare default permissions as read only.
permissions: read-all

jobs:
create-report:
name: "Create report"
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ on:
schedule:
- cron: '45 23 * * 0'

# Declare default permissions as read only.
permissions: read-all

jobs:
build:

Expand All @@ -36,12 +39,12 @@ jobs:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2
- uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.4.0
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: abatilo/actions-poetry@v2
- uses: actions/checkout@v4
- uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.4.0
- name: Publish distribution 📦 to PyPI
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-execution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ jobs:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2
- uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.4.0
- name: Install dependencies
Expand Down
11 changes: 5 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 13 additions & 11 deletions src/xmlcli/XmlCliLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,12 +792,13 @@ def ConfXmlCli(SkipEnable=0):
try:
from .tools.restricted import EnableXmlCli as exc
except (ModuleNotFoundError, ImportError) as e:
from .tools import EnableXmlCli as exc
except ImportError:
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
CloseInterface()
LastErrorSig = 0x13E4 # import error
return 0xF
try:
from .tools import EnableXmlCli as exc
except ImportError:
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
CloseInterface()
LastErrorSig = 0x13E4 # import error
return 0xF
Status = exc.EnableXmlCli()
if Status == 0:
Status = 2
Expand All @@ -824,11 +825,12 @@ def TriggerXmlCliEntry():
try:
from .tools.restricted import EnableXmlCli as exc
except (ModuleNotFoundError, ImportError) as e:
from .tools import EnableXmlCli as exc
except ImportError:
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
LastErrorSig = 0x13E4 # import error
return 1
try:
from .tools import EnableXmlCli as exc
except ImportError:
log.error(f'Import error on EnableXmlCli, current Python version {sys.version}')
LastErrorSig = 0x13E4 # import error
return 1
status = exc.XmlCliApiAuthenticate()
if status:
LastErrorSig = 0xE7CA # Error Triggering XmlCli command, Authentication Failed
Expand Down
30 changes: 10 additions & 20 deletions src/xmlcli/modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,15 @@ def generate_knobs_delta(ref_xml, new_xml, out_file=r'KnobsDiff.log', compare_ta
new_knobs_map[new_knob_name][current_tag] = new_value

file_content = ""
log_msg = f'\n\nWriting delta knobs for comparing following fields \"{compare_tag}\"\n RefXmlBiosVer = Arg 1 File = {ref_knobs_bios_version} \n MyXmlBiosVer = Arg 2 File = {new_knobs_bios_version} '
log_msg += '--------------------------------------------------|----------------------|---------------------|'
'\n Knob Name (compare_tag) | RefXmlDefVal | MyXmlDefVal |'
'\n | Arg 1 File | Arg 2 File |'
'\n--------------------------------------------------|----------------------|---------------------|'
log_msg = f'\n\nWriting delta knobs for comparing following fields \"{compare_tag}\"\n RefXmlBiosVer = Arg 1 File = {ref_knobs_bios_version} \n MyXmlBiosVer = Arg 2 File = {new_knobs_bios_version}\n'
log.info(log_msg)
if os.path.splitext(out_file)[-1].lower() not in ['.ini', '.cfg']:
file_content += log_msg
else:
file_content += ';-------------------------------------------------\n'
'; Knob Entries for XmlCli based setup, trying to clone {current_compare_tags[0]} from File 2\n'
'; The name entry here should be identical as the name from the XML file (retain the case)\n'
';-------------------------------------------------\n'
'[BiosKnobs]\n'

file_content += ';-------------------------------------------------\n; Knob Entries for XmlCli based setup, trying to clone {current_compare_tags[0]} from File 2\n; The name entry here should be identical as the name from the XML file (retain the case)\n;-------------------------------------------------\n[BiosKnobs]\n'
header_list = ['Knob Name (compare_tag)', 'RefXmlDefVal (Arg 1 File)', 'MyXmlDefVal (Arg 2 File)']
missing_in_new_knobs = []
knobs_dictionary=[]
for knob in ref_knobs_map:
if knob not in new_knobs_map:
missing_in_new_knobs.append(knob)
Expand All @@ -180,20 +173,19 @@ def generate_knobs_delta(ref_xml, new_xml, out_file=r'KnobsDiff.log', compare_ta
ref_str_value = ref_knobs_map[knob][current_tag]
new_str_value = new_knobs_map[knob][current_tag]
if ref_str_value != new_str_value:
log.info(f' {"%s (%s)" % (knob, current_tag):>48} | {ref_str_value:>20} | {new_str_value:<19} |')
if os.path.splitext(out_file)[-1].lower() not in ['.ini', '.cfg']:
file_content += f' {"%s (%s)" % (knob, current_tag):>48} | {ref_str_value:>20} | {new_str_value:<19} |\n'
else:
knobs_dictionary.append([f"{knob} ({current_tag})",ref_str_value,new_str_value])
if os.path.splitext(out_file)[-1].lower() in ['.ini', '.cfg']:
if print_first_tag:
file_content += f'{knob} = {new_str_value}\n'
print_first_tag = False
new_knobs_map.pop(knob)
missing_in_ref_knobs = []
for knob in new_knobs_map:
missing_in_ref_knobs.append(knob)
log.info('--------------------------------------------------|----------------------|---------------------|')
if os.path.splitext(out_file)[-1].lower() not in ['.ini', '.cfg']:
file_content += '--------------------------------------------------|----------------------|---------------------|\n'
file_content += utils.Table().create_table(header=header_list, data=knobs_dictionary, width=0)
log.result(utils.Table().create_table(header=header_list, data=knobs_dictionary, width=0))


if len(missing_in_ref_knobs) != 0:
log.info(f'Following Knobs are missing in Arg 1 File\n\t [ {", ".join(missing_in_ref_knobs)} ]')
Expand All @@ -206,8 +198,6 @@ def generate_knobs_delta(ref_xml, new_xml, out_file=r'KnobsDiff.log', compare_ta

with open(out_file, 'w') as out:
out.write(file_content)
return file_content


def compare_bios_knobs(reference_bin_file, new_bin_file, result_log_file=r'KnobsDifference.log', compare_tag='default'):
"""Take difference of Setup Option between two BIOS/IFWI
Expand All @@ -222,7 +212,7 @@ def compare_bios_knobs(reference_bin_file, new_bin_file, result_log_file=r'Knobs
new_xml = clb.KnobsXmlFile.replace('BiosKnobs', 'MyBiosKnobs')
cli.savexml(reference_xml, reference_bin_file)
cli.savexml(new_xml, new_bin_file)
return generate_knobs_delta(reference_xml, new_xml, result_log_file, compare_tag)
generate_knobs_delta(reference_xml, new_xml, result_log_file, compare_tag)


def launch_web_gui():
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tox >= 3.23.0
pygments >= 2.8.0
jinja2 == 3.1.3
jinja2 == 3.1.4
babel >= 2.9.1
sphinx >= 4.0.2
pytest >= 7.4.3
Expand Down

0 comments on commit 07710a9

Please sign in to comment.