Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2024"
license = "MIT"
repository = "https://github.com/atrinik/protocol"
rust-version = "1.97.1"
version = "0.2.0"
version = "0.2.1"

[workspace.dependencies]
bytes = "1.12.1"
Expand Down
4 changes: 2 additions & 2 deletions policy/rust-crate-candidate.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"schema_version": 1,
"name": "atrinik-protocol",
"version": "0.2.0",
"version": "0.2.1",
"base_published_version": "0.1.0",
"status": "unpublished",
"publication": "reviewed-manual-publication"
"publication": "reviewed-automatic-publication"
}
8 changes: 4 additions & 4 deletions tools/crate_publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ def verify_release_inventory(value, tag):
require(listed == expected, 'release checksums do not cover exact asset inventory')


def verify_crate(path, revision, inventory):
def verify_crate(path, revision, inventory, version=VERSION):
with (tarfile.open(fileobj=io.BytesIO(path), mode='r:gz') if isinstance(path, bytes) else tarfile.open(path, 'r:gz')) as archive:
members = []
total = 0
for member in archive:
total += member.size
require(len(members) < 256 and total <= MAX_BYTES, 'crate archive exceeds bound')
members.append(member)
prefix = f'{NAME}-{VERSION}/'
prefix = f'{NAME}-{version}/'
names = []
for member in members:
require(member.isfile() and member.name.startswith(prefix), 'unexpected archive member')
Expand All @@ -163,7 +163,7 @@ def read(name):
require(vcs == {'git': {'sha1': revision}, 'path_in_vcs': 'crates/atrinik-protocol'}, 'crate VCS provenance mismatch')
manifest = tomllib.loads(read('Cargo.toml').decode())
package = manifest['package']
require(package['name'] == NAME and package['version'] == VERSION and package.get('publish') == ['crates-io'], 'crate is not the publishable reviewed version')
require(package['name'] == NAME and package['version'] == version and package.get('publish') == ['crates-io'], 'crate is not the publishable reviewed version')
def no_source_override(value):
if isinstance(value, dict):
require('path' not in value and 'git' not in value, 'unapproved crate dependency source')
Expand All @@ -176,7 +176,7 @@ def no_source_override(value):
no_source_override(manifest.get(key, {}))
lock = tomllib.loads(read('Cargo.lock').decode())
for package in lock['package']:
if package['name'] == NAME and package['version'] == VERSION:
if package['name'] == NAME and package['version'] == version:
require('source' not in package, 'unexpected root crate source')
else:
require(package.get('source') == 'registry+https://github.com/rust-lang/crates.io-index', 'unapproved locked dependency source')
Expand Down
2 changes: 1 addition & 1 deletion tools/test_crate_release_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_rejects_missing_candidate(self) -> None:

def test_rejects_reusing_published_version(self) -> None:
path = self.root / "Cargo.toml"
path.write_text(path.read_text().replace('version = "0.2.0"', 'version = "0.1.0"'))
path.write_text(path.read_text().replace('version = "0.2.1"', 'version = "0.1.0"'))
self.assert_rejected("cannot be relabeled")

def test_rejects_policy_drift(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tools/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ cargo package --locked --offline --allow-dirty \
--manifest-path crates/atrinik-protocol/Cargo.toml \
--target-dir "${protocol_crate_target}"
test -s "${protocol_crate_target}/package/${protocol_crate_asset}"
python3 - "${protocol_crate_target}/package/${protocol_crate_asset}" "$(git rev-parse HEAD)" <<'PYTHON'
python3 - "${protocol_crate_target}/package/${protocol_crate_asset}" "$(git rev-parse HEAD)" "${protocol_crate_version}" <<'PYTHON'
from pathlib import Path
import sys
from tools.crate_publication import verify_crate
verify_crate(Path(sys.argv[1]), sys.argv[2], Path("policy/rust-crate-files.txt").read_text().splitlines())
verify_crate(Path(sys.argv[1]), sys.argv[2], Path("policy/rust-crate-files.txt").read_text().splitlines(), sys.argv[3])
PYTHON
protocol_crate_listing=$(mktemp /tmp/atrinik-protocol-crate-files.XXXXXX)
protocol_crate_extract=$(mktemp -d /tmp/atrinik-protocol-crate-extract.XXXXXX)
Expand Down
Loading