[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#927912: marked as done (unblock: gcalcli/4.0.4-2 (pre-approval))



Your message dated Sat, 27 Apr 2019 07:01:00 +0000
with message-id <8d167220-2850-4f7f-397e-dc8d56f06a75@thykier.net>
and subject line Re: Bug#927912: unblock: gcalcli/4.0.4-2 (pre-approval)
has caused the Debian Bug report #927912,
regarding unblock: gcalcli/4.0.4-2 (pre-approval)
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
927912: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=927912
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Howdy,

Pending approval, I'm uploading a version of gcalcli which contains an upstream patch to fix the reliance on the Google shortening service.

If a user invokes one of the subcommands with '--details url', the application hits traceback issues as the service has been shut down.

See https://github.com/insanum/gcalcli/issues/440 for more details of the problem.


The changelog reads:

gcalcli (4.0.4-2) unstable; urgency=medium

  * d/p/remove_url_shortening.patch: Remove the deprecated goo.gl service.

 -- Unit 193 <unit193@ubuntu.com>  Wed, 24 Apr 2019 19:46:16 -0400


And debdiff:

diff --git a/debian/changelog b/debian/changelog
index 868a5db..f6bd57b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+gcalcli (4.0.4-2) unstable; urgency=medium
+
+  * d/p/remove_url_shortening.patch: Remove the deprecated goo.gl service.
+
+ -- Unit 193 <unit193@ubuntu.com>  Wed, 24 Apr 2019 19:46:16 -0400
+
 gcalcli (4.0.4-1) unstable; urgency=medium
 
   * New upstream version 4.0.4
diff --git a/debian/patches/remove_url_shortening.patch b/debian/patches/remove_url_shortening.patch
new file mode 100644
index 0000000..74a3c44
--- /dev/null
+++ b/debian/patches/remove_url_shortening.patch
@@ -0,0 +1,225 @@
+From 428378a88f89d154c8d4046deb9bdb5eb4e81019 Mon Sep 17 00:00:00 2001
+From: Joshua Crowgey <jcrowgey@u.washington.edu>
+Date: Mon, 15 Apr 2019 21:07:49 -0700
+Subject: [PATCH] Remove URL Shortening [fixes #440] (#443)
+
+Google has removed the urlshortening service.  After some discussion,
+it was decided to remove the shortening facilities instead of trying to
+integrate with a separate provider.  This makes our code simpler and
+folks who need url shortening can hopefully layer on what they need.
+---
+ ChangeLog                |    3 +++
+ gcalcli/argparsers.py    |   16 +++++-----------
+ gcalcli/gcal.py          |   39 +++++++++------------------------------
+ setup.py                 |    2 +-
+ tests/test_argparsers.py |    9 ++-------
+ 5 files changed, 20 insertions(+), 49 deletions(-)
+
+Index: gcalcli/ChangeLog
+===================================================================
+--- gcalcli.orig/ChangeLog
++++ gcalcli/ChangeLog
+@@ -1,3 +1,6 @@
++v4.1.0
++  * Removed url shortening due to Google deprecation #440
++
+ v4.0.4
+   * Minor bugfixes: conky colors, issues with setup.py
+ 
+Index: gcalcli/gcalcli/argparsers.py
+===================================================================
+--- gcalcli.orig/gcalcli/argparsers.py
++++ gcalcli/gcalcli/argparsers.py
+@@ -7,11 +7,9 @@ from gcalcli.printer import valid_color_
+ from oauth2client import tools
+ import copy as _copy
+ 
+-DETAILS = ['all', 'calendar', 'location', 'length', 'reminders', 'description',
+-           'longurl', 'shorturl', 'url', 'attendees', 'email', 'attachments']
++DETAILS = ['calendar', 'location', 'length', 'reminders', 'description',
++           'url', 'attendees', 'email', 'attachments']
+ 
+-BOOL_DETAILS = ['calendar', 'location', 'length', 'reminders', 'description',
+-                'attendees', 'email', 'attachments']
+ 
+ PROGRAM_OPTIONS = {
+         '--client-id': {'default': gcalcli.__API_CLIENT_ID__,
+@@ -60,13 +58,9 @@ class DetailsAction(argparse._AppendActi
+         details = _copy.copy(getattr(namespace, self.dest, {}))
+ 
+         if value == 'all':
+-            details = {d: True for d in BOOL_DETAILS}
+-        elif value in BOOL_DETAILS:
++            details = {d: True for d in DETAILS}
++        else:
+             details[value] = True
+-        elif value in ['shorturl', 'url']:
+-            details['url'] = 'short'
+-        elif value == 'longurl':
+-            details['url'] = 'long'
+ 
+         setattr(namespace, self.dest, details)
+ 
+@@ -90,7 +84,7 @@ def get_details_parser():
+     details_parser = argparse.ArgumentParser(add_help=False)
+     details_parser.add_argument(
+             '--details', default={}, action=DetailsAction,
+-            choices=DETAILS,
++            choices=DETAILS + ['all'],
+             help='Which parts to display, can be: ' + ', '.join(DETAILS))
+     return details_parser
+ 
+Index: gcalcli/gcalcli/gcal.py
+===================================================================
+--- gcalcli.orig/gcalcli/gcal.py
++++ gcalcli/gcalcli/gcal.py
+@@ -47,7 +47,6 @@ class GoogleCalendarInterface:
+     max_retries = 5
+     auth_http = None
+     cal_service = None
+-    url_service = None
+ 
+     ACCESS_OWNER = 'owner'
+     ACCESS_WRITER = 'writer'
+@@ -140,8 +139,7 @@ class GoogleCalendarInterface:
+                     OAuth2WebServerFlow(
+                         client_id=self.options['client_id'],
+                         client_secret=self.options['client_secret'],
+-                        scope=['https://www.googleapis.com/auth/calendar',
+-                               'https://www.googleapis.com/auth/urlshortener'],
++                        scope=['https://www.googleapis.com/auth/calendar'],
+                         user_agent=__program__ + '/' + __version__
+                     ),
+                     storage,
+@@ -160,15 +158,6 @@ class GoogleCalendarInterface:
+ 
+         return self.cal_service
+ 
+-    def get_url_service(self):
+-        if not self.url_service:
+-            self._google_auth()
+-            self.url_service = build(serviceName='urlshortener',
+-                                     version='v1',
+-                                     http=self._google_auth())
+-
+-        return self.url_service
+-
+     def _get_cached(self):
+         if self.options['config_folder']:
+             cache_file = os.path.expanduser(
+@@ -224,16 +213,6 @@ class GoogleCalendarInterface:
+             with open(cache_file, 'wb') as _cache_:
+                 pickle.dump(self.cache, _cache_)
+ 
+-    def _shorten_url(self, url):
+-        if self.details.get('url', False) != 'short':
+-            return url
+-        # Note that when authenticated to a google account different shortUrls
+-        # can be returned for the same longUrl. See: http://goo.gl/Ya0A9
+-        shortUrl = self._retry_with_backoff(
+-                self.get_url_service().url().insert(body={'longUrl': url})
+-        )
+-        return shortUrl['id']
+-
+     def _calendar_color(self, event, override_color=False):
+         ansi_codes = {
+             '1': 'brightblue',
+@@ -621,9 +600,9 @@ class GoogleCalendarInterface:
+                                          _u(event['e'].strftime('%H:%M')))
+ 
+             if self.details.get('url'):
+-                output += '\t%s' % (self._shorten_url(event['htmlLink'])
++                output += '\t%s' % (event['htmlLink']
+                                     if 'htmlLink' in event else '')
+-                output += '\t%s' % (self._shorten_url(event['hangoutLink'])
++                output += '\t%s' % (event['hangoutLink']
+                                     if 'hangoutLink' in event else '')
+ 
+             output += '\t%s' % _u(self._valid_title(event).strip())
+@@ -724,12 +703,12 @@ class GoogleCalendarInterface:
+             self.printer.msg(xstr, 'default')
+ 
+         if self.details.get('url') and 'htmlLink' in event:
+-            hlink = self._shorten_url(event['htmlLink'])
++            hlink = event['htmlLink']
+             xstr = '%s  Link: %s\n' % (details_indent, hlink)
+             self.printer.msg(xstr, 'default')
+ 
+         if self.details.get('url') and 'hangoutLink' in event:
+-            hlink = self._shorten_url(event['hangoutLink'])
++            hlink = event['hangoutLink']
+             xstr = '%s  Hangout Link: %s\n' % (details_indent, hlink)
+             self.printer.msg(xstr, 'default')
+ 
+@@ -1282,7 +1261,7 @@ class GoogleCalendarInterface:
+                         )
+ 
+         if self.details.get('url'):
+-            hlink = self._shorten_url(new_event['htmlLink'])
++            hlink = new_event['htmlLink']
+             self.printer.msg('New event added: %s\n' % hlink, 'green')
+ 
+         return new_event
+@@ -1323,7 +1302,7 @@ class GoogleCalendarInterface:
+         new_event = self._retry_with_backoff(request)
+ 
+         if self.details.get('url'):
+-            hlink = self._shorten_url(new_event['htmlLink'])
++            hlink = new_event['htmlLink']
+             self.printer.msg('New event added: %s\n' % hlink, 'green')
+ 
+         return new_event
+@@ -1557,7 +1536,7 @@ class GoogleCalendarInterface:
+                                             body=event
+                                         )
+                                 )
+-                    hlink = self._shorten_url(new_event.get('htmlLink'))
++                    hlink = new_event.get('htmlLink')
+                     self.printer.msg(
+                             'New event added: %s\n' % hlink, 'green'
+                     )
+@@ -1576,7 +1555,7 @@ class GoogleCalendarInterface:
+                                             body=event
+                                         )
+                                 )
+-                    hlink = self._shorten_url(new_event.get('htmlLink'))
++                    hlink = new_event.get('htmlLink')
+                     self.printer.msg('New event added: %s\n' % hlink, 'green')
+                 elif val.lower() == 'q':
+                     sys.exit(0)
+Index: gcalcli/setup.py
+===================================================================
+--- gcalcli.orig/setup.py
++++ gcalcli/setup.py
+@@ -17,7 +17,7 @@ author_emails = ['edavis@insanum.com',
+                  'jcrowgey@uw.edu']
+ 
+ setup(name='gcalcli',
+-      version='4.0.4',
++      version='4.1.0',
+       author='Eric Davis, Brian Hartvigsen, Joshua Crowgey',
+       author_email=', '.join(author_emails),
+       maintainer='Joshua Crowgey',
+Index: gcalcli/tests/test_argparsers.py
+===================================================================
+--- gcalcli.orig/tests/test_argparsers.py
++++ gcalcli/tests/test_argparsers.py
+@@ -42,16 +42,11 @@ def test_details_parser():
+     parsed_details = details_parser.parse_args(argv).details
+     assert parsed_details['attendees']
+     assert parsed_details['location']
+-    assert parsed_details['url'] == 'short'
++    assert parsed_details['url']
+ 
+     argv = shlex.split('--details all')
+     parsed_details = details_parser.parse_args(argv).details
+-    assert all(parsed_details[d] for d in argparsers.BOOL_DETAILS)
+-
+-    # ensure we can specify url type even with details=all
+-    argv = shlex.split('--details all --details longurl')
+-    parsed_details = details_parser.parse_args(argv).details
+-    assert parsed_details['url'] == 'long'
++    assert all(parsed_details[d] for d in argparsers.DETAILS)
+ 
+ 
+ def test_handle_unparsed():
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f4dec53
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+remove_url_shortening.patch

--- End Message ---
--- Begin Message ---
Unit 193:
> Control: tags -1 moreinfo
> 
> Howdy,
> 
> I've uploaded the package and it should be in unstable now.
> 
> 
> ~Unit 193
> Unit193 @ freenode
> Unit193 @ OFTC
> 
> [...]

Unblocked, thanks.
~Niels

--- End Message ---

Reply to: