Do not use globs when building docs

If we use an explicit file lists then the docs are regenerated when the source
files change.
This commit is contained in:
Richard Hughes 2022-11-02 13:26:10 +00:00
parent 8f904cac17
commit da6928fe76
3 changed files with 44 additions and 9 deletions

View File

@ -8,7 +8,6 @@
import argparse
import sys
import json
import glob
import os
from typing import Dict, List, Any
@ -21,16 +20,14 @@ if __name__ == "__main__":
parser.add_argument(
"filename_dst", action="store", type=str, help="markdown destination"
)
parser.add_argument(
"attr_dir", action="store", type=str, help="directory for attributes"
)
parser.add_argument("json_attrs", nargs="+", help="JSON attributes")
args = parser.parse_args()
with open(args.filename_src, "rb") as f:
template = f.read()
txt: List[str] = []
for fn in sorted(glob.glob(os.path.join(args.attr_dir, "*.json"))):
for fn in sorted(args.json_attrs):
try:
with open(fn, "rb") as f:
item = json.loads(f.read())

View File

@ -0,0 +1,38 @@
hsi_test_jsons = files([
'org.fwupd.hsi.Amd.PlatformRollbackProtection.json',
'org.fwupd.hsi.Amd.SpiReplayProtection.json',
'org.fwupd.hsi.Amd.SpiWriteProtection.json',
'org.fwupd.hsi.EncryptedRam.json',
'org.fwupd.hsi.IntelBootguard.Acm.json',
'org.fwupd.hsi.IntelBootguard.Enabled.json',
'org.fwupd.hsi.IntelBootguard.Otp.json',
'org.fwupd.hsi.IntelBootguard.Policy.json',
'org.fwupd.hsi.IntelBootguard.Verified.json',
'org.fwupd.hsi.IntelCet.Active.json',
'org.fwupd.hsi.IntelCet.Enabled.json',
'org.fwupd.hsi.IntelSmap.json',
'org.fwupd.hsi.Iommu.json',
'org.fwupd.hsi.Kernel.Lockdown.json',
'org.fwupd.hsi.Kernel.Tainted.json',
'org.fwupd.hsi.Mei.BootGuardPlatformKey.json',
'org.fwupd.hsi.Mei.ManufacturingMode.json',
'org.fwupd.hsi.Mei.OverrideStrap.json',
'org.fwupd.hsi.Mei.Version.json',
'org.fwupd.hsi.PlatformDebugEnabled.json',
'org.fwupd.hsi.PlatformDebugLocked.json',
'org.fwupd.hsi.PlatformFused.json',
'org.fwupd.hsi.PrebootDma.json',
'org.fwupd.hsi.Spi.Bioswe.json',
'org.fwupd.hsi.Spi.Ble.json',
'org.fwupd.hsi.Spi.Descriptor.json',
'org.fwupd.hsi.Spi.SmmBwp.json',
'org.fwupd.hsi.SupportedCpu.json',
'org.fwupd.hsi.SuspendToIdle.json',
'org.fwupd.hsi.SuspendToRam.json',
'org.fwupd.hsi.Tpm.EmptyPcr.json',
'org.fwupd.hsi.Tpm.ReconstructionPcr0.json',
'org.fwupd.hsi.Tpm.Version20.json',
'org.fwupd.hsi.Uefi.Pk.json',
'org.fwupd.hsi.Uefi.SecureBoot.json',
])

View File

@ -43,15 +43,15 @@ if gidocgen_dep.found() and docs_python_deps.allowed() and gidocgen_app.found()
install_dir: join_paths(datadir, 'doc'),
)
subdir('hsi-tests.d')
hsi_md = custom_target('generate-hsi-spec',
input : 'hsi.md.in',
input: hsi_test_jsons,
output : 'hsi.md',
command : [
python3,
join_paths(meson.current_source_dir(), 'generate-hsi-spec.py'),
'@INPUT@',
files(['generate-hsi-spec.py', 'hsi.md.in']),
'@OUTPUT@',
join_paths(meson.current_source_dir(), 'hsi-tests.d'),
'@INPUT@',
],
)