public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
@ 2013-01-21 21:08 Pacho Ramos
  2013-01-22  7:16 ` Tomáš Chvátal
  0 siblings, 1 reply; 11+ messages in thread
From: Pacho Ramos @ 2013-01-21 21:08 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 226 bytes --]

This can be useful when, for example, doc contents are modified. You can
then rely on using REPLACING_VERSIONS in your ebuild to print messages
when people updates from versions using old docs

Patch to review attached


[-- Attachment #1.2: 1.patch --]
[-- Type: text/x-patch, Size: 1145 bytes --]

--- readme.gentoo.eclass	2013-01-20 12:42:30.000000000 +0100
+++ /usr/portage/eclass/readme.gentoo.eclass	2013-01-21 22:06:46.000000000 +0100
@@ -66,6 +66,18 @@
 	fi
 }
 
+# @FUNCTION: readme.gentoo_force_print_elog
+# @DESCRIPTION:
+# For elog message printing. This can be useful when, for example,
+# DOC_CONTENTS is modified. You can then rely on using REPLACING_VERSIONS
+# in your ebuild to print messages when people updates from versions
+# still providing old message.
+# Should be called before pkg_postinst phase.
+readme.gentoo_force_print_elog() {
+	debug-print-function ${FUNCNAME} "${@}"
+	touch "${T}"/README.gentoo.force_print_elog
+}
+
 # @FUNCTION: readme.gentoo_print_elog
 # @DESCRIPTION:
 # Print elog messages with "${T}"/README.gentoo contents.
@@ -74,7 +86,7 @@
 	debug-print-function ${FUNCNAME} "${@}"
 
 	if [[ -f "${T}"/README.gentoo ]]; then
-		if ! [[ "${REPLACING_VERSIONS}" ]]; then
+		if ! [[ "${REPLACING_VERSIONS}" ]] || [[ -f "${T}"/README.gentoo.force_print_elog ]]; then
 			eshopts_push
 			set -f
 			cat "${T}"/README.gentoo | while read -r ELINE; do elog "${ELINE}"; done

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-21 21:08 [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing Pacho Ramos
@ 2013-01-22  7:16 ` Tomáš Chvátal
  2013-01-22  8:07   ` Pacho Ramos
  0 siblings, 1 reply; 11+ messages in thread
From: Tomáš Chvátal @ 2013-01-22  7:16 UTC (permalink / raw
  To: gentoo-dev

2013/1/21 Pacho Ramos <pacho@gentoo.org>:
> This can be useful when, for example, doc contents are modified. You can
> then rely on using REPLACING_VERSIONS in your ebuild to print messages
> when people updates from versions using old docs
>
> Patch to review attached
>

Would'nt be better to just set some variable in the ebuild, rather
than call function that touches empty file?

Tom


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-22  7:16 ` Tomáš Chvátal
@ 2013-01-22  8:07   ` Pacho Ramos
  2013-01-22  9:33     ` Tomáš Chvátal
  0 siblings, 1 reply; 11+ messages in thread
From: Pacho Ramos @ 2013-01-22  8:07 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

El mar, 22-01-2013 a las 08:16 +0100, Tomáš Chvátal escribió:
> 2013/1/21 Pacho Ramos <pacho@gentoo.org>:
> > This can be useful when, for example, doc contents are modified. You can
> > then rely on using REPLACING_VERSIONS in your ebuild to print messages
> > when people updates from versions using old docs
> >
> > Patch to review attached
> >
> 
> Would'nt be better to just set some variable in the ebuild, rather
> than call function that touches empty file?
> 
> Tom
> 
> 

