Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-02-02 Thread Pacho Ramos
El vie, 01-02-2013 a las 21:34 +0100, Pacho Ramos escribió:
 El vie, 01-02-2013 a las 17:55 +0800, Ben de Groot escribió:
  On 1 February 2013 02:59, Pacho Ramos pa...@gentoo.org wrote:
   El dom, 27-01-2013 a las 18:47 +0100, Pacho Ramos escribió:
   El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
Currently, when people uses DOC_CONTENTS variable to place their 
desired
messages, they are automatically reformatted by fmt to get proper
messages (for example, splitting long lines).
   
But, in some cases, may be useful to disable this behavior and respect
strictly how DOC_CONTENTS was formatted, for example in that kind of
messages telling people to run a command and, then, requiring a new 
line
to be used. This can also be useful to append extra information to
DOC_CONTENTS when, for example, additional info is needed when enabling
a USE flag.
   
   
  
   Well, after reading man echo I see all this is not needed, I simply need
   to use echo -e to get it understand \n to create new lines
  
   New patch attached
  
   This will add an option to disabling autoformatting to let people get
   their doc_contents 100% respected if they want
  
  How about using an as-is argument to readme.gentoo_create_doc?
  That would be more concise. :-)

But, how could people then active that as-is option without needing to
write a src_install function calling readme.gentoo_create_doc with that
option? 


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-02-01 Thread Ben de Groot
On 1 February 2013 02:59, Pacho Ramos pa...@gentoo.org wrote:
 El dom, 27-01-2013 a las 18:47 +0100, Pacho Ramos escribió:
 El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
  Currently, when people uses DOC_CONTENTS variable to place their desired
  messages, they are automatically reformatted by fmt to get proper
  messages (for example, splitting long lines).
 
  But, in some cases, may be useful to disable this behavior and respect
  strictly how DOC_CONTENTS was formatted, for example in that kind of
  messages telling people to run a command and, then, requiring a new line
  to be used. This can also be useful to append extra information to
  DOC_CONTENTS when, for example, additional info is needed when enabling
  a USE flag.
 
 

 Well, after reading man echo I see all this is not needed, I simply need
 to use echo -e to get it understand \n to create new lines

 New patch attached

 This will add an option to disabling autoformatting to let people get
 their doc_contents 100% respected if they want

How about using an as-is argument to readme.gentoo_create_doc?
That would be more concise. :-)

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin



Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-02-01 Thread Michael Weber
On 02/01/2013 10:55 AM, Ben de Groot wrote:
 On 1 February 2013 02:59, Pacho Ramos pa...@gentoo.org wrote:
 El dom, 27-01-2013 a las 18:47 +0100, Pacho Ramos escribió:
 El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
 Currently, when people uses DOC_CONTENTS variable to place their desired
 messages, they are automatically reformatted by fmt to get proper
 messages (for example, splitting long lines).

 But, in some cases, may be useful to disable this behavior and respect
 strictly how DOC_CONTENTS was formatted, for example in that kind of
 messages telling people to run a command and, then, requiring a new line
 to be used. This can also be useful to append extra information to
 DOC_CONTENTS when, for example, additional info is needed when enabling
 a USE flag.



 Well, after reading man echo I see all this is not needed, I simply need
 to use echo -e to get it understand \n to create new lines

 New patch attached

 This will add an option to disabling autoformatting to let people get
 their doc_contents 100% respected if they want
 
 How about using an as-is argument to readme.gentoo_create_doc?
 That would be more concise. :-)
 
PLEASE, add define DOC_CONTENTS in an non-global scope, use
src_prepare/pkg_setup instead to the eclass documentation of
readme.gentoo_print_elog, Thanks

++ for the eclass, the README.gentoo might submerge into the users
handling of Gentoo Systems. (I always laughed about README.Debian)
[1] show an report about exactly the non-atomar situation of elog and
application usage.

While [2] complained about elog cluttering, I try to migrate
x11-wm/xpra-0.8.0 (upcoming), am I doing it right?

