Merge pull request #1805 from nanonyme/nanonyme/etag

Remove deprecated etag
diff --git a/.asf.yaml b/.asf.yaml
index 7483a9a..120de7b 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -33,6 +33,9 @@
     # disable rebase button:
     rebase: false
 
+  # Close branches when pull requests are merged
+  del_branch_on_merge: true
+
   # Enable pages publishing
   ghp_branch: gh-pages
   ghp_path: /
diff --git a/.github/common.env b/.github/common.env
index 2072f21..598896c 100644
--- a/.github/common.env
+++ b/.github/common.env
@@ -1,6 +1,6 @@
 # Shared common variables
 
-CI_IMAGE_VERSION=master-533491591
-CI_TOXENV_MAIN=py37,py38-nocover,py39-nocover,py310-nocover
-CI_TOXENV_PLUGINS=py37-plugins,py38-plugins-nocover,py39-plugins-nocover,py310-plugins-nocover
+CI_IMAGE_VERSION=master-643533272
+CI_TOXENV_MAIN=py37,py38,py39,py310,py311
+CI_TOXENV_PLUGINS=py37-plugins,py38-plugins,py39-plugins,py310-plugins,py311-plugins
 CI_TOXENV_ALL="${CI_TOXENV_MAIN},${CI_TOXENV_PLUGINS}"
diff --git a/.github/compose/ci.docker-compose.yml b/.github/compose/ci.docker-compose.yml
index f616f1a..19e0b2a 100644
--- a/.github/compose/ci.docker-compose.yml
+++ b/.github/compose/ci.docker-compose.yml
@@ -1,7 +1,7 @@
 version: '3.4'
 
 x-tests-template: &tests-template
-    image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:35-${CI_IMAGE_VERSION:-latest}
+    image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:36-${CI_IMAGE_VERSION:-latest}
     command: tox -vvvvv -- --color=yes --integration
     environment:
       TOXENV: ${CI_TOXENV_ALL}
@@ -22,14 +22,14 @@
 
 services:
 
-  fedora-35:
-    <<: *tests-template
-    image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:35-${CI_IMAGE_VERSION:-latest}
-
   fedora-36:
     <<: *tests-template
     image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:36-${CI_IMAGE_VERSION:-latest}
 
+  fedora-37:
+    <<: *tests-template
+    image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-fedora:37-${CI_IMAGE_VERSION:-latest}
+
   debian-10:
     <<: *tests-template
     image: registry.gitlab.com/buildstream/buildstream-docker-images/testsuite-debian:10-${CI_IMAGE_VERSION:-latest}
@@ -109,3 +109,8 @@
     <<: *tests-template
     image: quay.io/pypa/manylinux_2_28_x86_64
     command: .github/wheel-helpers/test-wheel-manylinux.sh cp310-cp310-manylinux_2_28_x86_64 /opt/python/cp310-cp310/bin/python3
+
+  wheels-manylinux_2_28-cp311:
+    <<: *tests-template
+    image: quay.io/pypa/manylinux_2_28_x86_64
+    command: .github/wheel-helpers/test-wheel-manylinux.sh cp311-cp311-manylinux_2_28_x86_64 /opt/python/cp311-cp311/bin/python3
diff --git a/.github/run-ci.sh b/.github/run-ci.sh
index 3227b32..bff9de8 100755
--- a/.github/run-ci.sh
+++ b/.github/run-ci.sh
@@ -102,7 +102,7 @@
 
 
 if [ -z "${test_names}" ]; then
-    for test_name in mypy debian-10 fedora-35 fedora-36 fedora-missing-deps; do
+    for test_name in mypy debian-10 fedora-36 fedora-37 fedora-missing-deps; do
 	if ! runTest "${test_name}"; then
 	    echo "Tests failed"
 	    exit 1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 81d1435..307bbb8 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -37,8 +37,8 @@
         # "../compose/ci.docker-compose.yml"
         test-name:
           - debian-10
-          - fedora-35
           - fedora-36
+          - fedora-37
           - fedora-missing-deps
           - lint
           - mypy
@@ -125,7 +125,7 @@
         run: ${GITHUB_WORKSPACE}/.github/wheel-helpers/fetch-latest-buildbox-release.sh
 
       - name: Build wheels
-        run: pipx run cibuildwheel==2.8.1
+        run: pipx run cibuildwheel==2.11.3
 
       - uses: actions/upload-artifact@v3
         with:
@@ -146,6 +146,7 @@
           - wheels-manylinux_2_28-cp38
           - wheels-manylinux_2_28-cp39
           - wheels-manylinux_2_28-cp310
+          - wheels-manylinux_2_28-cp311
 
     steps:
       - uses: actions/checkout@v3
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 125b45e..0019749 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -69,7 +69,7 @@
         run: ${GITHUB_WORKSPACE}/.github/wheel-helpers/fetch-latest-buildbox-release.sh
 
       - name: Build wheels
-        run: pipx run cibuildwheel==2.8.1
+        run: pipx run cibuildwheel==2.11.3
 
       - uses: actions/upload-artifact@v3
         with:
@@ -90,6 +90,7 @@
           - wheels-manylinux_2_28-cp38
           - wheels-manylinux_2_28-cp39
           - wheels-manylinux_2_28-cp310
+          - wheels-manylinux_2_28-cp311
 
     steps:
       - uses: actions/checkout@v3
diff --git a/COMMITTERS.rst b/COMMITTERS.rst
index 567458e..acb8fb4 100644
--- a/COMMITTERS.rst
+++ b/COMMITTERS.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. _committers:
 
 Committers
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 4ac301d..3cad208 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Contributing
 ============
 Some tips and guidelines for developers hacking on BuildStream
diff --git a/MANIFEST.in b/MANIFEST.in
index a408713..3a8a044 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -13,7 +13,6 @@
 #
 
 # Basic toplevel package includes
-include BuildStream.doap
 include COMMITTERS.rst
 include CONTRIBUTING.rst
 include LICENSE
diff --git a/NEWS b/NEWS
index 38f7d8c..e5b236e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+=================
+buildstream 2.0.0
+=================
+
+No changes since 1.95.6, releasing voted upon 2.0.0
+
+==================
+buildstream 1.95.6
+==================
+
+  o Adding missing license headers to some files in the _testing module
+
+==================
+buildstream 1.95.5
+==================
+
+  o Fixed remaining license header issues (in sources and also docs)
+
+  o Documenting how to prepare BuildStream for new python versions
+
+  o Remove generated GPL files from autotools test tarballs
+
+  o Update package metadata urls and author
+
 ==================
 buildstream 1.95.4
 ==================
diff --git a/README.rst b/README.rst
index b0fb11a..515a369 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 About
 -----
 
@@ -17,7 +30,7 @@
 
 What is BuildStream?
 ====================
-`BuildStream <https://buildstream.build>`_ is a Free Software tool for 
+`BuildStream <https://buildstream.build>`_ is an Open Source tool for
 building/integrating software stacks.
 It takes inspiration, lessons and use-cases from various projects including
 OBS, Reproducible Builds, Yocto, Baserock, Buildroot, Aboriginal, GNOME Continuous,
@@ -86,7 +99,7 @@
 To get started, first `install BuildStream by following the installation guide
 <https://buildstream.build/install.html>`_
 and then follow our tutorial in the
-`user guide <https://docs.buildstream.build/1.4.1/main_using.html>`_.
+`user guide <https://docs.buildstream.build/master/main_using.html>`_.
 
 We also recommend exploring some existing BuildStream projects:
 
@@ -95,16 +108,3 @@
 * https://gitlab.com/baserock/definitions
 
 If you have any questions please ask on our `#buildstream <irc://irc.gnome.org/buildstream>`_ channel in `irc.gnome.org <irc://irc.gnome.org>`_
-
-
-Availability in distros
-=======================
-* BuildStream:
-
-.. image:: https://repology.org/badge/vertical-allrepos/buildstream.svg
-   :target: https://repology.org/metapackage/buildstream/versions
-
-* BuildStream external plugins (bst-external)
-
-.. image:: https://repology.org/badge/vertical-allrepos/bst-external.svg
-   :target: https://repology.org/metapackage/bst-external/versions
diff --git a/doc/source/additional_docker.rst b/doc/source/additional_docker.rst
index a7cfd28..6cbfa42 100644
--- a/doc/source/additional_docker.rst
+++ b/doc/source/additional_docker.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _bst_and_docker:
 
diff --git a/doc/source/arch_cachekeys.rst b/doc/source/arch_cachekeys.rst
index 0d469de..4989c09 100644
--- a/doc/source/arch_cachekeys.rst
+++ b/doc/source/arch_cachekeys.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _cachekeys:
 
diff --git a/doc/source/arch_caches.rst b/doc/source/arch_caches.rst
index 77fd77a..6a3e7e4 100644
--- a/doc/source/arch_caches.rst
+++ b/doc/source/arch_caches.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _caches:
 
diff --git a/doc/source/arch_data_model.rst b/doc/source/arch_data_model.rst
index 6e78d3a..2d90ca3 100644
--- a/doc/source/arch_data_model.rst
+++ b/doc/source/arch_data_model.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Data model
diff --git a/doc/source/arch_dependency_model.rst b/doc/source/arch_dependency_model.rst
index 2b80564..2944910 100644
--- a/doc/source/arch_dependency_model.rst
+++ b/doc/source/arch_dependency_model.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Dependency model
diff --git a/doc/source/arch_overview.rst b/doc/source/arch_overview.rst
index f01dec4..42b676f 100644
--- a/doc/source/arch_overview.rst
+++ b/doc/source/arch_overview.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Overview of modules
diff --git a/doc/source/arch_program_flow.rst b/doc/source/arch_program_flow.rst
index 9198ee1..a0ba5ab 100644
--- a/doc/source/arch_program_flow.rst
+++ b/doc/source/arch_program_flow.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Overview of program flow
diff --git a/doc/source/arch_remote_execution.rst b/doc/source/arch_remote_execution.rst
index 9c8e9d3..7aef44a 100644
--- a/doc/source/arch_remote_execution.rst
+++ b/doc/source/arch_remote_execution.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Remote execution
 ================
 Remote execution allows builds to take place on different machines from the machine *bst* is run on, allowing faster builds, shared resources and different build capabilities, for example different machine architectures.
diff --git a/doc/source/arch_sandboxing.rst b/doc/source/arch_sandboxing.rst
index 324c6ae..a5daf3d 100644
--- a/doc/source/arch_sandboxing.rst
+++ b/doc/source/arch_sandboxing.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _sandboxing:
 
diff --git a/doc/source/arch_scheduler.rst b/doc/source/arch_scheduler.rst
index 4b05014..572bf59 100644
--- a/doc/source/arch_scheduler.rst
+++ b/doc/source/arch_scheduler.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Scheduler
diff --git a/doc/source/core_additional.rst b/doc/source/core_additional.rst
index 878745b..b496754 100644
--- a/doc/source/core_additional.rst
+++ b/doc/source/core_additional.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Additional writings
diff --git a/doc/source/core_format.rst b/doc/source/core_format.rst
index 294867f..e8089a9 100644
--- a/doc/source/core_format.rst
+++ b/doc/source/core_format.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Project format
diff --git a/doc/source/core_framework.rst b/doc/source/core_framework.rst
index 026607a..14efdc5 100644
--- a/doc/source/core_framework.rst
+++ b/doc/source/core_framework.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _core_framework:
diff --git a/doc/source/core_plugins.rst b/doc/source/core_plugins.rst
index 4786ec4..1b02cd4 100644
--- a/doc/source/core_plugins.rst
+++ b/doc/source/core_plugins.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _plugins:
 
diff --git a/doc/source/developing/strict-mode.rst b/doc/source/developing/strict-mode.rst
index e516a66..ed3255c 100644
--- a/doc/source/developing/strict-mode.rst
+++ b/doc/source/developing/strict-mode.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _developing_strict_mode:
diff --git a/doc/source/developing/workspaces.rst b/doc/source/developing/workspaces.rst
index 62c6138..db2c9a9 100644
--- a/doc/source/developing/workspaces.rst
+++ b/doc/source/developing/workspaces.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _developing_workspaces:
diff --git a/doc/source/examples/git-mirror.rst b/doc/source/examples/git-mirror.rst
index 1b05bf6..bcce6ec 100644
--- a/doc/source/examples/git-mirror.rst
+++ b/doc/source/examples/git-mirror.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Creating and using a git mirror
diff --git a/doc/source/examples/tar-mirror.rst b/doc/source/examples/tar-mirror.rst
index 7a4a2f5..77146b1 100644
--- a/doc/source/examples/tar-mirror.rst
+++ b/doc/source/examples/tar-mirror.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _using_tar_mirror:
diff --git a/doc/source/format_declaring.rst b/doc/source/format_declaring.rst
index fede3e0..7bad61f 100644
--- a/doc/source/format_declaring.rst
+++ b/doc/source/format_declaring.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Declaring elements
diff --git a/doc/source/format_intro.rst b/doc/source/format_intro.rst
index cc74345..9c19225 100644
--- a/doc/source/format_intro.rst
+++ b/doc/source/format_intro.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Introduction
diff --git a/doc/source/format_project.rst b/doc/source/format_project.rst
index 435fdee..83eac5e 100644
--- a/doc/source/format_project.rst
+++ b/doc/source/format_project.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. _projectconf:
 
 
diff --git a/doc/source/format_project_refs.rst b/doc/source/format_project_refs.rst
index 8dcb244..140e8e5 100644
--- a/doc/source/format_project_refs.rst
+++ b/doc/source/format_project_refs.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _projectrefs:
diff --git a/doc/source/format_public.rst b/doc/source/format_public.rst
index d596ea7..fc51681 100644
--- a/doc/source/format_public.rst
+++ b/doc/source/format_public.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _public_builtin:
diff --git a/doc/source/hacking/coding_guidelines.rst b/doc/source/hacking/coding_guidelines.rst
index 156d36b..eafb0c7 100644
--- a/doc/source/hacking/coding_guidelines.rst
+++ b/doc/source/hacking/coding_guidelines.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _coding_guidelines:
diff --git a/doc/source/hacking/grpc_protocols.rst b/doc/source/hacking/grpc_protocols.rst
index 9ac650f..0ca4c74 100644
--- a/doc/source/hacking/grpc_protocols.rst
+++ b/doc/source/hacking/grpc_protocols.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _protocol_buffers:
diff --git a/doc/source/hacking/making_releases.rst b/doc/source/hacking/making_releases.rst
index 52d4890..4f71c45 100644
--- a/doc/source/hacking/making_releases.rst
+++ b/doc/source/hacking/making_releases.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _making_releases:
diff --git a/doc/source/hacking/managing_data_files.rst b/doc/source/hacking/managing_data_files.rst
index ec9639e..291ee39 100644
--- a/doc/source/hacking/managing_data_files.rst
+++ b/doc/source/hacking/managing_data_files.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _managing_data_files:
diff --git a/doc/source/hacking/measuring_performance.rst b/doc/source/hacking/measuring_performance.rst
index b78d23a..44798c4 100644
--- a/doc/source/hacking/measuring_performance.rst
+++ b/doc/source/hacking/measuring_performance.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _measuring_performance:
diff --git a/doc/source/hacking/ui.rst b/doc/source/hacking/ui.rst
index cf33c55..5a8c4d5 100644
--- a/doc/source/hacking/ui.rst
+++ b/doc/source/hacking/ui.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Contributing to the UI
 ~~~~~~~~~~~~~~~~~~~~~~
 
