On Python 3, we can only decode byte sequences.
subprocess.Popen(universal_newlines=True) always returns unicode stdout/sderr.
Fixes https://pagure.io/fedora-infrastructure/issue/9366
Signed-off-by: Miro Hrončok <miro@hroncok.cz>
The issue was triggered when multiple commits were pushed at once at
which point the list of revisions contained a list of OID objects
that are not JSON serializable but can be converted to text via
str() or by accessing their .hex attribute.
However, when a single commit is pushed, the list of revisions
contains just the hash of the commit pushed and thus is already
a string. So relying on .hex will not work then.
Using str() becomes the solution that works for both scenarios.
Fixes https://pagure.io/fedora-infrastructure/issue/9247
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
The exists() method uses os.stat() instead of os.lstat() and so doesn't
work for symlinks pointing to a non-existent path. A corresponding
lexists() method doesn't exist yet.
Signed-off-by: Nils Philippsen <nils@redhat.com>
This doesn't attempt to prefix the base directory if a supplied `target`
is an absolute path (for debugging).
Fixes: fedora-infrastructure#9000
Signed-off-by: Nils Philippsen <nils@redhat.com>
This solves the permission denied error packager would see otherwise
when pushing to dist-git as the hooks would fail to send notifications
on the fedora-messaging bus.
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
The fedmsg_hook no longer exists. It was removed from the non-fork
post-receive-chained hook in 9875b043d ("Drop the fedmsg_hook since it
no longer exists", 2018-05-03).
Fixes the following warning when pushing to a fork:
remote: sh: /usr/lib/python2.7/site-packages/pagure/hooks/files/fedmsg_hook.py: No such file or directory
Signed-off-by: Todd Zullinger <tmz@pobox.com>
This hook doesn't send fedmsg messages on the git.receive topic
and does not notify the alternative arch folks about changes
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
Hi all,
This is something I've seen for ages and thought should be fixed (either by
this patch and/or another which supports multi-line description files
properly).
I have an alternate version of this patch which side-steps the issue by adding
the X-Project header last, so if it's multiple lines it won't screw up other
headers. I think this is the proper fix though.
If multi-line description files are really something which are desired, then a
commit on top of this change could add support for reading the remaining lines
from the description file and add them to the message body.
roles/git/hooks/files/git.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
The commit message and diff is stored in `full_change` as a string, via
`read_output()`. This is passed to `TEXT` which is a unicode string.
When a commit message or diff contains non-ascii characters we get:
UnicodeDecodeError: 'ascii' codec can't decode byte ...
Encode git output returned from `read_output()` as a unicode string and
define `full_change` as unicode for completeness.
Fixes#6040.