DOC_CONTENTS=
please make your Xorg binary readable for users of xpra
  chmod a+r /usr/bin/Xorg
and think about the security impact
A copy at ~/.xpra/Xorg matching the current modules is sufficient.


^^ clearly would benefit from non-formatting.
repoman full complains about Ebuild contains leading spaces on line.

[1] https://bugs.gentoo.org/show_bug.cgi?id=448588
[2] https://bugs.gentoo.org/show_bug.cgi?id=440464


-- 
Michael Weber
Gentoo Developer
web: https://xmw.de/
mailto: Michael Weber x...@gentoo.org



Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-02-01 Thread Pacho Ramos
El vie, 01-02-2013 a las 17:55 +0800, Ben de Groot escribió:
 On 1 February 2013 02:59, Pacho Ramos pa...@gentoo.org wrote:
  El dom, 27-01-2013 a las 18:47 +0100, Pacho Ramos escribió:
  El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
   Currently, when people uses DOC_CONTENTS variable to place their desired
   messages, they are automatically reformatted by fmt to get proper
   messages (for example, splitting long lines).
  
   But, in some cases, may be useful to disable this behavior and respect
   strictly how DOC_CONTENTS was formatted, for example in that kind of
   messages telling people to run a command and, then, requiring a new line
   to be used. This can also be useful to append extra information to
   DOC_CONTENTS when, for example, additional info is needed when enabling
   a USE flag.
  
  
 
  Well, after reading man echo I see all this is not needed, I simply need
  to use echo -e to get it understand \n to create new lines
 
  New patch attached
 
  This will add an option to disabling autoformatting to let people get
  their doc_contents 100% respected if they want
 
 How about using an as-is argument to readme.gentoo_create_doc?
 That would be more concise. :-)
 

I have no problem on either solution... but don't have time just now to
work on a patch to achieve it, if you have a bit time, I would really
appreciate :)


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-31 Thread Pacho Ramos
El dom, 27-01-2013 a las 18:47 +0100, Pacho Ramos escribió:
 El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
  Currently, when people uses DOC_CONTENTS variable to place their desired
  messages, they are automatically reformatted by fmt to get proper
  messages (for example, splitting long lines).
  
  But, in some cases, may be useful to disable this behavior and respect
  strictly how DOC_CONTENTS was formatted, for example in that kind of
  messages telling people to run a command and, then, requiring a new line
  to be used. This can also be useful to append extra information to
  DOC_CONTENTS when, for example, additional info is needed when enabling
  a USE flag.
  
  
 
 Well, after reading man echo I see all this is not needed, I simply need
 to use echo -e to get it understand \n to create new lines
 
 New patch attached

This will add an option to disabling autoformatting to let people get
their doc_contents 100% respected if they want
--- readme.gentoo.eclass	2013-01-24 22:38:41.0 +0100
+++ /usr/portage/eclass/readme.gentoo.eclass	2013-01-31 19:55:40.0 +0100
@@ -36,6 +36,12 @@
 
 EXPORT_FUNCTIONS src_install pkg_postinst
 
+# @ECLASS-VARIABLE: DISABLE_AUTOFORMATTING
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If non-empty, DOC_CONTENTS information will be strictly respected,
+# not getting it automatically formatted by fmt.
+
 # @ECLASS-VARIABLE: FORCE_PRINT_ELOG
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -53,7 +59,11 @@
 	if [[ -n ${DOC_CONTENTS} ]]; then
 		eshopts_push
 		set -f
-		echo ${DOC_CONTENTS} | fmt  ${T}/README.gentoo
+		if [[ -n ${DISABLE_AUTOFORMATTING} ]]; then
+			echo ${DOC_CONTENTS}  ${T}/README.gentoo
+		else
+			echo -e ${DOC_CONTENTS} | fmt  ${T}/README.gentoo
+		fi
 		eshopts_pop
 		dodoc ${T}/README.gentoo
 	else


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-30 Thread Ralph Sennhauser
On Tue, 29 Jan 2013 22:47:26 +0100
Pacho Ramos pa...@gentoo.org wrote:

 Also, autoformatting will help to prevent every package setting
 messages with different lines length (in some cases really long lines
 that I finally reported some bugs in the past to get them fitting in
 standard 80 characters per line). 

I agree with you, there should be consistency as far as reasonable.
Formatting certainly is a valid means. Some sort of code tags could
be used if formatting isn't desired. Ie similar to eclass-manpages.


The eclass blurb:
 readme.gentoo - An eclass for installing a README.gentoo doc file
 recording tips

I know it started out as CONFIGURATION, but README.gentoo is generic
enough to contain other package specific info a user or upstream
developer might be interested in. What I have in mind right now are
patches.

This could look like the following in an ebuild:
  README_GENTOO_PATCHES=( ${FILESDIR}/*.patch )
  epatch ${README_GENTOO_PATCHES[@]}

Then the eclass generates for each patch in README_GENTOO_PATCHES a
note within a standard section containing patch name, author, subject
line. This needs something similar enough to a git format patch to
magically work though, but might be a nice addition and would help the
goal of consistency. Also git-format-patch like patches are anyway
preferable to dangling patches with maybe a bug number in the ebuild
at best.


signature.asc
Description: PGP signature


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-30 Thread Ben de Groot
On 30 January 2013 05:47, Pacho Ramos pa...@gentoo.org wrote:
 El mar, 29-01-2013 a las 14:03 +0800, Ben de Groot escribió:
 On 29 January 2013 03:30, Pacho Ramos pa...@gentoo.org wrote:
  El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
  I've started using this eclass, but with README files, not the variable,
  because this is currently the only way I can make sure it honours my
  formatting.
 
 
  Couldn't it be covered if echo -e was used (even with fmt) and you,
  then, control formatting with some of the sequences it allows (they are
  shown in its man page)?

 No. The eclass should assume that DOC_CONTENTS is already correctly
 formatted. If you must, you can add a convenience function for people
 who do want reformatting, but this should NOT be the default. Please
 don't make this eclass harder to use than it needs to be.


 I can add a variable (and probably will), but would prefer to keep it
 formatting messages by default, otherwise, how will you set DOC_CONTENTS
 variable inside a pkg phase (instead of global scope) without adding
 tabs to it? You can of course add it, but it will be read as something
 like:
 src_prepare() {
 DOC_CONTENTS=blablabla
 blablabla
 # Rest of src_prepare stuff
 }

I still prefer the eclass not to mess with formatting by default. You
can do what you want by

src_prepare() {
DOC_CONTENTS=blabla
indented content
# other stuff
}

src_install() {
default
readme.gentoo_reformat
}

 Also, autoformatting will help to prevent every package setting messages
 with different lines length (in some cases really long lines that I
 finally reported some bugs in the past to get them fitting in standard
 80 characters per line).

Sometimes long lines are what is required. If not, then filing a bug
is the friendly solution.

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin



Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-30 Thread Pacho Ramos
El mié, 30-01-2013 a las 21:24 +0800, Ben de Groot escribió:
 On 30 January 2013 05:47, Pacho Ramos pa...@gentoo.org wrote:
  El mar, 29-01-2013 a las 14:03 +0800, Ben de Groot escribió:
  On 29 January 2013 03:30, Pacho Ramos pa...@gentoo.org wrote:
   El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
   I've started using this eclass, but with README files, not the variable,
   because this is currently the only way I can make sure it honours my
   formatting.
  
  
   Couldn't it be covered if echo -e was used (even with fmt) and you,
   then, control formatting with some of the sequences it allows (they are
   shown in its man page)?
 
  No. The eclass should assume that DOC_CONTENTS is already correctly
  formatted. If you must, you can add a convenience function for people
  who do want reformatting, but this should NOT be the default. Please
  don't make this eclass harder to use than it needs to be.
 
 
  I can add a variable (and probably will), but would prefer to keep it
  formatting messages by default, otherwise, how will you set DOC_CONTENTS
  variable inside a pkg phase (instead of global scope) without adding
  tabs to it? You can of course add it, but it will be read as something
  like:
  src_prepare() {
  DOC_CONTENTS=blablabla
  blablabla
  # Rest of src_prepare stuff
  }
 
 I still prefer the eclass not to mess with formatting by default. You
 can do what you want by
 
 src_prepare() {
 DOC_CONTENTS=blabla
 indented content
 # other stuff
 }

But it will be recorded with indent in README.gentoo, what is not
desired.

 
 src_install() {
 default
 readme.gentoo_reformat
 }
 
  Also, autoformatting will help to prevent every package setting messages
  with different lines length (in some cases really long lines that I
  finally reported some bugs in the past to get them fitting in standard
  80 characters per line).
 
 Sometimes long lines are what is required. If not, then filing a bug
 is the friendly solution.
 

In that case, you could set the variable to skip formatting as, the
preferred option is to keep them in standard length, and the exception
is to require longer lines (in that case they could be covered with the
variable) 


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-29 Thread Pacho Ramos
El mar, 29-01-2013 a las 14:03 +0800, Ben de Groot escribió:
 On 29 January 2013 03:30, Pacho Ramos pa...@gentoo.org wrote:
  El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
  I've started using this eclass, but with README files, not the variable,
  because this is currently the only way I can make sure it honours my
  formatting.
 
 
  Couldn't it be covered if echo -e was used (even with fmt) and you,
  then, control formatting with some of the sequences it allows (they are
  shown in its man page)?
 
 No. The eclass should assume that DOC_CONTENTS is already correctly
 formatted. If you must, you can add a convenience function for people
 who do want reformatting, but this should NOT be the default. Please
 don't make this eclass harder to use than it needs to be.
 

I can add a variable (and probably will), but would prefer to keep it
formatting messages by default, otherwise, how will you set DOC_CONTENTS
variable inside a pkg phase (instead of global scope) without adding
tabs to it? You can of course add it, but it will be read as something
like:
src_prepare() {
DOC_CONTENTS=blablabla
blablabla
# Rest of src_prepare stuff
}

Also, autoformatting will help to prevent every package setting messages
with different lines length (in some cases really long lines that I
finally reported some bugs in the past to get them fitting in standard
80 characters per line). 

I would then switch to echo -e and also add a function (like my
original solution in this thread) to allow you to disable formatting if
you want


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-29 Thread Michał Górny
On Tue, 29 Jan 2013 22:47:26 +0100
Pacho Ramos pa...@gentoo.org wrote:

 El mar, 29-01-2013 a las 14:03 +0800, Ben de Groot escribió:
  On 29 January 2013 03:30, Pacho Ramos pa...@gentoo.org wrote:
   El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
   I've started using this eclass, but with README files, not the variable,
   because this is currently the only way I can make sure it honours my
   formatting.
  
  
   Couldn't it be covered if echo -e was used (even with fmt) and you,
   then, control formatting with some of the sequences it allows (they are
   shown in its man page)?
  
  No. The eclass should assume that DOC_CONTENTS is already correctly
  formatted. If you must, you can add a convenience function for people
  who do want reformatting, but this should NOT be the default. Please
  don't make this eclass harder to use than it needs to be.
  
 
 I can add a variable (and probably will), but would prefer to keep it
 formatting messages by default, otherwise, how will you set DOC_CONTENTS
 variable inside a pkg phase (instead of global scope) without adding
 tabs to it? You can of course add it, but it will be read as something
 like:
 src_prepare() {
   DOC_CONTENTS=blablabla
 blablabla
   # Rest of src_prepare stuff
 }

How about:

src_prepare() {
DOC_CONTENTS=(
line 1
line 2
line 3
)
}

?

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-28 Thread Pacho Ramos
El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
 On 28 January 2013 12:37, Mike Frysinger vap...@gentoo.org wrote:
  On Sunday 27 January 2013 13:21:27 Pacho Ramos wrote:
  The problem is that it doesn't work so well. If I have the following at
  src_prepare (for example):
  src_prepare() {
  DOC_CONTENTS=You must create a symlink rom /etc/splash/tuxonice
  to the theme you want tuxonice to use, e.g.: \n
# ln -sfn /etc/splash/emergence /etc/splash/tuxonice 
  \n
  ...
 
  and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs
  also in generated file as the contents of the variable will be put
  as-is. On the other hand, if I don't put it between quotes
 
  forcibly normalizing whitespace for all callers is wrong imo (as is sending 
  it
  through `fmt`).  if the caller gave you content to write, it should write 
  it.
  if the caller didn't want tabs, it shouldn't have used it in the first 
  place.
  -mike
 
 I've started using this eclass, but with README files, not the variable,
 because this is currently the only way I can make sure it honours my
 formatting.
 

Couldn't it be covered if echo -e was used (even with fmt) and you,
then, control formatting with some of the sequences it allows (they are
shown in its man page)?


signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-28 Thread Mike Frysinger
On Monday 28 January 2013 14:30:06 Pacho Ramos wrote:
 El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
  On 28 January 2013 12:37, Mike Frysinger wrote:
   On Sunday 27 January 2013 13:21:27 Pacho Ramos wrote:
   The problem is that it doesn't work so well. If I have the following
   at src_prepare (for example):
   src_prepare() {
   
   DOC_CONTENTS=You must create a symlink rom
   /etc/splash/tuxonice
   to the theme you want tuxonice to use, e.g.: \n
 # ln -sfn /etc/splash/emergence
 /etc/splash/tuxonice \n
   ...
   
   and I handle ${DOC_CONTENTS} with quotes, it will end writing that
   tabs also in generated file as the contents of the variable will be
   put as-is. On the other hand, if I don't put it between quotes
   
   forcibly normalizing whitespace for all callers is wrong imo (as is
   sending it through `fmt`).  if the caller gave you content to write,
   it should write it. if the caller didn't want tabs, it shouldn't have
   used it in the first place.
  
  I've started using this eclass, but with README files, not the variable,
  because this is currently the only way I can make sure it honours my
  formatting.
 
 Couldn't it be covered if echo -e was used (even with fmt) and you,
 then, control formatting with some of the sequences it allows (they are
 shown in its man page)?

how is it better to require people to fill the string with \x20\n\t than to 
respect what was given ?  if people want to normalize whitespace themselves, 
they could just as easily do the `echo` themselves.
-mike


signature.asc
Description: This is a digitally signed message part.


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-28 Thread Ben de Groot
On 29 January 2013 03:30, Pacho Ramos pa...@gentoo.org wrote:
 El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
 I've started using this eclass, but with README files, not the variable,
 because this is currently the only way I can make sure it honours my
 formatting.


 Couldn't it be covered if echo -e was used (even with fmt) and you,
 then, control formatting with some of the sequences it allows (they are
 shown in its man page)?

No. The eclass should assume that DOC_CONTENTS is already correctly
formatted. If you must, you can add a convenience function for people
who do want reformatting, but this should NOT be the default. Please
don't make this eclass harder to use than it needs to be.

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin



Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-27 Thread Mike Frysinger
On Sunday 27 January 2013 12:47:28 Pacho Ramos wrote:
 El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
  Currently, when people uses DOC_CONTENTS variable to place their desired
  messages, they are automatically reformatted by fmt to get proper
  messages (for example, splitting long lines).
  
  But, in some cases, may be useful to disable this behavior and respect
  strictly how DOC_CONTENTS was formatted, for example in that kind of
  messages telling people to run a command and, then, requiring a new line
  to be used. This can also be useful to append extra information to
  DOC_CONTENTS when, for example, additional info is needed when enabling
  a USE flag.
 
 Well, after reading man echo I see all this is not needed, I simply need
 to use echo -e to get it understand \n to create new lines

printf '%b' ${foo}
-mike


signature.asc
Description: This is a digitally signed message part.


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-27 Thread Pacho Ramos
El dom, 27-01-2013 a las 13:05 -0500, Mike Frysinger escribió:
 On Sunday 27 January 2013 12:47:28 Pacho Ramos wrote:
  El dom, 27-01-2013 a las 15:00 +0100, Pacho Ramos escribió:
   Currently, when people uses DOC_CONTENTS variable to place their desired
   messages, they are automatically reformatted by fmt to get proper
   messages (for example, splitting long lines).
   
   But, in some cases, may be useful to disable this behavior and respect
   strictly how DOC_CONTENTS was formatted, for example in that kind of
   messages telling people to run a command and, then, requiring a new line
   to be used. This can also be useful to append extra information to
   DOC_CONTENTS when, for example, additional info is needed when enabling
   a USE flag.
  
  Well, after reading man echo I see all this is not needed, I simply need
  to use echo -e to get it understand \n to create new lines
 
 printf '%b' ${foo}
 -mike

The problem is that it doesn't work so well. If I have the following at
src_prepare (for example):
src_prepare() {
DOC_CONTENTS=You must create a symlink rom /etc/splash/tuxonice
to the theme you want tuxonice to use, e.g.: \n
# ln -sfn /etc/splash/emergence /etc/splash/tuxonice \n
...

and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs
also in generated file as the contents of the variable will be put
as-is. On the other hand, if I don't put it between quotes and, later,
pass fmt, it will be formatted properly, without tabs and jumping to a
new line when \n is passed. In this way, echo will output a long line
with all the contents jumping to a new line when \n is found and, later,
fmt does the formatting.

But, if I use printf instead of echo:
1. If I put the variable with quotes it will be printed as-is (with
tabs).
2. If I drop the quotes, all spaces are dropped and end up with
something like:
Youmustcreateasymlinkfrom/etc/splash/tuxonicetothethemeyou



signature.asc
Description: This is a digitally signed message part


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-27 Thread Mike Frysinger
On Sunday 27 January 2013 13:21:27 Pacho Ramos wrote:
 The problem is that it doesn't work so well. If I have the following at
 src_prepare (for example):
 src_prepare() {
 DOC_CONTENTS=You must create a symlink rom /etc/splash/tuxonice
 to the theme you want tuxonice to use, e.g.: \n
   # ln -sfn /etc/splash/emergence /etc/splash/tuxonice \n
 ...
 
 and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs
 also in generated file as the contents of the variable will be put
 as-is. On the other hand, if I don't put it between quotes

forcibly normalizing whitespace for all callers is wrong imo (as is sending it 
through `fmt`).  if the caller gave you content to write, it should write it.  
if the caller didn't want tabs, it shouldn't have used it in the first place.
-mike


signature.asc
Description: This is a digitally signed message part.


Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=

2013-01-27 Thread Ben de Groot
On 28 January 2013 12:37, Mike Frysinger vap...@gentoo.org wrote:
 On Sunday 27 January 2013 13:21:27 Pacho Ramos wrote:
 The problem is that it doesn't work so well. If I have the following at
 src_prepare (for example):
 src_prepare() {
 DOC_CONTENTS=You must create a symlink rom /etc/splash/tuxonice
 to the theme you want tuxonice to use, e.g.: \n
   # ln -sfn /etc/splash/emergence /etc/splash/tuxonice 
 \n
 ...

 and I handle ${DOC_CONTENTS} with quotes, it will end writing that tabs
 also in generated file as the contents of the variable will be put
 as-is. On the other hand, if I don't put it between quotes

 forcibly normalizing whitespace for all callers is wrong imo (as is sending it
 through `fmt`).  if the caller gave you content to write, it should write it.
 if the caller didn't want tabs, it shouldn't have used it in the first place.
 -mike

I've started using this eclass, but with README files, not the variable,
because this is currently the only way I can make sure it honours my
formatting.

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin