# get repo settings form build section
repo_urls = []
- repo_auths = []
+ repo_auths = set()
for repo in repos:
repo_auth = ''
# get repo url
if not valid:
continue
repo_auth = repo_auth[:-1]
- repo_auths.append(repo_auth)
+ repo_auths.add(repo_auth)
- return repo_urls, ''.join(repo_auths)
+ return repo_urls, ' '.join(repo_auths)
def do(opts, args):
cmd += ['--rsync-src=%s' % os.path.abspath(workdir)]
cmd += ['--rsync-dest=/home/abuild/rpmbuild/BUILD/%s-%s' % (name, version)]
- sucmd = configmgr.get('su_wrapper', 'build').split()
- if sucmd[0] == 'su':
- if sucmd[-1] == '-c':
- sucmd.pop()
- cmd = sucmd + ['-s', cmd[0], 'root', '--' ] + cmd[1:]
+ # if current user is root, don't run with sucmd
+ if os.getuid == 0:
+ os.environ['GBS_BUILD_REPOAUTH'] = repo_auth_conf
else:
- cmd = sucmd + ['GBS_BUILD_REPOAUTH=%s' % repo_auth_conf ] + cmd
-
+ sucmd = configmgr.get('su_wrapper', 'build').split()
+ if sucmd[0] == 'su':
+ if sucmd[-1] == '-c':
+ sucmd.pop()
+ cmd = sucmd + ['-s', cmd[0], 'root', '--' ] + cmd[1:]
+ else:
+ cmd = sucmd + ['GBS_BUILD_REPOAUTH=%s' % repo_auth_conf ] + cmd
# runner.show() can't support interactive mode, so use subprocess insterad.
try:
rc = subprocess.call(cmd)