diff --git a/doc/source/hacking/updating_python_deps.rst b/doc/source/hacking/updating_python_deps.rst
index 711cc26..548c317 100644
--- a/doc/source/hacking/updating_python_deps.rst
+++ b/doc/source/hacking/updating_python_deps.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _updating_python_deps:
@@ -20,3 +33,104 @@
 file::
 
    make -C requirements
+
+
+Adding support for a new Python release
+---------------------------------------
+When a new stable release of Python 3 appears, we must explicitly declare
+our support for it in the following places.
+
+
+tox.ini
+~~~~~~~
+The ``tox.ini`` file defines the environments where the BuildStream test suite
+runs.  Every ``py{3.x,3.y}`` list must be updated to contain the new version
+number such as ``311`` for CPython 3.11.
+
+Use ``tox -e py311-nocover`` to run the test suite with the new version of
+Python.
+
+
+pyproject.toml
+~~~~~~~~~~~~~~
+
+
+Bump cython version
+'''''''''''''''''''
+New releases of Cython must be depended on with new versions of Python
+in lock step.
+
+When supporting a new Python version, it is important to bump the minimal
+dependency on Cython to a new enough version which also supports the new
+version of Python.
+
+
+Wheel details
+'''''''''''''
+We produce binary "wheel" packages for each supported version of Python.
+The cibuildwheel build tool will build for all released versions of Python
+so no change is needed in the config.
+
+However, if you want to test wheel building with a prerelease version of Python
+you will need to set ``CIBW_PRERELEASE_PYTHONS=1`` in the cibuildwheel
+environment.
+
+
+.github/compose/ci.docker-compose.yml
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Each binary package is tested in a container, using the
+`pypa/manylinux <https://github.com/pypa/manylinux>`_ images.
+
+You need to add a new docker-compose service here -- copy the
+latest one and update the version number where it appears.
+
+
+.github/workflows/ci.yml and .github/workflows/release.yml
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+There is a separate CI job to run each of the above tests. Update the
+matrix config for the ``test_wheels`` jobs in ``ci.yml`` and ``release.yml``
+to add the new Python version.
+
+
+Removing support for a Python release
+-------------------------------------
+
+
+tox.ini
+~~~~~~~
+You will need to update the ``py{3.x,3.y}`` lists to remove the old version. In
+the ``envlist`` section, make sure the oldest version still has coverage
+enabled while the other versions are marked ``-nocover``.
+
+
+pyproject.toml
+~~~~~~~~~~~~~~
+The cibuildwheel tool will produce wheels for all versions of Python supported
+upstream.. If we drop support for a version before upstream do, update the
+``tool.cibuildwheel.skip`` list to skip all platform tags for that version.
+The glob ``cp36-*`` would skip all CPython 3.6 builds, for example.
+
+
+.github/compose/ci.docker-compose.yml
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Remove the corresponding service.
+
+
+.github/workflows/ci.yml and .github/workflows/release.yml
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Update the matrix config for the `test_wheels` jobs in `ci.yml` and
+`release.yml` to remove the old Python version.
+
+
+ABI compatibility for binary Python packages
+--------------------------------------------
+The Python binary packages declare system requirements using
+`platform compatibility tags <https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/>`_.
+
+For linux-gnu systems we use `manylinux_x_y platform tags <https://peps.python.org/pep-0600/>`_
+to specify a minimum GLIBC version. The platform tag is controlled in ``pyproject.toml`` with the
+``tool.cibuildwheel.manylinux-x86_64-image`` key.  It must correspond with the version of
+GLIBC used in `buildbox-integration <https://gitlab.com/BuildGrid/buildbox/buildbox-integration>`_
+to produce static buildbox binaries that are included in the package.
+The ``cibuildwheel`` tool uses `auditwheel <https://github.com/pypa/auditwheel>`_
+to ensure the correct platform tag is declared.
diff --git a/doc/source/hacking/using_the_testsuite.rst b/doc/source/hacking/using_the_testsuite.rst
index 487e3ca..347b4ac 100644
--- a/doc/source/hacking/using_the_testsuite.rst
+++ b/doc/source/hacking/using_the_testsuite.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _contributing_testing:
diff --git a/doc/source/hacking/writing_documentation.rst b/doc/source/hacking/writing_documentation.rst
index a234c7c..f744c63 100644
--- a/doc/source/hacking/writing_documentation.rst
+++ b/doc/source/hacking/writing_documentation.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _writing_documentation:
diff --git a/doc/source/hacking/writing_plugins.rst b/doc/source/hacking/writing_plugins.rst
index d8462d8..7e4ed46 100644
--- a/doc/source/hacking/writing_plugins.rst
+++ b/doc/source/hacking/writing_plugins.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _writing_plugins:
diff --git a/doc/source/handling-files/composition.rst b/doc/source/handling-files/composition.rst
index 2adfda3..2511192 100644
--- a/doc/source/handling-files/composition.rst
+++ b/doc/source/handling-files/composition.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _handling_files_composition:
diff --git a/doc/source/handling-files/filtering.rst b/doc/source/handling-files/filtering.rst
index 4fa3b4c..c030c02 100644
--- a/doc/source/handling-files/filtering.rst
+++ b/doc/source/handling-files/filtering.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _handling_files_filtering:
diff --git a/doc/source/handling-files/overlaps.rst b/doc/source/handling-files/overlaps.rst
index ab573d9..20ebfca 100644
--- a/doc/source/handling-files/overlaps.rst
+++ b/doc/source/handling-files/overlaps.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _handling_files_overlaps:
diff --git a/doc/source/index.rst b/doc/source/index.rst
index 57f9b21..e0be324 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -1,7 +1,15 @@
-.. BuildStream documentation master file, created by
-   sphinx-quickstart on Mon Nov  7 21:03:37 2016.
-   You can adapt this file completely to your liking, but it should at least
-   contain the root `toctree` directive.
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
 
 
 BuildStream documentation
