public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/setupscript/
Date: Fri, 13 Sep 2013 15:20:45 +0000 (UTC)	[thread overview]
Message-ID: <1379085569.60a9c209e4c43ec6de3437c3c26ed036b7976f56.dywi@gentoo> (raw)

commit:     60a9c209e4c43ec6de3437c3c26ed036b7976f56
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Sep 13 15:19:29 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Sep 13 15:19:29 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=60a9c209

setupscript: --[no-]relpath-hooks

Controls whether links with absolute/relative paths are created.
Defaults to absolute if installed and relative if not.

---
 roverlay/setupscript/hookenv.py | 15 +++++++++++----
 roverlay/setupscript/runtime.py | 13 +++++++++++++
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/roverlay/setupscript/hookenv.py b/roverlay/setupscript/hookenv.py
index 5ffcbdd..001e9cd 100644
--- a/roverlay/setupscript/hookenv.py
+++ b/roverlay/setupscript/hookenv.py
@@ -674,12 +674,19 @@ class SetupHookEnvironment (
                to_link.append ( ( script, dest_name, link ) )
          # -- end for
 
-         register_link = self.user_hooks.register_hook_link_unsafe
-         symlink       = self.setup_env.private_file.symlink
-         success       = True
+         register_link  = self.user_hooks.register_hook_link_unsafe
+         symlink        = self.setup_env.private_file.symlink
+         relative_links = self.setup_env.options ['hook_relpath']
+         success        = True
 
          for script, dest_name, link in to_link:
-            have_link = symlink ( script.fspath, link )
+            if relative_links:
+               have_link = symlink (
+                  os.path.relpath ( script.fspath, destdir ), link
+               )
+            else:
+               have_link = symlink ( script.fspath, link )
+
             if have_link:
                register_link ( event_name, script, link, dest_name )
             elif have_link is not None:

diff --git a/roverlay/setupscript/runtime.py b/roverlay/setupscript/runtime.py
index 43733a3..6ce804b 100644
--- a/roverlay/setupscript/runtime.py
+++ b/roverlay/setupscript/runtime.py
@@ -243,6 +243,17 @@ class SetupArgParser ( roverlay.argparser.RoverlayArgumentParser ):
          ),
       )
 
+      arg (
+         '--relpath-hooks', dest='hook_relpath',
+         flags=self.ARG_WITH_DEFAULT|self.ARG_OPT_IN,
+         help='create hook links with relative paths',
+      )
+      arg (
+         '--no-relpath-hooks', dest='hook_relpath',
+         flags=self.ARG_SHARED_INVERSE|self.ARG_OPT_OUT,
+         help='create hook links with absolute paths',
+      )
+
       return arg
    # --- end of setup_hooks (...) ---
 
@@ -293,6 +304,7 @@ class SetupEnvironment ( roverlay.runtime.IndependentRuntimeEnvironment ):
             'private_conf_root' : instinfo ['workroot'] + os.sep + 'config',
             'import_config'     : 'symlink=root',
             'additions_dir'     : instinfo ['workroot'] + os.sep + 'files',
+            'hook_relpath'      : False,
          }
       else:
          assert self.prjroot
@@ -304,6 +316,7 @@ class SetupEnvironment ( roverlay.runtime.IndependentRuntimeEnvironment ):
             'private_conf_root' : prjroot + 'config',
             'import_config'     : 'disable',
             'additions_dir'     : prjroot + 'files',
+            'hook_relpath'      : True,
          }
    # --- end of get_parser_defaults (...) ---
 


             reply	other threads:[~2013-09-13 15:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 15:20 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-01 16:38 [gentoo-commits] proj/R_overlay:master commit in: roverlay/setupscript/ André Erdmann
2014-02-22 14:56 André Erdmann
2014-02-21 17:36 André Erdmann
2014-02-17 17:22 André Erdmann
2014-02-17 17:10 André Erdmann
2013-09-19 15:00 André Erdmann
2013-09-18 15:24 André Erdmann
2013-09-13 15:10 André Erdmann
2013-09-13 15:10 André Erdmann
2013-09-12 16:36 André Erdmann
2013-09-11 14:50 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1379085569.60a9c209e4c43ec6de3437c3c26ed036b7976f56.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox