John Mandereau <john.mander...@gmail.com> writes: > On Mon, 2019-11-18 at 19:29 +0100, Jonas Hahnfeld wrote: >> Sure, but does it fix an issue that makes it "critical" enough to add >> the new relocation code fairly late in the process? > > For the discussion that motivated these changes, see > https://lists.gnu.org/archive/html/lilypond-devel/2019-02/msg00080.html > Although they fix a bug in a very special case, IMVHO they do not sound > really critical but fall more in the cleanup category. > > Note that if cherry-picking commits from issue 5481 is approved, then > the changes brought by these commits will need to be slightly reworked > or some or all commits for issue 5471 (at least 5471/1 for the > additional optional argument of sane_putenv and probably also 5471/2) > will have to be cherry-picked too. > > About the general cherry-picking process, I'm happy to provide > occasional GUB build test on it – I just launched it for > dev/hahnjo/stable-2.20.
This is a complete mess to cherry-pick. I've done all of 6fe27a71ba (HEAD -> stable) Issue 5481/3: flower/file-name.cc: Better handling of `.' and `..' 7b66fff27a Issue 5481/2: running.itely: Document relocation 468898c7f1 Issue 5481/1: main.cc, relocate.cc: Minor code clean-up b4d20ea792 Issue 5471/2: main.cc, relocate.cc: Improve relocation debug messages e1157a2632 Issue 5471/1: relocate.cc: Add `indent' parameter to `sane_putenv' 0aed46ada6 Issue 5453/2: Make unused command line option `--relocate' a no-op 43e672b04b Issue 5453/1: Remove unused configure option `--enable-relocation' including some minor conflict resolution and it still fails with the non-trivial diff --cc lily/relocate.cc index 5a85320dc1,8e97199a01..0000000000 --- a/lily/relocate.cc +++ b/lily/relocate.cc @@@ -110,57 -110,48 +110,91 @@@ prepend_env_path (char const *key, stri return -1; } ++<<<<<<< HEAD +static void +prefix_relocation (const string &prefix) +{ + string bindir = prefix + "/bin"; + string datadir = prefix + "/share"; + string localedir = datadir + "/locale"; + string package_datadir = datadir + "/lilypond/"; + string old_lilypond_datadir = lilypond_datadir; + + if (is_dir (package_datadir + "/" TOPLEVEL_VERSION)) + lilypond_datadir = package_datadir + "/" TOPLEVEL_VERSION; + else if (is_dir (package_datadir + "/current")) + lilypond_datadir = package_datadir + "/current"; + else + warning (_f ("Not relocating: no '%s/' or 'current/' found under '%s'", + TOPLEVEL_VERSION, package_datadir)); + +#if HAVE_GETTEXT + if (is_dir (localedir)) + bindtextdomain ("lilypond", localedir.c_str ()); +#endif + + prepend_env_path ("PATH", bindir); + + debug_output (_f (" Compiled-in datadir '%s'\n" + " New datadir '%s'\n", + old_lilypond_datadir, + lilypond_datadir)); +} + +/* + UGH : this is a complete mess. +*/ + +static void +framework_relocation (const string &prefix) ++======= + static string + set_up_directory (char const *env_name, + char const *id, + string compile_default, + string runtime_default, + string alt_runtime_default = "") ++>>>>>>> f0c3e7461e... Issue 5481/4: relocate.cc: Rewrite relocation algorithm { - debug_output (_f (" Framework prefix '%s'", prefix)); + string dir = ""; - sane_putenv ("INSTALLER_PREFIX", prefix, true, true); + // check environment variable + if (char const *env_value = getenv (env_name)) + { + dir = File_name (env_value).canonicalized ().to_string (); + debug_output (_f (" Found %s environment variable,\n" + " setting %s to '%s'\n", + env_name, id, dir)); + return dir; + } ++<<<<<<< HEAD + read_relocation_dir (prefix + "/etc/relocate/"); ++======= + // otherwise check run-time value(s) + if (is_dir (runtime_default)) + dir = runtime_default; + else if (is_dir (alt_runtime_default)) + dir = alt_runtime_default; ++>>>>>>> f0c3e7461e... Issue 5481/4: relocate.cc: Rewrite relocation algorithm + + if (!dir.empty ()) + { + dir = File_name (dir).canonicalized ().to_string (); + debug_output (_f (" Using run-time value for %s,\n" + " setting it to '%s'\n", + id, dir)); + return dir; + } - string bindir = prefix + "/bin"; - - prepend_env_path ("PATH", bindir); + // otherwise fall back to compile-time value + dir = File_name (compile_default).canonicalized ().to_string (); + debug_output (_f (" Using compile-time value for %s,\n" + " setting it to '%s'\n", + id, dir)); + return dir; } - /* - UGH : this is a complete mess. - */ void setup_paths (char const *argv0_ptr) { This is so much of a mess that I'd need a very good reason (namely: won't work otherwise) for trying to fold this in. -- David Kastrup