]> git.proxmox.com Git - proxmox.git/blob - README.rst
Merge branch 'proxmox-apt-merge'
[proxmox.git] / README.rst
1 Local cargo config
2 ==================
3
4 This repository ships with a ``.cargo/config`` that replaces the crates.io
5 registry with packaged crates located in ``/usr/share/cargo/registry``.
6
7 A similar config is also applied building with dh_cargo. Cargo.lock needs to be
8 deleted when switching between packaged crates and crates.io, since the
9 checksums are not compatible.
10
11 To reference new dependencies (or updated versions) that are not yet packaged,
12 the dependency needs to point directly to a path or git source.
13
14 Steps for Releases
15 ==================
16
17 - Run ./bump.sh <CRATE> [patch|minor|major|<VERSION>]
18 -- Fill out changelog
19 -- Confirm bump commit
20 - Build packages with `make deb`.
21 -- Don't forget to commit updated d/control!
22
23 Adding Crates
24 =============
25
26 1) At the top level:
27 - Generate the crate: ``cargo new --lib the-name``
28 - Sort the crate into ``Cargo.toml``'s ``workspace.members``
29
30 2) In the new crate's ``Cargo.toml``:
31 - In ``[package]`` set:
32 authors.workspace = true
33 license.workspace = true
34 edition.workspace = true
35 exclude.workspace = true
36 - Add a meaningful ``description``
37 - Copy ``debian/copyright`` and ``debian/debcargo.toml`` from another subcrate.
38
39 Adding a new Dependency
40 =======================
41
42 1) At the top level:
43 - Add it to ``[workspace.dependencies]`` specifying the version and any
44 features that should be enabled throughout the workspace
45
46 2) In each member's ``Cargo.toml``:
47 - Add it to the desired dependencies section with ``workspace = true`` and no
48 version specified.
49 - If this member requires additional features, add only the extra features to
50 the member dependency.
51
52 Updating a Dependency's Version
53 ===============================
54
55 1) At the top level:
56 - Bump the version in ``[workspace.dependencies]`` as desired.
57 - Check for deprecations or breakage throughout the workspace.
58
59 Notes on Workspace Inheritance
60 ==============================
61
62 Common metadata (like authors, license, ..) are inherited throughout the
63 workspace. If new fields are added that are identical for all crates, they
64 should be defined in the top-level ``Cargo.toml`` file's
65 ``[workspace.package]`` section, and inherited in all members explicitly by
66 setting ``FIELD.workspace = true`` in the member's ``[package]`` section.
67
68 Dependency information is also inherited throughout the workspace, allowing a
69 single dependency specification in the top-level Cargo.toml file to be used by
70 all members.
71
72 Some restrictions apply:
73 - features can only be added in members, never removed (this includes
74 ``default_features = false``!)
75 - the base feature set at the workspace level should be the minimum (possibly
76 empty!) set required by all members
77 - workspace dependency specifications cannot include ``optional``
78 - if needed, the ``optional`` flag needs to be set at the member level when
79 using a workspace dependency