actions: rebuild targets if includes change

This commit is contained in:
lemoer 2021-09-16 00:01:41 +02:00
parent 3f7c0b3ae8
commit 27cd003d1b
3 changed files with 26 additions and 6 deletions

16
.github/filters.yml vendored
View File

@ -21,7 +21,8 @@
"Makefile", "Makefile",
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk" "targets/targets.mk",
"targets/bcm27xx.inc"
], ],
"bcm27xx-bcm2709": [ "bcm27xx-bcm2709": [
"targets/bcm27xx-bcm2709", "targets/bcm27xx-bcm2709",
@ -29,7 +30,8 @@
"Makefile", "Makefile",
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk" "targets/targets.mk",
"targets/bcm27xx.inc"
], ],
"ipq40xx-generic": [ "ipq40xx-generic": [
"targets/ipq40xx-generic", "targets/ipq40xx-generic",
@ -133,7 +135,8 @@
"Makefile", "Makefile",
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk" "targets/targets.mk",
"targets/x86.inc"
], ],
"x86-geode": [ "x86-geode": [
"targets/x86-geode", "targets/x86-geode",
@ -149,7 +152,8 @@
"Makefile", "Makefile",
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk" "targets/targets.mk",
"targets/x86.inc"
], ],
"x86-64": [ "x86-64": [
"targets/x86-64", "targets/x86-64",
@ -158,6 +162,7 @@
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk", "targets/targets.mk",
"targets/x86.inc",
"contrib/ci/minimal-site/**", "contrib/ci/minimal-site/**",
"package/**" "package/**"
], ],
@ -167,7 +172,8 @@
"Makefile", "Makefile",
"patches/**", "patches/**",
"targets/generic", "targets/generic",
"targets/targets.mk" "targets/targets.mk",
"targets/bcm27xx.inc"
], ],
"mvebu-cortexa9": [ "mvebu-cortexa9": [
"targets/mvebu-cortexa9", "targets/mvebu-cortexa9",

View File

@ -104,7 +104,7 @@ update-modules: FORCE
@scripts/update-modules.sh @scripts/update-modules.sh
update-ci: FORCE update-ci: FORCE
@scripts/update-ci.sh @$(GLUON_ENV) scripts/update-ci.sh
GLUON_TARGETS := GLUON_TARGETS :=

View File

@ -3,6 +3,8 @@
# Update target filters using # Update target filters using
# make update-ci # make update-ci
import re
import os
import sys import sys
import json import json
@ -23,6 +25,13 @@ extra = [
_filter = dict() _filter = dict()
# INCLUDE_PATTERN matches:
# include '...'
# include "..."
# include("...")
# include('...')
INCLUDE_PATTERN = "^\\s*include *\\(? *[\"']([^\"']+)[\"']"
# construct filters map from stdin # construct filters map from stdin
for target in sys.stdin: for target in sys.stdin:
target = target.strip() target = target.strip()
@ -31,6 +40,11 @@ for target in sys.stdin:
f"targets/{target}" f"targets/{target}"
] + common ] + common
target_file = os.path.join(os.environ['GLUON_TARGETSDIR'], target)
with open(target_file) as f:
includes = re.findall(INCLUDE_PATTERN, f.read(), re.MULTILINE)
_filter[target].extend([f"targets/{i}" for i in includes])
if target == "x86-64": if target == "x86-64":
_filter[target].extend(extra) _filter[target].extend(extra)