aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/layman.cfg10
-rw-r--r--layman/config.py2
-rw-r--r--layman/overlays/git.py28
3 files changed, 34 insertions, 6 deletions
diff --git a/etc/layman.cfg b/etc/layman.cfg
index 7f7baab..a99ab9d 100644
--- a/etc/layman.cfg
+++ b/etc/layman.cfg
@@ -188,3 +188,13 @@ news_reporter: portage
#tar_postsync :
#g-common_postsync :
+
+#-----------------------------------------------------------
+# Layman user info
+#
+# The user name and email to use when adding new repos
+#
+#git_user : layman
+#git_email : layman@localhost
+
+
diff --git a/layman/config.py b/layman/config.py
index 8430221..8ac3ebf 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -134,6 +134,8 @@ class BareConfig(object):
'svn_postsync' : '',
'tar_postsync' : '',
'g-common_postsync' : '',
+ 'git_user': 'layman',
+ 'git_email': 'layman@localhost',
}
self._options = {
'config': config if config else self._defaults['config'],
diff --git a/layman/overlays/git.py b/layman/overlays/git.py
index 308c81f..e15f26d 100644
--- a/layman/overlays/git.py
+++ b/layman/overlays/git.py
@@ -67,12 +67,28 @@ class GitOverlay(OverlaySource):
args.append(cfg_opts)
args.append(fix_git_source(self.src))
args.append(target)
- return self.postsync(
- # adding cwd=base due to a new git bug in selinux due to
- # not having user_home_dir_t and portage_fetch_t permissions
- # but changing dir works around it.
- self.run_command(self.command(), args, cmd=self.type, cwd=base),
- cwd=target)
+ success = False
+ # adding cwd=base due to a new git bug in selinux due to
+ # not having user_home_dir_t and portage_fetch_t permissions
+ # but changing dir works around it.
+ success = self.run_command(self.command(), args, cmd=self.type, cwd=base)
+ self.output.debug("cloned git repo...success=%s" % str(success), 8)
+ success = self.set_user(target)
+ return self.postsync(success, cwd=target)
+
+ def set_user(self, target):
+ '''Set dummy user.name and user.email to prevent possible errors'''
+ user = '"%s"' % self.config['git_user']
+ email = '"%s"' % self.config['git_email']
+ args = ['config', 'user.name', user]
+ self.output.debug("set git user info...args=%s" % ' '.join(args), 8)
+ failure = self.run_command(self.command(), args, cmd=self.type, cwd=target)
+ if failure:
+ self.output.debug("set git user info...failure setting name")
+ return failure
+ args = ['config', 'user.email', email]
+ self.output.debug("set git user info...args=%s" % ' '.join(args), 8)
+ return self.run_command(self.command(), args, cmd=self.type, cwd=target)
def sync(self, base):
'''Sync overlay.'''