Skip to main content

A simple utility to make creating and managing APT repositories on S3

Project description

pydeb-s3

pydeb-s3 is a Python port of deb-s3, a simple utility to make creating and managing APT repositories on S3.

Most existing guides on using S3 to host an APT repository have you using something like reprepro to generate the repository file structure, and then s3cmd to sync the files to S3.

The annoying thing about this process is it requires you to maintain a local copy of the file tree for regenerating and syncing the next time. Personally, my process is to use one-off virtual machines with Vagrant, script out the build process, and then would prefer to just upload the final .deb from my Mac.

With pydeb-s3, there is no need for this. pydeb-s3 features:

  • Downloads the existing package manifest and parses it.
  • Updates it with the new package, replacing the existing entry if already there or adding a new one if not.
  • Uploads the package itself, the Packages manifest, and the Packages.gz manifest. It will skip the uploading if the package is already there.
  • Updates the Release file with the new hashes and file sizes.

Getting Started

Install the package via pip:

$ pip install pydeb-s3

Now to upload a package, simply use:

$ pydeb-s3 upload --bucket my-bucket my-deb-package-1.0.0_amd64.deb
>> Examining package file my-deb-package-1.0.0_amd64.deb
>> Retrieving existing package manifest
>> Uploading package and new manifests to S3
   -- Transferring pool/m/my/my-deb-package-1.0.0_amd64.deb
   -- Transferring dists/stable/main/binary-amd64/Packages
   -- Transferring dists/stable/main/binary-amd64/Packages.gz
   -- Transferring dists/stable/Release
>> Update complete.

For Google Cloud Storage (or other S3-compatible endpoints) you need to disable SDK checksum negotiation headers and set visibility settings to nil:

$ pydeb-s3 upload --bucket my-bucket --endpoint https://storage.googleapis.com --checksum-when-required --visibility nil my-deb-package-1.0.0_amd64.deb

Usage

Usage:
  pydeb-s3 upload FILES
  pydeb-s3 list
  pydeb-s3 show PACKAGE VERSION ARCH
  pydeb-s3 exists PACKAGE VERSION ARCH [PACKAGE VERSION ARCH ...]
  pydeb-s3 copy PACKAGE TO_CODENAME TO_COMPONENT
  pydeb-s3 delete PACKAGE
  pydeb-s3 verify
  pydeb-s3 clean

Commands

upload

Uploads the given files to a S3 bucket as an APT repository.

pydeb-s3 upload [--arch=ARCH] [--preserve-versions] [--lock] [--fail-if-exists]
              [--skip-package-upload] [--bucket=BUCKET] [--prefix=PREFIX]
              [--origin=ORIGIN] [--suite=SUITE] [--codename=CODENAME]
              [--component=COMPONENT] [--access-key-id=KEY] [--secret-access-key=KEY]
              [--s3-region=REGION] [--force-path-style] [--proxy-uri=URI]
              [--visibility=VISIBILITY] [--sign=KEY] [--gpg-options=OPTIONS]
              [--encryption] [--quiet] [--cache-control=CONTROL]
              FILES

list

Lists packages in given codename, component, and optionally architecture.

pydeb-s3 list [--long] [--arch=ARCH] [--bucket=BUCKET] [--prefix=PREFIX]
             [--codename=CODENAME] [--component=COMPONENT]
             [--s3-region=REGION] [--quiet]

show

Shows information about a package.

pydeb-s3 show PACKAGE VERSION ARCH [--bucket=BUCKET] [--prefix=PREFIX]
                          [--codename=CODENAME] [--component=COMPONENT]
                          [--s3-region=REGION] [--quiet]

exists

Check if packages exist in the repository.

pydeb-s3 exists PACKAGE VERSION ARCH [PACKAGE VERSION ARCH ...]
                 [--bucket=BUCKET] [--prefix=PREFIX]
                 [--codename=CODENAME] [--component=COMPONENT]
                 [--s3-region=REGION] [--quiet]

copy

Copy the package named PACKAGE to given codename and component.

