Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-27 Thread Michał Górny
Dnia 2013-07-24, o godz. 09:18:13
Michał Górny mgo...@gentoo.org napisał(a):

 Pacho requested that to be able to warn users in GNOME packages that do
 not work anymore without systemd.

Committed with a little more verbose description, and a MERGE_TYPE note.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


[gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Michał Górny
Pacho requested that to be able to warn users in GNOME packages that do
not work anymore without systemd.
---
 gx86/eclass/systemd.eclass | 17 +
 1 file changed, 17 insertions(+)

diff --git a/gx86/eclass/systemd.eclass b/gx86/eclass/systemd.eclass
index 166c7be..a2750d7 100644
--- a/gx86/eclass/systemd.eclass
+++ b/gx86/eclass/systemd.eclass
@@ -252,3 +252,20 @@ systemd_update_catalog() {
debug-print ${FUNCNAME}: journalctl not found.
fi
 }
+
+# @FUNCTION: systemd_is_booted
+# @DESCRIPTION:
+# Check whether the system was booted using systemd.
+#
+# Returns 0 if systemd is used to boot the system, 1 otherwise.
+#
+# See: man sd_booted
+systemd_update_catalog() {
+   debug-print-function ${FUNCNAME} ${@}
+
+   [[ -d /run/systemd/system ]]
+   local ret=${?}
+
+   debug-print ${FUNCNAME}: [[ -d /run/systemd/system ]] - ${ret}
+   return ${ret}
+}
-- 
1.8.3.2




Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Tom Wijsman
On Wed, 24 Jul 2013 09:18:13 +0200
Michał Górny mgo...@gentoo.org wrote:

 Pacho requested that to be able to warn users in GNOME packages that
 do not work anymore without systemd.

 +# @FUNCTION: systemd_is_booted
 +# @DESCRIPTION:
 +# Check whether the system was booted using systemd.

Can we have a short mention of that kind of usage in the description?

There is some set of possible wrong usages, some of which are nasty,
that this function should not be used for; for example, someone could
use this as a check to install a file which I believe isn't permitted.

Are there even other legit usages your original function would permit?

Alternatively, you could change the function altogether into something
more specific; eg. ewarn_systemd_boot and ewarn_no_systemd_boot.

These functions would then take a message as parameter; then the
resulting behavior of this function is in your hands, not the consumer.

-- 
With kind regards,

Tom Wijsman (TomWij)
Gentoo Developer

E-mail address  : tom...@gentoo.org
GPG Public Key  : 6D34E57D
GPG Fingerprint : C165 AF18 AB4C 400B C3D2  ABF0 95B2 1FCD 6D34 E57D


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Sergei Trofimovich
On Wed, 24 Jul 2013 09:18:13 +0200
Michał Górny mgo...@gentoo.org wrote:


 +# @FUNCTION: systemd_is_booted
 +systemd_update_catalog() {

Looks like a typo :]

-- 

  Sergei


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Michał Górny
Dnia 2013-07-24, o godz. 11:36:12
Sergei Trofimovich sly...@gentoo.org napisał(a):

 On Wed, 24 Jul 2013 09:18:13 +0200
 Michał Górny mgo...@gentoo.org wrote:
 
 
  +# @FUNCTION: systemd_is_booted
  +systemd_update_catalog() {
 
 Looks like a typo :]

Thanks for noticing. Does anyone else feel that eclassdoc is utterly
irritating and encourages that kind of mistakes?

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Ulrich Mueller
 On Wed, 24 Jul 2013, Michał Górny wrote:

 Pacho requested that to be able to warn users in GNOME packages that
 do not work anymore without systemd.

Why is the host where the package is built required to run systemd?
Wouldn't a warning at runtime better suit the purpose?

Ulrich



Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Ian Stakenvicius
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 24/07/13 10:17 AM, Ulrich Mueller wrote:
 On Wed, 24 Jul 2013, Michał Górny wrote:
 
 Pacho requested that to be able to warn users in GNOME packages
 that do not work anymore without systemd.
 
 Why is the host where the package is built required to run
 systemd? Wouldn't a warning at runtime better suit the purpose?
 
 Ulrich
 

Agreed -- although this function could still have uses, ie, in
pkg_postinst to do certain things if systemd is running, no?

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)

