GNOME Bugzilla – Bug 646510
jhbuild should use g_get_user_config_dir()
Last modified: 2021-05-17 15:51:24 UTC
Would be nice to use g_get_user_config_dir() instead of home for .jhbuildrc.
Obviously we do not want a glib dependency in jhbuild, I assume you meant XDG_CONFIG_HOME?
Created attachment 184948 [details] [review] Use XDG_CONFIG_DIR
Comment on attachment 184948 [details] [review] Use XDG_CONFIG_DIR Fixing this bug will require an update to the JHBuild manual.
Review of attachment 184948 [details] [review]: If I do: 'jhbuild -f no-such-file list', the following should not be displayed: W: You may wish to move /home/Oxyde/.jhbuildrc to no-such-file Only this should be displayed: jhbuild: could not load config file, no-such-file is missing I think the message could be improved. How about? 'The default location of the configuration file has changed. Please move %s to %s.' I think this is a good opportunity to change the name of the file from jhbuildrc. I think the filename should end in '.py' so users get syntax highlighting for free in their editor. I would prefer 'conf' rather than 'rc', but I'm not too fussed. When JHBuild changes XDG_CONFIG_HOME I want a JHBuild release to occur within two days of the git push. That is so the online JHBuild manual [1] is accurate for first time users. The wiki [2] needs updating too, but that's easy. [1] http://developer.gnome.org/jhbuild/stable/ [2] http://live.gnome.org/Jhbuild
The improved message suggestion needs to use the %(varname)s syntax as the replaced parts may appear in a different order in different languages. Don't hesitate to push me for a tarball release, whenever you feel the online manual needs to be updated.
The following files also need to be updated: buildbot/README doc/C/jhbuild.xml examples/sample.jhbuildrc jhbuild/defaults.jhbuildrc jhbuild/moduleset.py jhbuild/versioncontrol/tarball.py jhbuild/versioncontrol/hg.py jhbuild/versioncontrol/fossil.py jhbuild/versioncontrol/mtn.py jhbuild/versioncontrol/bzr.py jhbuild/versioncontrol/arch.py jhbuild/versioncontrol/darcs.py Makefile.plain README
Created attachment 191614 [details] [review] Update location to ~/.config/jhbuildrc Just a trivial patch that updates the files listed comment #6. The file is still called jhbuildrc though
Created attachment 191733 [details] [review] Use XDG_CONFIG_DIR Patch updated for comments. The file is still called jhbuildrc. I think a rename should be a separate commit.
Frédéric, What is your preference? ~/.config/jhbuildconf.py ~/.config/jhbuildrc.py ~/.config/jhbuildrc or other?
I'd be for keeping jhbuildrc, I don't want to advertise too much that it's in fact a Python file. Also we should now consider the bug report asking for jhbuild to work without a jhbuildrc, in that situation we shouldn't display "you should move your configuration file" and then continue with default values, if ~/.jhbuildrc is found, I suggest to load it, not to abort.
Created attachment 195379 [details] [review] Use XDG_CONFIG_HOME & no config file This patch solves this bug 646510 and bug 655763 (JHBuild should work without a config file ~/.jhbuildrc, use defaults). The two are closely related. JHBuild will use ~/.config/jhbuildrc (the default) or ~/.jhbuildrc. No warning or error will be displayed if using the old location - there is no reason to. But JHBuild will display an error is both ~/.config/jhbuildrc and ~/.jhbuildrc are present - to prevent the user editing ~/.jhbuildrc and wondering why the changes are being used. The patch improves some error messages. Before: 'perhaps you need to add use_local_modulesets = True to your .jhbuildrc.' Now it correct config file is displayed respecting '-f' and JHBUILDRC environment variable. This bug, bug 655763, bug 656611, bug 655714 should all be fixed together. In the one push. A JHBuild tarball should be rolled (to update the manual on the GNOME website) soon after and the wiki updated. Based on patch by Thomas Hindoe Paaboel Andersen Based on patch by William Jon McCann
Created attachment 195380 [details] [review] [doc] Add XDG_CONFIG_HOME & no config Update manual, default config location is now ~/.config/jhbuildrc and config file now not required.
Created attachment 195381 [details] [review] Remove 'create a ~/.jhbuildrc' from Makefile
Review of attachment 195379 [details] [review]: Doesn't work with no config file. Breaks tests/tests.py. Needs update to remove arch.py
So what exactly is needed to resolve this?
(In reply to comment #15) > So what exactly is needed to resolve this? Fix up the remaining issues with attachment 195379 [details] [review] as per my comment 14.
Created attachment 214490 [details] [review] Use XDG_CONFIG_HOME & no config file Addresses problems from comment 14.
Created attachment 214491 [details] [review] doc: Add XDG_CONFIG_HOME & no config
Created attachment 214492 [details] [review] Update tests to match Config's updated constructor
I'll commit these patches in a few weeks, if no objection. I have tested the patches. After commit, I'll ask Frédéric to roll a new JHBuild tarball so the on-line docs update.
Comment on attachment 214490 [details] [review] Use XDG_CONFIG_HOME & no config file Committed. http://git.gnome.org/browse/jhbuild/commit/?id=1f5848b16522de6a29e5119eacca86a4fd266935
Comment on attachment 214491 [details] [review] doc: Add XDG_CONFIG_HOME & no config Committed. http://git.gnome.org/browse/jhbuild/commit/?id=c38c95b6765000407a5f79665d6fd0fd6fbc3aa0
Comment on attachment 195381 [details] [review] Remove 'create a ~/.jhbuildrc' from Makefile Committed. http://git.gnome.org/browse/jhbuild/commit/?id=a7dbee1b9cb91f79c0ad39cacfa4e4788dc5ff54
Comment on attachment 214492 [details] [review] Update tests to match Config's updated constructor Committed. http://git.gnome.org/browse/jhbuild/commit/?id=c8dc4a9421f63c277ba1960144b30677e7cf977d
The committed patch uses either .jhbuildrc or ~/.config/jhbuildrc and if both exists, shows: The default location of the configuration file has changed. Please move %(old_path)s to %(new_path)s. If you are going to treat this as an error, the error message should be clear what the error is, and not recommending moving a file to a place where there is already a file. (If the user is using mv blindly, they'll overwrite, otherwise just not know what to do.) Both ~/.jhbuildrc and ~/.config/jhbuildrc exist, it is unclear what configuration you want to use. ~/.config/jhbuildrc is now the recommended location for this configuration file. If it has the correct contents, please remove ~/.jhbuildrc. Or something like that.
-- 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/112.