pydeb-s3 copy PACKAGE TO_CODENAME TO_COMPONENT
              [--arch=ARCH] [--lock] [--versions=VERSIONS]
              [--preserve-versions] [--fail-if-exists]
              [--bucket=BUCKET] [--prefix=PREFIX]
              [--codename=CODENAME] [--component=COMPONENT]
              [--s3-region=REGION] [--quiet]

delete

Remove the package named PACKAGE.

pydeb-s3 delete PACKAGE [--arch=ARCH] [--lock] [--versions=VERSIONS]
                  [--bucket=BUCKET] [--prefix=PREFIX]
                  [--origin=ORIGIN] [--suite=SUITE]
                  [--codename=CODENAME] [--component=COMPONENT]
                  [--s3-region=REGION] [--visibility=VISIBILITY]
                  [--sign=KEY] [--gpg-options=OPTIONS]
                  [--encryption] [--quiet] [--cache-control=CONTROL]

verify

Verifies that the files in the package manifests exist.

pydeb-s3 verify [--fix-manifests] [--bucket=BUCKET] [--prefix=PREFIX]
               [--origin=ORIGIN] [--suite=SUITE]
               [--codename=CODENAME] [--component=COMPONENT]
               [--s3-region=REGION] [--visibility=VISIBILITY]
               [--sign=KEY] [--gpg-options=OPTIONS]
               [--encryption] [--quiet] [--cache-control=CONTROL]

clean

Delete packages from the pool which are no longer referenced.

pydeb-s3 clean [--lock] [--bucket=BUCKET] [--prefix=PREFIX]
              [--origin=ORIGIN] [--suite=SUITE]
              [--codename=CODENAME] [--component=COMPONENT]
              [--s3-region=REGION] [--visibility=VISIBILITY]
              [--sign=KEY] [--gpg-options=OPTIONS]
              [--encryption] [--quiet] [--cache-control=CONTROL]

Configuration

AWS Credentials

pydeb-s3 supports multiple methods for AWS credentials:

  1. Command-line options:

    • --access-key-id and --secret-access-key
    • --session-token (for temporary credentials)
  2. Environment variables:

    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION
  3. AWS Config file: Uses standard boto3 credential resolution

S3 Bucket

The --bucket option is required for all commands.

Visibility

The --visibility option controls ACL on uploaded files:

  • public (default) - public-read
  • private - private
  • authenticated - authenticated-read
  • nil - do not set ACL (for buckets without ACL support)

Example S3 IAM Policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": ["s3:ListBucket"],
            "Resource": ["arn:aws:s3:::BUCKETNAME"]
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:GetObject",
                "s3:DeleteObject",
                "s3:DeleteObjectVersion",
                "s3:GetObjectAcl",
                "s3:GetObjectVersionAcl",
                "s3:PutObjectAcl",
                "s3:PutObjectVersionAcl"
            ],
            "Resource": ["arn:aws:s3:::BUCKETNAME/*"]
        }
    ]
}

License

MIT License - see LICENSE file for details.

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydeb_s3-0.1.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydeb_s3-0.1.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file pydeb_s3-0.1.0.tar.gz.

File metadata

  • Download URL: pydeb_s3-0.1.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for pydeb_s3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 404f9d918e513c3c917bb2d972a034b07252a638f1822bb68cb56ed7ffb0f5d5
MD5 24e02e399ded7847911438d38eb1875c
BLAKE2b-256 efa6a96b087a3d0e6e039752549d186129eea7283f4c371225c800dbc02b635d

See more details on using hashes here.

File details

Details for the file pydeb_s3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pydeb_s3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.13.5 HTTPX/0.28.1

File hashes

Hashes for pydeb_s3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8287bd1db58c61acbbccf79b7f0f4a7d94f55d1319eae6edbfed48f542d4fab
MD5 4b98e1661f05b1b2af12dbb4363bdf5c
BLAKE2b-256 0ee6f943b7e2a51cf14cb25f148e47b716995f4e2a07a22aa54edd011b64a26e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page