diff --git a/doc/source/junctions/junction-elements.rst b/doc/source/junctions/junction-elements.rst
index fb95523..f0effec 100644
--- a/doc/source/junctions/junction-elements.rst
+++ b/doc/source/junctions/junction-elements.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _junction_elements:
diff --git a/doc/source/junctions/junction-includes.rst b/doc/source/junctions/junction-includes.rst
index b8d0e77..0f58805 100644
--- a/doc/source/junctions/junction-includes.rst
+++ b/doc/source/junctions/junction-includes.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _advanced_junction_includes:
diff --git a/doc/source/junctions/junction-workspaces.rst b/doc/source/junctions/junction-workspaces.rst
index 82b73ad..23ebe3e 100644
--- a/doc/source/junctions/junction-workspaces.rst
+++ b/doc/source/junctions/junction-workspaces.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _junction_workspaces:
diff --git a/doc/source/main_about.rst b/doc/source/main_about.rst
index a6210d3..eb8c037 100644
--- a/doc/source/main_about.rst
+++ b/doc/source/main_about.rst
@@ -1 +1,14 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 .. include:: ../../README.rst
diff --git a/doc/source/main_architecture.rst b/doc/source/main_architecture.rst
index d9b9f3e..cff4d74 100644
--- a/doc/source/main_architecture.rst
+++ b/doc/source/main_architecture.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Architecture
diff --git a/doc/source/main_core.rst b/doc/source/main_core.rst
index c0757b7..0049de0 100644
--- a/doc/source/main_core.rst
+++ b/doc/source/main_core.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Reference
diff --git a/doc/source/main_glossary.rst b/doc/source/main_glossary.rst
index f1bf4cf..f16fac1 100644
--- a/doc/source/main_glossary.rst
+++ b/doc/source/main_glossary.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Glossary
diff --git a/doc/source/main_install.rst b/doc/source/main_install.rst
index a95d8f3..819c124 100644
--- a/doc/source/main_install.rst
+++ b/doc/source/main_install.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Installing from Source
 ======================
 
diff --git a/doc/source/main_porting.rst b/doc/source/main_porting.rst
index 07ac9ef..62f534d 100644
--- a/doc/source/main_porting.rst
+++ b/doc/source/main_porting.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _main_porting:
diff --git a/doc/source/main_using.rst b/doc/source/main_using.rst
index c6cd385..e5dfee4 100644
--- a/doc/source/main_using.rst
+++ b/doc/source/main_using.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _using:
diff --git a/doc/source/porting_command_line.rst b/doc/source/porting_command_line.rst
index 4520c07..5b24697 100644
--- a/doc/source/porting_command_line.rst
+++ b/doc/source/porting_command_line.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _porting_command_line:
diff --git a/doc/source/porting_project.rst b/doc/source/porting_project.rst
index cb2ddac..9a981ca 100644
--- a/doc/source/porting_project.rst
+++ b/doc/source/porting_project.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _porting_project:
diff --git a/doc/source/porting_user_configuration.rst b/doc/source/porting_user_configuration.rst
index 1971ddb..cdf5ff1 100644
--- a/doc/source/porting_user_configuration.rst
+++ b/doc/source/porting_user_configuration.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _porting_user_configuration:
diff --git a/doc/source/tutorial/autotools.rst b/doc/source/tutorial/autotools.rst
index 36b09bf..1907f26 100644
--- a/doc/source/tutorial/autotools.rst
+++ b/doc/source/tutorial/autotools.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial_autotools:
diff --git a/doc/source/tutorial/directives.rst b/doc/source/tutorial/directives.rst
index 33d9eeb..61b4d2c 100644
--- a/doc/source/tutorial/directives.rst
+++ b/doc/source/tutorial/directives.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial_directives:
diff --git a/doc/source/tutorial/first-project.rst b/doc/source/tutorial/first-project.rst
index ca3fd5b..c5c9407 100644
--- a/doc/source/tutorial/first-project.rst
+++ b/doc/source/tutorial/first-project.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial_first_project:
diff --git a/doc/source/tutorial/integration-commands.rst b/doc/source/tutorial/integration-commands.rst
index 8113ac6..16fd69a 100644
--- a/doc/source/tutorial/integration-commands.rst
+++ b/doc/source/tutorial/integration-commands.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial_integration_commands:
diff --git a/doc/source/tutorial/running-commands.rst b/doc/source/tutorial/running-commands.rst
index ac77f06..8be85dc 100644
--- a/doc/source/tutorial/running-commands.rst
+++ b/doc/source/tutorial/running-commands.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial_running_commands:
diff --git a/doc/source/using_commands.rst b/doc/source/using_commands.rst
index 6f4b1ce..aca308e 100644
--- a/doc/source/using_commands.rst
+++ b/doc/source/using_commands.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _commands:
 
diff --git a/doc/source/using_config.rst b/doc/source/using_config.rst
index 996fddf..b465977 100644
--- a/doc/source/using_config.rst
+++ b/doc/source/using_config.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 .. _user_config:
 
diff --git a/doc/source/using_configuring_cache_server.rst b/doc/source/using_configuring_cache_server.rst
index 8fdbabc..1ca3887 100644
--- a/doc/source/using_configuring_cache_server.rst
+++ b/doc/source/using_configuring_cache_server.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _cache_servers:
diff --git a/doc/source/using_configuring_remote_execution.rst b/doc/source/using_configuring_remote_execution.rst
index 759e40f..b4f0521 100644
--- a/doc/source/using_configuring_remote_execution.rst
+++ b/doc/source/using_configuring_remote_execution.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _remote_execution_servers:
diff --git a/doc/source/using_developing.rst b/doc/source/using_developing.rst
index b80cb20..ad64e4e 100644
--- a/doc/source/using_developing.rst
+++ b/doc/source/using_developing.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Developing
 ==========
 This section covers the features BuildStream provides for users
diff --git a/doc/source/using_examples.rst b/doc/source/using_examples.rst
index f4e16d4..89918b2 100644
--- a/doc/source/using_examples.rst
+++ b/doc/source/using_examples.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _examples:
diff --git a/doc/source/using_handling_files.rst b/doc/source/using_handling_files.rst
index 8d2e356..3899435 100644
--- a/doc/source/using_handling_files.rst
+++ b/doc/source/using_handling_files.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 Handling files
 ==============
 This section covers the various aspects related to finer grained
diff --git a/doc/source/using_junctions.rst b/doc/source/using_junctions.rst
index 9fe492c..a48747d 100644
--- a/doc/source/using_junctions.rst
+++ b/doc/source/using_junctions.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 Combining projects
diff --git a/doc/source/using_tutorial.rst b/doc/source/using_tutorial.rst
index 96a9da2..7e5139f 100644
--- a/doc/source/using_tutorial.rst
+++ b/doc/source/using_tutorial.rst
@@ -1,3 +1,16 @@
+..
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
 
 
 .. _tutorial:
diff --git a/requirements/cov-requirements.in b/requirements/cov-requirements.in
index d80d8f4..65bd5da 100644
--- a/requirements/cov-requirements.in
+++ b/requirements/cov-requirements.in
@@ -1,4 +1,4 @@
-coverage == 4.4.0
+coverage >= 6
 pytest-cov >= 2.5.0
 pytest >= 6.0.1
 Cython
diff --git a/requirements/cov-requirements.txt b/requirements/cov-requirements.txt
index d202c6e..9df1cf0 100644
--- a/requirements/cov-requirements.txt
+++ b/requirements/cov-requirements.txt
@@ -1,12 +1,11 @@
-coverage==4.4
-pytest-cov==2.10.1
-pytest==7.1.2
-Cython==0.29.28
+coverage==7.0.5
+pytest-cov==4.0.0
+pytest==7.2.0
+Cython==0.29.32
 ## The following requirements were added by pip freeze:
-attrs==21.4.0
+attrs==22.2.0
+exceptiongroup==1.1.0
 iniconfig==1.1.1
-packaging==21.3
+packaging==22.0
 pluggy==1.0.0
-py==1.11.0
-pyparsing==3.0.8
 tomli==2.0.1
diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt
index 040734d..203e5e3 100644
--- a/requirements/dev-requirements.txt
+++ b/requirements/dev-requirements.txt
@@ -1,28 +1,27 @@
 pexpect==4.8.0
 pylint==2.13.8
 # Pytest 6.0.0 doesn't play well with pylint
-pytest==7.1.2
+pytest==7.2.0
 pytest-datafiles==2.0.1
-pytest-env==0.6.2
-pytest-xdist==2.5.0
+pytest-env==0.8.1
+pytest-xdist==3.1.0
 pytest-timeout==2.1.0
-pyftpdlib==1.5.6
+pyftpdlib==1.5.7
 ## The following requirements were added by pip freeze:
-astroid==2.11.4
-attrs==21.4.0
-dill==0.3.4
+astroid==2.11.7
+attrs==22.2.0
+dill==0.3.6
+exceptiongroup==1.1.0
 execnet==1.9.0
 iniconfig==1.1.1
-isort==5.10.1
-lazy-object-proxy==1.7.1
+isort==5.11.4
+lazy-object-proxy==1.8.0
 mccabe==0.7.0
-packaging==21.3
-platformdirs==2.5.2
+packaging==22.0
+platformdirs==2.6.2
 pluggy==1.0.0
 ptyprocess==0.7.0
 py==1.11.0
-pyparsing==3.0.8
-pytest-forked==1.4.0
 tomli==2.0.1
-typing-extensions==4.2.0
+typing_extensions==4.4.0
 wrapt==1.14.1
diff --git a/requirements/requirements.txt b/requirements/requirements.txt
index a8ab1ef..3c621fb 100644
--- a/requirements/requirements.txt
+++ b/requirements/requirements.txt
@@ -1,14 +1,14 @@
 click==8.1.3
-grpcio==1.46.0
+grpcio==1.51.1
 Jinja2==3.1.2
 pluginbase==1.0.1
-protobuf==3.20.1
-psutil==5.9.0
+protobuf==4.21.12
+psutil==5.9.4
 ruamel.yaml==0.17.21
-ruamel.yaml.clib==0.2.6
-setuptools==44.1.1
-pyroaring==0.3.3
-ujson==5.2.0
+ruamel.yaml.clib==0.2.7
+setuptools==56.0.0
+pyroaring==0.3.4
+ujson==5.6.0
 python-dateutil==2.8.2
 ## The following requirements were added by pip freeze:
 MarkupSafe==2.1.1
diff --git a/setup.py b/setup.py
index f7adcce..e26ba09 100755
--- a/setup.py
+++ b/setup.py
@@ -419,7 +419,7 @@
     name="BuildStream",
     version=version,
     cmdclass=get_cmdclass(),
-    author="BuildStream Developers",
+    author="The Apache Software Foundation",
     author_email="dev@buildstream.apache.org",
     classifiers=[
         "Environment :: Console",
@@ -439,9 +439,9 @@
     long_description_content_type="text/x-rst; charset=UTF-8",
     url="https://buildstream.build",
     project_urls={
-        "Source": "https://gitlab.com/BuildStream/buildstream",
+        "Source": "https://github.com/apache/buildstream",
         "Documentation": "https://docs.buildstream.build",
-        "Tracker": "https://gitlab.com/BuildStream/buildstream/issues",
+        "Tracker": "https://github.com/apache/buildstream/issues",
         "Mailing List": "https://lists.apache.org/list.html?dev@buildstream.apache.org",
     },
     python_requires="~={}.{}".format(REQUIRED_PYTHON_MAJOR, REQUIRED_PYTHON_MINOR),
diff --git a/src/buildstream/_elementsourcescache.py b/src/buildstream/_elementsourcescache.py
index 8330851..dbe6cb9 100644
--- a/src/buildstream/_elementsourcescache.py
+++ b/src/buildstream/_elementsourcescache.py
@@ -12,7 +12,6 @@
 #  limitations under the License.
 #
 import os
-import grpc
 
 from ._cas.casremote import BlobNotFound
 from ._assetcache import AssetCache
@@ -227,12 +226,6 @@
             if cas_error.reason != "cache-too-full":
                 raise SourceCacheError("Failed to push source blobs: {}".format(cas_error))
             return False
-        except grpc.RpcError as e:
-            if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED:
-                raise SourceCacheError(
-                    "Failed to push source blobs with status {}: {}".format(e.code().name, e.details()), temporary=True
-                )
-            return False
 
         return True
 
@@ -269,10 +262,8 @@
                 source_digest,
                 references_directories=referenced_directories,
             )
-        except grpc.RpcError as e:
-            raise SourceCacheError(
-                "Failed to push source with status {}: {}".format(e.code().name, e.details()), temporary=True
-            )
+        except AssetCacheError as e:
+            raise SourceCacheError("Failed to push source: {}".format(e), temporary=True)
 
         return True
 
@@ -305,12 +296,10 @@
                 f.write(source.SerializeToString())
 
             self.cas._fetch_directory(remote, source.files)
-        except grpc.RpcError as e:
-            if e.code() != grpc.StatusCode.NOT_FOUND:
-                raise SourceCacheError(
-                    "Failed to pull source with status {}: {}".format(e.code().name, e.details()), temporary=True
-                )
+        except BlobNotFound:
             return False
+        except CASRemoteError as e:
+            raise SourceCacheError("Failed to pull source: {}".format(e), temporary=True)
 
         return True
 
@@ -323,9 +312,6 @@
             remote.push_directory([uri], source_proto.files)
             return True
 
-        except grpc.RpcError as e:
-            if e.code() != grpc.StatusCode.RESOURCE_EXHAUSTED:
-                raise SourceCacheError(
-                    "Failed to push source with status {}: {}".format(e.code().name, e.details()), temporary=True
-                )
-            return False
+        except AssetCacheError as e:
+            raise SourceCacheError("Failed to push source: {}".format(e), temporary=True)
+        return False
diff --git a/src/buildstream/_scheduler/queues/cachequeryqueue.py b/src/buildstream/_scheduler/queues/cachequeryqueue.py
index 0cd27c7..5251dc9 100644
--- a/src/buildstream/_scheduler/queues/cachequeryqueue.py
+++ b/src/buildstream/_scheduler/queues/cachequeryqueue.py
@@ -1,16 +1,16 @@
 #
-#  This program is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2 of the License, or (at your option) any later version.
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
 #
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
-#  Lesser General Public License for more details.
+#      http://www.apache.org/licenses/LICENSE-2.0
 #
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library. If not, see <http://www.gnu.org/licenses/>.
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
 
 from . import Queue, QueueStatus
 from ..resources import ResourceType
diff --git a/src/buildstream/_scheduler/resources.py b/src/buildstream/_scheduler/resources.py
index a11555c..736227f 100644
--- a/src/buildstream/_scheduler/resources.py
+++ b/src/buildstream/_scheduler/resources.py
@@ -1,3 +1,18 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+
+
 class ResourceType:
     CACHE = 0
     DOWNLOAD = 1
diff --git a/src/buildstream/_testing/_utils/__init__.py b/src/buildstream/_testing/_utils/__init__.py
index 5938e6a..9f2c1df 100644
--- a/src/buildstream/_testing/_utils/__init__.py
+++ b/src/buildstream/_testing/_utils/__init__.py
@@ -1 +1,14 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
 from .junction import generate_junction
