[jhbuild] Create a symlink to the srcdir from the builddir



commit 3f5e90d152ab39627503dfcf91169fd5b81bd76e
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 5 14:03:22 2018 +0100

    Create a symlink to the srcdir from the builddir
    
    When doing non-srcdir builds, the number one complaint is that it's hard
    to go back to the source directory when inside a shell opened by jhbuild
    on failure.
    
    For this reason, if the build and source directories do not match,
    jhbuild should create a symbolic link to the source directory inside the
    build directory. This link exists while the user shell is active, and is
    removed once the user exits; to avoid naming collisions, the symbolic
    link is called `.jhbuild-srcdir`.

 jhbuild/frontends/terminal.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/frontends/terminal.py b/jhbuild/frontends/terminal.py
index 64b1143..37e498d 100644
--- a/jhbuild/frontends/terminal.py
+++ b/jhbuild/frontends/terminal.py
@@ -355,12 +355,23 @@ class TerminalBuildScript(buildscript.BuildScript):
                 return 'fail'
             elif val == '4':
                 cwd = os.getcwd()
+                builddir = module.get_builddir(self)
+                srcdir = module.get_srcdir(self)
                 try:
-                    os.chdir(module.get_builddir(self))
+                    os.chdir(builddir)
                 except OSError:
                     os.chdir(self.config.checkoutroot)
+                unlink_srcdir = False
+                try:
+                    if builddir != srcdir:
+                        os.symlink(srcdir, '.jhbuild-srcdir')
+                        unlink_srcdir = True
+                except OSError:
+                    pass
                 uprint(_('exit shell to continue with build'))
                 os.system(user_shell)
+                if unlink_srcdir:
+                    os.unlink('.jhbuild-srcdir')
                 os.chdir(cwd) # restor working directory
             elif val == '5':
                 self.config.reload()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]