After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669850 - [PATCH] port g-s from CK to systemd
[PATCH] port g-s from CK to systemd
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks: systemd
 
 
Reported: 2012-02-11 00:43 UTC by Lennart Poettering
Modified: 2012-02-22 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gdm: port gnome-shell --gdm-mode to systemd (7.01 KB, patch)
2012-02-11 00:43 UTC, Lennart Poettering
needs-work Details | Review
automount: port from CK to systemd-logind (7.49 KB, patch)
2012-02-11 03:56 UTC, Lennart Poettering
reviewed Details | Review
gdm: port gnome-shell --gdm-mode to systemd (7.00 KB, patch)
2012-02-13 21:09 UTC, Lennart Poettering
accepted-commit_now Details | Review
automount: port from CK to systemd-logind (7.50 KB, patch)
2012-02-13 21:13 UTC, Lennart Poettering
accepted-commit_now Details | Review

Description Lennart Poettering 2012-02-11 00:43:23 UTC
Created attachment 207304 [details] [review]
gdm: port gnome-shell --gdm-mode to systemd

ConsoleKit is obsoleted by systemd-logind. Accordingly, the attached patch ports over the current CK code to systemd. In order to be nice to the Debian people this patch falls back to CK if systemd is not found, so that the code makes the best of whatever it runs on.
Comment 1 Lennart Poettering 2012-02-11 03:56:57 UTC
Created attachment 207317 [details] [review]
automount: port from CK to systemd-logind

And here's a second patch, porting over the other CK using bit of gnome-shell: the automounting logic.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-02-11 11:37:29 UTC
Review of attachment 207317 [details] [review]:

::: js/ui/automountManager.js
@@ +82,3 @@
 
+        if (haveSystemd())
+            this.ckListener = new ConsoleKitManager();

We only init CK if we have systemd?
Comment 3 Lennart Poettering 2012-02-11 15:03:00 UTC
(In reply to comment #2)
> Review of attachment 207317 [details] [review]:
> 
> ::: js/ui/automountManager.js
> @@ +82,3 @@
> 
> +        if (haveSystemd())
> +            this.ckListener = new ConsoleKitManager();
> 
> We only init CK if we have systemd?

Yes, exactly. We don't need CK on systemd systems. It's what this is about: systemd-logind obsoletes CK so that we don't have to install CK any longer.
Comment 4 Jasper St. Pierre (not reading bugmail) 2012-02-11 15:42:49 UTC
(In reply to comment #3)
> Yes, exactly. We don't need CK on systemd systems. It's what this is about:
> systemd-logind obsoletes CK so that we don't have to install CK any longer.

Well right. I just think your logic is backwards. We should only be initializing ckListener if we *don't* have systemd, right?
Comment 5 drago01 2012-02-12 11:29:15 UTC
Review of attachment 207304 [details] [review]:

Overall looks good (has some style issues though).

I am not sure I really like the "if (Systemd.haveSystemd())" stuff but can't think of a cleaner solution so ...

::: js/Makefile.am
@@ +5,3 @@
 	gdm/batch.js		\
 	gdm/consoleKit.js	\
+	gdm/systemd.js	 	\

This list is supposed to be alphabetically ordered.

::: js/gdm/powerMenu.js
@@ +68,1 @@
+        if (Systemd.haveSystemd()) {

Hmm calling this all over the place is kind of ugly ... but abstracting it in separate class would just move the ugliness around.

@@ +68,2 @@
+        if (Systemd.haveSystemd()) {
+

Useless newline.

@@ +84,3 @@
+
+        } else {
+

Useless newline.

@@ +92,3 @@
+                        this._haveShutdown = false;
+
+                    if (this._haveShutdown) {

Don't use curly braces in single line if / else blocks.

@@ +107,2 @@
+        if (Systemd.haveSystemd()) {
+

Useless newline.

@@ +123,3 @@
+
+        } else {
+

Useless newline.

@@ +131,3 @@
+                        this._haveRestart = false;
+
+                    if (this._haveRestart) {

Don't use braces in single line if / else blocks.
Comment 6 Lennart Poettering 2012-02-13 21:09:33 UTC
Created attachment 207487 [details] [review]
gdm: port gnome-shell --gdm-mode to systemd

(In reply to comment #4)
> (In reply to comment #3)
> > Yes, exactly. We don't need CK on systemd systems. It's what this is about:
> > systemd-logind obsoletes CK so that we don't have to install CK any longer.
> 
> Well right. I just think your logic is backwards. We should only be
> initializing ckListener if we *don't* have systemd, right?

Ouch, you are right. Fixed now.
Comment 7 Lennart Poettering 2012-02-13 21:13:00 UTC
Created attachment 207489 [details] [review]
automount: port from CK to systemd-logind

(In reply to comment #5)

> ::: js/Makefile.am
> @@ +5,3 @@
>      gdm/batch.js        \
>      gdm/consoleKit.js    \
> +    gdm/systemd.js         \
> 
> This list is supposed to be alphabetically ordered.

Fixed.

> @@ +68,2 @@
> +        if (Systemd.haveSystemd()) {
> +
> 
> Useless newline.

Fixed.

> @@ +92,3 @@
> +                        this._haveShutdown = false;
> +
> +                    if (this._haveShutdown) {
> 
> Don't use curly braces in single line if / else blocks.

I explicitly wanted to avoid touching this code, it's the original CK code, just wrapped in an if/else block. If the CK code should be cleaned up like this, this should be done independently of this code I think.

Also note that my own code does not use {} for the one-line-ifs.
Comment 8 drago01 2012-02-13 21:26:04 UTC
Review of attachment 207487 [details] [review]:

Code looks good, commit message could be improved a bit i.e push with something like:

gdm: Port to systemd

ConsoleKit is obsoleted by systemd-logind. Accordingly, port
the current CK code to systemd. In order to be nice to
the Debian people fall back to CK if systemd is not found,
so that the code makes the best of whatever it runs on.
Comment 9 drago01 2012-02-13 21:27:35 UTC
Review of attachment 207489 [details] [review]:

Looks good.
Comment 10 Lennart Poettering 2012-02-13 22:18:55 UTC
OK, thanks, description fixed, and commited.