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

Bug#927183: [pre-approval] unblock: debiancontributors/0.7.8-1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Hello!

This is a pre-approval to unblock package debiancontributors 0.7.8-1

debiancontributors is a package used internally by our infra team and this
upload would fix some simple but important bugs, in particular:

https://salsa.debian.org/python-team/modules/python-debiancontributors/commit/51adfafa4ee8cb58fc4d651ec99b6f46a83f02d5

https://salsa.debian.org/python-team/modules/python-debiancontributors/commit/b41908ea65e6a550438f90339c29ea2a3feda718

The first one (workaround for #801506) is the most important one:
python-requests can't support (for now) 100-Continue response.

The debdiff against the package in testing is attached. Thanks for considering
this pre-approval.

unblock debiancontributors/0.7.8-1

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-4-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_US.UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) (ignored: LC_ALL set to
en_US.UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru debiancontributors-0.7.7/dc-tool debiancontributors-0.7.8/dc-tool
--- debiancontributors-0.7.7/dc-tool	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/dc-tool	2019-04-16 01:24:06.000000000 +0200
@@ -26,6 +26,7 @@
 import argparse
 import logging
 
+
 def read_json_sources(source_name, pathnames):
     import debiancontributors as dc
     # Read JSON data, parsing it to validate it
@@ -50,6 +51,7 @@
         submission = dc.Submission.from_json(source_name, sys.stdin)
     return submission
 
+
 if __name__ == "__main__":
     parser = argparse.ArgumentParser()
     parser.add_argument("--debug", help="enable debugging output", action="store_true")
@@ -95,8 +97,10 @@
             sys.exit(1)
 
     # Override auth_token and baseurl from commandline if requested
-    if args.auth_token: submission.set_auth_token(args.auth_token)
-    if args.baseurl: submission.baseurl = args.baseurl
+    if args.auth_token:
+        submission.set_auth_token(args.auth_token)
+    if args.baseurl:
+        submission.baseurl = args.baseurl
 
     if args.post:
         success, details = submission.post()
diff -Nru debiancontributors-0.7.7/debian/changelog debiancontributors-0.7.8/debian/changelog
--- debiancontributors-0.7.7/debian/changelog	2018-02-14 14:27:21.000000000 +0100
+++ debiancontributors-0.7.8/debian/changelog	2019-04-16 02:27:01.000000000 +0200
@@ -1,3 +1,12 @@
+debiancontributors (0.7.8-1) unstable; urgency=medium
+
+  * New upstream release.
+  * Update to use my debian.org mail address.
+  * debian/control
+    - Bump Standards-Version to 4.3.0 (no changes needed).
+
+ -- Daniele Tricoli <eriol@debian.org>  Tue, 16 Apr 2019 02:27:01 +0200
+
 debiancontributors (0.7.7-1) unstable; urgency=medium
 
   * Team upload.
diff -Nru debiancontributors-0.7.7/debian/control debiancontributors-0.7.8/debian/control
--- debiancontributors-0.7.7/debian/control	2018-02-14 14:27:21.000000000 +0100
+++ debiancontributors-0.7.8/debian/control	2019-04-16 02:27:01.000000000 +0200
@@ -1,6 +1,6 @@
 Source: debiancontributors
 Maintainer: Debian Python Modules Team <python-modules-team@lists.alioth.debian.org>
-Uploaders: Enrico Zini <enrico@debian.org>, Daniele Tricoli <eriol@mornie.org>
+Uploaders: Enrico Zini <enrico@debian.org>, Daniele Tricoli <eriol@debian.org>
 Section: python
 Priority: optional
 Build-Depends: debhelper (>= 11),
@@ -14,7 +14,7 @@
                python3-six,
                python3-debian
 Build-Depends-Indep: help2man
-Standards-Version: 4.1.3
+Standards-Version: 4.3.0
 Homepage: https://salsa.debian.org/python-team/modules/python-debiancontributors
 Vcs-Git: https://salsa.debian.org/python-team/modules/python-debiancontributors.git
 Vcs-Browser: https://salsa.debian.org/python-team/modules/python-debiancontributors
diff -Nru debiancontributors-0.7.7/debian/copyright debiancontributors-0.7.8/debian/copyright
--- debiancontributors-0.7.7/debian/copyright	2018-02-14 14:27:21.000000000 +0100
+++ debiancontributors-0.7.8/debian/copyright	2019-04-16 02:27:01.000000000 +0200
@@ -9,7 +9,7 @@
 
 Files: debian/*
 Copyright: 2013, Enrico Zini <enrico@debian.org>
-           2016, Daniele Tricoli <eriol@mornie.org>
+           2016, Daniele Tricoli <eriol@debian.org>
 License: LGPL-3+
 
 License: LGPL-3+
diff -Nru debiancontributors-0.7.7/debian/rules debiancontributors-0.7.8/debian/rules
--- debiancontributors-0.7.7/debian/rules	2018-02-14 14:27:21.000000000 +0100
+++ debiancontributors-0.7.8/debian/rules	2019-04-16 02:27:01.000000000 +0200
@@ -24,4 +24,3 @@
 	      exit 1 ; \
 	fi
 	gbp buildpackage --git-debian-branch=backport -S -us -uc
-
diff -Nru debiancontributors-0.7.7/debiancontributors/parser.py debiancontributors-0.7.8/debiancontributors/parser.py
--- debiancontributors-0.7.7/debiancontributors/parser.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/debiancontributors/parser.py	2019-04-16 01:24:06.000000000 +0200
@@ -25,6 +25,7 @@
 import io
 import six
 
+
 class Fail(BaseException):
     """
     Exception raised when a validation or lookup fails
@@ -33,6 +34,7 @@
         self.code = code
         self.msg = msg
 
+
 class ClusterFail(Fail):
     """
     Exception raised to report a number of errors of the same kind
@@ -41,6 +43,7 @@
         super(ClusterFail, self).__init__(code, msg)
         self.errors = errors
 
+
 def get_key(d, key):
     "Get a key from a dict"
     try:
@@ -48,6 +51,7 @@
     except KeyError:
         raise Fail(400, "Key '{}' not found".format(key))
 
+
 def get_key_int(d, key):
     "Get a key from a dict, as an int"
     try:
@@ -55,11 +59,13 @@
     except ValueError:
         raise Fail(400, "Key '{}' does not contain an integer value".format(key))
 
+
 def get_key_string(d, key, empty=False):
     "Get a key from a dict, as a string"
     if empty:
         res = d.get(key, "")
-        if not res: return ""
+        if not res:
+            return ""
     else:
         res = get_key(d, key)
 
@@ -73,11 +79,13 @@
 
     return res
 
+
 def get_key_unicode(d, key, empty=False):
     "Get a key from a dict, as a unicode, decoded from utf8 if necessary"
     if empty:
         res = d.get(key, "")
-        if not res: return ""
+        if not res:
+            return ""
     else:
         res = get_key(d, key)
         if not res:
@@ -94,6 +102,7 @@
         escaped = res.decode(encoding="utf8", errors="replace")
         raise Fail(400, "Key '{}' contain {} which is not a valid UTF8 string".format(key, escaped))
 
+
 def get_key_sequence(d, key):
     "Get a key from a dict, ensuring it is a list or tuple"
     res = get_key(d, key)
@@ -101,6 +110,7 @@
         raise Fail(400, "Key '{}' does not contain an array".format(key))
     return res
 
+
 def get_key_sequence_or_object(d, key):
     """
     Get a key from a dict, ensuring it is a list or tuple, allowing singleton
@@ -114,16 +124,19 @@
     else:
         raise Fail(400, "Key '{}' does not contain an array or object".format(key))
 
+
 def get_key_date_or_none(d, key):
     "Get a key from a dict, as a date, allowing None"
     res = get_key_string(d, key, empty=True)
-    if not res: return None
+    if not res:
+        return None
 
     try:
         return datetime.datetime.strptime(res, "%Y-%m-%d").date()
     except ValueError:
         raise Fail(400, "Key '{}' does not contain a YYYY-MM-DD date".format(key))
 
+
 def get_json(f, compression=None):
     """
     Parse JSON from data from a file-like object, with optional decompression
@@ -222,11 +235,11 @@
                 s_contribs = [self.parse_contribution(d)
                               for d in get_key_sequence_or_object(rec, "contributions")]
             except Fail as f:
-                errors.append("#{} for {}: cannot parse contribution(s): {}".format(idx, s_id[0].id, f.msg))
+                errors.append("#{} for {}: cannot parse contribution(s): {}".format(idx, s_ids[0].id, f.msg))
                 continue
 
             if not s_contribs:
-                errors.append("#{} for {}: contribution list is empty".format(idx, s_id[0].id))
+                errors.append("#{} for {}: contribution list is empty".format(idx, s_ids[0].id))
                 continue
 
             yield s_ids, s_contribs
diff -Nru debiancontributors-0.7.7/debiancontributors/scanners/utils/bts.py debiancontributors-0.7.8/debiancontributors/scanners/utils/bts.py
--- debiancontributors-0.7.7/debiancontributors/scanners/utils/bts.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/debiancontributors/scanners/utils/bts.py	2019-04-16 01:24:06.000000000 +0200
@@ -19,7 +19,7 @@
 from __future__ import absolute_import
 from __future__ import division
 from __future__ import unicode_literals
-from ...submission import Identifier, Contribution
+from ...types import Identifier, Contribution
 import os
 import os.path
 import datetime
diff -Nru debiancontributors-0.7.7/debiancontributors/scanners/utils/filesystem.py debiancontributors-0.7.8/debiancontributors/scanners/utils/filesystem.py
--- debiancontributors-0.7.7/debiancontributors/scanners/utils/filesystem.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/debiancontributors/scanners/utils/filesystem.py	2019-04-16 01:24:06.000000000 +0200
@@ -19,7 +19,7 @@
 from __future__ import absolute_import
 from __future__ import division
 from __future__ import unicode_literals
-from ...submission import Identifier
+from ...types import Identifier
 from .mine import Aggregate
 import os
 import os.path
diff -Nru debiancontributors-0.7.7/debiancontributors/submission.py debiancontributors-0.7.8/debiancontributors/submission.py
--- debiancontributors-0.7.7/debiancontributors/submission.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/debiancontributors/submission.py	2019-04-16 01:24:06.000000000 +0200
@@ -20,7 +20,7 @@
 from __future__ import division
 from __future__ import unicode_literals
 from collections import defaultdict
-from .types import *
+from .types import Contribution
 import sys
 import os
 import io
@@ -31,6 +31,7 @@
 
 DEFAULT_BASE_URL = "https://contributors.debian.org/";
 
+
 class Submission(object):
     """
     A submission to contributors.debian.org
@@ -109,7 +110,7 @@
         for ident, contributions in self.entries.items():
             yield {
                 "id": (ident.to_json(),),
-                "contributions": [ c.to_json() for c in contributions.values() ],
+                "contributions": [c.to_json() for c in contributions.values()],
             }
 
     def to_json(self, file=None, indent=None):
@@ -158,7 +159,6 @@
 
         # Build the POST request to contributors.debian.org
         url = urljoin(self.baseurl, '/contributors/post')
-        #print("Posting to '{}'...".format(url))
 
         # Prepare the file to post
         try:
@@ -168,6 +168,7 @@
         except ImportError:
             import gzip
             compress_type = "gzip"
+
             def compress(data):
                 out = io.BytesIO()
                 with gzip.GzipFile(mode="wb", fileobj=out) as fd:
@@ -197,8 +198,14 @@
             args["verify"] = "/etc/ssl/ca-debian/ca-certificates.crt"
         else:
             args["verify"] = True
+
+        session = requests.Session()
         try:
-            res = requests.post(url, **args)
+            # Do a GET before the POST, to do HTTPS negotiation without a huge
+            # payload. See #801506
+            res = session.get(url)
+            res.raise_for_status()
+            res = session.post(url, **args)
             res.raise_for_status()
         except requests.ConnectionError as e:
             return False, {
@@ -211,7 +218,7 @@
             try:
                 parsed = json.loads(res.text)
                 errors = parsed["errors"]
-            except:
+            except Exception:
                 errors = []
             return False, {
                 "code": None,
@@ -248,10 +255,11 @@
         parser = Parser()
         for ids, contribs in parser.parse_submission(data):
             for i in ids:
-                res.entries[i] = { c.type: c for c in contribs }
+                res.entries[i] = {c.type: c for c in contribs}
 
         return res
 
+
 def merge_contrib_dicts(d1, d2):
     """
     Merge two dicts of contributions from the same identifier.
diff -Nru debiancontributors-0.7.7/debiancontributors/types.py debiancontributors-0.7.8/debiancontributors/types.py
--- debiancontributors-0.7.7/debiancontributors/types.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/debiancontributors/types.py	2019-04-16 01:24:06.000000000 +0200
@@ -25,18 +25,21 @@
 
 __all__ = ["Identifier", "Contribution"]
 
+
 class Identifier(object):
     """
     Information about a user identifier
     """
+    __slots__ = ("type", "id", "desc")
+
     # Validator regexps
     TYPE_VALIDATORS = {
         "login": re.compile(r"^[a-z0-9._-]+$"),
         # From http://www.regular-expressions.info/email.html
-        "email": re.compile(r"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", re.I),
+        "email": re.compile(r"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}", re.I),
         "fpr": re.compile(r"^[A-F0-9]{32,40}$"),
         "url": re.compile(r"^https?://"),
-        #"wiki": re.compile("^[A-Za-z]+$"),
+        # "wiki": re.compile("^[A-Za-z]+$"),
     }
 
     def __init__(self, type, id, desc=None):
@@ -49,7 +52,7 @@
 
     def __eq__(self, other):
         return (self.type == other.type
-            and self.id == other.id)
+                and self.id == other.id)
 
     def to_json(self):
         """
@@ -123,11 +126,12 @@
         raise ValueError("cannot infer a valid Identifier from '{}'".format(s))
 
 
-
 class Contribution(object):
     """
     Information about a contribution.
     """
+    __slots__ = ("type", "begin", "end", "url")
+
     def __init__(self, type, begin=None, end=None, url=None):
         """
         type: contribution type (as configured in contrbutors.debian.org for a
@@ -147,8 +151,8 @@
 
     def __eq__(self, other):
         return (self.type == other.type
-            and self.begin == other.begin
-            and self.end == other.end)
+                and self.begin == other.begin
+                and self.end == other.end)
 
     def extend_by_date(self, date):
         """
@@ -171,10 +175,13 @@
         """
         Return a JSON-serializable structure for this contribution
         """
-        res = { "type": self.type }
-        if self.begin: res["begin"] = self.begin.strftime("%Y-%m-%d")
-        if self.end: res["end"] = self.end.strftime("%Y-%m-%d")
-        if self.url: res["url"] = self.url
+        res = {"type": self.type}
+        if self.begin:
+            res["begin"] = self.begin.strftime("%Y-%m-%d")
+        if self.end:
+            res["end"] = self.end.strftime("%Y-%m-%d")
+        if self.url:
+            res["url"] = self.url
         return res
 
     @classmethod
@@ -212,7 +219,8 @@
         if not isinstance(self.type, six.string_types):
             raise Fail(400, "Contribution type is '{}' instead of a string".format(type(self.type)))
         if self.begin is not None and not hasattr(self.begin, "strftime"):
-            raise Fail(400, "Contribution begin is '{}' and does not look like a date or datetime".format(type(self.begin)))
+            raise Fail(400, "Contribution begin is '{}' and does not look like a date or datetime".format(
+                type(self.begin)))
         if self.end is not None and not hasattr(self.end, "strftime"):
             raise Fail(400, "Contribution end is '{}' and does not look like a date or datetime".format(type(self.end)))
         if self.url is not None and not isinstance(self.url, six.string_types):
diff -Nru debiancontributors-0.7.7/.gitignore debiancontributors-0.7.8/.gitignore
--- debiancontributors-0.7.7/.gitignore	1970-01-01 01:00:00.000000000 +0100
+++ debiancontributors-0.7.8/.gitignore	2019-04-16 01:24:06.000000000 +0200
@@ -0,0 +1,3 @@
+*.swp
+*.pyc
+MANIFEST
diff -Nru debiancontributors-0.7.7/PKG-INFO debiancontributors-0.7.8/PKG-INFO
--- debiancontributors-0.7.7/PKG-INFO	2018-02-14 15:54:45.000000000 +0100
+++ debiancontributors-0.7.8/PKG-INFO	1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-Metadata-Version: 1.1
-Name: debiancontributors
-Version: 0.7.7
-Summary: Manage submissions to contributors.debian.org
-Home-page: https://salsa.debian.org/python-team/modules/python-debiancontributors
-Author: ['Enrico Zini']
-Author-email: ['enrico@debian.org']
-License: http://www.gnu.org/licenses/lgpl-3.0.html
-Description: UNKNOWN
-Platform: UNKNOWN
-Requires: requests (>=2.0.0)
diff -Nru debiancontributors-0.7.7/setup.py debiancontributors-0.7.8/setup.py
--- debiancontributors-0.7.7/setup.py	2018-02-14 15:33:56.000000000 +0100
+++ debiancontributors-0.7.8/setup.py	2019-04-16 01:24:06.000000000 +0200
@@ -25,14 +25,14 @@
     scripts = ['dc-tool']
 
 setup(
-    name = "debiancontributors",
+    name="debiancontributors",
     requires=['requests (>=2.0.0)'],
-    version = "0.7.7",
-    description = "Manage submissions to contributors.debian.org",
-    author = ["Enrico Zini"],
-    author_email = ["enrico@debian.org"],
-    url = "https://salsa.debian.org/python-team/modules/python-debiancontributors";,
-    license = "http://www.gnu.org/licenses/lgpl-3.0.html";,
-    packages = ["debiancontributors", "debiancontributors.scanners", "debiancontributors.scanners.utils"],
+    version="0.7.8",
+    description="Manage submissions to contributors.debian.org",
+    author=["Enrico Zini"],
+    author_email=["enrico@debian.org"],
+    url="https://salsa.debian.org/python-team/modules/python-debiancontributors";,
+    license="http://www.gnu.org/licenses/lgpl-3.0.html";,
+    packages=["debiancontributors", "debiancontributors.scanners", "debiancontributors.scanners.utils"],
     scripts=scripts,
 )

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: