Add support for $thisyear and $lastyear in *.sources
All checks were successful
the build was successful

This commit is contained in:
Reinhard Müller 2019-03-13 00:26:26 +01:00
parent 5c1d2ac5bb
commit 456817fb58
4 changed files with 22 additions and 13 deletions

View File

@ -1,4 +1,4 @@
donate/donors/donors-2018:[]
donate/donors/donors-2019:[]
donate/donors/donors-$thisyear:[]
donate/donors/donors-$lastyear:[]
localmenuinfo:[]
d_day:[]

View File

@ -1,5 +1,7 @@
news/2019/news:[frontpage]
news/2019/.news:[frontpage]
events/2019/event:[frontpage]
news/$thisyear/news:[frontpage]
news/$lastyear/news:[frontpage]
news/$thisyear/.news:[frontpage]
news/$lastyear/.news:[frontpage]
events/$thisyear/event:[frontpage]
tools/frontpage/:[]
tools/static-elements/element-:[]

View File

@ -1,9 +1,9 @@
news/2019/news:[]
news/2019/.news:[]
news/nl/nl-2019:[]
news/nl/.nl-2019:[]
news/2018/news:[]
news/2018/.news:[]
news/nl/nl-2018:[]
news/nl/.nl-2018:[]
news/$thisyear/news:[]
news/$lastyear/news:[]
news/$thisyear/.news:[]
news/$lastyear/.news:[]
news/nl/nl-$thisyear:[]
news/nl/nl-$lastyear:[]
news/nl/.nl-$thisyear:[]
news/nl/.nl-$lastyear:[]
tools/static-elements/element-:[]

View File

@ -27,6 +27,9 @@ set -o pipefail
pid=$$
thisyear=$(date --date="this year" +%Y)
lastyear=$(date --date="last year" +%Y)
# -----------------------------------------------------------------------------
# Make sure temporary directory is empty
# -----------------------------------------------------------------------------
@ -101,6 +104,10 @@ for source_file in $(find * -name '*.sources' | sort); do
continue
fi
# Honor $thisyear and $lastyear variables
pattern=${pattern//\$thisyear/${thisyear}}
pattern=${pattern//\$lastyear/${lastyear}}
# Change from a glob pattern into a regex
pattern=$(echo "${pattern}" | sed -r -e 's/([.^$[])/\\\1/g; s/\*/.*/g')