* [ptxdist] [PATCH 1/2] ptxd_lib_template: fix indentation
@ 2017-06-14 10:31 Roland Hieber
2017-06-14 10:31 ` [ptxdist] [PATCH 2/2] templates/*-in: tell vim to use Kconfig syntax Roland Hieber
0 siblings, 1 reply; 3+ messages in thread
From: Roland Hieber @ 2017-06-14 10:31 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
---
scripts/lib/ptxd_lib_template.sh | 92 ++++++++++++++++++++--------------------
1 file changed, 47 insertions(+), 45 deletions(-)
diff --git a/scripts/lib/ptxd_lib_template.sh b/scripts/lib/ptxd_lib_template.sh
index 68c614218..6a478e8fa 100644
--- a/scripts/lib/ptxd_lib_template.sh
+++ b/scripts/lib/ptxd_lib_template.sh
@@ -9,7 +9,7 @@
#
if echo | read -i foo -p bar -e > /dev/null 2>&1; then
- _ptxd_can_read_initial=1
+ _ptxd_can_read_initial=1
fi
export _ptxd_can_read_initial
#
@@ -22,11 +22,11 @@ export _ptxd_can_read_initial
ptxd_template_read() {
local -a iargs
if [ -n "$_ptxd_can_read_initial" -a -n "${3}" ]; then
- iargs=( "-i" "${3}" )
+ iargs=( "-i" "${3}" )
fi
local prompt="${PTXDIST_LOG_PROMPT}${1}"
for (( i=$[30-$(wc -c <<< $1)]; $i ; i=$[i-1] )); do
- prompt="${prompt}."
+ prompt="${prompt}."
done
read -e -p "${prompt}: " "${iargs[@]}" "${2}" &&
export "${2}"
@@ -44,33 +44,33 @@ export -f ptxd_template_read_name
ptxd_template_check_existing() {
if ptxd_in_path PTXDIST_PATH_RULES "${package_name}.make"; then
- export ptxd_template_have_existing=1
- action="${action}-existing-target"
- template="${template}-existing-target"
+ export ptxd_template_have_existing=1
+ action="${action}-existing-target"
+ template="${template}-existing-target"
else
- unset ptxd_template_have_existing
+ unset ptxd_template_have_existing
fi
}
export -f ptxd_template_check_existing
ptxd_template_read_version() {
if [ -z "${ptxd_template_have_existing}" ]; then
- ptxd_template_read "enter version number" VERSION
+ ptxd_template_read "enter version number" VERSION
fi
}
export -f ptxd_template_read_version
ptxd_template_read_url() {
if [ -z "${ptxd_template_have_existing}" ]; then
- ptxd_template_read "enter URL of basedir" URL
- ptxd_template_read "enter suffix" SUFFIX
+ ptxd_template_read "enter URL of basedir" URL
+ ptxd_template_read "enter suffix" SUFFIX
fi
}
export -f ptxd_template_read_url
ptxd_template_read_author() {
ptxd_template_read "enter package author" AUTHOR \
- "${PTXCONF_SETUP_USER_NAME} <${PTXCONF_SETUP_USER_EMAIL}>"
+ "${PTXCONF_SETUP_USER_NAME} <${PTXCONF_SETUP_USER_EMAIL}>"
}
export -f ptxd_template_read_author
@@ -113,7 +113,7 @@ export -f ptxd_template_read_local
ptxd_template_print_path() {
if [ $# -ne 1 ]; then
- ptxd_bailout "number of arguments must be 1"
+ ptxd_bailout "number of arguments must be 1"
fi
echo "${1#${PWD}/}"
}
@@ -130,21 +130,21 @@ ptxd_template_filter() {
local template_file="${1}"
local filename="${2}"
if [ ! -f "${template_file}" ]; then
- echo
- echo "${PTXDIST_LOG_PROMPT}warning: template '${template_file}' does not exist"
- echo
- continue
+ echo
+ echo "${PTXDIST_LOG_PROMPT}warning: template '${template_file}' does not exist"
+ echo
+ continue
fi
if [ -f "${filename}" ]; then
- echo
- local overwrite
- read -e -p "${PTXDIST_LOG_PROMPT}warning: $(ptxd_template_print_path "${filename}") does already exist, overwrite? [y/n] " overwrite
- if [ "${overwrite}" != "y" ]; then
- echo "${PTXDIST_LOG_PROMPT}aborted."
- echo
- exit
- fi
+ echo
+ local overwrite
+ read -e -p "${PTXDIST_LOG_PROMPT}warning: $(ptxd_template_print_path "${filename}") does already exist, overwrite? [y/n] " overwrite
+ if [ "${overwrite}" != "y" ]; then
+ echo "${PTXDIST_LOG_PROMPT}aborted."
+ echo
+ exit
+ fi
fi
echo "generating $(ptxd_template_print_path ${filename})"
mkdir -p "$(dirname "${filename}")"
@@ -154,7 +154,7 @@ export -f ptxd_template_filter
ptxd_template_file() {
if ! ptxd_in_path PTXDIST_PATH_TEMPLATES "${1}"; then
- ptxd_bailout "Failed to find '${1}' in '${PTXDIST_PATH_TEMPLATES}'!"
+ ptxd_bailout "Failed to find '${1}' in '${PTXDIST_PATH_TEMPLATES}'!"
fi
echo "${ptxd_reply}"
}
@@ -164,9 +164,9 @@ ptxd_template_write_rules() {
local template_suffix
echo
for template_suffix in "make" "in"; do
- local template_file="$(ptxd_template_file "${template}-${template_suffix}")"
- local filename="${PTXDIST_WORKSPACE}/rules/${class}${package_filename}.${template_suffix}"
- ptxd_template_filter "${template_file}" "${filename}"
+ local template_file="$(ptxd_template_file "${template}-${template_suffix}")"
+ local filename="${PTXDIST_WORKSPACE}/rules/${class}${package_filename}.${template_suffix}"
+ ptxd_template_filter "${template_file}" "${filename}"
done
}
export -f ptxd_template_write_rules
@@ -191,24 +191,24 @@ ptxd_template_write_src() {
local template_dir
if [ -d "${dst}" ]; then
- return
+ return
fi
echo
local r
read -e -p "${dst#${PTXDIST_WORKSPACE}/} does not exist, create? [Y/n] " r
case "${r}" in
- y|Y|"") ;;
- *) return ;;
+ y|Y|"") ;;
+ *) return ;;
esac
template_src="$(ptxd_template_file "${action}")" &&
mkdir -p "${dst}" &&
tar -C "${template_src}" -cf - --exclude .svn . | \
- tar -C "${dst}" -xvf - &&
+ tar -C "${dst}" -xvf - &&
if [ ! -e "${dst}/wizard.sh" ]; then
- return
+ return
fi &&
template_dir=$(dirname "${template_src}") &&
( cd "${dst}" && bash wizard.sh "${package}" "${template_dir}") &&
@@ -238,8 +238,8 @@ ptxd_template_new() {
local func="ptxd_template_new_${action//-/_}"
if ! declare -F | grep -q "${func}$"; then
- ptxd_template_help
- return
+ ptxd_template_help
+ return
fi
echo
echo "${PTXDIST_LOG_PROMPT}creating a new '${action}' package:"
@@ -255,12 +255,12 @@ ptxd_template_help() {
echo
set -- "${ptxd_template_help_list[@]}"
while [ $# -gt 0 ]; do
- while [ -z "${1}" ]; do
- echo
- shift
- done
- printf " %-24s %s\n" "${1}" "${2}"
- shift 2
+ while [ -z "${1}" ]; do
+ echo
+ shift
+ done
+ printf " %-24s %s\n" "${1}" "${2}"
+ shift 2
done
echo
}
@@ -427,9 +427,9 @@ ptxd_template_new_image_genimage() {
local template_file="$(ptxd_template_file "${template}-config")"
local filename="${PTXDIST_PLATFORMCONFIGDIR}/config/images/${CONFIG}"
if ptxd_get_alternative config/images "${CONFIG}"; then
- echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})"
+ echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})"
else
- ptxd_template_filter "${template_file}" "${filename}"
+ ptxd_template_filter "${template_file}" "${filename}"
fi
}
export -f ptxd_template_new_image_genimage
@@ -450,11 +450,13 @@ ptxd_template_new_blspec_entry() {
local template_file="$(ptxd_template_file "${template}-conf")"
local filename="${PTXDIST_PLATFORMCONFIGDIR}/projectroot/loader/entries/${ENTRY}"
if ptxd_get_alternative loader/entries "${ENTRY}"; then
- echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})"
+ echo "using existing config file $(ptxd_template_print_path ${ptxd_reply})"
else
- ptxd_template_filter "${template_file}" "${filename}"
+ ptxd_template_filter "${template_file}" "${filename}"
fi
}
export -f ptxd_template_new_blspec_entry
ptxd_template_help_list[${#ptxd_template_help_list[@]}]="blspec-entry"
ptxd_template_help_list[${#ptxd_template_help_list[@]}]="create package for a bootloader spec entry"
+
+# vim: ts=4 sw=4 sts=4 et
--
2.11.0
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ptxdist] [PATCH 2/2] templates/*-in: tell vim to use Kconfig syntax
2017-06-14 10:31 [ptxdist] [PATCH 1/2] ptxd_lib_template: fix indentation Roland Hieber
@ 2017-06-14 10:31 ` Roland Hieber
2017-06-14 11:10 ` Alexander Dahl
0 siblings, 1 reply; 3+ messages in thread
From: Roland Hieber @ 2017-06-14 10:31 UTC (permalink / raw)
To: ptxdist; +Cc: Roland Hieber
Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
---
rules/templates/template-barebox-in | 2 ++
rules/templates/template-blspec-entry-in | 2 ++
rules/templates/template-class-existing-target-in | 2 ++
rules/templates/template-class-in | 2 ++
rules/templates/template-file-in | 2 ++
rules/templates/template-font-in | 2 ++
rules/templates/template-image-genimage-in | 2 ++
rules/templates/template-image-tgz-in | 2 ++
rules/templates/template-kernel-in | 2 ++
rules/templates/template-klibc-existing-target-in | 2 ++
rules/templates/template-klibc-in | 2 ++
rules/templates/template-src-autoconf-in | 2 ++
rules/templates/template-src-cmake-prog-in | 2 ++
rules/templates/template-src-linux-driver-in | 2 ++
rules/templates/template-src-make-prog-in | 2 ++
rules/templates/template-src-qmake-prog-in | 2 ++
rules/templates/template-src-stellaris-in | 2 ++
rules/templates/template-target-in | 2 ++
18 files changed, 36 insertions(+)
diff --git a/rules/templates/template-barebox-in b/rules/templates/template-barebox-in
index 44d920f4f..90a0e9668 100644
--- a/rules/templates/template-barebox-in
+++ b/rules/templates/template-barebox-in
@@ -5,3 +5,5 @@ config BAREBOX_@PACKAGE@
prompt "Barebox (@package@)"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-blspec-entry-in b/rules/templates/template-blspec-entry-in
index c17e3ed8c..c76738c6e 100644
--- a/rules/templates/template-blspec-entry-in
+++ b/rules/templates/template-blspec-entry-in
@@ -3,3 +3,5 @@
config BLSPEC_@PACKAGE@
tristate
prompt "/loader/entries/@ENTRY@ bootloader spec entry"
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-class-existing-target-in b/rules/templates/template-class-existing-target-in
index 7aeb6eb03..bc63a8992 100644
--- a/rules/templates/template-class-existing-target-in
+++ b/rules/templates/template-class-existing-target-in
@@ -5,3 +5,5 @@ config @CLASS@@PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-class-in b/rules/templates/template-class-in
index 7aeb6eb03..bc63a8992 100644
--- a/rules/templates/template-class-in
+++ b/rules/templates/template-class-in
@@ -5,3 +5,5 @@ config @CLASS@@PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-file-in b/rules/templates/template-file-in
index e5cdde569..f8de25358 100644
--- a/rules/templates/template-file-in
+++ b/rules/templates/template-file-in
@@ -5,3 +5,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-font-in b/rules/templates/template-font-in
index bf20d50bf..95934e97d 100644
--- a/rules/templates/template-font-in
+++ b/rules/templates/template-font-in
@@ -6,3 +6,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-image-genimage-in b/rules/templates/template-image-genimage-in
index 28a95d6d9..1b4d3b465 100644
--- a/rules/templates/template-image-genimage-in
+++ b/rules/templates/template-image-genimage-in
@@ -6,3 +6,5 @@ config IMAGE_@PACKAGE@
prompt "Generate images/@package@.@TYPE@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-image-tgz-in b/rules/templates/template-image-tgz-in
index cdb0712f6..1a3c52750 100644
--- a/rules/templates/template-image-tgz-in
+++ b/rules/templates/template-image-tgz-in
@@ -5,3 +5,5 @@ config IMAGE_@PACKAGE@_TGZ
prompt "Generate images/@package@.tgz"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-kernel-in b/rules/templates/template-kernel-in
index 1b2b06a55..ea6a78197 100644
--- a/rules/templates/template-kernel-in
+++ b/rules/templates/template-kernel-in
@@ -7,3 +7,5 @@ config KERNEL_@PACKAGE@
#select HOST_U_BOOT_TOOLS
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-klibc-existing-target-in b/rules/templates/template-klibc-existing-target-in
index ec66826ae..88589a4f5 100644
--- a/rules/templates/template-klibc-existing-target-in
+++ b/rules/templates/template-klibc-existing-target-in
@@ -6,3 +6,5 @@ config @CLASS@@PACKAGE@
select KLIBC
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-klibc-in b/rules/templates/template-klibc-in
index 69fe0b8f7..9e666a8c7 100644
--- a/rules/templates/template-klibc-in
+++ b/rules/templates/template-klibc-in
@@ -6,3 +6,5 @@ config @PACKAGE@
select KLIBC
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-autoconf-in b/rules/templates/template-src-autoconf-in
index bd724effb..48fad45ed 100644
--- a/rules/templates/template-src-autoconf-in
+++ b/rules/templates/template-src-autoconf-in
@@ -5,3 +5,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-cmake-prog-in b/rules/templates/template-src-cmake-prog-in
index 37e6541dd..b56612ba2 100644
--- a/rules/templates/template-src-cmake-prog-in
+++ b/rules/templates/template-src-cmake-prog-in
@@ -6,3 +6,5 @@ config @PACKAGE@
select HOST_CMAKE
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-linux-driver-in b/rules/templates/template-src-linux-driver-in
index 7cb61c87c..b5186e101 100644
--- a/rules/templates/template-src-linux-driver-in
+++ b/rules/templates/template-src-linux-driver-in
@@ -6,3 +6,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-make-prog-in b/rules/templates/template-src-make-prog-in
index e5cdde569..f8de25358 100644
--- a/rules/templates/template-src-make-prog-in
+++ b/rules/templates/template-src-make-prog-in
@@ -5,3 +5,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-qmake-prog-in b/rules/templates/template-src-qmake-prog-in
index 914b6816c..e360264ef 100644
--- a/rules/templates/template-src-qmake-prog-in
+++ b/rules/templates/template-src-qmake-prog-in
@@ -6,3 +6,5 @@ config @PACKAGE@
select QT4
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-src-stellaris-in b/rules/templates/template-src-stellaris-in
index d255fec84..95e89a8d3 100644
--- a/rules/templates/template-src-stellaris-in
+++ b/rules/templates/template-src-stellaris-in
@@ -6,3 +6,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
diff --git a/rules/templates/template-target-in b/rules/templates/template-target-in
index e5cdde569..f8de25358 100644
--- a/rules/templates/template-target-in
+++ b/rules/templates/template-target-in
@@ -5,3 +5,5 @@ config @PACKAGE@
prompt "@package@"
help
FIXME
+
+# vim: syntax=kconfig
--
2.11.0
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ptxdist] [PATCH 2/2] templates/*-in: tell vim to use Kconfig syntax
2017-06-14 10:31 ` [ptxdist] [PATCH 2/2] templates/*-in: tell vim to use Kconfig syntax Roland Hieber
@ 2017-06-14 11:10 ` Alexander Dahl
0 siblings, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2017-06-14 11:10 UTC (permalink / raw)
To: ptxdist
[-- Attachment #1.1: Type: text/plain, Size: 705 bytes --]
Hei hei,
> +# vim: syntax=kconfig
is there any reason you chose 'syntax' over 'filetype'? I probably did
not fully understand the differences between those two Vim commands,
but the modeline in my custom *.in is like this:
# vim: ft=kconfig noet tw=72
noexpandtab is useful to keep the whitespace like in the other
rules/*.in files and textwidth=72 is my personal choice for easier
wrapping.
Greets
Alex
--
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: C28E E6B9 0263 95CF 8FAF 08FA 34AD CD00 7221 5CC6 ***
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 91 bytes --]
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-14 11:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 10:31 [ptxdist] [PATCH 1/2] ptxd_lib_template: fix indentation Roland Hieber
2017-06-14 10:31 ` [ptxdist] [PATCH 2/2] templates/*-in: tell vim to use Kconfig syntax Roland Hieber
2017-06-14 11:10 ` Alexander Dahl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox