Skip to content

Commit e79d931

Browse files
build_package: simplify extra-repositories parsing
Keep only global entries and explicit suite-filtered entries in debian/extra-repositories.txt. Remove wildcard and placeholder handling. Keep sid/unstable alias matching for suite filters. Update docs to reflect the simplified contract. Signed-off-by: Simon Beaudoin <sbeaudoi@qti.qualcomm.com>
1 parent 36169e8 commit e79d931

3 files changed

Lines changed: 32 additions & 34 deletions

File tree

.github/actions/build_package/action.yml

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,14 @@ runs:
162162
163163
# Optional repo-local extension point for additional build-dependency apt repos.
164164
# Each non-empty, non-comment line in debian/extra-repositories.txt is passed
165-
# through to sbuild as --extra-repository "<line>".
165+
# to sbuild as --extra-repository "<line>".
166166
#
167167
# Supported entry formats:
168-
# deb [arch=arm64 ...] https://example.org/repo {suite} main
168+
# deb [arch=arm64 ...] https://example.org/repo noble main
169169
# -> applies to all suites
170170
#
171171
# [noble,questing] deb [arch=arm64 ...] https://ppa.launchpadcontent.net/org/ppa/ubuntu noble main
172172
# -> applies only when target suite is listed
173-
#
174-
# Placeholders replaced with the runtime suite:
175-
# {suite}, {SUITE}, ${suite}, ${SUITE}, @suite@, @SUITE@
176173
EXTRA_REPOSITORIES_FILE="./debian/extra-repositories.txt"
177174
target_suite="${{inputs.suite}}"
178175
if [[ "$target_suite" == "unstable" ]]; then
@@ -192,33 +189,35 @@ runs:
192189
193190
repo_entry="$line"
194191
195-
if [[ "$line" =~ ^\[([^][]+)\][[:space:]]+(.+)$ ]]; then
196-
suites_csv="${BASH_REMATCH[1]}"
197-
repo_entry="${BASH_REMATCH[2]}"
198-
include_entry=false
199-
200-
IFS=',' read -ra suite_filters <<< "$suites_csv"
201-
for suite_filter in "${suite_filters[@]}"; do
202-
suite_filter="$(printf '%s' "$suite_filter" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')"
203-
[[ -n "$suite_filter" ]] || continue
204-
if [[ "$suite_filter" == "$target_suite" || "$suite_filter" == "all" || "$suite_filter" == "*" ]]; then
205-
include_entry=true
206-
break
192+
if [[ "$line" == \[* ]]; then
193+
if [[ "$line" =~ ^\[([^][]+)\][[:space:]]+(.+)$ ]]; then
194+
suites_csv="${BASH_REMATCH[1]}"
195+
repo_entry="${BASH_REMATCH[2]}"
196+
include_entry=false
197+
198+
IFS=',' read -ra suite_filters <<< "$suites_csv"
199+
for suite_filter in "${suite_filters[@]}"; do
200+
suite_filter="$(printf '%s' "$suite_filter" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')"
201+
[[ -n "$suite_filter" ]] || continue
202+
if [[ "$suite_filter" == "unstable" ]]; then
203+
suite_filter="sid"
204+
fi
205+
if [[ "$suite_filter" == "$target_suite" ]]; then
206+
include_entry=true
207+
break
208+
fi
209+
done
210+
211+
if [[ "$include_entry" != true ]]; then
212+
echo "ℹ️ Skipping entry with suite filter [${suites_csv}] for target suite ${target_suite}"
213+
continue
207214
fi
208-
done
209-
210-
if [[ "$include_entry" != true ]]; then
211-
echo "ℹ️ Skipping entry with suite filter [${suites_csv}] for target suite ${target_suite}"
212-
continue
215+
else
216+
echo "::error::Invalid ${EXTRA_REPOSITORIES_FILE} entry '${line}'. Expected '[suite1,suite2] deb ...' or a plain 'deb ...' line."
217+
exit 1
213218
fi
214219
fi
215220
216-
repo_entry="${repo_entry//\$\{suite\}/$target_suite}"
217-
repo_entry="${repo_entry//\$\{SUITE\}/$target_suite}"
218-
repo_entry="${repo_entry//\{suite\}/$target_suite}"
219-
repo_entry="${repo_entry//\{SUITE\}/$target_suite}"
220-
repo_entry="${repo_entry//@suite@/$target_suite}"
221-
repo_entry="${repo_entry//@SUITE@/$target_suite}"
222221
repo_entry="$(printf '%s' "$repo_entry" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')"
223222
[[ -n "$repo_entry" ]] || continue
224223

AGENTS.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ orchestration around build, test, promotion, and release flows.
3737
- Supported entry styles:
3838
- global entries (apply to all suites)
3939
- suite-filtered entries (for example `[noble,questing] deb ...`)
40-
- wildcards (`[all]` or `[*]`)
41-
- Suite placeholders are expanded at runtime:
42-
- `{suite}`, `{SUITE}`, `${suite}`, `${SUITE}`, `@suite@`, `@SUITE@`
40+
- Suite filters are exact matches against the build suite.
41+
- `unstable` and `sid` are treated as equivalent for suite-filter matching.
4342

4443
## Workflow Naming Convention
4544

docs/actions/build_package.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ Supported entry forms:
2828

2929
```text
3030
# Applies to all suites:
31-
deb [arch=arm64 signed-by=/etc/apt/keyrings/vendor.gpg] https://repo.example.org/debian {suite} main
31+
deb [arch=arm64 signed-by=/etc/apt/keyrings/vendor.gpg] https://repo.example.org/debian noble main
3232
3333
# Applies only to specific suites:
3434
[noble,questing,resolute] deb [arch=arm64 trusted=yes] https://ppa.launchpadcontent.net/example/team/ubuntu noble main
3535
```
3636

3737
Notes:
3838
- Lines beginning with `#` and empty lines are ignored.
39-
- Suite filters support `all` or `*` as wildcards.
40-
- Suite placeholders are expanded at runtime: `{suite}`, `{SUITE}`, `${suite}`, `${SUITE}`, `@suite@`, `@SUITE@`.
39+
- Suite filters are exact matches against the build suite.
40+
- `unstable` and `sid` are treated as equivalent for suite-filter matching.
4141

4242
Example:
4343

0 commit comments

Comments
 (0)