[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.ecl
From:       Pacho Ramos <pacho () gentoo ! org>
Date:       2013-01-31 18:59:03
Message-ID: 1359658743.26423.13.camel () belkin4
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


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

["1.patch" (1.patch)]

--- readme.gentoo.eclass	2013-01-24 22:38:41.000000000 +0100
+++ /usr/portage/eclass/readme.gentoo.eclass	2013-01-31 19:55:40.000000000 +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" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic