Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mustache to dev env #5819

Merged
merged 11 commits into from
Aug 7, 2023
121 changes: 62 additions & 59 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
43 changes: 43 additions & 0 deletions mk/spksrc.spk.mk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done.

Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down