From 9b45ca12a937653c63b0b7754836d5c86eaf1f23 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Jan 09 2019 20:08:30 +0000 Subject: [PATCH 1/3] Switch to Python 3 https://bugzilla.redhat.com/show_bug.cgi?id=1650648 --- diff --git a/.gitignore b/.gitignore index c3b6896..61db58c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /fedora-easy-karma-0https0c81432c.tar.bz2 /fedora-easy-karma-0httpsbc16e916.tar.bz2 /fedora-easy-karma-0httpsa8fe9cbc.tar.bz2 +/fedora-easy-karma-b6d97e0.tar.gz diff --git a/fedora-easy-karma.spec b/fedora-easy-karma.spec index af0c376..fd547cb 100644 --- a/fedora-easy-karma.spec +++ b/fedora-easy-karma.spec @@ -1,43 +1,22 @@ Name: fedora-easy-karma Version: 0 -Release: 0.38.20171129gita8fe9cbc%{?dist} +Release: 0.39.20181206gitb6d97e0%{?dist} Summary: Fedora update feedback made easy - -Group: Development/Tools License: GPLv2+ URL: https://fedoraproject.org/wiki/Fedora_Easy_Karma -#VCS: git:https://pagure.io/fedora-easy-karma.git -## current tarball -# Updated using: -# https://fedorapeople.org/cgit/walters/public_git/fedpkg-make-pull.git/ -# Commandline: fedpkg-vcs -f pull-retarget -Source0: fedora-easy-karma-0httpsa8fe9cbc.tar.bz2 +# git clone https://pagure.io/fedora-easy-karma.git +# cd fedora-easy-karma +# git checkout b6d97e0 +# git archive --format=tar.gz --prefix=fedora-easy-karma-b6d97e0/ HEAD > \ +# ../fedora-easy-karma-b6d97e0.tar.gz +Source0: fedora-easy-karma-b6d97e0.tar.gz BuildArch: noarch +BuildRequires: python3-devel -Requires: python2-fedora -# contains fedora_cert python module -Requires: fedora-cert - -# Use new bodhi client bindings if available -%if 0%{?fedora} || 0%{?rhel} -%if 0%{?fedora} < 29 || 0%{?rhel} >= 7 -Requires: bodhi-client -%endif -%endif - -# With Fedora 29, the bodhi-client refers to the python3 client, therefore -# require the python2 client explicitly -%if 0%{?fedora} >= 29 -Requires: python2-bodhi-client -%endif - -%if 0%{?fedora} >= 25 -# For Fedora 23 and newer, dnf is python3, then python2-dnf needs to required -Requires: python2-dnf -%else -Requires: yum -%endif +Requires: python3-bodhi-client +Requires: python3-dnf +Requires: python3-fedora %description @@ -46,11 +25,8 @@ updates that you have currently installed. %prep -%setup -q -n fedora-easy-karma-0httpsa8fe9cbc - - -%build -# Set useragent +%setup -q -n fedora-easy-karma-b6d97e0 +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" fedora-easy-karma.py sed -i 's,useragent="Fedora Easy Karma/GIT",useragent="Fedora Easy Karma/%{version}-%{release}",' fedora-easy-karma.py @@ -60,10 +36,14 @@ sed -i 's,useragent="Fedora Easy Karma/GIT",useragent="Fedora Easy Karma/%{versi %files %license gpl-2.0.txt gpl-3.0.txt +%doc README %{_bindir}/fedora-easy-karma %changelog +* Wed Jan 09 2019 Miro Hrončok - 0-0.39.20181206gitb6d97e0 +- Switch to Python 3 (#1650648) + * Thu Aug 09 2018 Till Maas - 0-0.38.20171129gita8fe9cbc - Update Bodhi dependency for Fedora 29 and newer diff --git a/sources b/sources index 32d7da6..91b1274 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (fedora-easy-karma-0httpsa8fe9cbc.tar.bz2) = 272e57eee5e1af5102edfd03786eb09e905f41863e50dc32f0a1d8095aa3dec69c25f4514d45129cecb7a5c5012dfae8284a4cf173361ea020ce8f768c8fb350 +SHA512 (fedora-easy-karma-b6d97e0.tar.gz) = 6b9ed2e935fd4063155f7e750b6a3ac188fc82980a6c6a355789a17469dd31e7e657c61fc8b4662c170c991950d19257be96ca881506350902004fa9bbb10bdd From 11f25016ec1b08c790a949fb5d4d35cb816b4a2a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Jan 31 2019 19:28:51 +0000 Subject: [PATCH 2/3] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- diff --git a/fedora-easy-karma.spec b/fedora-easy-karma.spec index fd547cb..301b1cb 100644 --- a/fedora-easy-karma.spec +++ b/fedora-easy-karma.spec @@ -1,6 +1,6 @@ Name: fedora-easy-karma Version: 0 -Release: 0.39.20181206gitb6d97e0%{?dist} +Release: 0.40.20181206gitb6d97e0%{?dist} Summary: Fedora update feedback made easy License: GPLv2+ URL: https://fedoraproject.org/wiki/Fedora_Easy_Karma @@ -41,6 +41,9 @@ sed -i 's,useragent="Fedora Easy Karma/GIT",useragent="Fedora Easy Karma/%{versi %changelog +* Thu Jan 31 2019 Fedora Release Engineering - 0-0.40.20181206gitb6d97e0 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Wed Jan 09 2019 Miro Hrončok - 0-0.39.20181206gitb6d97e0 - Switch to Python 3 (#1650648) From 7406ac5602640ee300090330804d9f1e9743234c Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Jul 03 2019 08:49:36 +0000 Subject: [PATCH 3/3] Apply workarounds from pull requests --- diff --git a/7.patch b/7.patch new file mode 100644 index 0000000..f40a089 --- /dev/null +++ b/7.patch @@ -0,0 +1,74 @@ +From 984a7f68c9172f3429f80cb057fa4a602efd09a5 Mon Sep 17 00:00:00 2001 +From: Kamil Páral +Date: Jul 01 2019 14:31:18 +0000 +Subject: ask user to open URL manually because of Bodhi bug + + +Because of [1] we can't add a comment from f-e-k. Until it is resolved, +ask the user to open the URL manually. This is very suboptimal, but it's +still better than be completely broken - at least the user is able to +figure out *which* updates he/she can comment on. + +[1] https://github.com/fedora-infra/bodhi/issues/3298 + +--- + +diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py +index 2dd7739..ae0e649 100755 +--- a/fedora-easy-karma.py ++++ b/fedora-easy-karma.py +@@ -698,24 +698,35 @@ class FedoraEasyKarma(object): + self.options.fas_username): + print("!!! already commented by you !!!") + try: +- karma = self.raw_input( +- PROMPT, default=self.options.default_karma, +- add_to_history=False) +- if karma in ["-1", "0", "1"]: +- comment = self.raw_input( +- "Comment> ", +- default=self.options.default_comment) +- if comment or not self.options.skip_empty_comment: +- result = self.send_comment(bc, update, comment, +- karma) +- if not result[0]: +- self.warning("Comment not submitted: %s" % +- result[1]) +- else: +- print("skipped because of empty comment") +- elif karma == "i": +- ignored_updates.append(update.title) +- print("ignored as requested") ++ while True: ++ karma = self.raw_input( ++ PROMPT, default=self.options.default_karma, ++ add_to_history=False) ++ if karma in ["-1", "0", "1"]: ++ # Disable this temporarily ++ # See: https://pagure.io/fedora-easy-karma/issue/6 ++ # See: https://github.com/fedora-infra/bodhi/issues/3298 ++ print("Posting karma to Bodhi unfortunatelly doesn't " ++ "work at the moment due to a Bodhi bug. Until it " ++ "is resolved, please open the URL shown above " ++ "manually and add a comment through the website, " ++ "thank you.") ++ continue ++ comment = self.raw_input( ++ "Comment> ", ++ default=self.options.default_comment) ++ if comment or not self.options.skip_empty_comment: ++ result = self.send_comment(bc, update, comment, ++ karma) ++ if not result[0]: ++ self.warning("Comment not submitted: %s" % ++ result[1]) ++ else: ++ print("skipped because of empty comment") ++ elif karma == "i": ++ ignored_updates.append(update.title) ++ print("ignored as requested") ++ break + + except EOFError: + ignored_updates.extend(previously_ignored_updates) + diff --git a/8.patch b/8.patch new file mode 100644 index 0000000..7f471c7 --- /dev/null +++ b/8.patch @@ -0,0 +1,50 @@ +From e039292195d491ccef283dcb96e911bb72fb9378 Mon Sep 17 00:00:00 2001 +From: Miro Hrončok +Date: Jul 02 2019 21:21:26 +0000 +Subject: Hotpatch for Bodhi 4 + + +See https://bugzilla.redhat.com/show_bug.cgi?id=1714925 + +--- + +diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py +index c1dfb61..b602905 100755 +--- a/fedora-easy-karma.py ++++ b/fedora-easy-karma.py +@@ -190,8 +190,6 @@ class FEK_helper(object): + + # the format of the user has changed, add a data member + comment["username"] = comment["user"]["name"] +- if comment["anonymous"]: +- comment["username"] += " (unauthenticated)" + + comments.append( + "%(indent)s%(username)s - %(timestamp)s " +@@ -222,6 +220,7 @@ class FEK_helper(object): + values["karma_status"] = "%d/%s" % (values["karma"], + values["stable_karma"]) + ++ values["submitter"] = values["user"]["name"] + return format_string % values + + @staticmethod +@@ -653,7 +652,7 @@ class FedoraEasyKarma(object): + + # Ignore own updates + if self.options.ignore_own and \ +- update["submitter"] == self.options.fas_username: ++ update["user"]["name"] == self.options.fas_username: + continue + + if update not in processed_updates and \ +@@ -773,7 +772,7 @@ class FedoraEasyKarma(object): + + def already_commented(self, update, user): + for comment in update["comments"]: +- if not comment["anonymous"] and comment["user"]["name"] == user: ++ if comment["user"]["name"] == user: + return True + return False + + diff --git a/fedora-easy-karma.spec b/fedora-easy-karma.spec index 301b1cb..780cd0c 100644 --- a/fedora-easy-karma.spec +++ b/fedora-easy-karma.spec @@ -1,6 +1,6 @@ Name: fedora-easy-karma Version: 0 -Release: 0.40.20181206gitb6d97e0%{?dist} +Release: 0.41.20181206gitb6d97e0%{?dist} Summary: Fedora update feedback made easy License: GPLv2+ URL: https://fedoraproject.org/wiki/Fedora_Easy_Karma @@ -11,6 +11,13 @@ URL: https://fedoraproject.org/wiki/Fedora_Easy_Karma # git archive --format=tar.gz --prefix=fedora-easy-karma-b6d97e0/ HEAD > \ # ../fedora-easy-karma-b6d97e0.tar.gz Source0: fedora-easy-karma-b6d97e0.tar.gz + +# ask user to open URL manually because of Bodhi bug +Patch7: https://pagure.io/fedora-easy-karma/pull-request/7.patch + +# Hotpatch for Bodhi 4 +Patch8: https://pagure.io/fedora-easy-karma/pull-request/8.patch + BuildArch: noarch BuildRequires: python3-devel @@ -25,7 +32,7 @@ updates that you have currently installed. %prep -%setup -q -n fedora-easy-karma-b6d97e0 +%autosetup -p1 -n fedora-easy-karma-b6d97e0 pathfix.py -pni "%{__python3} %{py3_shbang_opts}" fedora-easy-karma.py sed -i 's,useragent="Fedora Easy Karma/GIT",useragent="Fedora Easy Karma/%{version}-%{release}",' fedora-easy-karma.py @@ -41,6 +48,9 @@ sed -i 's,useragent="Fedora Easy Karma/GIT",useragent="Fedora Easy Karma/%{versi %changelog +* Wed Jul 03 2019 Miro Hrončok - 0-0.41.20181206gitb6d97e0 +- Apply workarounds from pull requests + * Thu Jan 31 2019 Fedora Release Engineering - 0-0.40.20181206gitb6d97e0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild