PREFIX = 'x-git-tracker-'
FAIL = 'failed'
+SCRIPT_GIT_NAME = 'backports git tracker'
+SCRIPT_GIT_EMAIL = ''
def update_cache_objects(gittree, objdir):
git.remote_update(objdir)
def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, backport_rev, kernel_rev,
- prev_kernel_rev=None, defconfig=None):
+ prev_kernel_rev=None, defconfig=None, env={}):
log = []
def logwrite(l):
log.append(l)
wdir = os.path.join(tmpdir, kernel_rev)
os.makedirs(wdir)
+ env = env.copy()
+ env.update({
+ 'GIT_COMMITTER_NAME': SCRIPT_GIT_NAME,
+ 'GIT_COMMITTER_EMAIL': SCRIPT_GIT_EMAIL,
+ })
try:
failure = gentree.process(kernelobjdir, wdir, open(args.copy_list, 'r'),
git_revision=kernel_rev,
newline = '\n'
if failure:
+ env.update({
+ 'GIT_AUTHOR_NAME': SCRIPT_GIT_NAME,
+ 'GIT_AUTHOR_EMAIL': SCRIPT_GIT_EMAIL,
+ })
msg = 'Failed to create backport\n\n%s%s: %s' % (PREFIX, FAIL, failure)
for l in log:
print l
'krev': kernel_rev,
}
- env = git.commit_env_vars(kernel_rev, tree=kernelobjdir)
git.commit(msg, tree=wdir, env=env, opts=['-q', '--allow-empty'])
git.push(opts=['-f', '-q', 'origin', branch], tree=wdir)
os.rename(os.path.join(wdir, '.git'), wgitdir)
kernel_head = git.ls_remote(branch, tree=kernelobjdir)
+ backport_author_env = {
+ 'GIT_AUTHOR_NAME': SCRIPT_GIT_NAME,
+ 'GIT_AUTHOR_EMAIL': SCRIPT_GIT_EMAIL,
+ }
+
old_data = {}
try:
msg = git.commit_message('HEAD', wgitdir)
handle_commit(args, "Initialize backport branch\n\nCreate the new git tracker backport branch.",
branch, tree, kernelobjdir,
branch_tmpdir, wgitdir, backport_rev,
- kernel_head, defconfig=defconfig)
+ kernel_head, defconfig=defconfig,
+ env=backport_author_env)
continue
if old_data['backport'] == backport_rev and old_data[tree] == kernel_head:
continue
handle_commit(args, "Update backport tree\n\n",
branch, tree, kernelobjdir,
branch_tmpdir, wgitdir, backport_rev,
- kernel_head, defconfig=defconfig)
+ kernel_head, defconfig=defconfig,
+ env=backport_author_env)
continue
# update from old to new
if prefail in old_data:
sys.exit(10)
for commit in commits:
print 'updating to commit', commit
+ env = git.commit_env_vars(commit, tree=kernelobjdir)
msg = git.commit_message(commit, kernelobjdir)
try:
# add information about commits that went into this
# will fail if it wasn't a merge commit
pass
failure = handle_commit(args, msg, branch, tree, kernelobjdir, branch_tmpdir,
- wgitdir, backport_rev, commit,
+ wgitdir, backport_rev, commit, env=env,
prev_kernel_rev=prev, defconfig=defconfig)
if not failure:
prev = commit