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 679871 - Make network-manager optional?
Make network-manager optional?
Status: RESOLVED DUPLICATE of bug 669495
Product: gnome-shell
Classification: Core
Component: building
3.4.x
Other OpenBSD
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-07-13 15:44 UTC by Jasper Lievisse Adriaanse
Modified: 2013-10-12 09:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Current OpenBSD patch (6.25 KB, patch)
2012-07-13 15:47 UTC, Jasper Lievisse Adriaanse
needs-work Details | Review
Make NetworkManager support optional (7.36 KB, patch)
2012-08-29 11:55 UTC, Jasper Lievisse Adriaanse
reviewed Details | Review
Make NetworkManager support optional (5.61 KB, patch)
2012-09-30 12:43 UTC, Jasper Lievisse Adriaanse
needs-work Details | Review
Make NetworkManager support optional (7.01 KB, patch)
2012-09-30 20:54 UTC, Jasper Lievisse Adriaanse
none Details | Review
Make NetworkManager support optional (7.01 KB, patch)
2012-10-04 15:19 UTC, Colin Walters
none Details | Review

Description Jasper Lievisse Adriaanse 2012-07-13 15:44:30 UTC
As network-manager only exists on Linux, we're running into an issue when we ported gnome-shell to OpenBSD. Right now we've used a sledgehammer to disable NM, but that's hardly a clean fix, or one that could be committed as it is right now.

I've attached our current patch.

So I'd like to have a --disable-nm (or smth similar) switch that can be used on systems w/o NM. That would be easy for the Makefile's part. But how could this be implemented properly in the Javascript files (which do an import of the NM introspected data). Right now we've commented the imports, but of course the right way would be to have it play nice with a future --disable-nm switch.