diff --git a/src/buildstream/_testing/_utils/junction.py b/src/buildstream/_testing/_utils/junction.py
index a3537ac..bc1869f 100644
--- a/src/buildstream/_testing/_utils/junction.py
+++ b/src/buildstream/_testing/_utils/junction.py
@@ -1,3 +1,16 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
 import os
 import tarfile
 
diff --git a/src/buildstream/_testing/_utils/site.py b/src/buildstream/_testing/_utils/site.py
index d0e4cdb..0895e2b 100644
--- a/src/buildstream/_testing/_utils/site.py
+++ b/src/buildstream/_testing/_utils/site.py
@@ -1,3 +1,16 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
 # Some things resolved about the execution site,
 # so we dont have to repeat this everywhere
 #
diff --git a/src/buildstream/_testing/_yaml.py b/src/buildstream/_testing/_yaml.py
index 396266b..3464219 100644
--- a/src/buildstream/_testing/_yaml.py
+++ b/src/buildstream/_testing/_yaml.py
@@ -1,3 +1,16 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
 import os
 from buildstream import _yaml
 
diff --git a/src/buildstream/downloadablefilesource.py b/src/buildstream/downloadablefilesource.py
index 8bdbba2..ce91f7c 100644
--- a/src/buildstream/downloadablefilesource.py
+++ b/src/buildstream/downloadablefilesource.py
@@ -97,22 +97,36 @@
     if etag is not None:
         request.add_header("If-None-Match", etag)
 
-    with contextlib.closing(opener.open(request)) as response:
-        info = response.info()
+    try:
+        with contextlib.closing(opener.open(request)) as response:
+            info = response.info()
 
-        # some servers don't honor the 'If-None-Match' header
-        if etag and info["ETag"] == etag:
-            return None, None
+            # some servers don't honor the 'If-None-Match' header
+            if etag and info["ETag"] == etag:
+                return None, None, None
 
-        etag = info["ETag"]
+            etag = info["ETag"]
 
-        filename = info.get_filename(default_name)
-        filename = os.path.basename(filename)
-        local_file = os.path.join(directory, filename)
-        with open(local_file, "wb") as dest:
-            shutil.copyfileobj(response, dest)
+            filename = info.get_filename(default_name)
+            filename = os.path.basename(filename)
+            local_file = os.path.join(directory, filename)
+            with open(local_file, "wb") as dest:
+                shutil.copyfileobj(response, dest)
 
-    return local_file, etag
+    except urllib.error.HTTPError as e:
+        if e.code == 304:
+            # 304 Not Modified.
+            # Because we use etag only for matching ref, currently specified ref is what
+            # we would have downloaded.
+            return None, None, None
+
+        return None, None, str(e)
+    except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError, ValueError) as e:
+        # Note that urllib.request.Request in the try block may throw a
+        # ValueError for unknown url types, so we handle it here.
+        return None, None, str(e)
+
+    return local_file, etag, None
 
 
 class DownloadableFileSource(Source):
@@ -198,50 +212,39 @@
 
     def _ensure_mirror(self, activity_name: str):
         # Downloads from the url and caches it according to its sha256sum.
-        try:
-            with self.tempdir() as td:
-                # We do not use etag in case what we have in cache is
-                # not matching ref in order to be able to recover from
-                # corrupted download.
-                if self.ref and not self.is_cached():
-                    # Do not re-download the file if the ETag matches.
-                    etag = self._get_etag(self.ref)
-                else:
-                    etag = None
+        with self.tempdir() as td:
+            # We do not use etag in case what we have in cache is
+            # not matching ref in order to be able to recover from
+            # corrupted download.
+            if self.ref and not self.is_cached():
+                # Do not re-download the file if the ETag matches.
+                etag = self._get_etag(self.ref)
+            else:
+                etag = None
 
-                local_file, new_etag = self.blocking_activity(
-                    _download_file, (self.__get_urlopener(), self.url, etag, td), activity_name
-                )
+            local_file, new_etag, error = self.blocking_activity(
+                _download_file, (self.__get_urlopener(), self.url, etag, td), activity_name
+            )
 
-                if local_file is None:
-                    return self.ref
+            if error:
+                raise SourceError("{}: Error mirroring {}: {}".format(self, self.url, error), temporary=True)
 
-                # Make sure url-specific mirror dir exists.
-                if not os.path.isdir(self._mirror_dir):
-                    os.makedirs(self._mirror_dir)
-
-                # Store by sha256sum
-                sha256 = utils.sha256sum(local_file)
-                # Even if the file already exists, move the new file over.
-                # In case the old file was corrupted somehow.
-                os.rename(local_file, self._get_mirror_file(sha256))
-
-                if new_etag:
-                    self._store_etag(sha256, new_etag)
-                return sha256
-
-        except urllib.error.HTTPError as e:
-            if e.code == 304:
-                # 304 Not Modified.
-                # Because we use etag only for matching ref, currently specified ref is what
-                # we would have downloaded.
+            if local_file is None:
                 return self.ref
-            raise SourceError("{}: Error mirroring {}: {}".format(self, self.url, e), temporary=True) from e
 
-        except (urllib.error.URLError, urllib.error.ContentTooShortError, OSError, ValueError) as e:
-            # Note that urllib.request.Request in the try block may throw a
-            # ValueError for unknown url types, so we handle it here.
-            raise SourceError("{}: Error mirroring {}: {}".format(self, self.url, e), temporary=True) from e
+            # Make sure url-specific mirror dir exists.
+            if not os.path.isdir(self._mirror_dir):
+                os.makedirs(self._mirror_dir)
+
+            # Store by sha256sum
+            sha256 = utils.sha256sum(local_file)
+            # Even if the file already exists, move the new file over.
+            # In case the old file was corrupted somehow.
+            os.rename(local_file, self._get_mirror_file(sha256))
+
+            if new_etag:
+                self._store_etag(sha256, new_etag)
+            return sha256
 
     def _get_mirror_file(self, sha=None):
         if sha is not None:
diff --git a/src/buildstream/plugin.py b/src/buildstream/plugin.py
index e1e7b1f..14e35b9 100644
--- a/src/buildstream/plugin.py
+++ b/src/buildstream/plugin.py
@@ -123,7 +123,6 @@
 import multiprocessing.popen_forkserver  # type: ignore
 
 import os
-import pickle
 import queue
 import signal
 import subprocess
@@ -184,13 +183,8 @@
     try:
         result = target(*args)
         result_queue.put((None, result))
-    except Exception as exc:  # pylint: disable=broad-except
-        try:
-            # Here we send the result again, just in case it was a PickleError
-            # in which case the same exception would be thrown down
-            result_queue.put((exc, result))
-        except pickle.PickleError:
-            result_queue.put((traceback.format_exc(), None))
+    except Exception:  # pylint: disable=broad-except
+        result_queue.put((traceback.format_exc(), None))
 
 
 class Plugin:
@@ -606,7 +600,8 @@
         in order to avoid starving the scheduler.
 
         The function, its arguments and return value must all be pickleable,
-        as it will be run in another process.
+        as it will be run in another process. The function should not raise
+        an exception.
 
         This should be used whenever there is a potential for a blocking
         syscall to not return in a reasonable (<1s) amount of time.
@@ -676,12 +671,7 @@
                     raise PluginError("Background process didn't exit after 15 seconds and got killed.")
 
             if err is not None:
-                if isinstance(err, str):
-                    # This was a pickle error, this is a bug
-                    raise PluginError(
-                        "An error happened while returning the result from a blocking activity", detail=err
-                    )
-                raise err
+                raise PluginError("An error happened while running a blocking activity", detail=err)
 
             return result
 
