Skip to main content

Large scale VCS change management

Project description

Silver-Platter logo

Silver-Platter makes it possible to contribute automatable changes to source code in a version control system (codemods).

It automatically creates a local checkout of a remote repository, makes user-specified changes, publishes those changes on the remote hosting site and then creates a pull request.

In addition to that, it can also perform basic maintenance on branches that have been proposed for merging - such as restarting them if they have conflicts due to upstream changes.

Silver-Platter powers the Debian Janitor (https://janitor.debian.org/) and Kali Janitor (https://kali.janitor.org/). However, it is an independent project and can be used fine as a standalone tool. The UI is still a bit rough around the edges, I’d be grateful for any feedback from people using it - please file bugs in the issue tracker at https://github.com/jelmer/silver-platter/issues/new.

Getting started

To log in to a code-hosting site, use svp login:

svp login https://github.com/

The simplest way to create a change as a merge proposal is to run something like:

svp run --mode=propose ./framwork.sh https://github.com/jelmer/dulwich

where framwork.sh makes some modifications to a working copy and prints the commit message and body for the pull request to standard out. For example:

#!/bin/sh
sed -i 's/framwork/framework/' README.rst
echo "Fix common typo: framwork ⇒ framework"

If you leave pending changes, silver-platter will automatically create a commit and use the output from the script as the commit message. Scripts also create their own commits if they prefer - this is especially useful if they would like to create multiple commits.

Recipes

To make this process a little bit easier to repeat, recipe files can be used. For the example above, we could create a framwork.yaml with the following contents:

---
name: framwork
command: |-
 sed -i 's/framwork/framework/' README.rst
 echo "Fix common typo: framwork ⇒ framework"
mode: propose
merge-request:
  commit-message: Fix a typo
  description:
    markdown: |-
      I spotted that we often mistype *framework* as *framwork*.

To execute this recipe, run:

svp run --recipe=framwork.yaml https://github.com/jelmer/dulwich

See example.yaml for an example recipe with plenty of comments.

In addition, you can run a particular recipe over a set of repositories by specifying a candidate list. For example, if candidates.yaml looked like this:

---
- url: https://github.com/dulwich/dulwich
- url: https://github.com/jelmer/xandikos

then the following command would process each repository in turn:

svp run --recipe=framwork.yaml --candidates=candidates.yaml

Batch Mode

Use batch mode when you’re going to make a large number of changes and would like to review or modify the diffs before sending them out:

svp batch generate --recipe=framwork.yaml --candidates=candidate.syml framwork

This will then create a directory called “framwork”, with a file called batch.yaml with all the pending changes:

name: framwork
work:
- url: https://github.com/dulwich/dulwich
  name: dulwich
  description: I spotted that we often mistype *framework* as *framwork*.
  commit-message: Fix a typo
  mode: propose
- url: https://github.com/jelmer/xandikos
  name: dulwich
  description: I spotted that we often mistype *framework* as *framwork*.
  commit-message: Fix a typo
  mode: propose
recipe: ../framwork.yaml

For each of the candidates, a clone with the changes is created. You can introspect and modify the clones as appropriate.

After you review the changes, edit batch.yaml as you see fit - remove entries that don’t appear to be correct, edit the details for the merge requests, etc.

Once you’re happy, you can publish the results:

svp batch publish framwork

This will publish all the changes, using the mode and parameters specified in batch.yaml.

batch.yaml is automatically stripped of any entries in work that have fully landed, i.e. where the pull request has been merged or where the changes were pushed to the origin.

To check up on the status of your changes, run svp batch status:

svp batch status framwork

And to refresh any merge proposals that may have become out of date, run publish again:

svp batch publish framwork

Supported hosters

At the moment, the following code hosters are supported:

Working with Debian packages

Several common operations for Debian packages have dedicated subcommands under the debian-svp command. These will also automatically look up packaging repository location for any Debian package names that are specified.

  • upload-pending: Build and upload a package and push/propose the changelog updates.

  • run: Similar to svp run but specific to Debian packages: it ensures that the upstream and pristine-tar branches are available as well, can optionally update the changelog, and can test that the branch still builds.

Some Debian-specific example recipes are provided in examples/debian/:

  • lintian-fixes.yaml: Run the lintian-brush command to fix common issues reported by lintian.

  • new-upstream-release.yaml: Merge in a new upstream release.

  • multi-arch-hints.yaml: Apply multi-arch hints.

  • orphan.yaml: Mark a package as orphaned, update its Maintainer field and move it to the common Debian salsa group.

  • rules-requires-root.yaml: Mark a package as “Rules-Requires-Root: no”

  • cme.yaml: Run “cme fix dpkg”, from the cme package.

debian-svp run takes package name arguments that will be resolved to repository locations from the Vcs-Git field in the package.

See debian-svp COMMAND --help for more details.

Examples running debian-svp:

# Create merge proposal running lintian-brush against Samba
debian-svp run --recipe=examples/lintian-brush.yaml samba

# Upload pending changes for tdb
debian-svp upload-pending tdb

# Upload pending changes for any packages maintained by Jelmer,
# querying vcswatch.
debian-svp upload-pending --vcswatch --maintainer jelmer@debian.org

# Import the latest upstream release for tdb, without testing
# the build afterwards.
debian-svp run --recipe=examples/debian/new-upstream-release.yaml \
    --no-build-verify tdb

# Apply multi-arch hints to tdb
debian-svp run --recipe=examples/debian/multiarch-hints.yaml tdb

The following environment variables are provided for Debian packages:

  • DEB_SOURCE: the source package name

  • DEB_UPDATE_CHANGELOG: indicates whether a changelog entry should be added. Either “leave” (leave alone) or “update” (update changelog).

Credentials

The svp hosters subcommand can be used to display the hosting sites that silver-platter is aware of:

svp hosters

And to log into a new hosting site, simply run svp login BASE-URL, e.g.:

svp login https://launchpad.net/

Exit status

svp run will exit 0 if no changes have been made, 1 if at least one repository has been changed and 2 in case of trouble.

Python API

Other than the command-line API, silver-platter also has a Python API. The core class is the Workspace context manager, which exists in two forms:

  • silver_platter.workspace.Workspace (for generic projects)

  • silver_platter.debian.Workspace (for Debian packages)

An example, adding a new entry to a changelog file in the dulwich Debian package and creating a merge proposal with that change:

from silver_platter.debian import Workspace
import subprocess

with Workspace.from_apt_package(package="dulwich") as ws:
    subprocess.check_call(['dch', 'some change'], cwd=ws.path)
    ws.commit()  # Behaves like debcommit
    ws.publish(mode='propose')

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

silver_platter-0.5.26.tar.gz (34.6 kB view details)

Uploaded Source

Built Distributions

silver_platter-0.5.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.26-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (4.8 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

silver_platter-0.5.26-cp312-cp312-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

silver_platter-0.5.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.26-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (4.8 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

silver_platter-0.5.26-cp311-cp311-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

silver_platter-0.5.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.26-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (4.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686

silver_platter-0.5.26-cp310-cp310-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

silver_platter-0.5.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.26-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (4.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

silver_platter-0.5.26-cp39-cp39-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

silver_platter-0.5.26-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

silver_platter-0.5.26-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (4.8 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

silver_platter-0.5.26-cp38-cp38-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

Details for the file silver_platter-0.5.26.tar.gz.

File metadata

  • Download URL: silver_platter-0.5.26.tar.gz
  • Upload date:
  • Size: 34.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for silver_platter-0.5.26.tar.gz
Algorithm Hash digest
SHA256 66027c6848f5c2f9e819cabadd3432522051b478e16ef94de8f3a01c6a3168a9
MD5 95193cc6433a09261020595eaa0521e5
BLAKE2b-256 6a5b75be3e56378d9751e457b927a7bffdce446f184adf3f6d2dbf574aca1abe

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 91a6677d1edabcc00cfb2a135b290967f8d9495aaefa04f690c75325acea6f94
MD5 7691594877a1abc5334c91c2a155f3ff
BLAKE2b-256 619c06e4af90f7e34e4f805487766fbcf20cd5685a62fd83b1592dfa70581c08

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 22be62618d2a8dcc3ff95dba5d20002a83880a868584bb0f4305fe4603316008
MD5 22e26b65826652db328d79298ce9b025
BLAKE2b-256 451066ff1d371c8a3a55bf08ab2cf93fda7e5a8d737d615bc382145b3dc1762e

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3df292637112121b7060d2eb3d0f477948fbb7052b67879b4bd7b4add38e480d
MD5 fe8553a3e3d9068354da08b7bdc903a8
BLAKE2b-256 8c53701cc0706f3d47d4cb180626360974843e6c6e89795d5e5cb4b1e8cb8224

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 16b6f59b546a93252e9f297435d36b0493e7327774a315d6758f6b1a74baec5b
MD5 430146296c91e55fcfce06e38cc70bca
BLAKE2b-256 e5b0dd47076a5e2e945c3aa4e8704d4464cb4f91593851b79dd61b6ec6d830bc

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 e51ef6337c578ca7d7616cf88313aa66db8586261eaf1956436acba1f864790e
MD5 418a7685920d2cd44d42bd32b4f0d75e
BLAKE2b-256 72ce52e5c3f98e8edd939770c71556f2c72f7ccc6672d2742e4bf82186c9a836

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aae455d7a0ee8f0fcf82778b831e150c6f35a24e8998bb365f329c5bb11b8d9b
MD5 1cffedc58205b2528c3a4a2a592a9110
BLAKE2b-256 41f51fcfe6a77b6feabbf36a108a830c8787df13d27650fa8bf052e4da737456

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4babe1be4a56fa1d9b1552e0c6c22801fc2f6f30f9680796962219a6ec76e3b1
MD5 ed0e8bb504b222261c1df4c228e6292a
BLAKE2b-256 76861444e0f4cc6010e57fb70ab0ebf7c35481403202eba2b5f8fef9cf4aa498

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 d1685cd57b0ecd2444d749fd322588cebaa0a4fefd7ce9e9476d09916404214c
MD5 5798bb108f5a837f2d7adab6fec210a2
BLAKE2b-256 38fe3cc46a81d57b3b5b88527fc2a6e1a1e2fdbffa0f06f05cafc16345723877

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 adf07fee6ada190239e920c5df1cab9c29415d33a56c89705ab8fc932bca2200
MD5 c172715558ddf909df2184a177e41f84
BLAKE2b-256 24cbffc8629c4b56af31e6b2e449e414f1e18ef82ebdc32c5979d1cd3d4a8549

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a4149084f8f74081807d3bc061469a3bb361a2cecfcd02e6fd90785d76c8298
MD5 3e471f6748d462ce968fb2dad2f6f086
BLAKE2b-256 14cc552e3d94524d0da2f8cfd139f74a9e4a0bd091d3e84d1bc9a09c49dd3fda

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 08e417758b17e3a5506b73c97e4c8781b56623ef2e59374f781cc21195539c5b
MD5 f49e1f4f01062b3daac0562f266cd36a
BLAKE2b-256 8497d7abdd2bd415ea1c374ecfe7f60ab535d517f734685bb208149998491998

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ffb107c02cf130276f155387d27c291758e187a4a0220d2abeae745f96fe9d28
MD5 19486638854cf34fb7588fcc1be4a033
BLAKE2b-256 96c81b4e9cbdeaf57eeea3055cfee8a2cc62fc56859bff21261e889c678b4cd4

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a60dc76f8d458f9cd9c311512958f11179f8d098ce74d2e4db955bce2d18117
MD5 1adbe1df30327231a40070bc11acdc0d
BLAKE2b-256 5005a1b435ffa81de926d1e13f27069a510c3eb938149a9c80d1658fe722220c

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 677bfc4c7e5003d077e297e7eb65558a7637a152541f0169e2bfbcbba3ba9ebe
MD5 0c846203826d3bd13e3676aa330c87e8
BLAKE2b-256 1a4868e0463a40b2999ae5be3f9059cf8c5700aa41e8458e93f2b4ac9ea2fe8e

See more details on using hashes here.

File details

Details for the file silver_platter-0.5.26-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for silver_platter-0.5.26-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f2802ccfc4ca82dd59d2a7fbebb48929d2c085fc19e3b0c3e7d2586bb427b542
MD5 b4a76f7b0a7910b67241c1fa2ff6a802
BLAKE2b-256 55b385c408f37ee0cbed02044f66294549a50225ac5464202268661e919a0b47

See more details on using hashes here.

Supported by

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