summaryrefslogtreecommitdiffhomepage
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rwxr-xr-xbuild/check-controllers.sh30
-rwxr-xr-xbuild/zoneinfo2lua.pl28
2 files changed, 58 insertions, 0 deletions
diff --git a/build/check-controllers.sh b/build/check-controllers.sh
new file mode 100755
index 0000000000..573e6f8642
--- /dev/null
+++ b/build/check-controllers.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+[ -d build ] || {
+ echo "Execute as ./build/check-controllers.sh" >&2
+ exit 1
+}
+
+find . -type f -name '*.lua' -path '*/controller/*' | while read controller; do
+ controller="${controller#./}"
+ base="${controller%%/controller/*}"
+
+ sed -rne 's#^.*\b(cbi|form)\([[:space:]]*("([^"]*)"|\047([^\047]*)\047)[[:space:]]*[,)].*$#\1 \3\4#gp' "$controller" | while read type map; do
+ model="$base/model/cbi/$map.lua"
+ package="${controller##*/controller/}"; package="${package%.lua}"; package="luci.controller.${package//\//.}"
+
+ if ! grep -sqE '\bmodule[[:space:]]*\(?[[:space:]]*("|\047|\[=*\[)'"$package" "$controller"; then
+ echo "'$controller' does not containt the expected\n\t'module(\"$package\", ...)' line.\n"
+ fi
+
+ grep -sqE '\b(Form|SimpleForm)[[:space:]]*\(' "$model" && ! grep -sqE '\bMap[[:space:]]*\(' "$model" && is_form=1 || is_form=0
+
+ if [ ! -f "$model" ]; then
+ echo -e "'$controller' references $type('$map')\n\tbut expected file '$model' does not exist.\n"
+ elif [ $type = "cbi" -a $is_form = 1 ]; then
+ echo -e "'$controller' references $type('$map')\n\tbut '$model' looks like a Form or SimpleForm.\n"
+ elif [ $type = "form" -a $is_form = 0 ]; then
+ echo -e "'$controller' references $type('$map')\n\tbut '$model' does not look like a Form or SimpleForm.\n"
+ fi
+ done
+done
diff --git a/build/zoneinfo2lua.pl b/build/zoneinfo2lua.pl
index d3f0403263..1a0bee1c68 100755
--- a/build/zoneinfo2lua.pl
+++ b/build/zoneinfo2lua.pl
@@ -46,6 +46,34 @@ while( ! eof ZTAB ) {
close ZTAB;
+# Add Etc/GMT zones from manually as they are not in zone.tab
+$TZ{"Etc/GMT"} = "GMT0";
+$TZ{"Etc/GMT-1"} = "<+01>-1";
+$TZ{"Etc/GMT-2"} = "<+02>-2";
+$TZ{"Etc/GMT-3"} = "<+03>-3";
+$TZ{"Etc/GMT-4"} = "<+04>-4";
+$TZ{"Etc/GMT-5"} = "<+05>-5";
+$TZ{"Etc/GMT-6"} = "<+06>-6";
+$TZ{"Etc/GMT-7"} = "<+07>-7";
+$TZ{"Etc/GMT-8"} = "<+08>-8";
+$TZ{"Etc/GMT-9"} = "<+09>-9";
+$TZ{"Etc/GMT-10"} = "<+10>-10";
+$TZ{"Etc/GMT-11"} = "<+11>-11";
+$TZ{"Etc/GMT-12"} = "<+12>-12";
+$TZ{"Etc/GMT-13"} = "<+13>-13";
+$TZ{"Etc/GMT-14"} = "<+14>-14";
+$TZ{"Etc/GMT+1"} = "<-01>1";
+$TZ{"Etc/GMT+2"} = "<-02>2";
+$TZ{"Etc/GMT+3"} = "<-03>3";
+$TZ{"Etc/GMT+4"} = "<-04>4";
+$TZ{"Etc/GMT+5"} = "<-05>5";
+$TZ{"Etc/GMT+6"} = "<-06>6";
+$TZ{"Etc/GMT+7"} = "<-07>7";
+$TZ{"Etc/GMT+8"} = "<-08>8";
+$TZ{"Etc/GMT+9"} = "<-09>9";
+$TZ{"Etc/GMT+10"} = "<-10>10";
+$TZ{"Etc/GMT+11"} = "<-11>11";
+$TZ{"Etc/GMT+12"} = "<-12>12";
open(O, "> $tzdout/tzdata.lua") || die "open($tzdout/tzdata.lua): $!\n";