diff --git a/Dockerfile b/Dockerfile index 5c9fd88c741..db92d7f9a91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,70 +10,73 @@ ENV LANG C.UTF-8 RUN dpkg --add-architecture i386 # Install required packages (in sync with README.rst instructions) +# ATTENTION: the total length of the following RUN command must not exceed 1024 characters RUN apt-get update && apt-get install --no-install-recommends -y \ - autoconf-archive \ - autogen \ - automake \ - autopoint \ - bash \ - bc \ - bison \ - build-essential \ - check \ - cmake \ - curl \ - cython3 \ - debootstrap \ - ed \ - expect \ - fakeroot \ - flex \ - g++-multilib \ - gawk \ - gettext \ - git \ - gperf \ - imagemagick \ - intltool \ - jq \ - libbz2-dev \ - libc6-i386 \ - libcppunit-dev \ - libffi-dev \ - libgc-dev \ - libgmp3-dev \ - libltdl-dev \ - libmount-dev \ - libncurses-dev \ - libpcre3-dev \ - libssl-dev \ - libtool \ - libunistring-dev \ - lzip \ - mercurial \ - moreutils \ - ninja-build \ - patchelf \ - php \ - pkg-config \ - python2 \ - python3 \ - python3-distutils \ - rename \ - rsync \ - scons \ - subversion \ - sudo \ - swig \ - texinfo \ - unzip \ - xmlto \ - zlib1g-dev && \ + autoconf-archive \ + autogen \ + automake \ + autopoint \ + bash \ + bc \ + bison \ + build-essential \ + check \ + cmake \ + curl \ + cython3 \ + debootstrap \ + ed \ + expect \ + fakeroot \ + flex \ + g++-multilib \ + gawk \ + gettext \ + git \ + gperf \ + imagemagick \ + intltool \ + jq \ + libbz2-dev \ + libc6-i386 \ + libcppunit-dev \ + libffi-dev \ + libgc-dev \ + libgmp3-dev \ + libltdl-dev \ + libmount-dev \ + libncurses-dev \ + libpcre3-dev \ + libssl-dev \ + libtool \ + libunistring-dev \ + lzip \ + mercurial \ + moreutils \ + ninja-build \ + patchelf \ + php \ + pkg-config \ + python2 \ + python3 \ + python3-distutils \ + rename \ + rsync \ + ruby-mustache \ + scons \ + subversion \ + sudo \ + swig \ + texinfo \ + unzip \ + xmlto \ + zip \ + zlib1g-dev && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ adduser --disabled-password --gecos '' user && \ adduser user sudo && \ - echo "%users ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/users + echo "%user ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/users # Install setuptools, wheel and pip for Python2 RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | python2 diff --git a/README.md b/README.md index fcf2d0838fa..29b7be0e3b2 100644 --- a/README.md +++ b/README.md @@ -61,8 +61,8 @@ sudo apt install autoconf-archive autogen automake autopoint bash bc bison \ g++-multilib gawk gettext git gperf imagemagick intltool jq libbz2-dev libc6-i386 \ libcppunit-dev libffi-dev libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ libpcre3-dev libssl-dev libtool libunistring-dev lzip mercurial moreutils ninja-build \ - patchelf php pkg-config python2 python3 python3-distutils rename rsync scons subversion \ - swig texinfo unzip xmlto zlib1g-dev + patchelf php pkg-config python2 python3 python3-distutils rename ruby-mustache rsync scons subversion \ + swig texinfo unzip xmlto zip zlib1g-dev wget https://bootstrap.pypa.io/pip/2.7/get-pip.py -O - | sudo python2 sudo pip2 install wheel httpie wget https://bootstrap.pypa.io/get-pip.py -O - | sudo python3 @@ -87,8 +87,8 @@ lxc exec spksrc -- /usr/bin/apt install autoconf-archive autogen automake autopo g++-multilib gawk gettext git gperf imagemagick intltool jq libbz2-dev libc6-i386 \ libcppunit-dev libffi-dev libgc-dev libgmp3-dev libltdl-dev libmount-dev libncurses-dev \ libpcre3-dev libssl-dev libtool libunistring-dev lzip mercurial moreutils ninja-build \ - patchelf php pkg-config python2 python3 python3-distutils rename rsync scons subversion \ - swig texinfo unzip xmlto zlib1g-dev + patchelf php pkg-config python2 python3 python3-distutils rename rsync ruby-mustache scons subversion \ + swig texinfo unzip xmlto zip zlib1g-dev ``` 5. Install `python2` wheels: ```bash diff --git a/mk/spksrc.spk.mk b/mk/spksrc.spk.mk index f9787aab614..28a9668cfdc 100644 --- a/mk/spksrc.spk.mk +++ b/mk/spksrc.spk.mk @@ -282,6 +282,9 @@ endif # Wizard DSM_WIZARDS_DIR = $(WORK_DIR)/WIZARD_UIFILES +ifneq ($(strip $(WIZARDS_TEMPLATES_DIR)),) +WIZARDS_DIR = $(WORK_DIR)/generated-wizards +endif ifneq ($(WIZARDS_DIR),) # export working wizards dir to the shell for use later at compile-time export SPKSRC_WIZARDS_DIR=$(WIZARDS_DIR) @@ -390,6 +393,46 @@ ifeq ($(strip $(WIZARDS_DIR)),) $(eval SPK_CONTENT += WIZARD_UIFILES) endif endif +ifneq ($(strip $(WIZARDS_TEMPLATES_DIR)),) + @$(MSG) "Generate DSM Wizards from templates" + @mkdir -p $(WIZARDS_DIR) + $(eval IS_DSM_6_OR_GREATER = $(if $(filter 1,$(call version_gt, $(TCVERSION), 6.0)),true,false)) + $(eval IS_DSM_7_OR_GREATER = $(if $(filter 1,$(call version_gt, $(TCVERSION), 7.0)),true,false)) + $(eval IS_DSM_7 = $(IS_DSM_7_OR_GREATER)) + $(eval IS_DSM_6 = $(if $(filter true,$(IS_DSM_6_OR_GREATER)),$(if $(filter true,$(IS_DSM_7)),false,true),false)) + @for template in `find $(WIZARDS_TEMPLATES_DIR) -maxdepth 1 -type f -and \( $(WIZARD_FILE_NAMES) \) -print`; do \ + template_filename="$$(basename $${template})"; \ + template_name="$${template_filename%.*}"; \ + if [ "$${template_name}" = "$${template_filename}" ]; then \ + template_suffix=; \ + else \ + template_suffix=".$${template_filename##*.}"; \ + fi; \ + template_file_path="$(WIZARDS_TEMPLATES_DIR)/$${template_filename}"; \ + for suffix in '' $(patsubst %,_%,$(LANGUAGES)) ; do \ + template_file_localization_data_path="$(WIZARDS_TEMPLATES_DIR)/$${template_name}$${suffix}.yml"; \ + output_file="$(WIZARDS_DIR)/$${template_name}$${suffix}$${template_suffix}"; \ + if [ -f "$${template_file_localization_data_path}" ]; then \ + { \ + echo "IS_DSM_6_OR_GREATER: $(IS_DSM_6_OR_GREATER)"; \ + echo "IS_DSM_6: $(IS_DSM_6)"; \ + echo "IS_DSM_7_OR_GREATER: $(IS_DSM_7_OR_GREATER)"; \ + echo "IS_DSM_7: $(IS_DSM_7)"; \ + cat "$${template_file_localization_data_path}"; \ + } | mustache - "$${template_file_path}" >"$${output_file}"; \ + if [ "$${template_suffix}" = "" ]; then \ + jq_failed=0; \ + errors=$$(jq . "$${output_file}" 2>&1) || jq_failed=1; \ + if [ "$${jq_failed}" != "0" ]; then \ + echo "Invalid wizard file generated $${output_file}:"; \ + echo "$${errors}"; \ + exit 1; \ + fi; \ + fi; \ + fi; \ + done; \ + done +endif ifneq ($(strip $(WIZARDS_DIR)),) @$(MSG) "Create DSM Wizards" $(eval SPK_CONTENT += WIZARD_UIFILES)