diff --git a/src/buildstream/utils.py b/src/buildstream/utils.py
index 7d80725..267cd51 100644
--- a/src/buildstream/utils.py
+++ b/src/buildstream/utils.py
@@ -70,6 +70,10 @@
 _UMASK = os.umask(0o777)
 os.umask(_UMASK)
 
+# Only some operating systems have os.copy_file_range and even when present
+# it might not work
+_USE_CP_FILE_RANGE = hasattr(os, "copy_file_range")
+
 
 class UtilError(BstError):
     """Raised by utility functions when system calls fail.
@@ -357,6 +361,26 @@
     return h.hexdigest()
 
 
+def _copy_file_range(src, dest):
+    global _USE_CP_FILE_RANGE  # pylint: disable=global-statement
+    if not _USE_CP_FILE_RANGE:
+        return False
+    with open(src, "rb") as src_file, open(dest, "wb") as dest_file:
+        num_bytes = os.fstat(src_file.fileno()).st_size
+        while num_bytes > 0:
+            try:
+                bytes_read = os.copy_file_range(src_file.fileno(), dest_file.fileno(), num_bytes)
+                if not bytes_read:
+                    return True
+                num_bytes -= bytes_read
+            except OSError as error:
+                if error.errno in (errno.ENOSYS, errno.EXDEV):
+                    _USE_CP_FILE_RANGE = False
+                    return False
+                raise error from None
+    return True
+
+
 def safe_copy(src: str, dest: str, *, copystat: bool = True, result: Optional[FileListResult] = None) -> None:
     """Copy a file while optionally preserving attributes
 
@@ -381,7 +405,9 @@
             raise UtilError("Failed to remove destination file '{}': {}".format(dest, e)) from e
 
     try:
-        shutil.copyfile(src, dest)
+        ret = _copy_file_range(src, dest)
+        if not ret:
+            shutil.copyfile(src, dest)
     except (OSError, shutil.Error) as e:
         raise UtilError("Failed to copy '{} -> {}': {}".format(src, dest, e)) from e
 
diff --git a/tests/integration/project/elements/autotools/amhello-failure.bst b/tests/integration/project/elements/autotools/amhello-failure.bst
index 771466b..23175b5 100644
--- a/tests/integration/project/elements/autotools/amhello-failure.bst
+++ b/tests/integration/project/elements/autotools/amhello-failure.bst
@@ -12,4 +12,4 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
diff --git a/tests/integration/project/elements/autotools/amhello.bst b/tests/integration/project/elements/autotools/amhello.bst
index ee3a029..3e5532a 100644
--- a/tests/integration/project/elements/autotools/amhello.bst
+++ b/tests/integration/project/elements/autotools/amhello.bst
@@ -7,4 +7,4 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
diff --git a/tests/integration/project/elements/autotools/amhelloconfroot.bst b/tests/integration/project/elements/autotools/amhelloconfroot.bst
index 2892644..2fde4aa 100644
--- a/tests/integration/project/elements/autotools/amhelloconfroot.bst
+++ b/tests/integration/project/elements/autotools/amhelloconfroot.bst
@@ -7,7 +7,7 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
   directory: SourceFile
 
 variables:
diff --git a/tests/integration/project/elements/compose/amhello.bst b/tests/integration/project/elements/compose/amhello.bst
index bec7e31..2b57186 100644
--- a/tests/integration/project/elements/compose/amhello.bst
+++ b/tests/integration/project/elements/compose/amhello.bst
@@ -8,4 +8,4 @@
 sources:
   - kind: tar
     url: project_dir:/files/amhello.tar.gz
-    ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+    ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
diff --git a/tests/integration/project/files/amhello.tar.gz b/tests/integration/project/files/amhello.tar.gz
index afe1899..b484095 100644
--- a/tests/integration/project/files/amhello.tar.gz
+++ b/tests/integration/project/files/amhello.tar.gz
Binary files differ
diff --git a/tests/remotecache/project/elements/autotools/amhello.bst b/tests/remotecache/project/elements/autotools/amhello.bst
index 3af67ef..cb371e2 100644
--- a/tests/remotecache/project/elements/autotools/amhello.bst
+++ b/tests/remotecache/project/elements/autotools/amhello.bst
@@ -7,7 +7,7 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
 
 config:
 
diff --git a/tests/remotecache/project/files/amhello.tar.gz b/tests/remotecache/project/files/amhello.tar.gz
index afe1899..b484095 100644
--- a/tests/remotecache/project/files/amhello.tar.gz
+++ b/tests/remotecache/project/files/amhello.tar.gz
Binary files differ
diff --git a/tests/remoteexecution/project/elements/autotools/amhello.bst b/tests/remoteexecution/project/elements/autotools/amhello.bst
index 3af67ef..cb371e2 100644
--- a/tests/remoteexecution/project/elements/autotools/amhello.bst
+++ b/tests/remoteexecution/project/elements/autotools/amhello.bst
@@ -7,7 +7,7 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
 
 config:
 
diff --git a/tests/remoteexecution/project/files/amhello.tar.gz b/tests/remoteexecution/project/files/amhello.tar.gz
index afe1899..b484095 100644
--- a/tests/remoteexecution/project/files/amhello.tar.gz
+++ b/tests/remoteexecution/project/files/amhello.tar.gz
Binary files differ
diff --git a/tests/remoteexecution/project/files/sub-project/elements/autotools/amhello.bst b/tests/remoteexecution/project/files/sub-project/elements/autotools/amhello.bst
index ee3a029..3e5532a 100644
--- a/tests/remoteexecution/project/files/sub-project/elements/autotools/amhello.bst
+++ b/tests/remoteexecution/project/files/sub-project/elements/autotools/amhello.bst
@@ -7,4 +7,4 @@
 sources:
 - kind: tar
   url: project_dir:/files/amhello.tar.gz
