1
0
forked from me/IronOS

Merge branch 'dev' into Short-Detection

This commit is contained in:
discip
2023-07-24 00:06:50 +02:00
committed by GitHub
5 changed files with 56 additions and 17 deletions

View File

@@ -143,7 +143,7 @@ jobs:
steps: steps:
- name: Install dependencies (apk) - name: Install dependencies (apk)
run: apk add --no-cache make git diffutils findutils clang-extra-tools run: apk add --no-cache make git diffutils findutils clang-extra-tools bash
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:

View File

@@ -70,6 +70,7 @@ list:
@echo " * docker-clean - delete created docker container (but not pre-downloaded data for it)" @echo " * docker-clean - delete created docker container (but not pre-downloaded data for it)"
@echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file" @echo " * docs - generate \"site\"/ directory with documentation in a form of static html files using ReadTheDocs framework and $(MKDOCS_YML) local config file"
@echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo" @echo " * docs-deploy - generate & deploy docs online to gh-pages branch of current github repo"
@echo " * tests - run set of checks, linters & tests (equivalent of github CI IronOS project settings for push trigger)"
@echo " * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image" @echo " * clean-build - delete generated files & dirs produced during builds EXCEPT generated docker container image"
@echo " * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image" @echo " * clean-full - delete generated files & dirs produced during builds INCLUDING generated docker container image"
@echo "" @echo ""
@@ -81,7 +82,7 @@ list:
@echo " $$ make firmware-LANG_ID model=MODEL_ID" @echo " $$ make firmware-LANG_ID model=MODEL_ID"
@echo @echo
@echo "Full list of current supported IDs:" @echo "Full list of current supported IDs:"
@echo " * LANG_ID: BE BG CS DA DE EL EN ES FI FR HR HU IT JA_JP LT NB NL_BE NL PL PT RO RU SK SL SR_CYRL SR_LATN SV TR UK VI YUE_HK ZH_CN ZH_TW" @echo " * LANG_ID: $(shell echo "`ls Translations/ | grep -e "^translation_.*.json$$" | sed -e 's,^translation_,,g; s,\.json$$,,g; ' | tr '\n' ' '`")"
@echo " * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60" @echo " * MODEL_ID: TS100 TS101 TS80 TS80P MHP30 Pinecil Pinecilv2 S60"
@echo @echo
@echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:" @echo "For example, to make a local build of IronOS firmware for TS100 with English language, just type:"
@@ -89,9 +90,6 @@ list:
@echo " $$ make firmware-EN model=TS100" @echo " $$ make firmware-EN model=TS100"
@echo @echo
# bash one-liner to generate langs for "make list":
# echo "`ls Translations/ | grep -e "^translation_.*.json$" | sed -e 's,^translation_,,g; s,\.json$,,g; ' | tr '\n' ' '`"
# detect availability of docker # detect availability of docker
docker-check: docker-check:
ifeq ($(DOCKER_BIN),) ifeq ($(DOCKER_BIN),)
@@ -121,6 +119,44 @@ docs: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/im
docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/* docs-deploy: $(MKDOCS_YML) Documentation/* Documentation/Flashing/* Documentation/images/*
$(MKDOCS) gh-deploy -f $(MKDOCS_YML) -d ../site $(MKDOCS) gh-deploy -f $(MKDOCS_YML) -d ../site
# routine check for autogenerated Documentation/README.md
test-md:
@echo ""
@echo "---- Checking REAMDE.md... ----"
@echo ""
@/bin/sh ./scripts/deploy.sh docs_readme
# shell style & linter check (github CI version of shellcheck is more recent than alpine one so the latter may not catch some policies)
test-sh:
@echo ""
@echo "---- Checking shell scripts... ----"
@echo ""
@for f in `find ./scripts -type f -iname "*.sh" ! -name "flash_ts100_linux.sh"` ; do shellcheck "$${f}"; done;
# python-related tests & checks
test-py:
@echo ""
@echo "---- Checking python code... ----"
@echo ""
flake8 Translations
black --check Translations
@make -C source/ Objects/host/brieflz/libbrieflz.so
./Translations/brieflz_test.py
./Translations/make_translation_test.py
# clang-format check for C/C++ code style
test-ccpp:
@echo ""
@echo "---- Checking C/C++ code... ----"
@echo ""
make -C source/ clean check-style
# meta target for tests & checks based on .github/workflows/push
tests: test-md test-sh test-py test-ccpp
@echo ""
@echo "All tests & checks have been completed successfully."
@echo ""
# pass-through target for Makefile inside source/ dir # pass-through target for Makefile inside source/ dir
%: %:
make -C source/ $@ make -C source/ $@
@@ -135,5 +171,4 @@ clean-build:
clean-full: clean-build docker-clean clean-full: clean-build docker-clean
# phony targets # phony targets
.PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy clean-build clean-full .PHONY: help list docker-check docker-shell docker-build docker-clean docs docs-deploy test-md test-sh test-py test-ccpp tests clean-build clean-full

View File

@@ -6,21 +6,22 @@ LABEL maintainer="Ben V. Brown <ralim@ralimtek.com>"
# Default current dir when container starts # Default current dir when container starts
WORKDIR /build/ironos WORKDIR /build/ironos
# Installing the two compilers (ARM & RISCV), python3 & pip, clang tools: # Installing the two compilers (ARM & RISCV), python3 & pip, clang tools, etc.:
## - compilers: gcc-*, newlib-* ## - compilers: gcc-*, newlib-*
## - python3: py*, black (required to check Python code formatting) ## - python3: py*, black (required to check Python code formatting)
## - misc: findutils, make, git, diffutils ## - misc: findutils, make, git, diffutils
## - musl-dev (required for the multi lang firmwares) ## - musl-dev (required for the multi lang firmwares)
## - clang (required for clang-format to check C++ code formatting) ## - clang (required for clang-format to check C++ code formatting)
## - shellcheck (to check sh scripts)
ARG APK_COMPS="gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf \ ARG APK_COMPS="gcc-riscv-none-elf gcc-arm-none-eabi newlib-riscv-none-elf \
newlib-arm-none-eabi" newlib-arm-none-eabi"
ARG APK_PYTHON="python3 py3-pip black" ARG APK_PYTHON="python3 py3-pip black"
ARG APK_MISC="findutils make git diffutils" ARG APK_MISC="findutils make git diffutils"
ARG APK_DEV="musl-dev clang bash clang-extra-tools" ARG APK_DEV="musl-dev clang bash clang-extra-tools shellcheck"
# PIP packages # PIP packages to check & test Python code
ARG PIP_PKGS='bdflib' ARG PIP_PKGS='bdflib flake8'
# Install system packages using alpine package manager # Install system packages using alpine package manager
RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV} RUN apk add --no-cache ${APK_COMPS} ${APK_PYTHON} ${APK_MISC} ${APK_DEV}

View File

@@ -95,9 +95,12 @@ check_style_file()
# * https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces # * https://clang.llvm.org/docs/ClangFormatStyleOptions.html#insertbraces
# - since reference env is alpine 3.16 with clang-format 13, implement custom parser to do the similar thing here with grep: # - since reference env is alpine 3.16 with clang-format 13, implement custom parser to do the similar thing here with grep:
# it used to trace missing { and } for if/else/do/while/for BUT IT'S VERY SPECULATIVE, very-very hacky & dirty. # it used to trace missing { and } for if/else/do/while/for BUT IT'S VERY SPECULATIVE, very-very hacky & dirty.
test -z "${LIST}" || silent_opt="-q" # - if file is problematic but filename only requested make final grep in pipe silent ... UPD: make code messy but shellcheck happy
# if file is problematic but filename only requested make final grep in pipe silent ... if [ -z "${LIST}" ]; then
grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep "${silent_opt}" -e "^.*$" grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -e "^.*$"
else
grep -H -n -e "^ .*if .*)$" -e "^ .*else$" -e "^ .* do$" -e "^ .*while .*)$" -e "^ .*for .*)$" "${src}" | grep -v -e "^.*//" -e "^.*:.*: .*if ((.*[^)])$" | sed 's,^,\n\n,; s,: ,:1: error: probably missing { or } for conditional or loop block:\n>>>,;' | grep -q -e "^.*$"
fi;
if [ "${?}" -ne 1 ]; then if [ "${?}" -ne 1 ]; then
# ... and only print the filename # ... and only print the filename
test -z "${LIST}" || echo "${src}" test -z "${LIST}" || echo "${src}"

View File

@@ -734,7 +734,7 @@ static void setTempF(const enum SettingsOptions option) {
Temp = ((Temp - 32) * 5) / 9; Temp = ((Temp - 32) * 5) / 9;
} }
// Rescale to be multiples of 10 // Rescale to be multiples of 10
Temp = BoostTemp / 10; Temp = Temp / 10;
Temp *= 10; Temp *= 10;
setSettingValue(option, Temp); setSettingValue(option, Temp);
} }