Skip to content

Allow disabling pattern updates - #40

Merged
gouttegd merged 3 commits into
mainfrom
allow-disabling-pattern-updates
Oct 11, 2026
Merged

gouttegd merged 3 commits into
mainfrom
allow-disabling-pattern-updates

Conversation

@gouttegd

Copy link
Copy Markdown
Collaborator

This PR brings two small improvements to the workflows related to DOSDP patterns:

(A) It allows to comment out an URL in the src/patterns/dosdp-patterns/external.txt file. Commented-out URLs will be ignored when the external patterns are updated.

(B) It disables the automatic updating of external patterns under MIR=false, since the general idea of MIR=false is that it prevents ODK workflows from attempting to fetch external resources – there’s no reason to exclude remotely sourced DOSDP patterns from that logic.

Users might sometimes want to temporarily disable updating an externally
sourced DOSDP pattern. For now, the only way to do that is to remove the
corresponding URL entirely from the
src/patterns/dosdp-patterns/external.txt file, but then the URL has to
be added back later when updating that pattern is desired again.

This commit makes it possible to comment out a URL in the external.txt
file by preceding it with a `#` character.

We also remove the EXTERNAL_PATTERN_FILES variable, which is never used
anywhere.
The general promise of the MIR variable is that ODK workflows should not
attempt to fetch any remote resources under MIR=false. This should apply
to remotely source DOSDP patterns -- that is, running:

```
make patterns MIR=false
```

should _not_ automatically the patterns listed in
src/patterns/dosdp-patterns/external.txt.
@gouttegd gouttegd self-assigned this Oct 11, 2026
To compute the EXTERNAL_PATTERN_URLS, we cannot rely on the
`$(filter-out)` and `$(file)` Make functions, which are broken on the
version of GNU Make found on macOS.

So we explicitly invoke grep instead.
@gouttegd
gouttegd requested a review from matentzn October 11, 2026 14:24

@matentzn matentzn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine with this, but note my comment!


EXTERNAL_PATTERN_URLS = $(strip $(file <$(PATTERNDIR)/dosdp-patterns/external.txt))
EXTERNAL_PATTERN_FILES = $(notdir $(EXTERNAL_PATTERN_URLS))
EXTERNAL_PATTERN_URLS = $(strip $(shell test -f $(PATTERNDIR)/dosdp-patterns/external.txt && grep -v ^\# $(PATTERNDIR)/dosdp-patterns/external.txt))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very strict, # yo wont match.

https://example.org/a.yaml
#https://example.org/b.yaml
  # indented comment
https://example.org/c.yaml # trailing note

will result in https://example.org/a.yaml # indented comment https://example.org/c.yaml # trailing note. So #, indented, comment, trailing and note all end up in $(foreach url, ...) and get passed to odk-helper download.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the point is solely to allow ignoring one line – not to introduce a full-fledged comment syntax.

@gouttegd
gouttegd merged commit 94448a5 into main Oct 11, 2026
6 checks passed
@gouttegd
gouttegd deleted the allow-disabling-pattern-updates branch October 11, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants