mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [RFC] idea about ptxdist development helpers
@ 2014-06-15 20:28 Alexander Aring
  0 siblings, 0 replies; only message in thread
From: Alexander Aring @ 2014-06-15 20:28 UTC (permalink / raw)
  To: ptxdist

Hi ptxdist hackers,

I hacked several scripts to generate some search/replacing ptxdist
code. For example:

I run 'ptxdist install kbd', which contains many binary tools. The new
ptxdist code style describes a list for that, because this will be easy
to maintain.

My hacked script 'list_generate' looks like following:

---snip
#!/bin/bash 

LISTNAME=$1
NAME=$2
DIR=$3

echo "$LISTNAME-y:="

for i in `ls $DIR`
do
	TO_UPPER=`echo $i | tr '[:lower:]' '[:upper:]'`
	if [ -x $DIR/$i ] && [ -f $DIR/$i ] && [ ! -h $DIR/$i ]
	then
		echo "${LISTNAME}-\$(PTXCONF_${NAME}_$TO_UPPER)+= $i"
	fi
done
---snap

and which replaced ${BSP} and ${PLATFORM}:

./list_generate KBD_TOOLS KBD ${BSP}/${PLATFORM}/packages/kbd-2.0.1/usr/bin

generates:

KBD_TOOLS-y:=
KBD_TOOLS-$(PTXCONF_KBD_CHVT)+= chvt
KBD_TOOLS-$(PTXCONF_KBD_DEALLOCVT)+= deallocvt
KBD_TOOLS-$(PTXCONF_KBD_DUMPKEYS)+= dumpkeys
KBD_TOOLS-$(PTXCONF_KBD_FGCONSOLE)+= fgconsole
KBD_TOOLS-$(PTXCONF_KBD_GETKEYCODES)+= getkeycodes
KBD_TOOLS-$(PTXCONF_KBD_KBDINFO)+= kbdinfo
KBD_TOOLS-$(PTXCONF_KBD_KBD_MODE)+= kbd_mode
KBD_TOOLS-$(PTXCONF_KBD_KBDRATE)+= kbdrate
KBD_TOOLS-$(PTXCONF_KBD_LOADKEYS)+= loadkeys
KBD_TOOLS-$(PTXCONF_KBD_LOADUNIMAP)+= loadunimap
KBD_TOOLS-$(PTXCONF_KBD_MAPSCRN)+= mapscrn
KBD_TOOLS-$(PTXCONF_KBD_OPENVT)+= openvt
KBD_TOOLS-$(PTXCONF_KBD_PSFXTABLE)+= psfxtable
KBD_TOOLS-$(PTXCONF_KBD_SETFONT)+= setfont
KBD_TOOLS-$(PTXCONF_KBD_SETKEYCODES)+= setkeycodes
KBD_TOOLS-$(PTXCONF_KBD_SETLEDS)+= setleds
KBD_TOOLS-$(PTXCONF_KBD_SETMETAMODE)+= setmetamode
KBD_TOOLS-$(PTXCONF_KBD_SETVTRGB)+= setvtrgb
KBD_TOOLS-$(PTXCONF_KBD_SHOWCONSOLEFONT)+= showconsolefont
KBD_TOOLS-$(PTXCONF_KBD_SHOWKEY)+= showkey
KBD_TOOLS-$(PTXCONF_KBD_UNICODE_START)+= unicode_start
KBD_TOOLS-$(PTXCONF_KBD_UNICODE_STOP)+= unicode_stop

This is something which we need and we don't need to make some copy&paste
which takes some minutes...

I hacked this tool less in the minutes which my copy&paste would take to
be done and yes, I need to intend manually. I think the idea is simple,
but the question is maybe we should do a more cleaner (with intend
support) mainline solution for that. This would support more than my hacked
solution. I also have some scripts to generate help texts, search
symlinks in binpath and so on.

Or the corresponding script to generate the Kconfig menuentries.

---snap
#!/bin/bash 

NAME=$1
DIR=$2

echo -e "if $NAME\n"

for i in `ls $DIR`
do
	TO_UPPER=`echo $i | tr '[:lower:]' '[:upper:]'`
	if [ -x $DIR/$i ] && [ -f $DIR/$i ] && [ ! -h $DIR/$i ]
	then
		echo "config ${NAME}_$TO_UPPER"
		echo -e "\tbool"
		echo -e "\tprompt \"$i\""
		echo -e "\thelp"
		echo -e "\t  FIXME"
		echo ""
	fi
done

echo "endif"
---snap

which generates with:

./kconfig_help_generate KBD ${BSP}/${PLATFORM}/packages/kbd-2.0.1/usr/bin

if KBD

config KBD_CHVT
	bool
	prompt "chvt"
	help
	  FIXME

config KBD_DEALLOCVT
	bool
	prompt "deallocvt"
	help
	  FIXME

config KBD_DUMPKEYS
	bool
	prompt "dumpkeys"
	help
	  FIXME

config KBD_FGCONSOLE
	bool
	prompt "fgconsole"
	help
	  FIXME

config KBD_GETKEYCODES
	bool
	prompt "getkeycodes"
	help
	  FIXME

config KBD_KBDINFO
	bool
	prompt "kbdinfo"
	help
	  FIXME

config KBD_KBD_MODE
	bool
	prompt "kbd_mode"
	help
	  FIXME

....

endif


These scripts for generating snippets for a newpackage would decrease the
failure count and it will be faster to make some new packages.


My question is: Is there any interest to have something like this in
mainline ptxdist which provides some helper scripts like this? My
solution is a self hacked solution for my private use... but I think I
can do it better and then others ptxdist developers can use this.

Then we should add some new ptxdist argument to generate some snippets.
Maybe 'ptxdist snippet ...' or something else. :-)

- Alex

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-06-15 20:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15 20:28 [ptxdist] [RFC] idea about ptxdist development helpers Alexander Aring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox