diff --git a/roles/git/hooks/files/post-receive-alternativearch b/roles/git/hooks/files/post-receive-alternativearch index 8697ddb3af..a391b41f1b 100755 --- a/roles/git/hooks/files/post-receive-alternativearch +++ b/roles/git/hooks/files/post-receive-alternativearch @@ -57,6 +57,7 @@ def read_output(cmd, abspath, input=None, keepends=False, **kw): stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=abspath, + universal_newlines=True, **kw) (out, err) = procs.communicate(input) retcode = procs.wait() @@ -66,7 +67,7 @@ def read_output(cmd, abspath, input=None, keepends=False, **kw): print(err) if not keepends: out = out.rstrip('\n\r') - return unicode(out, errors='ignore') + return out def read_git_output(args, abspath, input=None, keepends=False, **kw): diff --git a/roles/git/hooks/files/post-receive-chained b/roles/git/hooks/files/post-receive-chained index c1e973dea8..0120019cff 100755 --- a/roles/git/hooks/files/post-receive-chained +++ b/roles/git/hooks/files/post-receive-chained @@ -6,7 +6,7 @@ pee \ /usr/share/git-core/post-receive-fedora-messaging \ /usr/share/git-core/post-receive-alternativearch \ - /usr/lib/python2.7/site-packages/pagure/hooks/files/post-receive \ + /usr/lib/python3.6/site-packages/pagure/hooks/files/post-receive \ "/usr/bin/grok-manifest -m /srv/git/grokmirror/manifest.js.gz -t /srv/git/repositories/ -n `pwd`" # We used to send emails directly from the git hook here, but now we send to diff --git a/roles/git/hooks/files/post-receive-fedora-messaging b/roles/git/hooks/files/post-receive-fedora-messaging index a2dad7cf33..da91ab8a24 100644 --- a/roles/git/hooks/files/post-receive-fedora-messaging +++ b/roles/git/hooks/files/post-receive-fedora-messaging @@ -40,7 +40,13 @@ def revs_between(head, base): # pygit2 can't do a rev-list yet, so we have to shell out.. silly. cmd = '/usr/bin/git rev-list %s...%s' % (head.id, base.id) - proc = sp.Popen(cmd.split(), stdout=sp.PIPE, stderr=sp.PIPE, cwd=abspath) + proc = sp.Popen( + cmd.split(), + stdout=sp.PIPE, + stderr=sp.PIPE, + cwd=abspath, + universal_newlines=True, + ) stdout, stderr = proc.communicate() if proc.returncode != 0: raise IOError('git rev-list failed: %r, err: %r' % (stdout, stderr)) @@ -114,7 +120,7 @@ for line in lines: revs = [head.id] def _build_commit(rev): - commit = repo.revparse_single(unicode(rev)) + commit = repo.revparse_single(rev) # Tags are a little funny, and vary between versions of pygit2, so we'll # just ignore them as far as fedmsg is concerned. @@ -133,7 +139,7 @@ for line in lines: files=files, total=total, ), - rev=unicode(rev), + rev=rev, path=abspath, repo=repo_name, namespace=namespace, @@ -141,7 +147,7 @@ for line in lines: agent=getlogin(), ) - commits = map(_build_commit, revs) + commits = [_build_commit(rev) for rev in revs] print("* Publishing information for %i commits" % len(commits)) for commit in reversed(commits):