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 693290 - use of <suggests> in modulesets is confused
use of <suggests> in modulesets is confused
Status: RESOLVED OBSOLETE
Product: jhbuild
Classification: Infrastructure
Component: module sets
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
: 693288 693289 (view as bug list)
Depends on:
Blocks: 742266
 
 
Reported: 2013-02-07 01:20 UTC by Allison Karlitskaya (desrt)
Modified: 2021-05-17 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
resolver: warn on circular dependencies (1.10 KB, patch)
2014-12-31 03:20 UTC, Allison Karlitskaya (desrt)
committed Details | Review
3.16: change glib <suggests> to <after> (1.30 KB, patch)
2015-01-11 02:51 UTC, Allison Karlitskaya (desrt)
none Details | Review
3.16: adwaita-icon-theme does not depend on gtk+ (894 bytes, patch)
2015-01-11 02:51 UTC, Allison Karlitskaya (desrt)
none Details | Review
core: rewrite the dependency solver, again (8.74 KB, patch)
2015-01-11 02:52 UTC, Allison Karlitskaya (desrt)
none Details | Review
core: stop ignoring 'after' modules (5.43 KB, patch)
2015-01-11 02:52 UTC, Allison Karlitskaya (desrt)
none Details | Review
docs: clarify 'suggests' and 'after' (3.10 KB, patch)
2015-01-11 02:52 UTC, Allison Karlitskaya (desrt)
none Details | Review
fixup! core: rewrite the dependency solver, again (1004 bytes, patch)
2015-01-19 03:34 UTC, Allison Karlitskaya (desrt)
none Details | Review

Description Allison Karlitskaya (desrt) 2013-02-07 01:20:06 UTC
We use <suggests> like so:

  <autotools id="glib">
...
    <suggests>
      <!-- these provide gnome implementations of glib
           extension points -->
      <dep package="gvfs"/>
      <dep package="glib-networking"/>
    </suggests>
  </autotools>


as if it somehow means "these things should be built after building glib".

It doesn't mean that at all, though.

'jhbuild build --build-optional-modules glib' just builds glib and its dependencies (and --build-optional-modules is the only argument listed in --help that says anything about suggests or 'soft depends').

Meanwhile, another module uses it in a way that seems to mean "this would be nice to have to enable optional features during my build":

 <autotools id="libchamplain">
...
   <suggests>
     <dep package="libsoup"/>
     <dep package="clutter-gtk"/>
   </suggests>
 </autotools>

When building that module, --build-optional-modules has no effect on the number of packages built (vs. giving no arguments), but --ignore-suggests results in the suggests packages being ignored.

I guess this probably means that glib is the example of invalid usage (and that I don't understand what --build-optional-modules is supposed to do, unless it overrides a config file saying the opposite).

Outside of glib, it appears that the only module using <suggests> in a way that introduces cyclic dependencies is gnome-js-common suggesting seed.
Comment 1 Allison Karlitskaya (desrt) 2013-02-07 01:29:01 UTC
*** Bug 693288 has been marked as a duplicate of this bug. ***
Comment 2 Allison Karlitskaya (desrt) 2013-02-07 01:29:11 UTC
*** Bug 693289 has been marked as a duplicate of this bug. ***
Comment 3 Colin Walters 2013-02-07 23:54:09 UTC
My take on suggests has been that it's often used where one would have runtime dependencies.  The glib one is pretty much like that - we can't make glib <depends> on gvfs since it'd create a cicular dep.

But the recommended glib configuration definitely includes gvfs.

Soo...dunno.  Personally I think the right think is to make the current use of suggests explicitly runtime dependencies.

The actual thing one might think <suggests> is for - optional dependencies, like Recommends: in Debian...well, it's just a huge new layer of complication.  Maybe it'd make sense to look at after jhbuild actually understands build vs runtime.
Comment 4 Allison Karlitskaya (desrt) 2013-02-08 05:10:29 UTC
Currently <suggests> is the same thing as <depends> with two differences:

 1) you can turn it off with --ignore-suggests

 2) if a module in suggests can't be built, it doesn't poison the other module
Comment 5 Allison Karlitskaya (desrt) 2014-12-31 03:17:39 UTC
After a bit more reading it seems that what we really want to be using here is <after>.  The code for dealing with these two things is slightly difficult to understand, however, and it produces strange results.  It seems not to be working as documented...

Assuming we can untangle it all, there is an open question here.  Do we really want to install dconf/gvfs/glib-networking every time I type 'jhbuild install glib'?

I'd probably prefer to have gvfs/dconf/glib-networking brought in as part of some gnome-desktop meta-module.  Consider on a case-by-case basis:

gvfs: totally not required for a reasonably-well-functioning GLib assuming people only want to use local files (which has more to do with the user's expectations than the program's).  In short: it is very unlikely that any particular program will "notice" that this is missing.

dconf: probably required for reasonably-well-functioning GLib if any program wants to actually save its settings, but not in all situations.  On Mac OS, for example, we don't want dconf.  Perhaps a good case for conditions.

glib-networking: we could probably could make the strongest case for always installing this one since it's required for working TLS.