I think it can be done in either way... but I don't see the advantage of
any over the other :/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-22  8:07   ` Pacho Ramos
@ 2013-01-22  9:33     ` Tomáš Chvátal
  2013-01-22 18:37       ` Pacho Ramos
  0 siblings, 1 reply; 11+ messages in thread
From: Tomáš Chvátal @ 2013-01-22  9:33 UTC (permalink / raw
  To: gentoo-dev

2013/1/22 Pacho Ramos <pacho@gentoo.org>:
> El mar, 22-01-2013 a las 08:16 +0100, Tomáš Chvátal escribió:
>> Would'nt be better to just set some variable in the ebuild, rather
>> than call function that touches empty file?
>>
>> Tom
>>
>>
>
> I think it can be done in either way... but I don't see the advantage of
> any over the other :/

Just few I can think of right now:

You can set the variable in the ebuilds global scope somewhere on top easily.
You can actually do more magic later based on what content user puts
to the variable if we want to (all msgs, important ones only, ...)
You actually allow user to enforce this behaviour in make conf for all
packages if he desires to do so.

Also I never seen this being handled by touching files in any other eclasses :-)

Tom


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-22  9:33     ` Tomáš Chvátal
@ 2013-01-22 18:37       ` Pacho Ramos
  2013-01-22 18:42         ` Tomáš Chvátal
  0 siblings, 1 reply; 11+ messages in thread
From: Pacho Ramos @ 2013-01-22 18:37 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 1006 bytes --]

El mar, 22-01-2013 a las 10:33 +0100, Tomáš Chvátal escribió:
> 2013/1/22 Pacho Ramos <pacho@gentoo.org>:
> > El mar, 22-01-2013 a las 08:16 +0100, Tomáš Chvátal escribió:
> >> Would'nt be better to just set some variable in the ebuild, rather
> >> than call function that touches empty file?
> >>
> >> Tom
> >>
> >>
> >
> > I think it can be done in either way... but I don't see the advantage of
> > any over the other :/
> 
> Just few I can think of right now:
> 
> You can set the variable in the ebuilds global scope somewhere on top easily.
> You can actually do more magic later based on what content user puts
> to the variable if we want to (all msgs, important ones only, ...)
> You actually allow user to enforce this behaviour in make conf for all
> packages if he desires to do so.
> 
> Also I never seen this being handled by touching files in any other eclasses :-)
> 
> Tom
> 
> 

I agree, thanks for pointing it. Just attached patch should handle it.


[-- Attachment #1.2: 1.patch --]
[-- Type: text/x-patch, Size: 1176 bytes --]

--- readme.gentoo.eclass	2013-01-20 12:42:30.000000000 +0100
+++ /usr/portage/eclass/readme.gentoo.eclass	2013-01-22 19:36:12.000000000 +0100
@@ -68,13 +68,20 @@
 
 # @FUNCTION: readme.gentoo_print_elog
 # @DESCRIPTION:
-# Print elog messages with "${T}"/README.gentoo contents.
+# Print elog messages with "${T}"/README.gentoo contents. They will be
+# shown only when package is installed at first time.
 # Usually called at pkg_postinst phase.
+#
+# If you want to show them always, please set FORCE_PRINT_ELOG to a non empty
+# value in your ebuild before this function is called.
+# This can be useful when, for example, DOC_CONTENTS is modified, then, you can
+# rely on specific REPLACING_VERSIONS handling in your ebuild to print messages
+# when people update from versions still providing old message.
 readme.gentoo_print_elog() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	if [[ -f "${T}"/README.gentoo ]]; then
-		if ! [[ "${REPLACING_VERSIONS}" ]]; then
+		if ! [[ "${REPLACING_VERSIONS}" ]] || [[ "${FORCE_PRINT_ELOG}" ]]; then
 			eshopts_push
 			set -f
 			cat "${T}"/README.gentoo | while read -r ELINE; do elog "${ELINE}"; done

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-22 18:37       ` Pacho Ramos
@ 2013-01-22 18:42         ` Tomáš Chvátal
  2013-01-24 20:33           ` Pacho Ramos
  0 siblings, 1 reply; 11+ messages in thread
From: Tomáš Chvátal @ 2013-01-22 18:42 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

Dne Út 22. ledna 2013 19:37:12, Pacho Ramos napsal(a):
> I agree, thanks for pointing it. Just attached patch should handle it.

Still not nice enough for me :D

Use the ECLASS_VARIABLE to describe it @DEFAULT_UNSET is what you seek, see 
git-2.eclass.

Tom

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-22 18:42         ` Tomáš Chvátal
@ 2013-01-24 20:33           ` Pacho Ramos
  2013-01-24 20:42             ` Tomáš Chvátal
  0 siblings, 1 reply; 11+ messages in thread
From: Pacho Ramos @ 2013-01-24 20:33 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 377 bytes --]

