build script update, rename *.json files to be more consistent

This commit is contained in:
Gerd Hoffmann 2022-12-05 07:58:31 +01:00
parent 9d00764610
commit 82d42e78b6
5 changed files with 44 additions and 16 deletions

View File

@ -7,7 +7,14 @@ import optparse
import subprocess
import configparser
rebase_prefix = ""
version_override = None
def check_rebase():
""" detect 'git rebase -x edk2-build.py master' testbuilds """
global rebase_prefix
global version_override
if not os.path.exists('.git/rebase-merge/msgnum'):
return ""
with open('.git/rebase-merge/msgnum', 'r') as f:
@ -16,7 +23,11 @@ def check_rebase():
end = int(f.read())
with open('.git/rebase-merge/head-name', 'r') as f:
head = f.read().strip().split('/')
return f'[ {int(msgnum/2)} / {int(end/2)} - {head[-1]} ] '
rebase_prefix = f'[ {int(msgnum/2)} / {int(end/2)} - {head[-1]} ] '
if msgnum != end:
# fixed version speeds up builds
version_override = "test-build-patch-series"
def get_coredir(cfg):
if cfg.has_option('global', 'core'):
@ -26,6 +37,11 @@ def get_coredir(cfg):
def get_version(cfg):
coredir = get_coredir(cfg)
if version_override:
version = version_override
print('')
print(f'### version [override]: {version}')
return version
if os.environ.get('RPM_PACKAGE_NAME'):
version = os.environ.get('RPM_PACKAGE_NAME');
version += '-' + os.environ.get('RPM_PACKAGE_VERSION');
@ -37,6 +53,11 @@ def get_version(cfg):
cmdline = [ 'git', 'describe', '--tags', '--abbrev=8', '--match=edk2-stable*' ]
result = subprocess.run(cmdline, capture_output = True, cwd = coredir)
version = result.stdout.decode().strip()
#cmdline = [ 'git', 'branch', '--show-current']
#result = subprocess.run(cmdline, capture_output = True, cwd = coredir)
#branch = result.stdout.decode().strip()
#if branch != "master":
# version += f' ({branch})'
print('')
print(f'### version [git]: {version}')
return version
@ -52,17 +73,15 @@ def pcd_version(cfg):
return [ '--pcd', pcd_string('PcdFirmwareVersionString', version) ]
def build_message(line):
prefix = check_rebase()
if os.environ.get('TERM') in [ 'xterm', 'xterm-256color' ]:
# setxterm title
start = '\x1b]2;'
end = '\x07'
print(f'{start}{prefix}{line}{end}', end = '')
print(f'{start}{rebase_prefix}{line}{end}', end = '')
print('')
print('###')
print(f'### {prefix}{line}')
print(f'### {rebase_prefix}{line}')
print('###')
def build_run(cmdline, name):
@ -213,7 +232,7 @@ def build_list(cfg):
desc = 'no description'
if 'desc' in cfg[build]:
desc = cfg[build]['desc']
print(f'# {name:16s} - {desc}')
print(f'# {name:20s} - {desc}')
def main():
parser = optparse.OptionParser()
@ -223,6 +242,7 @@ def main():
parser.add_option('-m', '--match', dest = 'match', type = 'string')
parser.add_option('-l', '--list', dest = 'list', action = 'store_true')
parser.add_option('--core', dest = 'core', type = 'string')
parser.add_option('--version-override', dest = 'version_override', type = 'string')
(options, args) = parser.parse_args()
cfg = configparser.ConfigParser()
@ -237,6 +257,10 @@ def main():
if options.core:
cfg.set('global', 'core', options.core)
check_rebase()
if options.version_override:
version_override = options.version_override
prepare_env(cfg)
build_basetools()
for build in cfg.sections():

View File