-  ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590
+  ref: 534a884bc1974ffc539a9c215e35c4217b6f666a134cd729e786b9c84af99650
diff --git a/tests/remoteexecution/project/files/sub-project/files/amhello.tar.gz b/tests/remoteexecution/project/files/sub-project/files/amhello.tar.gz
index afe1899..b484095 100644
--- a/tests/remoteexecution/project/files/sub-project/files/amhello.tar.gz
+++ b/tests/remoteexecution/project/files/sub-project/files/amhello.tar.gz
Binary files differ
diff --git a/tests/remoteexecution/workspace.py b/tests/remoteexecution/workspace.py
index 3c97ed0..636b79a 100644
--- a/tests/remoteexecution/workspace.py
+++ b/tests/remoteexecution/workspace.py
@@ -45,12 +45,8 @@
     _input_files = [
         ".bstproject.yaml",
         "aclocal.m4",
-        "missing",
         "README",
-        "install-sh",
-        "depcomp",
         "configure.ac",
-        "compile",
         SRC,
         MAIN,
         os.path.join(SRC, "Makefile.am"),
@@ -67,12 +63,16 @@
         os.path.join(AUTO, "requests"),
         os.path.join(AUTO, "output.0"),
         os.path.join(AUTO, "output.1"),
+        "compile",
         "config.h",
         "config.h.in",
         "config.log",
         "config.status",
         "configure",
         "configure.lineno",
+        "depcomp",
+        "install-sh",
+        "missing",
         os.path.join(SRC, "hello"),
         DEPS,
         os.path.join(DEPS, "main.Po"),
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index 36c6990..753384b 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -11,13 +11,13 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 #
+import multiprocessing
 import os
 import shutil
 import signal
 from collections import namedtuple
 from contextlib import ExitStack, contextmanager
 from concurrent import futures
-from multiprocessing import Process, Queue
 from urllib.parse import urlparse
 
 import grpc
@@ -36,9 +36,11 @@
 
 class BaseArtifactShare:
     def __init__(self):
-        q = Queue()
+        multiprocessing_context = multiprocessing.get_context("forkserver")
 
-        self.process = Process(target=self.run, args=(q,))
+        q = multiprocessing_context.Queue()
+
+        self.process = multiprocessing_context.Process(target=self.run, args=(q,))
         self.process.start()
 
         # Retrieve port from server subprocess
@@ -74,14 +76,6 @@
 
             server.stop(0)
 
-        # Save collected coverage data
-        try:
-            from pytest_cov.embed import cleanup
-        except ImportError:
-            pass
-        else:
-            cleanup()
-
     # _create_server()
     #
     # Create the server that will be run in the process
@@ -138,13 +132,14 @@
         self.repodir = os.path.join(self.directory, "repo")
         os.makedirs(self.repodir)
 
-        self.cas = CASCache(self.repodir, casd=False)
-
         self.quota = quota
         self.index_only = index_only
 
         super().__init__()
 
+        # Set after subprocess creation as it's not picklable
+        self.cas = CASCache(self.repodir, casd=False)
+
     def _create_server(self):
         return create_server(
             self.repodir,
diff --git a/tests/testutils/repo/git.py b/tests/testutils/repo/git.py
index 7882be1..050d10e 100644
--- a/tests/testutils/repo/git.py
+++ b/tests/testutils/repo/git.py
@@ -78,7 +78,7 @@
         if url is not None:
             submodule["url"] = url
         self.submodules[subdir] = submodule
-        self._run_git("submodule", "add", url, subdir)
+        self._run_git("-c", "protocol.file.allow=always", "submodule", "add", url, subdir)
         self._run_git("commit", "-m", "Added the submodule")
         return self.latest_commit()
 
diff --git a/tox.ini b/tox.ini
index 6c0341e..c6998a9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,7 +16,7 @@
 # Tox global configuration
 #
 [tox]
-envlist = py37,py{38,39,310}-nocover
+envlist = py{37,38,39,310,311}
 skip_missing_interpreters = true
 isolated_build = true
 
@@ -33,30 +33,30 @@
 [testenv]
 usedevelop =
     # This is required by Cython in order to get coverage for cython files.
-    py{37,38,39,310}-!nocover: True
+    py{37,38,39,310,311}-!nocover: True
 
 commands =
     # Running with coverage reporting enabled
-    py{37,38,39,310}-!plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs}
+    py{37,38,39,310,311}-!plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs}
     # Running with coverage reporting disabled
-    py{37,38,39,310}-!plugins-nocover: pytest --basetemp {envtmpdir} {posargs}
+    py{37,38,39,310,311}-!plugins-nocover: pytest --basetemp {envtmpdir} {posargs}
     # Running external plugins tests with coverage reporting enabled
-    py{37,38,39,310}-plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc --plugins {posargs}
+    py{37,38,39,310,311}-plugins-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc --plugins {posargs}
     # Running external plugins tests with coverage disabled
-    py{37,38,39,310}-plugins-nocover: pytest --basetemp {envtmpdir} --plugins {posargs}
+    py{37,38,39,310,311}-plugins-nocover: pytest --basetemp {envtmpdir} --plugins {posargs}
 commands_post:
-    py{37,38,39,310}-!nocover: mkdir -p .coverage-reports
-    py{37,38,39,310}-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
+    py{37,38,39,310,311}-!nocover: mkdir -p .coverage-reports
+    py{37,38,39,310,311}-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname}
 deps =
-    py{37,38,39,310}: -rrequirements/requirements.txt
-    py{37,38,39,310}: -rrequirements/dev-requirements.txt
-    py{37,38,39,310}: git+https://github.com/apache/buildstream-plugins.git@{env:BST_PLUGINS_VERSION:{[config]BST_PLUGINS_VERSION}}
+    py{37,38,39,310,311}: -rrequirements/requirements.txt
+    py{37,38,39,310,311}: -rrequirements/dev-requirements.txt
+    py{37,38,39,310,311}: git+https://github.com/apache/buildstream-plugins.git@{env:BST_PLUGINS_VERSION:{[config]BST_PLUGINS_VERSION}}
 
     # Install local sample plugins for testing pip plugin origins
-    py{37,38,39,310}: {toxinidir}/tests/plugins/sample-plugins
+    py{37,38,39,310,311}: {toxinidir}/tests/plugins/sample-plugins
 
     # Install external plugins for plugin tests
-    py{37,38,39,310}-plugins: git+https://gitlab.com/buildstream/bst-plugins-experimental.git@{env:BST_PLUGINS_EXPERIMENTAL_VERSION:{[config]BST_PLUGINS_EXPERIMENTAL_VERSION}}#egg=bst_plugins_experimental[deb]
+    py{37,38,39,310,311}-plugins: git+https://gitlab.com/buildstream/bst-plugins-experimental.git@{env:BST_PLUGINS_EXPERIMENTAL_VERSION:{[config]BST_PLUGINS_EXPERIMENTAL_VERSION}}#egg=bst_plugins_experimental[deb]
 
     # Only require coverage and pytest-cov when using it
     !nocover: -rrequirements/cov-requirements.txt
@@ -84,21 +84,21 @@
 # These keys are not inherited by any other sections
 #
 setenv =
-    py{37,38,39,310}: COVERAGE_FILE = {envtmpdir}/.coverage
-    py{37,38,39,310}: BST_TEST_HOME = {envtmpdir}
-    py{37,38,39,310}: BST_TEST_XDG_CACHE_HOME = {envtmpdir}/cache
-    py{37,38,39,310}: BST_TEST_XDG_CONFIG_HOME = {envtmpdir}/config
-    py{37,38,39,310}: BST_TEST_XDG_DATA_HOME = {envtmpdir}/share
+    py{37,38,39,310,311}: COVERAGE_FILE = {envtmpdir}/.coverage
+    py{37,38,39,310,311}: BST_TEST_HOME = {envtmpdir}
+    py{37,38,39,310,311}: BST_TEST_XDG_CACHE_HOME = {envtmpdir}/cache
+    py{37,38,39,310,311}: BST_TEST_XDG_CONFIG_HOME = {envtmpdir}/config
+    py{37,38,39,310,311}: BST_TEST_XDG_DATA_HOME = {envtmpdir}/share
 
     # This is required to run tests with python 3.7
     py37: SETUPTOOLS_ENABLE_FEATURES = "legacy-editable"
 
     # This is required to get coverage for Cython
-    py{37,38,39,310}-!nocover: BST_CYTHON_TRACE = 1
+    py{37,38,39,310,311}-!nocover: BST_CYTHON_TRACE = 1
     randomized: PYTEST_ADDOPTS="--random-order-bucket=global"
 
 whitelist_externals =
-    py{37,38,39,310}:
+    py{37,38,39,310,311}:
         mv
         mkdir
 
@@ -177,7 +177,7 @@
 [testenv:mypy]
 skip_install = True
 commands =
-    mypy {posargs}
+    mypy --namespace-packages {posargs}
 deps =
     mypy==0.910
     types-protobuf