GNOME Bugzilla – Bug 781938
meson should automatically delete build dir
Last modified: 2021-05-17 16:06:11 UTC
*** Building nautilus *** [124/208] ninja [0/1] Regenerating build files Meson encountered an error: Build directory has been generated with Meson version 0.40.0, which is incompatible with current version 0.40.1. Please delete this build directory AND create a new one. FAILED: build.ninja '/usr/bin/python3' '/mnt/wd20ezrx-00dc0b0/JHBuild/3.26/install/bin/meson' --internal regenerate '/mnt/wd20ezrx-00dc0b0/JHBuild/3.26/checkout/nautilus' '/mnt/wd20ezrx-00dc0b0/JHBuild/3.26/checkout/nautilus/build' --backend ninja ninja: error: rebuilding 'build.ninja': subcommand failed Manual action seems unacceptable... :( Is there automatic way to delete build dir when meson version has changed?
I can't think of any way to handle this, but that doesn't mean it's impossible... perhaps it's just a failure of imagination. Note: pretty much the same situation occurs with Autotools, but you don't notice because they almost never get new releases anymore.
How does meson knows that directory was generated with older version? Maybe jhbuild could do same thing to get that version and compare it with `meson --version`?
Created attachment 353755 [details] [review] meson: remove builddir when meson version has changed Here is idea how to fix this, seems to work... Most likely someone with better python knowledge could come up with better patch.
Review of attachment 353755 [details] [review]: Um.... Why do you need to generate a new Python script at runtime? There's got to be a better way.
I would normally approve a hacky patch too, if it works, but this is a bit too much IMO.
That patch was meant as an idea... I don't know python and I have no time to learn it. :( Feel free to update patch to put generated file in ~/.cache or whatever feels better. The idea is to get version from coredata and compare it with current meson version. If versions does not match then it will fail: https://github.com/mesonbuild/meson/blob/master/mesonbuild/coredata.py#L252 Extra script is needed, generated or installed, because meson is python3, but jhbuild is still python2 which does not know how to load that file. Even better idea could be to open bug / feature request for meson. Meson could have extra command line option that could check if existing buildir is compatible with current version (generated with same version)... Then jhbuild could parse this output and decide it buildir should be deleted or not.
Created attachment 354090 [details] [review] meson: remove builddir when meson version has changed
Probably time to investigate porting JHBuild to Python 3....
(In reply to Michael Catanzaro from comment #8) > Probably time to investigate porting JHBuild to Python 3.... If you do that please keep it working with Py2 as well. After a brief flirtation with Py3 in 10.6 Apple has shipped only Py2.
I'm surprised macOS users are using JHBuild! I think that's fine, so long as it's not holding back the core codebase. Maintaining support for Python 2 would be too much IMO. We've already ported most of the rest of GNOME to Python 3 without maintaining Python 2 compatibility. Anyway, let's move further discussion on this to bug #688070, and focus here on meson builddir deletion.
-- 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/262.