iF4EAREIAAYFAlHv4osACgkQ2ugaI38ACPCNeAEAlqSpCrIcH5gdXFwNI4mna9yw
VziYKhZrDB+4+8h40SoA/RXkCjLOhnVmVBSZP5zKmu3qih2H7mJcob/7dGkIp5Cw
=4Wtp
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Alexandre Rostovtsev
On Wed, 2013-07-24 at 16:17 +0200, Ulrich Mueller wrote:
  On Wed, 24 Jul 2013, Michał Górny wrote:
 
  Pacho requested that to be able to warn users in GNOME packages that
  do not work anymore without systemd.
 
 Why is the host where the package is built required to run systemd?
 Wouldn't a warning at runtime better suit the purpose?

The purpose of systemd_is_booted() is to provide helpful postinst
messages to users depending on whether or not they are running systemd,
and for the vast majority of users, the machine where the package is
built is the machine where the package will be run.

Runtime warnings would require non-trivial patching of the packages in
question, so it's not a realistic alternative.

Those who have separate build hosts are probably sufficiently
technically proficient to understand if the message does not apply to
their case.




Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Alex Xu
On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
 On Wed, 2013-07-24 at 16:17 +0200, Ulrich Mueller wrote:
 On Wed, 24 Jul 2013, Michał Górny wrote:

 Pacho requested that to be able to warn users in GNOME packages that
 do not work anymore without systemd.

 Why is the host where the package is built required to run systemd?
 Wouldn't a warning at runtime better suit the purpose?
 
 The purpose of systemd_is_booted() is to provide helpful postinst
 messages to users depending on whether or not they are running systemd,
 and for the vast majority of users, the machine where the package is
 built is the machine where the package will be run.
 
 Runtime warnings would require non-trivial patching of the packages in
 question, so it's not a realistic alternative.
 
 Those who have separate build hosts are probably sufficiently
 technically proficient to understand if the message does not apply to
 their case.
 
 

So it is sufficient to add e.g. ewarn_systemd_is_not_booted() (possibly
with a better name) to discourage inappropriate use cases?



signature.asc
Description: OpenPGP digital signature


Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Ian Stakenvicius
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
 
 Runtime warnings would require non-trivial patching of the
 packages in question, so it's not a realistic alternative.
 

It should be done anyways, though, unless the runtime errors
themselves are obvious enough to understand.

A News item would be good, too.  In fact, perhaps this pkg_postinst()
warning should exist no matter what the end-user is running, just so
they know they can't trivially switch back to sysvinit/openrc??

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (GNU/Linux)

iF4EAREIAAYFAlHv8/YACgkQ2ugaI38ACPAFzAD/XfUg1IjWB4dBCCq32rFuy74A
+W42E6fXnBdgfTDFA38A/RZfHDjdPDTydt8FBc0IS/+h/22qlbbuPEJypv04VgAa
=Imh1
-END PGP SIGNATURE-



Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Michał Górny
Dnia 2013-07-24, o godz. 16:17:47
Ulrich Mueller u...@gentoo.org napisał(a):

  On Wed, 24 Jul 2013, Michał Górny wrote:
 
  Pacho requested that to be able to warn users in GNOME packages that
  do not work anymore without systemd.
 
 Why is the host where the package is built required to run systemd?
 Wouldn't a warning at runtime better suit the purpose?

Warning at pkg_postinst() for non-pure-package build seems best.

A warning at meantime seems not meaningful. It would just be a small
warning compared to the big runtime problem that package does not work
anymore.

-- 
Best regards,
Michał Górny


signature.asc
Description: PGP signature


Re: [gentoo-dev] [PATCH systemd.eclass] Introduce systemd_is_booted().

2013-07-24 Thread Pacho Ramos
El mié, 24-07-2013 a las 11:34 -0400, Ian Stakenvicius escribió:
 On 24/07/13 10:33 AM, Alexandre Rostovtsev wrote:
  
  Runtime warnings would require non-trivial patching of the
  packages in question, so it's not a realistic alternative.
  
 
 It should be done anyways, though, unless the runtime errors
 themselves are obvious enough to understand.
 
 A News item would be good, too.  In fact, perhaps this pkg_postinst()
 warning should exist no matter what the end-user is running, just so
 they know they can't trivially switch back to sysvinit/openrc??
 

A news item will be added for sure before Gnome 3.8 gets stabilized,
this was more to be even more sure people know that information