Right now the dependency resolution algorithm seems to be bringing in gvfs/glib-networking/dconf in some combinations based on semi-random chance depending on how many passes of the dependency algorithm gets run, depending on the list of modules.  If we did make this work properly with 'after' and always installed them, I think that would be an improvement, but then we would definitely want a --no-after switch to disable that in case I really did only want glib.
Comment 6 Allison Karlitskaya (desrt) 2014-12-31 03:20:12 UTC
Created attachment 293505 [details] [review]
resolver: warn on circular dependencies

Enable the warning for circular dependencies in module sets.

This warning being disabled by default has almost certainly led to
incorrect use of <suggests> in our modulesets.
Comment 7 Allison Karlitskaya (desrt) 2014-12-31 03:20:58 UTC
With the above patch we can see some of the problems that <suggests> is causing:

W: Circular dependencies detected: gtk+ -> atk -> glib -> gvfs -> glib
W: Circular dependencies detected: gtk+ -> atk -> glib -> glib-networking -> glib
W: Circular dependencies detected: gtk+ -> atk -> glib -> dconf -> glib
W: Circular dependencies detected: gtk+ -> glib -> dconf -> gtk+
W: Circular dependencies detected: gtk+ -> adwaita-icon-theme -> gtk+
Comment 8 Allison Karlitskaya (desrt) 2015-01-06 20:06:08 UTC
Comment on attachment 293505 [details] [review]
resolver: warn on circular dependencies

Attachment 293505 [details] pushed as bfa36c2 - resolver: warn on circular dependencies
Comment 9 Allison Karlitskaya (desrt) 2015-01-11 02:51:53 UTC
Created attachment 294259 [details] [review]
3.16: change glib <suggests> to <after>

<suggests> is for packages that would ideally be available as a build
dependency for this package -- not for packages that should be installed
after in order to supplement functionality.  That's <after>.

That's the case for glib-networking, dconf and gvfs for GLib and
adwaita-icon-theme for Gtk+.
Comment 10 Allison Karlitskaya (desrt) 2015-01-11 02:51:57 UTC
Created attachment 294260 [details] [review]
3.16: adwaita-icon-theme does not depend on gtk+

Resolve a warning about a cyclic dependency (since gtk+ suggests the
icon theme).
Comment 11 Allison Karlitskaya (desrt) 2015-01-11 02:52:01 UTC
Created attachment 294261 [details] [review]
core: rewrite the dependency solver, again

Although this was already done a couple of years ago (bug 669554), there
is room for more simplicity in the algorithm, with only small and
desirable functionality changes.

The new algorithm offers much more consistent handling of 'after'
depends (if they are enabled): it simply installs them after the module
in question, as if the user had requested that.  It also removes
warnings about cyclic dependencies when 'A' depends on 'B' and 'B' is
after 'A'.  This is a perfectly reasonable situation.

The change in handling of 'after' depends will produce some surprising
results when we enable 'after' by default.  For example, 'dconf' is an
'after' of 'glib', but depends on 'gtk+' (for the editor) so building
'glib' will pull in 'gtk+'.  That's perfectly logical -- we'll just need
to figure out a way to sort it all out.

The new algorithm will also abort in case a dependency cycle is detected
while attempting to satisfy the hard depends of a module requested for
building which is the only reasonable thing to do, in my opinion.
Comment 12 Allison Karlitskaya (desrt) 2015-01-11 02:52:05 UTC
Created attachment 294262 [details] [review]
core: stop ignoring 'after' modules

The --build-optional-modules flag on the 'build' command was the only
way to get jhbuild to actually consider 'after' modules.  Get rid of it
and turn that functionality on by default.

Add a new config flag to turn it off.  That makes it the same as
'suggests' now (which has a similar config flag).
Comment 13 Allison Karlitskaya (desrt) 2015-01-11 02:52:09 UTC
Created attachment 294263 [details] [review]
docs: clarify 'suggests' and 'after'

Clarify the documentation for what <suggests/> and <after/> do, as well
as adding documentation for the new 'ignore_after' config option.
Comment 14 John Ralls 2015-01-11 03:39:04 UTC
(In reply to comment #12)
> Created an attachment (id=294262) [details] [review]
> core: stop ignoring 'after' modules
> 
> The --build-optional-modules flag on the 'build' command was the only
> way to get jhbuild to actually consider 'after' modules.  Get rid of it
> and turn that functionality on by default.

Not exactly. If an <after> dependency is being built for some other reason then jhbuild will use <after> dependencies for ordering the build. <suggests> dependencies works the same way except that they are added to the build unless --ignore-suggests is passed on the command line. IOW same behavior with opposite defaults.
Comment 15 Allison Karlitskaya (desrt) 2015-01-19 03:34:30 UTC
Created attachment 294839 [details] [review]
fixup! core: rewrite the dependency solver, again
Comment 16 Frederic Peters 2015-01-28 14:52:39 UTC
The dependency solver is one of the few jhbuild pieces with unit tests, this breaks them :)

There's an easy one:
  • File "../jhbuild/moduleset.py", line 182 in get_full_module_list
    raise DependencyCycleError(_("Could not resolve dependencies for module '%s'.") % module.name)
UnboundLocalError: local variable 'module' referenced before assignment

but there's three other ones where a more attentive look would be useful.
Comment 17 GNOME Infrastructure Team 2021-05-17 15:56:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/jhbuild/-/issues/163.