@ -35,7 +35,7 @@ ExclusiveArch: x86_64 aarch64
Name: edk2
Version: %{GITDATE}git%{GITCOMMIT}
Release: 4%{?dist}
Release: 5%{?dist}
Summary: UEFI firmware for 64-bit virtual machines
License: BSD-2-Clause-Patent and OpenSSL and MIT
URL: http://www.tianocore.org
@ -57,10 +57,10 @@ Source20: 50-edk2-arm-verbose.json
Source30: 30-edk2-ovmf-ia32-sb-enrolled.json
Source31: 40-edk2-ovmf-ia32-sb.json
Source32: 50-edk2-ovmf-ia32.json
Source32: 50-edk2-ovmf-ia32-nosb.json
Source40: 30-edk2-ovmf-x64-sb.json
Source41: 40-edk2-ovmf-x64.json
Source40: 30-edk2-ovmf-x64-sb-enrolled.json
Source41: 40-edk2-ovmf-x64-sb.json
Source42: 50-edk2-ovmf-x64-microvm.json
Source43: 50-edk2-ovmf-x64-nosb.json
Source44: 60-edk2-ovmf-x64-amdsev.json
@ -384,8 +384,8 @@ ln -s OVMF_CODE.fd %{buildroot}%{_datadir}/%{name}/ovmf/OVMF_CODE.cc.fd
# json description files
mkdir -p %{buildroot}%{_datadir}/qemu/firmware
install -m 0644 \
30-edk2-ovmf-x64-sb.json \
40-edk2-ovmf-x64.json \
30-edk2-ovmf-x64-sb-enrolled.json \
40-edk2-ovmf-x64-sb.json \
50-edk2-ovmf-x64-nosb.json \
60-edk2-ovmf-x64-amdsev.json \
60-edk2-ovmf-x64-inteltdx.json \
@ -395,7 +395,7 @@ install -m 0644 \
50-edk2-ovmf-x64-microvm.json \
30-edk2-ovmf-ia32-sb-enrolled.json \
40-edk2-ovmf-ia32-sb.json \
50-edk2-ovmf-ia32.json \
50-edk2-ovmf-ia32-nosb.json \
%{buildroot}%{_datadir}/qemu/firmware
%endif
@ -483,8 +483,8 @@ done
%{_datadir}/%{name}/ovmf/UefiShell.iso
%{_datadir}/%{name}/ovmf/Shell.efi
%{_datadir}/%{name}/ovmf/EnrollDefaultKeys.efi
%{_datadir}/qemu/firmware/30-edk2-ovmf-x64-sb.json
%{_datadir}/qemu/firmware/40-edk2-ovmf-x64.json
%{_datadir}/qemu/firmware/30-edk2-ovmf-x64-sb-enrolled.json
%{_datadir}/qemu/firmware/40-edk2-ovmf-x64-sb.json
%{_datadir}/qemu/firmware/50-edk2-ovmf-x64-nosb.json
%{_datadir}/qemu/firmware/60-edk2-ovmf-x64-amdsev.json
%{_datadir}/qemu/firmware/60-edk2-ovmf-x64-inteltdx.json
@ -557,7 +557,7 @@ done
%{_datadir}/%{name}/ovmf-ia32/UefiShell.iso
%{_datadir}/qemu/firmware/30-edk2-ovmf-ia32-sb-enrolled.json
%{_datadir}/qemu/firmware/40-edk2-ovmf-ia32-sb.json
%{_datadir}/qemu/firmware/50-edk2-ovmf-ia32.json
%{_datadir}/qemu/firmware/50-edk2-ovmf-ia32-nosb.json
%files ovmf-experimental
%common_files
@ -596,6 +596,10 @@ done
%changelog
* Mon Dec 05 2022 Gerd Hoffmann <kraxel@redhat.com> - 20221117gitfff6d81270b5-5
- rename *.json files to be more consistent.
- build script update
* Fri Dec 02 2022 Gerd Hoffmann <kraxel@redhat.com> - 20221117gitfff6d81270b5-4
- apply dbx updates