#3 Apply workarounds from pull requests
Merged 2 months ago by churchyard. Opened 2 months ago by churchyard.
rpms/ churchyard/fedora-easy-karma hotfixes  into  master

file added
+74

@@ -0,0 +1,74 @@ 

+ From 984a7f68c9172f3429f80cb057fa4a602efd09a5 Mon Sep 17 00:00:00 2001

+ From: Kamil Páral <kparal@redhat.com>

+ 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)

+ 

file added
+50

@@ -0,0 +1,50 @@ 

+ From e039292195d491ccef283dcb96e911bb72fb9378 Mon Sep 17 00:00:00 2001

+ From: Miro Hrončok <miro@hroncok.cz>

+ 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

+  

+ 

file modified
+12 -2

@@ -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 @@ 

  # 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 @@ 

  

  

  %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 @@ 

  

  

  %changelog

+ * Wed Jul 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0-0.41.20181206gitb6d97e0

+ - Apply workarounds from pull requests

+ 

  * Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.40.20181206gitb6d97e0

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild