-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate.sh
executable file
·44 lines (36 loc) · 1.13 KB
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
set -eo pipefail
set -x
# ensure github api token added
source "${HOME}/.bashrc"
cd "$(dirname "$0")"
git fetch --all
git checkout master
# cleanup git-ignored stuff (leftovers of previous jobs maybe)
git clean -fX >/dev/null
# remove spec files for modules no longer built
rm -rf ./*.spec
if [[ -t 1 ]]; then
bold=$(tput bold)
normal=$(tput sgr0)
else
bold=""
normal=""
fi
for ymlConfig in ./resty/*.yml; do
echo "${bold}====== Processing $ymlConfig ======${normal}"
LUA_PKG_NAME="resty-$(basename $ymlConfig .yml)"
moduleName="lua-${LUA_PKG_NAME}"
echo "Generating ${moduleName}.spec ... "
# generate .spec by feeding module .yml to lastversion, then template result via jinja2cli
lastversion "${ymlConfig}" --format json |
jinja2 -D luapkgname=${LUA_PKG_NAME} --format=json spec.j2 --strict - > ${moduleName}.spec
echo "Done!"
printf "Checking with rpmlint ...: "
# rpmlint -f ./rpmlint.config ./${moduleName}.spec
done
git add --all .
# at this point we don't know what updated: rpmmacros or spec files, but we check-in all
git commit -m "Updated"
git push --force origin
git checkout master