Any ideas/thoughts on how to implement this optional functionality correctly?
Comment 1 Jasper Lievisse Adriaanse 2012-07-13 15:47:38 UTC
Created attachment 218742 [details] [review]
Current OpenBSD patch
Comment 2 Florian Müllner 2012-07-13 15:55:15 UTC
(In reply to comment #0)
> Any ideas/thoughts on how to implement this optional functionality correctly?

Add an appropriate property to js/misc/config.js and use it to make the imports conditional.
Comment 3 Colin Walters 2012-07-13 17:04:56 UTC
I'll help pitch in myself on portability for GTK+ and below, because honestly we need portability to Windows for strategic reasons, and if we do that, also handling random Unix variations is a rounding error.

Portability for the full system is a much larger task and consequently more controversial.  Many people in GNOME have gone back and forth on what we should do on this topic:

http://www.mail-archive.com/desktop-devel-list@gnome.org/msg16654.html

I myself have argued that we should always have GNOME be able to run in "thin client" mode.  That argument means that while a patch to make NM optional is probably not too difficult to manage, having different pluggable network stacks is an entirely different world.
 
Anyways, on your actual patch - this is why I hate that people build from tarballs.  Patches to the Makefile.in are useless.  Make a patch on top of git (https://live.gnome.org/GnomeLove/SubmittingPatches) please.
Comment 4 Jasper Lievisse Adriaanse 2012-07-13 20:58:36 UTC
(In reply to comment #3)
[...]

> Anyways, on your actual patch - this is why I hate that people build from
> tarballs.  Patches to the Makefile.in are useless.  Make a patch on top of git
> (https://live.gnome.org/GnomeLove/SubmittingPatches) please.
As I mentioned in my original post, this patch is not intended get committed, hence the patch configure and Makefile.in scripts. When I get around to doing a proper patch which I intend to commit, yes, I'll patch the Makefile.am files of course.
Comment 5 Antoine Jacoutot 2012-07-13 21:01:50 UTC
(In reply to comment #3)
> Anyways, on your actual patch - this is why I hate that people build from
> tarballs.  Patches to the Makefile.in are useless.  Make a patch on top of git
> (https://live.gnome.org/GnomeLove/SubmittingPatches) please.

I think what Jasper was after is some inputs of how to implement the js part, _not_ the autoconf part. Obviously once we figure out the best way to implement the js part, he will post a patch against git. The idea was to show what we were currently doing to make it easier for reviewer to understand the issue.
So please, don't look at the Makefile/configure/autoconf part, these are easy to handle.
Anyway, it seems Florian got us the answer we were looking for.
Comment 6 drago01 2012-07-14 18:31:08 UTC
Review of attachment 218742 [details] [review]:

Marking as needs-work based on the above comments.
Comment 7 Jasper Lievisse Adriaanse 2012-08-29 11:54:27 UTC
Please find attached a reworked patch that I'd like to push once it's found to be OK and inline with the coding standards.
Comment 8 Jasper Lievisse Adriaanse 2012-08-29 11:55:23 UTC
Created attachment 222739 [details] [review]
Make NetworkManager support optional
Comment 9 Colin Walters 2012-08-29 15:33:50 UTC
Review of attachment 222739 [details] [review]:

One minor style comment.

::: js/ui/main.js
@@ +44,3 @@
 
+if (Config.HAVE_NETWORK_MANAGER)
+        const NetworkAgent = imports.ui.networkAgent;

Using "const" inside a conditional is a bit weird.  How about:

const NetworkAgent = Config.HAVE_NETWORK_MANAGER ? imports.ui.networkAgent : null;
Comment 10 Jasper Lievisse Adriaanse 2012-08-29 19:30:47 UTC
Yes, that's better indeed. With that tweak ok to push?
Comment 11 Jasper Lievisse Adriaanse 2012-09-30 12:42:34 UTC
I've updated the patch to apply on git master. I'd like to push this diff this week unless someone objects.
Comment 12 Jasper Lievisse Adriaanse 2012-09-30 12:43:12 UTC
Created attachment 225422 [details] [review]
Make NetworkManager support optional
Comment 13 Colin Walters 2012-09-30 15:50:15 UTC
Review of attachment 225422 [details] [review]:

::: configure.ac
@@ +143,3 @@
+AC_MSG_CHECKING([for Network Manager support])
+PKG_CHECK_EXISTS([libnm-glib libnm-util],
+        [ NM_LIBS=`$PKG_CONFIG --libs libnm-glib libnm-util`

Two things are broken here:

1) We need to get the CFLAGS too; it's very common for pkg-config-using libraries to install in a subdirectory of /usr/include to support parallel installation.

2) We're not actually using NM_LIBS in the Makefile.am, so we'll just fail to link.  You need to add NM_CFLAGS to the gnome_shell_cflags variable, and add NM_LIBS to libgnome_shell_la_LIBADD.

In general, since you're splitting nm out of the GNOME_SHELL_CFLAGS and GNOME_SHELL_LIBS variable, you need to update every place that references either one.  For example, a quick "git grep GNOME_SHELL_LIBS" shows it being used in docs/reference/shell/Makefile.am.

@@ +148,3 @@
+	 AC_SUBST([HAVE_NETWORK_MANAGER],[1])
+	 AC_MSG_RESULT([yes])
+	 $network_manager=true],

Drop the $ from the variable when assigning; this is shell, not Perl.
Comment 14 Jasper Lievisse Adriaanse 2012-09-30 20:54:32 UTC
Thanks, I've updated the patch.
Comment 15 Jasper Lievisse Adriaanse 2012-09-30 20:54:57 UTC
Created attachment 225443 [details] [review]
Make NetworkManager support optional
Comment 16 Colin Walters 2012-10-04 15:19:14 UTC
Created attachment 225819 [details] [review]
Make NetworkManager support optional

Fix a syntax error output from configure.
Comment 17 Colin Walters 2012-10-04 15:21:02 UTC
I tried this locally in the enable-NM case; there was a syntax error that happened due to this line

GNOME_SHELL=$GNOME_SHELL $NM_LIBS

which was both conceptually and syntactically wrong.

Otherwise I think this is fine to go in after 3.6.1 is released and gnome-shell opens up for 3.7 development.
Comment 18 Jasper Lievisse Adriaanse 2012-10-15 08:39:05 UTC
Hmm, it turned out the patch wasn't complete as it would still try to load the networkAgent module. We currently "solved" it with this patch:

--- js/ui/sessionMode.js.orig	Mon Oct  8 14:59:38 2012
+++ js/ui/sessionMode.js	Mon Oct  8 15:00:06 2012
@@ -91,7 +91,7 @@ const _modes = {
         isLocked: false,
         isPrimary: true,
         unlockDialog: imports.ui.unlockDialog.UnlockDialog,
-        components: ['networkAgent', 'polkitAgent', 'telepathyClient',
+        components: ['polkitAgent', 'telepathyClient',
                      'keyring', 'recorder', 'autorunManager', 'automountManager'],
         panel: {
             left: ['activities', 'appMenu'],

Though I wonder how to solve this in a proper way. Perhaps appending to _modes.components after declaring it based on config.HAVE_NETWORK_MANAGER ?
Comment 19 Simon McVittie 2012-11-01 16:44:45 UTC
Debian also patches Shell to make NetworkManager optional (both for Linux users who don't have/trust NetworkManager, and for kFreeBSD to which NM isn't portable). Our patch appears to originate from a Gentoo developer, and applies to 3.4.x (it hasn't yet been updated for 3.6):

http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gnome-shell/debian/patches/10-make-NetworkManager-optional.patch?revision=35202&view=markup

It might be useful to compare what's been merged with the patch we were using?

Cross-references: the original bug was <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652482>; I've opened <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692049> to track "update the patch for 3.6".
Comment 20 Michael Biebl 2012-11-01 23:33:11 UTC
(In reply to comment #19)
> Debian also patches Shell to make NetworkManager optional (both for Linux users
> who don't have/trust NetworkManager, and for kFreeBSD to which NM isn't
> portable). Our patch appears to originate from a Gentoo developer, and applies
> to 3.4.x (it hasn't yet been updated for 3.6):
> 
> http://anonscm.debian.org/viewvc/pkg-gnome/desktop/unstable/gnome-shell/debian/patches/10-make-NetworkManager-optional.patch?revision=35202&view=markup
> 
> It might be useful to compare what's been merged with the patch we were using?
> 
> Cross-references: the original bug was
> <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652482>; I've opened
> <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692049> to track "update the
> patch for 3.6".

The patch in https://bugzilla.gnome.org/show_bug.cgi?id=669495 is based on my initial work and was extended by Alexandre Rostovtsev from Gentoo.

Looks to me as if Bug#679871 should be marked as duplicate of #669496
Comment 21 Jasper Lievisse Adriaanse 2013-10-12 09:24:45 UTC
Yes, I think we can close this bug as a dup of 669496 as that has the set of patches that really should go in rather sooner than later.
Comment 22 Jasper Lievisse Adriaanse 2013-10-12 09:25:00 UTC

*** This bug has been marked as a duplicate of bug 669495 ***