diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0716f6fd5..5780c32d4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -158,3 +158,11 @@ jobs: context: . push: true tags: backblaze/b2:${{ steps.build.outputs.version }} + + debian-release: + if: ${{ vars.B2_DEBIAN_BUCKET_UPLOAD }} + 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..42a1b5a21 --- /dev/null +++ b/.github/workflows/cd_debian.yml @@ -0,0 +1,41 @@ +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 }} + + - name: Install dependencies + run: python -m pip install -U wheel b2 + + - uses: jtdor/build-deb-action@v1 + with: + buildpackage-opts: --build=binary + + - name: Upload to B2 + working-directory: debian/artifacts + run: | + ls -1 *.deb | xargs -I {} b2 upload_file ${{ inputs.b2-upload-bucket }} {} {} diff --git a/.gitignore b/.gitignore index c0cd70cdf..159d0818c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,9 @@ venv doc/source/main_help.rst Dockerfile b2/licenses_output.txt +.pc +.pybuild +debian/backblaze-b2* +debian/.debhelper +debian/debhelper-build-stamp +debian/files diff --git a/CHANGELOG.md b/CHANGELOG.md index 07a400f35..40b945450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +* Unpin `setuptools-scm<6.0` as we don't support Python 3.5 (reason for pinning) anymore +* use `rst2ansi` conditionally as it's not available in Debian packaging ### Infrastructure * Autocomplete integration tests will now work properly even if tested package has not been installed @@ -13,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Increase timeout time in autocomplete tests to accommodate slower CI environments * Update pyinstaller to fix Linux Bundle build * Replace `pyflakes` with `ruff` for linting +* Add Debian package build to CD ## [3.9.0] - 2023-04-28 diff --git a/b2/arg_parser.py b/b2/arg_parser.py index 61863c5db..4aeb73395 100644 --- a/b2/arg_parser.py +++ b/b2/arg_parser.py @@ -13,10 +13,29 @@ import re import sys import textwrap +from contextlib import suppress import arrow from b2sdk.v2 import RetentionPeriod -from rst2ansi import rst2ansi + +rst2ansi = None +with suppress(ImportError): + from rst2ansi import rst2ansi + +if not rst2ansi: + + def rst2ansi(input_string, output_encoding='utf-8'): + """Dummy replacement of rst2ansi which is not available in Debian.""" + if isinstance(input_string, bytes): + input_string = input_string.decode(output_encoding) + + # remove double backticks + stripped = input_string.replace('``', '') + # remove code-block directive + stripped = stripped.replace('.. code-block::', '') + + return stripped + _arrow_version = tuple(int(p) for p in arrow.__version__.split(".")) diff --git a/b2/console_tool.py b/b2/console_tool.py index 7b2a17e91..f55dde187 100644 --- a/b2/console_tool.py +++ b/b2/console_tool.py @@ -41,7 +41,6 @@ import argcomplete import b2sdk import requests -import rst2ansi from b2sdk.v2 import ( ALL_CAPABILITIES, B2_ACCOUNT_INFO_DEFAULT_FILE, @@ -126,11 +125,13 @@ from b2.json_encoder import B2CliJsonEncoder from b2.version import VERSION +rst2ansi = None piplicenses = None prettytable = None with suppress(ImportError): import piplicenses import prettytable + import rst2ansi logger = logging.getLogger(__name__) @@ -3290,7 +3291,7 @@ def _fetch_license_from_url(self, url: str) -> str: def _get_single_license(self, module_dict: dict): license_ = module_dict['LicenseText'] module_name = module_dict['Name'] - if module_name == 'rst2ansi': + if module_name == 'rst2ansi' and rst2ansi: # this one module is problematic, we need to extract the license text from its docstring assert license_ == piplicenses.LICENSE_UNKNOWN # let's make sure they didn't fix it license_ = rst2ansi.__doc__ diff --git a/debian/backblaze-b2.1 b/debian/backblaze-b2.1 new file mode 100644 index 000000000..4659c6264 --- /dev/null +++ b/debian/backblaze-b2.1 @@ -0,0 +1,448 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3. +.TH BACKBLAZE-B2 "1" "June 2023" "backblaze-b2 [-h]" "User Commands" +.SH NAME +backblaze-b2 \- manual page for backblaze-b2 [-h] +.SH DESCRIPTION +backblaze\-b2 [\-h] +.IP +{authorize\-account,authorize_account,cancel\-all\-unfinished\-large\-files,cancel_all_unfinished_large_files,cancel\-large\-file,cancel_large_file,clear\-account,clear_account,copy\-file\-by\-id,copy_file_by_id,create\-bucket,create_bucket,create\-key,create_key,delete\-bucket,delete_bucket,delete\-file\-version,delete_file_version,delete\-key,delete_key,download\-file\-by\-id,download_file_by_id,download\-file\-by\-name,download_file_by_name,get\-account\-info,get_account_info,get\-bucket,get_bucket,get\-file\-info,get_file_info,get\-download\-auth,get_download_auth,get\-download\-url\-with\-auth,get_download_url_with_auth,hide\-file,hide_file,list\-buckets,list_buckets,list\-keys,list_keys,list\-parts,list_parts,list\-unfinished\-large\-files,list_unfinished_large_files,ls,rm,make\-url,make_url,make\-friendly\-url,make_friendly_url,sync,update\-bucket,update_bucket,upload\-file,upload_file,update\-file\-legal\-hold,update_file_legal_hold,update\-file\-retention,update_file_retention,replication\-setup,replication_setup,replication\-delete,replication_delete,replication\-pause,replication_pause,replication\-unpause,replication_unpause,replication\-status,replication_status,version,license,install\-autocomplete,install_autocomplete} +\&... +.IP +This program provides command\-line access to the B2 service. +.IP +There are two flows of authorization: +.IP +* call ``backblaze\-b2 authorize\-account`` and have the credentials cached in sqlite +* set ``B2_APPLICATION_KEY_ID`` and ``B2_APPLICATION_KEY`` environment +.IP +variables when running this program +.IP +This program caches authentication\-related and other data in a local SQLite database. +The location of this database is determined in the following way: +.IP +If ``profile`` arg is provided: +* ``XDG_CONFIG_HOME/b2/db\-.sqlite``, if ``XDG_CONFIG_HOME`` env var is set +* ``~/.b2db\-{profile}.sqlite`` +.IP +Otherwise: +* ``B2_ACCOUNT_INFO`` env var's value, if set +* ``~/.b2_account_info``, if it exists +* ``XDG_CONFIG_HOME/b2/account_info``, if ``XDG_CONFIG_HOME`` env var is set +* ``~/.b2_account_info``, as default +.IP +If the directory ``XDG_CONFIG_HOME/b2`` does not exist (and is needed), it is created. +Please note that the above rules may be changed in next versions of b2sdk, and in order to get +reliable authentication file location you should use ``b2 get\-account\-info``. +.IP +For more details on one command: +.IP +\&.. code\-block:: +.IP +backblaze\-b2 \fB\-\-help\fR +.IP +When authorizing with application keys, this tool requires that the key +have the ``listBuckets`` capability so that it can take the bucket names +you provide on the command line and translate them into bucket IDs for the +B2 Storage service. Each different command may required additional +capabilities. You can find the details for each command in the help for +that command. +.IP +A string provided via an optional environment variable ``B2_USER_AGENT_APPEND`` +will be appended to the User\-Agent. +.SS "options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.SS "usages:" +.TP +backblaze\-b2 authorize\-account [\-h] [\-\-profile PROFILE] +[applicationKeyId] [applicationKey] +.TP +backblaze\-b2 cancel\-all\-unfinished\-large\-files [\-h] [\-\-profile PROFILE] +bucketName +.IP +backblaze\-b2 cancel\-large\-file [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 clear\-account [\-h] [\-\-profile PROFILE] +backblaze\-b2 copy\-file\-by\-id [\-h] [\-\-profile PROFILE] [\-\-fetchMetadata] +.TP +[\-\-contentType CONTENTTYPE] [\-\-range RANGE] +[\-\-info INFO | \fB\-\-noInfo]\fR +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-fileRetentionMode {compliance,governance}] +[\-\-retainUntil TIMESTAMP] [\-\-legalHold {on,off}] +sourceFileId destinationBucketName b2FileName +.TP +backblaze\-b2 create\-bucket [\-h] [\-\-profile PROFILE] [\-\-bucketInfo BUCKETINFO] +[\-\-corsRules CORSRULES] +[\-\-lifecycleRules LIFECYCLERULES] +[\-\-fileLockEnabled] [\-\-replication REPLICATION] +[\-\-defaultServerSideEncryption {SSE\-B2,none}] +[\-\-defaultServerSideEncryptionAlgorithm {AES256}] +bucketName {allPublic,allPrivate} +.TP +backblaze\-b2 create\-key [\-h] [\-\-profile PROFILE] [\-\-bucket BUCKET] +[\-\-namePrefix NAMEPREFIX] [\-\-duration DURATION] +[\-\-allCapabilities] +keyName [capabilities] +.IP +backblaze\-b2 delete\-bucket [\-h] [\-\-profile PROFILE] bucketName +backblaze\-b2 delete\-file\-version [\-h] [\-\-profile PROFILE] [fileName] fileId +backblaze\-b2 delete\-key [\-h] [\-\-profile PROFILE] applicationKeyId +backblaze\-b2 download\-file\-by\-id [\-h] [\-\-profile PROFILE] [\-\-noProgress] +.TP +[\-\-threads THREADS] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] +[\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +fileId localFileName +.TP +backblaze\-b2 download\-file\-by\-name [\-h] [\-\-profile PROFILE] [\-\-noProgress] +[\-\-threads THREADS] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] +[\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +bucketName b2FileName localFileName +.IP +backblaze\-b2 get\-account\-info [\-h] [\-\-profile PROFILE] +backblaze\-b2 get\-bucket [\-h] [\-\-profile PROFILE] [\-\-showSize] bucketName +backblaze\-b2 get\-file\-info [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 get\-download\-auth [\-h] [\-\-profile PROFILE] [\-\-prefix PREFIX] +.TP +[\-\-duration DURATION] +bucketName +.TP +backblaze\-b2 get\-download\-url\-with\-auth [\-h] [\-\-profile PROFILE] +[\-\-duration DURATION] +bucketName fileName +.IP +backblaze\-b2 hide\-file [\-h] [\-\-profile PROFILE] bucketName fileName +backblaze\-b2 list\-buckets [\-h] [\-\-profile PROFILE] [\-\-json] +backblaze\-b2 list\-keys [\-h] [\-\-profile PROFILE] [\-\-long] +backblaze\-b2 list\-parts [\-h] [\-\-profile PROFILE] largeFileId +backblaze\-b2 list\-unfinished\-large\-files [\-h] [\-\-profile PROFILE] bucketName +backblaze\-b2 ls [\-h] [\-\-profile PROFILE] [\-\-long] [\-\-json] [\-\-replication] +.IP +[\-\-versions] [\-\-recursive] [\-\-withWildcard] +bucketName [folderName] +.IP +backblaze\-b2 rm [\-h] [\-\-profile PROFILE] [\-\-dryRun] [\-\-threads THREADS] +.IP +[\-\-queueSize QUEUESIZE] [\-\-noProgress] [\-\-failFast] +[\-\-versions] [\-\-recursive] [\-\-withWildcard] +bucketName [folderName] +.IP +backblaze\-b2 make\-url [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 make\-friendly\-url [\-h] [\-\-profile PROFILE] bucketName fileName +backblaze\-b2 sync [\-h] [\-\-profile PROFILE] [\-\-noProgress] [\-\-dryRun] +.TP +[\-\-allowEmptySource] [\-\-excludeAllSymlinks] +[\-\-threads THREADS] [\-\-syncThreads SYNCTHREADS] +[\-\-downloadThreads DOWNLOADTHREADS] +[\-\-uploadThreads UPLOADTHREADS] +[\-\-compareVersions {none,modTime,size}] +[\-\-compareThreshold MILLIS] [\-\-excludeRegex REGEX] +[\-\-includeRegex REGEX] [\-\-excludeDirRegex REGEX] +[\-\-excludeIfModifiedAfter TIMESTAMP] +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] [\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +[\-\-incrementalMode] [\-\-skipNewer | \fB\-\-replaceNewer]\fR +[\-\-delete | \fB\-\-keepDays\fR DAYS] +source destination +.TP +backblaze\-b2 update\-bucket [\-h] [\-\-profile PROFILE] [\-\-bucketInfo BUCKETINFO] +[\-\-corsRules CORSRULES] +[\-\-lifecycleRules LIFECYCLERULES] +[\-\-defaultRetentionMode {compliance,governance,none}] +[\-\-defaultRetentionPeriod period] +[\-\-replication REPLICATION] [\-\-fileLockEnabled] +[\-\-defaultServerSideEncryption {SSE\-B2,none}] +[\-\-defaultServerSideEncryptionAlgorithm {AES256}] +bucketName [{allPublic,allPrivate}] +.TP +backblaze\-b2 upload\-file [\-h] [\-\-profile PROFILE] [\-\-noProgress] [\-\-quiet] +[\-\-contentType CONTENTTYPE] +[\-\-minPartSize MINPARTSIZE] [\-\-sha1 SHA1] +[\-\-threads THREADS] [\-\-info INFO] +[\-\-custom\-upload\-timestamp CUSTOM_UPLOAD_TIMESTAMP] +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-legalHold {on,off}] +[\-\-fileRetentionMode {compliance,governance}] +[\-\-retainUntil TIMESTAMP] [\-\-incrementalMode] +bucketName localFilePath b2FileName +.TP +backblaze\-b2 update\-file\-legal\-hold [\-h] [\-\-profile PROFILE] +[fileName] fileId {on,off} +.TP +backblaze\-b2 update\-file\-retention [\-h] [\-\-profile PROFILE] +[\-\-retainUntil TIMESTAMP] +[\-\-bypassGovernance] +[fileName] fileId +{governance,compliance,none} +.TP +backblaze\-b2 replication\-setup [\-h] [\-\-profile PROFILE] +[\-\-destination\-profile DESTINATION_PROFILE] +[\-\-name NAME] [\-\-priority PRIORITY] +[\-\-file\-name\-prefix PREFIX] +[\-\-include\-existing\-files] +SOURCE_BUCKET_NAME DESTINATION_BUCKET_NAME +.TP +backblaze\-b2 replication\-delete [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-pause [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-unpause [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-status [\-h] [\-\-profile PROFILE] +[\-\-rule REPLICATION_RULE_NAME] +[\-\-destination\-profile DESTINATION_PROFILE] +[\-\-dont\-scan\-destination] +[\-\-output\-format {console,json,csv}] +[\-\-noProgress] +[\-\-columns COLUMN ONE,COLUMN TWO] +SOURCE_BUCKET_NAME +.IP +backblaze\-b2 version [\-h] [\-\-profile PROFILE] +backblaze\-b2 license [\-h] [\-\-profile PROFILE] +backblaze\-b2 install\-autocomplete [\-h] [\-\-profile PROFILE] [\-\-shell {bash}] +.IP +{authorize\-account,authorize_account,cancel\-all\-unfinished\-large\-files,cancel_all_unfinished_large_files,cancel\-large\-file,cancel_large_file,clear\-account,clear_account,copy\-file\-by\-id,copy_file_by_id,create\-bucket,create_bucket,create\-key,create_key,delete\-bucket,delete_bucket,delete\-file\-version,delete_file_version,delete\-key,delete_key,download\-file\-by\-id,download_file_by_id,download\-file\-by\-name,download_file_by_name,get\-account\-info,get_account_info,get\-bucket,get_bucket,get\-file\-info,get_file_info,get\-download\-auth,get_download_auth,get\-download\-url\-with\-auth,get_download_url_with_auth,hide\-file,hide_file,list\-buckets,list_buckets,list\-keys,list_keys,list\-parts,list_parts,list\-unfinished\-large\-files,list_unfinished_large_files,ls,rm,make\-url,make_url,make\-friendly\-url,make_friendly_url,sync,update\-bucket,update_bucket,upload\-file,upload_file,update\-file\-legal\-hold,update_file_legal_hold,update\-file\-retention,update_file_retention,replication\-setup,replication_setup,replication\-delete,replication_delete,replication\-pause,replication_pause,replication\-unpause,replication_unpause,replication\-status,replication_status,version,license,install\-autocomplete,install_autocomplete} +\&... +.IP +This program provides command\-line access to the B2 service. +.IP +There are two flows of authorization: +.IP +* call ``backblaze\-b2 authorize\-account`` and have the credentials cached in sqlite +* set ``B2_APPLICATION_KEY_ID`` and ``B2_APPLICATION_KEY`` environment +.IP +variables when running this program +.IP +This program caches authentication\-related and other data in a local SQLite database. +The location of this database is determined in the following way: +.IP +If ``profile`` arg is provided: +* ``XDG_CONFIG_HOME/b2/db\-.sqlite``, if ``XDG_CONFIG_HOME`` env var is set +* ``~/.b2db\-{profile}.sqlite`` +.IP +Otherwise: +* ``B2_ACCOUNT_INFO`` env var's value, if set +* ``~/.b2_account_info``, if it exists +* ``XDG_CONFIG_HOME/b2/account_info``, if ``XDG_CONFIG_HOME`` env var is set +* ``~/.b2_account_info``, as default +.IP +If the directory ``XDG_CONFIG_HOME/b2`` does not exist (and is needed), it is created. +Please note that the above rules may be changed in next versions of b2sdk, and in order to get +reliable authentication file location you should use ``b2 get\-account\-info``. +.IP +For more details on one command: +.IP +\&.. code\-block:: +.IP +backblaze\-b2 \fB\-\-help\fR +.IP +When authorizing with application keys, this tool requires that the key +have the ``listBuckets`` capability so that it can take the bucket names +you provide on the command line and translate them into bucket IDs for the +B2 Storage service. Each different command may required additional +capabilities. You can find the details for each command in the help for +that command. +.IP +A string provided via an optional environment variable ``B2_USER_AGENT_APPEND`` +will be appended to the User\-Agent. +.SS "options:" +.TP +\fB\-h\fR, \fB\-\-help\fR +show this help message and exit +.SS "usages:" +.TP +backblaze\-b2 authorize\-account [\-h] [\-\-profile PROFILE] +[applicationKeyId] [applicationKey] +.TP +backblaze\-b2 cancel\-all\-unfinished\-large\-files [\-h] [\-\-profile PROFILE] +bucketName +.IP +backblaze\-b2 cancel\-large\-file [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 clear\-account [\-h] [\-\-profile PROFILE] +backblaze\-b2 copy\-file\-by\-id [\-h] [\-\-profile PROFILE] [\-\-fetchMetadata] +.TP +[\-\-contentType CONTENTTYPE] [\-\-range RANGE] +[\-\-info INFO | \fB\-\-noInfo]\fR +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-fileRetentionMode {compliance,governance}] +[\-\-retainUntil TIMESTAMP] [\-\-legalHold {on,off}] +sourceFileId destinationBucketName b2FileName +.TP +backblaze\-b2 create\-bucket [\-h] [\-\-profile PROFILE] [\-\-bucketInfo BUCKETINFO] +[\-\-corsRules CORSRULES] +[\-\-lifecycleRules LIFECYCLERULES] +[\-\-fileLockEnabled] [\-\-replication REPLICATION] +[\-\-defaultServerSideEncryption {SSE\-B2,none}] +[\-\-defaultServerSideEncryptionAlgorithm {AES256}] +bucketName {allPublic,allPrivate} +.TP +backblaze\-b2 create\-key [\-h] [\-\-profile PROFILE] [\-\-bucket BUCKET] +[\-\-namePrefix NAMEPREFIX] [\-\-duration DURATION] +[\-\-allCapabilities] +keyName [capabilities] +.IP +backblaze\-b2 delete\-bucket [\-h] [\-\-profile PROFILE] bucketName +backblaze\-b2 delete\-file\-version [\-h] [\-\-profile PROFILE] [fileName] fileId +backblaze\-b2 delete\-key [\-h] [\-\-profile PROFILE] applicationKeyId +backblaze\-b2 download\-file\-by\-id [\-h] [\-\-profile PROFILE] [\-\-noProgress] +.TP +[\-\-threads THREADS] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] +[\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +fileId localFileName +.TP +backblaze\-b2 download\-file\-by\-name [\-h] [\-\-profile PROFILE] [\-\-noProgress] +[\-\-threads THREADS] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] +[\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +bucketName b2FileName localFileName +.IP +backblaze\-b2 get\-account\-info [\-h] [\-\-profile PROFILE] +backblaze\-b2 get\-bucket [\-h] [\-\-profile PROFILE] [\-\-showSize] bucketName +backblaze\-b2 get\-file\-info [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 get\-download\-auth [\-h] [\-\-profile PROFILE] [\-\-prefix PREFIX] +.TP +[\-\-duration DURATION] +bucketName +.TP +backblaze\-b2 get\-download\-url\-with\-auth [\-h] [\-\-profile PROFILE] +[\-\-duration DURATION] +bucketName fileName +.IP +backblaze\-b2 hide\-file [\-h] [\-\-profile PROFILE] bucketName fileName +backblaze\-b2 list\-buckets [\-h] [\-\-profile PROFILE] [\-\-json] +backblaze\-b2 list\-keys [\-h] [\-\-profile PROFILE] [\-\-long] +backblaze\-b2 list\-parts [\-h] [\-\-profile PROFILE] largeFileId +backblaze\-b2 list\-unfinished\-large\-files [\-h] [\-\-profile PROFILE] bucketName +backblaze\-b2 ls [\-h] [\-\-profile PROFILE] [\-\-long] [\-\-json] [\-\-replication] +.IP +[\-\-versions] [\-\-recursive] [\-\-withWildcard] +bucketName [folderName] +.IP +backblaze\-b2 rm [\-h] [\-\-profile PROFILE] [\-\-dryRun] [\-\-threads THREADS] +.IP +[\-\-queueSize QUEUESIZE] [\-\-noProgress] [\-\-failFast] +[\-\-versions] [\-\-recursive] [\-\-withWildcard] +bucketName [folderName] +.IP +backblaze\-b2 make\-url [\-h] [\-\-profile PROFILE] fileId +backblaze\-b2 make\-friendly\-url [\-h] [\-\-profile PROFILE] bucketName fileName +backblaze\-b2 sync [\-h] [\-\-profile PROFILE] [\-\-noProgress] [\-\-dryRun] +.TP +[\-\-allowEmptySource] [\-\-excludeAllSymlinks] +[\-\-threads THREADS] [\-\-syncThreads SYNCTHREADS] +[\-\-downloadThreads DOWNLOADTHREADS] +[\-\-uploadThreads UPLOADTHREADS] +[\-\-compareVersions {none,modTime,size}] +[\-\-compareThreshold MILLIS] [\-\-excludeRegex REGEX] +[\-\-includeRegex REGEX] [\-\-excludeDirRegex REGEX] +[\-\-excludeIfModifiedAfter TIMESTAMP] +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-sourceServerSideEncryption {SSE\-C}] +[\-\-sourceServerSideEncryptionAlgorithm {AES256}] +[\-\-write\-buffer\-size BYTES] [\-\-skip\-hash\-verification] +[\-\-max\-download\-streams\-per\-file MAX_DOWNLOAD_STREAMS_PER_FILE] +[\-\-incrementalMode] [\-\-skipNewer | \fB\-\-replaceNewer]\fR +[\-\-delete | \fB\-\-keepDays\fR DAYS] +source destination +.TP +backblaze\-b2 update\-bucket [\-h] [\-\-profile PROFILE] [\-\-bucketInfo BUCKETINFO] +[\-\-corsRules CORSRULES] +[\-\-lifecycleRules LIFECYCLERULES] +[\-\-defaultRetentionMode {compliance,governance,none}] +[\-\-defaultRetentionPeriod period] +[\-\-replication REPLICATION] [\-\-fileLockEnabled] +[\-\-defaultServerSideEncryption {SSE\-B2,none}] +[\-\-defaultServerSideEncryptionAlgorithm {AES256}] +bucketName [{allPublic,allPrivate}] +.TP +backblaze\-b2 upload\-file [\-h] [\-\-profile PROFILE] [\-\-noProgress] [\-\-quiet] +[\-\-contentType CONTENTTYPE] +[\-\-minPartSize MINPARTSIZE] [\-\-sha1 SHA1] +[\-\-threads THREADS] [\-\-info INFO] +[\-\-custom\-upload\-timestamp CUSTOM_UPLOAD_TIMESTAMP] +[\-\-destinationServerSideEncryption {SSE\-B2,SSE\-C}] +[\-\-destinationServerSideEncryptionAlgorithm {AES256}] +[\-\-legalHold {on,off}] +[\-\-fileRetentionMode {compliance,governance}] +[\-\-retainUntil TIMESTAMP] [\-\-incrementalMode] +bucketName localFilePath b2FileName +.TP +backblaze\-b2 update\-file\-legal\-hold [\-h] [\-\-profile PROFILE] +[fileName] fileId {on,off} +.TP +backblaze\-b2 update\-file\-retention [\-h] [\-\-profile PROFILE] +[\-\-retainUntil TIMESTAMP] +[\-\-bypassGovernance] +[fileName] fileId +{governance,compliance,none} +.TP +backblaze\-b2 replication\-setup [\-h] [\-\-profile PROFILE] +[\-\-destination\-profile DESTINATION_PROFILE] +[\-\-name NAME] [\-\-priority PRIORITY] +[\-\-file\-name\-prefix PREFIX] +[\-\-include\-existing\-files] +SOURCE_BUCKET_NAME DESTINATION_BUCKET_NAME +.TP +backblaze\-b2 replication\-delete [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-pause [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-unpause [\-h] [\-\-profile PROFILE] +SOURCE_BUCKET_NAME REPLICATION_RULE_NAME +.TP +backblaze\-b2 replication\-status [\-h] [\-\-profile PROFILE] +[\-\-rule REPLICATION_RULE_NAME] +[\-\-destination\-profile DESTINATION_PROFILE] +[\-\-dont\-scan\-destination] +[\-\-output\-format {console,json,csv}] +[\-\-noProgress] +[\-\-columns COLUMN ONE,COLUMN TWO] +SOURCE_BUCKET_NAME +.IP +backblaze\-b2 version [\-h] [\-\-profile PROFILE] +backblaze\-b2 license [\-h] [\-\-profile PROFILE] +backblaze\-b2 install\-autocomplete [\-h] [\-\-profile PROFILE] [\-\-shell {bash}] +.SH "SEE ALSO" +The full documentation for +.B backblaze-b2 +is maintained as a Texinfo manual. If the +.B info +and +.B backblaze-b2 +programs are properly installed at your site, the command +.IP +.B info backblaze-b2 +.PP +should give you access to the complete manual. diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..276daf21d --- /dev/null +++ b/debian/changelog @@ -0,0 +1,102 @@ +backblaze-b2 (3.9.0-1) unstable; urgency=medium + + * New upstream release + * d/control: Add constraint X-Python3-Version to 3.7+ + + -- yed podtrzitko Mon, 19 Jun 2023 22:17:48 +0700 + + +backblaze-b2 (1.3.8-6) unstable; urgency=medium + + [ Debian Janitor ] + * Remove constraints unnecessary since buster: + + Build-Depends-Indep: Drop versioned constraint on python3-arrow, + python3-requests and python3-six. + + -- Jelmer Vernooij Tue, 06 Dec 2022 18:52:43 +0000 + +backblaze-b2 (1.3.8-5) unstable; urgency=medium + + [ Ondřej Nový ] + * d/control: Update Maintainer field with new Debian Python Team + contact address. + * d/control: Update Vcs-* fields with new Debian Python Team Salsa + layout. + + [ Debian Janitor ] + * Set upstream metadata fields: Repository. + * Remove obsolete field Name from debian/upstream/metadata (already present in + machine-readable debian/copyright). + * Update standards version to 4.5.0, no changes needed. + + -- Sandro Tosi Wed, 08 Sep 2021 20:21:59 -0400 + +backblaze-b2 (1.3.8-4) unstable; urgency=medium + + * Drop yapf from B-D (Closes: #948084). + + -- Ondřej Nový Sat, 04 Jan 2020 19:31:22 +0100 + +backblaze-b2 (1.3.8-3) unstable; urgency=medium + + [ Ondřej Nový ] + * Bump Standards-Version to 4.4.1. + + [ Gianfranco Costamagna ] + * Team upload + * Build depend on pylint, not old pylint3 package + + -- Gianfranco Costamagna Tue, 10 Dec 2019 15:21:05 +0100 + +backblaze-b2 (1.3.8-2) unstable; urgency=medium + + [ Ondřej Nový ] + * Bump Standards-Version to 4.4.0. + + [ Ondřej Kobližek ] + * Remove untrue reference about full doc in Texinfo manual from man pages. + (Closes: #927048) + + -- Ondřej Kobližek Tue, 06 Aug 2019 02:13:35 +0200 + +backblaze-b2 (1.3.8-1) unstable; urgency=medium + + * New upstream release + * Bump standards version to 4.3.0 (no changes) + * Bump debhelper compat level to 12 and use debhelper-compat + + -- Ondřej Nový Mon, 31 Dec 2018 23:22:03 +0100 + +backblaze-b2 (1.3.6-1) unstable; urgency=medium + + * New upstream release (Closes: #903519) + * d/control: Remove ancient X-Python3-Version field + * Rebase patches + * Bump standards version to 4.2.1 (no changes) + * Bump debhelper compat level to 11 + * Add upstream metadata + + -- Ondřej Nový Sat, 29 Sep 2018 11:49:29 +0200 + +backblaze-b2 (1.1.0-1) unstable; urgency=medium + + * New upstream release + * Update man pages + + -- Ondřej Kobližek Mon, 04 Dec 2017 08:43:40 +0100 + +backblaze-b2 (1.0.0-2) unstable; urgency=medium + + [ Ondřej Nový ] + * Change maintainer to Python Applications Packaging Team + + [ Ondřej Kobližek ] + * Rename binary from b2 -> backblaze-b2. (Closes: #883137) + + -- Ondřej Kobližek Thu, 30 Nov 2017 14:08:46 +0100 + +backblaze-b2 (1.0.0-1) unstable; urgency=medium + + * Initial release. (Closes: #874639) + + -- Ondřej Kobližek Tue, 14 Nov 2017 07:17:18 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..b3a5e1d34 --- /dev/null +++ b/debian/control @@ -0,0 +1,43 @@ +Source: backblaze-b2 +Maintainer: Debian Python Team +Uploaders: Ondřej Kobližek , + Ondřej Nový , +Section: utils +Priority: optional +Build-Depends: debhelper-compat (= 13), + dh-python, + pylint, + python3-all, + python3-logfury, + python3-mock, + python3-pytest, + python3-pyflakes, + python3-setuptools, + python3-setuptools-scm, + python3-tqdm, + yapf3, + python3-argcomplete, + python3-pexpect, + python3-pip, +Build-Depends-Indep: python3-arrow, + python3-requests, + python3-six, + python3-argcomplete, +Standards-Version: 4.6.2 +Homepage: https://github.com/Backblaze/B2_Command_Line_Tool +Vcs-Browser: https://salsa.debian.org/python-team/packages/backblaze-b2 +Vcs-Git: https://salsa.debian.org/python-team/packages/backblaze-b2.git + +Package: backblaze-b2 +X-Python3-Version: >= 3.7 +Architecture: all +# pybuild strips the dependency version, be explicit +Depends: python3-b2sdk (>= 1.21.0) + ${misc:Depends}, + ${python3:Depends}, +Description: Command Line Tool for Backblaze B2 + The command-line tool that gives easy access to all of the capabilities + of B2 Cloud Storage. + This program provides command-line access to the B2 service. + . + Usage: For more details try command: backblaze-b2 help diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..fefb4838d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: B2_Command_Line_Tool +Source: https://github.com/Backblaze/B2_Command_Line_Tool + +Files: * +Copyright: 2015-2023, Backblaze, Inc. +License: Expat + +Files: debian/* +Copyright: 2017, 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/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/manpages b/debian/manpages new file mode 100644 index 000000000..bc3ddf15c --- /dev/null +++ b/debian/manpages @@ -0,0 +1 @@ +debian/backblaze-b2.1 diff --git a/debian/patches/001-rename-entrypoint.diff b/debian/patches/001-rename-entrypoint.diff new file mode 100644 index 000000000..cb0d1b2a3 --- /dev/null +++ b/debian/patches/001-rename-entrypoint.diff @@ -0,0 +1,11 @@ +rename entry point +--- B2_Command_Line_Tool.orig/setup.py ++++ B2_Command_Line_Tool/setup.py +@@ -130,6 +130,6 @@ setup( + # "scripts" keyword. Entry points provide cross-platform support and allow + # pip to create the appropriate form of executable for the target platform. + entry_points={ +- 'console_scripts': ['b2=b2.console_tool:main'], ++ 'console_scripts': ['backblaze-b2=b2.console_tool:main'], + }, + ) diff --git a/debian/patches/002-remove-rst2ansi.diff b/debian/patches/002-remove-rst2ansi.diff new file mode 100644 index 000000000..a30b56f52 --- /dev/null +++ b/debian/patches/002-remove-rst2ansi.diff @@ -0,0 +1,9 @@ +--- B2_Command_Line_Tool.orig/requirements.txt ++++ B2_Command_Line_Tool/requirements.txt +@@ -5,6 +5,5 @@ docutils==0.19 + idna>=2.2.0; platform_system == 'Java' + importlib-metadata>=3.3.0; python_version < '3.8' + phx-class-registry==4.0.6 +-rst2ansi==0.1.5 + tabulate==0.9.0 + tqdm>=4.65.0,<5.0.0 diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 000000000..41f4378a2 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +002-remove-rst2ansi.diff +001-rename-entrypoint.diff diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..99e211312 --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#! /usr/bin/make -f + +#export DH_VERBOSE=1 +export PYBUILD_NAME=backblaze-b2 + +%: + dh $@ --with python3 --buildsystem=pybuild 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..92abc7b13 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,11 @@ +Depends: backblaze-b2, + python3-all, + python3-mock, + python3-pytest, + python3-pyflakes, + python3-setuptools, + yapf3, +Test-Command: set -e; for py in $(py3versions -i); do echo "[*] testing on $py:"; $py setup.py test ./test/unit ./test/static 2>&1; done + +Depends: backblaze-b2, +Test-Command: HOME=$AUTOPKGTEST_TMP backblaze-b2 --help 2>&1 | grep -q "This program provides command-line access to the B2 service." diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 000000000..25ab40678 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,4 @@ +Bug-Database: https://github.com/Backblaze/B2_Command_Line_Tool/issues +Bug-Submit: https://github.com/Backblaze/B2_Command_Line_Tool/issues/new +Repository: https://github.com/Backblaze/B2_Command_Line_Tool.git +Repository-Browse: https://github.com/Backblaze/B2_Command_Line_Tool diff --git a/debian/watch b/debian/watch new file mode 100644 index 000000000..31dec4001 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/backblaze-b2-$1\.tar\.gz/ \ + https://github.com/Backblaze/B2_Command_Line_Tool/tags .*/v?(\d\S*)\.tar\.gz diff --git a/setup.py b/setup.py index 899d1a179..b9dbd534d 100644 --- a/setup.py +++ b/setup.py @@ -112,7 +112,7 @@ def read_requirements(extra=None): 'doc': read_requirements('doc'), 'license': read_requirements('license'), }, - 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