El mar, 22-01-2013 a las 19:42 +0100, Tomáš Chvátal escribió:
> Dne Út 22. ledna 2013 19:37:12, Pacho Ramos napsal(a):
> > I agree, thanks for pointing it. Just attached patch should handle it.
> 
> Still not nice enough for me :D
> 
> Use the ECLASS_VARIABLE to describe it @DEFAULT_UNSET is what you seek, see 
> git-2.eclass.
> 
> Tom

What about this one?

[-- Attachment #1.2: 1.patch --]
[-- Type: text/x-patch, Size: 1529 bytes --]

--- readme.gentoo.eclass	2013-01-20 12:42:30.000000000 +0100
+++ /usr/portage/eclass/readme.gentoo.eclass	2013-01-24 21:30:09.000000000 +0100
@@ -36,6 +36,11 @@
 
 EXPORT_FUNCTIONS src_install pkg_postinst
 
+# @ECLASS-VARIABLE: FORCE_PRINT_ELOG
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If non-empty this variable forces elog messages to be printed.
+
 # @FUNCTION: readme.gentoo_create_doc
 # @DESCRIPTION:
 # Create doc file with ${DOC_CONTENTS} variable (preferred) and, if not set,
@@ -68,13 +73,20 @@
 
 # @FUNCTION: readme.gentoo_print_elog
 # @DESCRIPTION:
-# Print elog messages with "${T}"/README.gentoo contents.
+# Print elog messages with "${T}"/README.gentoo contents. They will be
+# shown only when package is installed at first time.
 # Usually called at pkg_postinst phase.
+#
+# If you want to show them always, please set FORCE_PRINT_ELOG to a non empty
+# value in your ebuild before this function is called.
+# This can be useful when, for example, DOC_CONTENTS is modified, then, you can
+# rely on specific REPLACING_VERSIONS handling in your ebuild to print messages
+# when people update from versions still providing old message.
 readme.gentoo_print_elog() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	if [[ -f "${T}"/README.gentoo ]]; then
-		if ! [[ "${REPLACING_VERSIONS}" ]]; then
+		if ! [[ "${REPLACING_VERSIONS}" ]] || [[ "${FORCE_PRINT_ELOG}" ]]; then
 			eshopts_push
 			set -f
 			cat "${T}"/README.gentoo | while read -r ELINE; do elog "${ELINE}"; done

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-24 20:33           ` Pacho Ramos
@ 2013-01-24 20:42             ` Tomáš Chvátal
  2013-01-24 21:39               ` Pacho Ramos
  0 siblings, 1 reply; 11+ messages in thread
From: Tomáš Chvátal @ 2013-01-24 20:42 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 649 bytes --]

Dne Čt 24. ledna 2013 21:33:45, Pacho Ramos napsal(a):
> El mar, 22-01-2013 a las 19:42 +0100, Tomáš Chvátal escribió:
> > Dne Út 22. ledna 2013 19:37:12, Pacho Ramos napsal(a):
> > > I agree, thanks for pointing it. Just attached patch should handle it.
> > 
> > Still not nice enough for me :D
> > 
> > Use the ECLASS_VARIABLE to describe it @DEFAULT_UNSET is what you seek,
> > see
> > git-2.eclass.
> > 
> > Tom
> 
> What about this one?

-		if ! [[ "${REPLACING_VERSIONS}" ]] || [[ "${FORCE_PRINT_ELOG}" ]]; then
+		if ! [[ -n "${REPLACING_VERSIONS}"  || -n "${FORCE_PRINT_ELOG}" ]]; then

But thats just cosmetic

Tom

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-24 20:42             ` Tomáš Chvátal
@ 2013-01-24 21:39               ` Pacho Ramos
  2013-02-01 14:32                 ` Fabio Erculiani
  0 siblings, 1 reply; 11+ messages in thread
From: Pacho Ramos @ 2013-01-24 21:39 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

El jue, 24-01-2013 a las 21:42 +0100, Tomáš Chvátal escribió:
> Dne Čt 24. ledna 2013 21:33:45, Pacho Ramos napsal(a):
> > El mar, 22-01-2013 a las 19:42 +0100, Tomáš Chvátal escribió:
> > > Dne Út 22. ledna 2013 19:37:12, Pacho Ramos napsal(a):
> > > > I agree, thanks for pointing it. Just attached patch should handle it.
> > > 
> > > Still not nice enough for me :D
> > > 
> > > Use the ECLASS_VARIABLE to describe it @DEFAULT_UNSET is what you seek,
> > > see
> > > git-2.eclass.
> > > 
> > > Tom
> > 
> > What about this one?
> 
> -		if ! [[ "${REPLACING_VERSIONS}" ]] || [[ "${FORCE_PRINT_ELOG}" ]]; then
> +		if ! [[ -n "${REPLACING_VERSIONS}"  || -n "${FORCE_PRINT_ELOG}" ]]; then
> 
> But thats just cosmetic
> 
> Tom

Done, and committed

+  24 Jan 2013; Pacho Ramos <pacho@gentoo.org> readme.gentoo.eclass:
+  Include FORCE_PRINT_ELOG variable to for printing of messages when
desired.
+  Thanks to Tomáš Chvátal for his suggestions.
+


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-01-24 21:39               ` Pacho Ramos
@ 2013-02-01 14:32                 ` Fabio Erculiani
  2013-02-01 14:34                   ` Fabio Erculiani
  0 siblings, 1 reply; 11+ messages in thread
From: Fabio Erculiani @ 2013-02-01 14:32 UTC (permalink / raw
  To: gentoo-dev

Well done!
Binary packages is now broken :-/

>>    ## SPM: post-install phase
 * ERROR: x11-misc/bumblebee-3.0.1-r2 failed (postinst phase):
 *   README.gentoo wasn't created at src_install!
 *
 * Call stack:
 *     ebuild.sh, line   93:  Called pkg_postinst
 *   environment, line 2080:  Called readme.gentoo_pkg_postinst
 *   environment, line 2230:  Called readme.gentoo_print_elog
 *   environment, line 2245:  Called die
 * The specific snippet of code:
 *           die "README.gentoo wasn't created at src_install!";
 *
 * If you need support, post the output of `emerge --info
'=x11-misc/bumblebee-3.0.1-r2'`,
 * the complete build log and the output of `emerge -pqv
'=x11-misc/bumblebee-3.0.1-r2'`.
 * The complete build log is located at
'/var/tmp/entropy/packages/amd64/5/x11-misc_bumblebee-3.0.1-r2_0.tbz2/portage/x11-misc/bumblebee-3.0.1-r2/temp/build.log'.
 * The ebuild environment file is located at
'/var/tmp/entropy/packages/amd64/5/x11-misc_bumblebee-3.0.1-r2_0.tbz2/portage/x11-misc/bumblebee-3.0.1-r2/temp/environment'.
 * Working directory:
'/var/tmp/entropy/packages/amd64/5/x11-misc_bumblebee-3.0.1-r2_0.tbz2/portage/x11-misc/bumblebee-3.0.1-r2'
 * S: '/var/tmp/entropy/packages/amd64/5/x11-misc_bumblebee-3.0.1-r2_0.tbz2/portage/x11-misc/bumblebee-3.0.1-r2/work/bumblebee-3.0.1'

-- 
Fabio Erculiani


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing
  2013-02-01 14:32                 ` Fabio Erculiani
@ 2013-02-01 14:34                   ` Fabio Erculiani
  0 siblings, 0 replies; 11+ messages in thread
From: Fabio Erculiani @ 2013-02-01 14:34 UTC (permalink / raw
  To: gentoo-dev

No FILESDIR nor T in pkg_* phases please!

-- 
Fabio Erculiani


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-02-01 14:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-21 21:08 [gentoo-dev] readme.gentoo.eclass: Add a readme.gentoo_force_print_elog function to force elog printing Pacho Ramos
2013-01-22  7:16 ` Tomáš Chvátal
2013-01-22  8:07   ` Pacho Ramos
2013-01-22  9:33     ` Tomáš Chvátal
2013-01-22 18:37       ` Pacho Ramos
2013-01-22 18:42         ` Tomáš Chvátal
2013-01-24 20:33           ` Pacho Ramos
2013-01-24 20:42             ` Tomáš Chvátal
2013-01-24 21:39               ` Pacho Ramos
2013-02-01 14:32                 ` Fabio Erculiani
2013-02-01 14:34                   ` Fabio Erculiani

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