From 1fc8914f767f5f80d7263d8db96d73bf0310a39c Mon Sep 17 00:00:00 2001
From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Date: Tue, 19 May 2020 13:48:41 +0100
Subject: [PATCH 1/4] update dh-virtualenv (#7526)

---
 changelog.d/7526.misc             |  1 +
 debian/build_virtualenv           |  1 -
 debian/changelog                  |  4 +---
 docker/Dockerfile-dhvirtualenv    | 15 ++++++++-------
 scripts-dev/build_debian_packages |  1 +
 5 files changed, 11 insertions(+), 11 deletions(-)
 create mode 100644 changelog.d/7526.misc

diff --git a/changelog.d/7526.misc b/changelog.d/7526.misc
new file mode 100644
index 0000000000..c739312c4c
--- /dev/null
+++ b/changelog.d/7526.misc
@@ -0,0 +1 @@
+Update the version of dh-virtualenv we use to build debs, and add focal to the list of target distributions.
diff --git a/debian/build_virtualenv b/debian/build_virtualenv
index d892fd5c9d..4c9aabcac3 100755
--- a/debian/build_virtualenv
+++ b/debian/build_virtualenv
@@ -36,7 +36,6 @@ esac
 dh_virtualenv \
     --install-suffix "matrix-synapse" \
     --builtin-venv \
-    --setuptools \
     --python "$SNAKE" \
     --upgrade-pip \
     --preinstall="lxml" \
diff --git a/debian/changelog b/debian/changelog
index 8641571986..2db94ee609 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,16 +1,14 @@
-<<<<<<< HEAD
 matrix-synapse-py3 (1.12.3ubuntu1) UNRELEASED; urgency=medium
 
   * Add information about .well-known files to Debian installation scripts.
 
  -- Patrick Cloke <patrickc@matrix.org>  Mon, 06 Apr 2020 10:10:38 -0400
-=======
+
 matrix-synapse-py3 (1.12.4) stable; urgency=medium
 
   * New synapse release 1.12.4.
 
  -- Synapse Packaging team <packages@matrix.org>  Thu, 23 Apr 2020 10:58:14 -0400
->>>>>>> master
 
 matrix-synapse-py3 (1.12.3) stable; urgency=medium
 
diff --git a/docker/Dockerfile-dhvirtualenv b/docker/Dockerfile-dhvirtualenv
index ac9ebcfd88..579724685c 100644
--- a/docker/Dockerfile-dhvirtualenv
+++ b/docker/Dockerfile-dhvirtualenv
@@ -27,15 +27,16 @@ RUN env DEBIAN_FRONTEND=noninteractive apt-get install \
         wget
 
 # fetch and unpack the package
-RUN wget -q -O /dh-virtuenv-1.1.tar.gz https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz
-RUN tar xvf /dh-virtuenv-1.1.tar.gz
+RUN mkdir /dh-virtualenv
+RUN wget -q -O /dh-virtualenv.tar.gz https://github.com/matrix-org/dh-virtualenv/archive/matrixorg-20200519.tar.gz
+RUN tar -xv --strip-components=1 -C /dh-virtualenv -f /dh-virtualenv.tar.gz
 
 # install its build deps
-RUN cd dh-virtualenv-1.1/ \
-    && env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends"
+RUN cd /dh-virtualenv \
+    && env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -y --no-install-recommends"
 
 # build it
-RUN cd dh-virtualenv-1.1 && dpkg-buildpackage -us -uc -b
+RUN cd /dh-virtualenv && dpkg-buildpackage -us -uc -b
 
 ###
 ### Stage 1
@@ -68,12 +69,12 @@ RUN apt-get update -qq -o Acquire::Languages=none \
         sqlite3 \
         libpq-dev
 
-COPY --from=builder /dh-virtualenv_1.1-1_all.deb /
+COPY --from=builder /dh-virtualenv_1.2~dev-1_all.deb /
 
 # install dhvirtualenv. Update the apt cache again first, in case we got a
 # cached cache from docker the first time.
 RUN apt-get update -qq -o Acquire::Languages=none \
-    && apt-get install -yq /dh-virtualenv_1.1-1_all.deb
+    && apt-get install -yq /dh-virtualenv_1.2~dev-1_all.deb
 
 WORKDIR /synapse/source
 ENTRYPOINT ["bash","/synapse/source/docker/build_debian.sh"]
diff --git a/scripts-dev/build_debian_packages b/scripts-dev/build_debian_packages
index 84eaec6a95..ae2145d717 100755
--- a/scripts-dev/build_debian_packages
+++ b/scripts-dev/build_debian_packages
@@ -27,6 +27,7 @@ DISTS = (
     "ubuntu:cosmic",
     "ubuntu:disco",
     "ubuntu:eoan",
+    "ubuntu:focal",
 )
 
 DESC = '''\

From ac3264bf1ec8815cde14d77a62caad373c280ef1 Mon Sep 17 00:00:00 2001
From: Patrick Cloke <patrickc@matrix.org>
Date: Tue, 19 May 2020 09:19:09 -0400
Subject: [PATCH 2/4] 1.13.0

---
 CHANGES.md            | 9 +++++++++
 changelog.d/7526.misc | 1 -
 debian/changelog      | 8 ++++++--
 synapse/__init__.py   | 2 +-
 4 files changed, 16 insertions(+), 4 deletions(-)
 delete mode 100644 changelog.d/7526.misc

diff --git a/CHANGES.md b/CHANGES.md
index 45008995e5..04a3e525e6 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,12 @@
+Synapse 1.13.0 (2020-05-19)
+===========================
+
+Internal Changes
+----------------
+
+- Update the version of dh-virtualenv we use to build debs, and add focal to the list of target distributions. ([\#7526](https://github.com/matrix-org/synapse/issues/7526))
+
+
 Synapse 1.13.0rc3 (2020-05-18)
 ==============================
 
diff --git a/changelog.d/7526.misc b/changelog.d/7526.misc
deleted file mode 100644
index c739312c4c..0000000000
--- a/changelog.d/7526.misc
+++ /dev/null
@@ -1 +0,0 @@
-Update the version of dh-virtualenv we use to build debs, and add focal to the list of target distributions.
diff --git a/debian/changelog b/debian/changelog
index 2db94ee609..e7842d4174 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-matrix-synapse-py3 (1.12.3ubuntu1) UNRELEASED; urgency=medium
+matrix-synapse-py3 (1.13.0) stable; urgency=medium
 
+  [ Patrick Cloke ]
   * Add information about .well-known files to Debian installation scripts.
 
- -- Patrick Cloke <patrickc@matrix.org>  Mon, 06 Apr 2020 10:10:38 -0400
+  [ Synapse Packaging team ]
+  * New synapse release 1.13.0.
+
+ -- Synapse Packaging team <packages@matrix.org>  Tue, 19 May 2020 09:16:56 -0400
 
 matrix-synapse-py3 (1.12.4) stable; urgency=medium
 
diff --git a/synapse/__init__.py b/synapse/__init__.py
index 6b26c5e87e..0abf491172 100644
--- a/synapse/__init__.py
+++ b/synapse/__init__.py
@@ -36,7 +36,7 @@ try:
 except ImportError:
     pass
 
-__version__ = "1.13.0rc3"
+__version__ = "1.13.0"
 
 if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
     # We import here so that we don't have to install a bunch of deps when

From 66fd16261c5662a2ac315c60f19b018d4c3319e0 Mon Sep 17 00:00:00 2001
From: Patrick Cloke <patrickc@matrix.org>
Date: Tue, 19 May 2020 09:24:29 -0400
Subject: [PATCH 3/4] Move warnings in the changelog and re-iterate changes to
 branches.

---
 CHANGES.md | 50 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 18 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 04a3e525e6..96dfb1668f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,38 @@
 Synapse 1.13.0 (2020-05-19)
 ===========================
 
+This release brings some potential changes necessary for certain
+configurations of Synapse:
+
+* If your Synapse is configured to use SSO and have a custom
+  `sso_redirect_confirm_template_dir` configuration option set, you will need
+  to duplicate the new `sso_auth_confirm.html`, `sso_auth_success.html` and
+  `sso_account_deactivated.html` templates into that directory.
+* Synapse plugins using the `complete_sso_login` method of
+  `synapse.module_api.ModuleApi` should instead switch to the async/await
+  version, `complete_sso_login_async`, which includes additional checks. The
+  former version is now deprecated.
+* A bug was introduced in Synapse 1.4.0 which could cause the room directory
+  to be incomplete or empty if Synapse was upgraded directly from v1.2.1 or
+  earlier, to versions between v1.4.0 and v1.12.x.
+
+Please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes
+and for general upgrade guidance.
+
+
+Notice of change to the default `git` branch for Synapse
+--------------------------------------------------------
+
+With the release of Synapse 1.13.0, the default `git` branch for Synapse has
+changed to `develop`, which is the development tip. This is more consistent with
+common practice and modern `git` usage.
+
+The `master` branch, which tracks the latest release, is still available. It is
+recommended that developers and distributors who have scripts which run builds
+using the default branch of `Synapse` should therefore consider pinning their
+scripts to `master`.
+
+
 Internal Changes
 ----------------
 
@@ -34,24 +66,6 @@ Internal Changes
 Synapse 1.13.0rc1 (2020-05-11)
 ==============================
 
-This release brings some potential changes necessary for certain
-configurations of Synapse:
-
-* If your Synapse is configured to use SSO and have a custom
-  `sso_redirect_confirm_template_dir` configuration option set, you will need
-  to duplicate the new `sso_auth_confirm.html`, `sso_auth_success.html` and
-  `sso_account_deactivated.html` templates into that directory.
-* Synapse plugins using the `complete_sso_login` method of
-  `synapse.module_api.ModuleApi` should instead switch to the async/await
-  version, `complete_sso_login_async`, which includes additional checks. The
-  former version is now deprecated.
-* A bug was introduced in Synapse 1.4.0 which could cause the room directory
-  to be incomplete or empty if Synapse was upgraded directly from v1.2.1 or
-  earlier, to versions between v1.4.0 and v1.12.x.
-
-Please review [UPGRADE.rst](UPGRADE.rst) for more details on these changes
-and for general upgrade guidance.
-
 Features
 --------
 

From 45c8b1c618878905ab20187460da2260590211b2 Mon Sep 17 00:00:00 2001
From: Patrick Cloke <patrickc@matrix.org>
Date: Tue, 19 May 2020 09:31:59 -0400
Subject: [PATCH 4/4] Update changelog based on feedback.

---
 CHANGES.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 96dfb1668f..225fced285 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -29,7 +29,7 @@ common practice and modern `git` usage.
 
 The `master` branch, which tracks the latest release, is still available. It is
 recommended that developers and distributors who have scripts which run builds
-using the default branch of `Synapse` should therefore consider pinning their
+using the default branch of Synapse should therefore consider pinning their
 scripts to `master`.