mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [RFC] idea about ptxdist development helpers
Date: Sun, 15 Jun 2014 22:28:26 +0200	[thread overview]
Message-ID: <20140615202824.GA31001@omega> (raw)

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

                 reply	other threads:[~2014-06-15 20:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140615202824.GA31001@omega \
    --to=alex.aring@gmail.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox