From 0da8e6e0515e8ca357083e2beb0374a17a9008db Mon Sep 17 00:00:00 2001 From: yedpodtrzitko Date: Fri, 16 Jun 2023 15:59:25 +0800 Subject: [PATCH 1/3] ci: add debian build pipeline --- .github/workflows/cd.yml | 7 ++ .github/workflows/cd_debian.yml | 43 +++++++++++ .gitignore | 6 ++ CHANGELOG.md | 2 + debian/changelog | 133 ++++++++++++++++++++++++++++++++ debian/control | 45 +++++++++++ debian/copyright | 33 ++++++++ debian/debhelper-build-stamp | 1 + debian/gbp.conf | 2 + debian/rules | 11 +++ debian/source/format | 1 + debian/source/options | 1 + debian/tests/control | 12 +++ debian/upstream/metadata | 4 + debian/watch | 5 ++ setup.py | 3 +- 16 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cd_debian.yml create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/debhelper-build-stamp create mode 100644 debian/gbp.conf create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options create mode 100644 debian/tests/control create mode 100644 debian/upstream/metadata create mode 100644 debian/watch diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d8e78c98a..cb808e608 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -48,3 +48,10 @@ jobs: with: user: __token__ password: ${{ env.B2_PYPI_PASSWORD }} + + debian-release: + name: Build Debian Package + uses: ./.github/workflows/cd_debian.yml + secrets: inherit + with: + b2-upload-bucket: ${{ vars.B2_DEBIAN_BUCKET_UPLOAD }} diff --git a/.github/workflows/cd_debian.yml b/.github/workflows/cd_debian.yml new file mode 100644 index 000000000..6ae9d966e --- /dev/null +++ b/.github/workflows/cd_debian.yml @@ -0,0 +1,43 @@ +name: Debian Continuous Delivery + +on: + workflow_call: + inputs: + b2-upload-bucket: + required: true + type: string + +env: + PYTHON_DEFAULT_VERSION: "3.11" + +jobs: + build-deb: + env: + # dont run tests in Debian build, we ran them already + DEB_BUILD_OPTIONS: nocheck + B2_APPLICATION_KEY_ID: '${{ secrets.B2_DEBIAN_APPLICATION_KEY_ID }}' + B2_APPLICATION_KEY: '${{ secrets.B2_DEBIAN_APPLICATION_KEY }}' + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_DEFAULT_VERSION }} + + - uses: jtdor/build-deb-action@v1 + with: + buildpackage-opts: --build=binary + + - uses: qualk/upload-artifact-as-is@master + with: + path: debian/artifacts/*.deb + + - name: Upload to B2 + working-directory: debian/artifacts + run: | + ls -1 *.deb | xargs -I {} sudo apt install ./{} + pip install -U wheel b2 + ls -1 *.deb | xargs -I {} b2 upload_file ${{ inputs.b2-upload-bucket }} {} {} diff --git a/.gitignore b/.gitignore index 25b7093a0..423a66f15 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,9 @@ dist venv .venv .vscode +.pc +.pybuild +debian/python3-b2sdk* +debian/.debhelper +debian/debhelper-build-stamp +debian/files diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bc3d3d72..2cad5985e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,12 +11,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * `version_utils` decorators now ignore `current_version` parameter to better fit `apiver` needs +* Unpin `setuptools-scm<6.0` as we don't support Python 3.5 (reason for pinning) anymore ### Fixed * Circular symlinks no longer cause infinite loops when syncing a folder ### Infrastructure * Replaced `pyflakes` with `ruff` for linting +* Add Debian package build to CI ## [1.21.0] - 2023-04-17 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..786c097be --- /dev/null +++ b/debian/changelog @@ -0,0 +1,133 @@ +python-b2sdk (1.21.0-1) unstable; urgency=medium + + * New upstream release. + * d/control: Add constraint X-Python3-Version to 3.7+ + + -- yed podtrzitko Thu, 15 Jun 2023 13:29:34 +0800 + +python-b2sdk (1.17.3-2) unstable; urgency=medium + + [ Debian Janitor ] + * Set upstream metadata fields: Repository. + * Remove obsolete field Name from debian/upstream/metadata (already present in + machine-readable debian/copyright). + + -- Jelmer Vernooij Mon, 17 Oct 2022 00:28:54 +0100 + +python-b2sdk (1.17.3-1) unstable; urgency=medium + + * Team upload. + * New upstream release. + * Build depend on python3-pyfakefs and python3-pytest-lazy-fixture, now + required to run the tests. + * Update PYBUILD_TEST_ARGS to skip integration tests. + * Update autopkgtest to install -pyfakefs and -pytest-lazy-fixture and skip + integration tests. + * Update debian/patches/0001-Don-t-use-setuptools-scm.patch and + debian/patches/0002-Hardcoded-b2sdk-version.patch. + * Update Standards-Version, no changes needed. + + -- Emanuele Rocca Wed, 14 Sep 2022 21:43:39 +0200 + +python-b2sdk (1.3.0-4) unstable; urgency=medium + + * debian/tests/control + - fix pytest -k syntax for pytest7 also for autopkgtests + + -- Sandro Tosi Sat, 09 Jul 2022 10:45:50 -0400 + +python-b2sdk (1.3.0-3) unstable; urgency=medium + + * debian/rules + - fix pytest -k syntax for pytest7; Closes: #1013724 + + -- Sandro Tosi Sun, 26 Jun 2022 13:09:52 -0400 + +python-b2sdk (1.3.0-2) unstable; urgency=medium + + * Team upload. + * debian/control + - use proper team email address + + -- Sandro Tosi Wed, 25 Aug 2021 00:24:22 -0400 + +python-b2sdk (1.3.0-1) unstable; urgency=medium + + * Team upload. + + [ Ondřej Nový ] + * d/control: Update Vcs-* fields with new Debian Python Team Salsa + layout. + + [ Emmanuel Arias ] + * New upstream version 1.3.0 (Closes: #975721) + * d/rules: Skip test_raw_api test. + - This test use network access. + * d/control: Use python3-pytest and python3-pytest-mock (Closes: #981766). + - Remove python3-mock. + * d/tests/control: Use py3versions -s instead of py3versions -i. + * wrap-and-sort. + * d/salsa-ci.yml: enable salsa-ci. + * d/patch: Add patch to remove setuptools-scm dependency. + - Add patch to hardcoded version to 1.3.0. + + -- Emmanuel Arias Wed, 10 Feb 2021 19:13:13 -0300 + +python-b2sdk (1.1.4-1) unstable; urgency=medium + + * New upstream release. + + -- Ondřej Kobližek Wed, 26 Aug 2020 10:18:22 +0200 + +python-b2sdk (1.0.2-3) unstable; urgency=medium + + * d/control: + - Bump debhelper compat levet to 13 + - Bump standards version to 4.5.0 (no changes) + - Update mailing-list address in Maintainer + - Remove upper version limit for python3-arrow as dependency + + -- Ondřej Kobližek Mon, 25 May 2020 07:13:34 +0200 + +python-b2sdk (1.0.2-2) unstable; urgency=medium + + * Add python3-arrow as dependency (Closes: #955565). + + -- Ondřej Nový Fri, 22 May 2020 10:29:25 +0200 + +python-b2sdk (1.0.2-1) unstable; urgency=medium + + * Change my email address. + * New upstream release. + * d/tests/control: Add dependency python3-arrow. + + -- Ondřej Kobližek Wed, 23 Oct 2019 08:15:57 +0200 + +python-b2sdk (1.0.0-2) unstable; urgency=medium + + * d/control: remove upper version constraint for python3-arrow (no needed + for Python version greater than 3.4) + https://github.com/Backblaze/b2-sdk-python/pull/64 + + -- Ondřej Kobližek Fri, 11 Oct 2019 13:10:37 +0200 + +python-b2sdk (1.0.0-1) unstable; urgency=medium + + * New upstream release + * d/control: + - Add Rules-Requires-Root + - Bump standards version to 4.4.1 (no changes) + + -- Ondřej Kobližek Fri, 04 Oct 2019 12:30:44 +0200 + +python-b2sdk (1.0.0~rc1-2) unstable; urgency=medium + + * Rebuild for source upload + + -- Ondřej Kobližek Mon, 05 Aug 2019 06:45:31 +0200 + +python-b2sdk (1.0.0~rc1-1) unstable; urgency=medium + + * Initial release (Closes: #931755) + + -- Ondřej Kobližek Fri, 19 Jul 2019 00:20:08 +0200 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..a543def93 --- /dev/null +++ b/debian/control @@ -0,0 +1,45 @@ +Source: python-b2sdk +Section: python +Priority: optional +Maintainer: Debian Python Modules Team +Uploaders: + Ondřej Kobližek , +Build-Depends: + debhelper-compat (= 13), + dh-python, + python3-all, + python3-arrow, + python3-pyfakefs, + python3-logfury, + python3-pyflakes, + python3-pytest, + python3-pytest-lazy-fixture, + python3-pytest-mock, + python3-requests, + python3-setuptools, + python3-setuptools-scm, + python3-six, + python3-tqdm, + yapf3, +Standards-Version: 4.6.1 +Homepage: https://github.com/Backblaze/b2-sdk-python +Vcs-Git: https://salsa.debian.org/python-team/packages/python-b2sdk.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-b2sdk +Testsuite: autopkgtest-pkg-python +Rules-Requires-Root: no + +Package: python3-b2sdk +X-Python3-Version: >= 3.7 +Architecture: all +Depends: + python3-arrow, + ${misc:Depends}, + ${python3:Depends}, +Description: Python library to access B2 cloud storage + Client library and a few handy utilities for easy access to all of + the capabilities of B2 Cloud Storage. + . + B2 command-line tool (backblaze-b2 package) is an example of how it + can be used to provide command-line access to the B2 service, but + there are many possible applications (including FUSE filesystems, + storage backend drivers for backup applications etc). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..cbc3e4a4e --- /dev/null +++ b/debian/copyright @@ -0,0 +1,33 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: b2-sdk-python +Upstream-Contact: Backblaze, Inc. +Source: https://github.com/Backblaze/b2-sdk-python + +Files: * +Copyright: + 2015-2019, Backblaze, Inc. +License: Expat + +Files: debian/* +Copyright: + 2019, Ondřej Kobližek +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 000000000..1af8e1425 --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +python3-b2sdk diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 000000000..3879982a0 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,2 @@ +[DEFAULT] +debian-branch=debian/master diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..042d38e4d --- /dev/null +++ b/debian/rules @@ -0,0 +1,11 @@ +#! /usr/bin/make -f + +export PYBUILD_NAME=b2sdk +export PYBUILD_TEST_PYTEST=1 +export PYBUILD_TEST_ARGS=test/static/ test/unit/ -k "not test_requests_notice_file" + +%: + dh $@ --buildsystem=pybuild --with python3 + +override_dh_installchangelogs: + dh_installchangelogs $(CURDIR)/README.md diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 000000000..cb61fa526 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = "^[^/]*[.]egg-info/" diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 000000000..c7cc28d17 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,12 @@ +Depends: + python3-all, + python3-arrow, + python3-b2sdk, + python3-pyfakefs, + python3-pyflakes, + python3-pytest, + python3-pytest-lazy-fixture, + python3-pytest-mock, + python3-setuptools, + yapf3, +Test-Command: set -e; for py in $(py3versions -s); do echo "[*] testing on $py:"; $py -m pytest test/unit/ -k "not test_requests_notice_file" 2>&1; done diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 000000000..28adc1597 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/Backblaze/b2-sdk-python/issues +Bug-Submit: https://github.com/Backblaze/b2-sdk-python/issues/new +Repository: https://github.com/Backblaze/b2-sdk-python.git +Repository-Browse: https://github.com/Backblaze/b2-sdk-python.git diff --git a/debian/watch b/debian/watch new file mode 100644 index 000000000..a17dcbd7f --- /dev/null +++ b/debian/watch @@ -0,0 +1,5 @@ +version=4 +opts=\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/,\ +filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/python-b2sdk-$1\.tar\.gz/ \ + https://github.com/Backblaze/b2-sdk-python/tags .*/v?(\d\S*)\.tar\.gz diff --git a/setup.py b/setup.py index 16db078e2..d94ae94b8 100644 --- a/setup.py +++ b/setup.py @@ -109,7 +109,7 @@ def read_requirements(extra=None): # for example: # $ pip install -e .[dev,test] extras_require={'doc': read_requirements('doc')}, - setup_requires=['setuptools_scm<6.0'], + setup_requires=['setuptools_scm'], use_scm_version=True, # If there are data files included in your packages that need to be @@ -131,3 +131,4 @@ def read_requirements(extra=None): 'pyinstaller40': ['hook-dirs=b2sdk._pyinstaller:get_hook_dirs'], }, ) + From b158539679a0c845f99e393452f375b85cde022e Mon Sep 17 00:00:00 2001 From: yed podtrzitko Date: Mon, 19 Jun 2023 22:01:01 +0800 Subject: [PATCH 2/3] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michał Nowacki <77497496+mpnowacki-reef@users.noreply.github.com> --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cad5985e..cd771409d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Infrastructure * Replaced `pyflakes` with `ruff` for linting -* Add Debian package build to CI +* Add Debian package build to CD ## [1.21.0] - 2023-04-17 From e1190118072258e878adf3be7c7b45ffb0410647 Mon Sep 17 00:00:00 2001 From: yedpodtrzitko Date: Mon, 19 Jun 2023 22:04:53 +0800 Subject: [PATCH 3/3] address code review --- .github/workflows/cd.yml | 1 + .github/workflows/cd_debian.yml | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index cb808e608..de86e59c3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -50,6 +50,7 @@ jobs: password: ${{ env.B2_PYPI_PASSWORD }} debian-release: + if: ${{ vars.B2_DEBIAN_BUCKET_UPLOAD }} name: Build Debian Package uses: ./.github/workflows/cd_debian.yml secrets: inherit diff --git a/.github/workflows/cd_debian.yml b/.github/workflows/cd_debian.yml index 6ae9d966e..646c672c4 100644 --- a/.github/workflows/cd_debian.yml +++ b/.github/workflows/cd_debian.yml @@ -31,10 +31,6 @@ jobs: with: buildpackage-opts: --build=binary - - uses: qualk/upload-artifact-as-is@master - with: - path: debian/artifacts/*.deb - - name: Upload to B2 working-directory: debian/artifacts run: |