]> git.proxmox.com Git - debcargo-conf.git/blob - README.rst
Merge branch 'pending-crates-io'
[debcargo-conf.git] / README.rst
1 Instructions
2 ============
3
4 To get set up, run::
5
6 apt update && apt install debcargo
7
8 Then for each new package:
9
10 To package a new crate, or to update an existing crate
11 ------------------------------------------------------
12
13 ::
14
15 ./new-package.sh <rust-crate-name> # or
16 ./update.sh <rust-crate-name>
17
18 and follow its instructions.
19
20 Note that ``new-package.sh`` is just a symlink to ``update.sh``, to help newcomers.
21
22 To package an older version of a crate
23 --------------------------------------
24
25 To maintain an old version of a crate alongside the latest one, first make sure
26 the latest version is packaged by doing all of the above, then run::
27
28 ./new-package.sh <rust-crate-name> <old-version> # or
29 ./update.sh <rust-crate-name> <old-version>
30
31 and follow its instructions. To save time, you can first copy anything relevant
32 from ``src/<rust-crate-name>`` to ``src/<rust-crate-name>-<old-version>``, then
33 adapt it as needed.
34
35 To prepare a release
36 --------------------
37
38 ::
39
40 ./release.sh <rust-crate-name> # or
41 ./release.sh <rust-crate-name> <old-version> # as appropriate
42
43 This prepares the necessary Debian files in ``build/``, and creates a git
44 branch to manage the packaging until it is accepted in Debian itself. You need
45 to run additional commands after this - more specific instructions are given to
46 you about this, by the script after you run it.
47
48 Holding packages at old versions
49 --------------------------------
50
51 If you need to keep the latest version in Debian at an older version than is
52 released on crates.io, e.g. to upload an important bugfix without being blocked
53 on having to package all the dependencies of the newest version, you can::
54
55 REALVER=<old-version> ./update.sh <rust-crate-name> # then
56 REALVER=<old-version> ./release.sh <rust-crate-name>
57
58
59 DD instructions
60 ===============
61
62 To set up a suitable build environment for ``./build.sh``::
63
64 $ sudo apt-get install devscripts reprepro debootstrap sbuild
65 $ sudo sbuild-createchroot --include=eatmydata,ccache,gnupg,dh-cargo,cargo,lintian \
66 --chroot-prefix debcargo-unstable unstable \
67 /srv/chroot/debcargo-unstable-amd64-sbuild http://deb.debian.org/debian
68
69
70 General packaging tips
71 ======================
72
73 Dependencies on clippy
74 ----------------------
75
76 Patch away dependencies on "clippy" unless it is a "real" dependency. Usually
77 crates only use clippy to lint themselves and it is not a "real" dependency
78 in the sense that they actually import clippy's code for what they do.
79
80 If you want to be sure, `rg clippy` and check that all the usages of it are
81 inside `cfg_attr` declarations. If so, then just get rid of it.
82
83 OS-specific crates
84 ------------------
85
86 See redox-syscall for examples on how to deal with these.
87
88 If this is unclear, ask on IRC.
89
90 Architecture-specific crates
91 ----------------------------
92
93 This is a bit harder. Usually there are two options:
94
95 1. The crate should build a dummy/no-op version of itself "out-of-the-box"
96 on the architectures it doesn't work on.
97 2. Dependent crates should depend on it with a platform-specific dependency,
98 see https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies
99
100 (1) involves less burden for others, both for dependent crates and for us
101 packagers, since we don't have to override d/rules to ignore test failures on
102 non-working architectures. You should communicate to upstream that this is
103 the preferred approach.
104
105 In the case of (2), the crate should document exactly what conditional should
106 be used, and keep this documentation up-to-date. This allows us to easily
107 determine if dependent crates are using the correct conditional. You will then
108 have to override d/rules for this crate, see src/simd for an example.
109
110 You should file a bug upstream if the crate does neither (1) nor document the
111 conditions for (2), e.g. https://github.com/hsivonen/simd/issues/25
112
113 (Actually the above applies even for "OS-specific crates" but then (2) is
114 obvious so documentation is less necessary, and dependent crates all do it
115 correctly already.)
116
117 ITPs
118 ----
119
120 Don't file ITPs for library crates, but do file them for binary crates.
121
122 For now (updated 2018-09) we have several hundred crates to upload. Submitting
123 ITPs for these is unnecessary since we're the only ones uploading and there is
124 no chance of conflict. It would only be spam for the bug tracker. Please
125 instead co-ordinate uploads on the #debian-rust IRC channel.
126
127 Testing
128 -------
129
130 For now, testsuites aren't executed for library.
131 However, for binary, it is strongly recommended to run the testsuites.
132 See ripgrep as example.
133
134 TODO
135 ====
136
137 Maybe use ``--copyright-guess-harder``.