Debian Codegraph @

debian/README.source

raw
1 Source layout of rust-coreutils
2 ===============================
3
4 The source package is built from three pieces, on purpose kept identical to
5 what the Ubuntu package does so that both distributions stay easy to merge:
6
7 1. the *pristine* upstream tarball, i.e. the GitHub tag of uutils/coreutils,
8 2. the l10n component tarball (uutils/coreutils-l10n), unpacked into l10n/,
9 3. the vendored crates, in debian/rust-vendor/, shipped in the .debian.tar.
10
11 Nothing is repacked; debian/repack.sh is gone.
12
13
14 Importing a new upstream release
15 --------------------------------
16
17 uscan --verbose --destdir ..
18
19 downloads both tarballs (rust-coreutils_<version>.orig.tar.gz and
20 rust-coreutils_<version>.orig-l10n.tar.gz). Unpack the first one over the
21 tree, the second one into l10n/, then refresh debian/patches and update
22 debian/changelog.
23
24
25 Refreshing the vendored crates
26 ------------------------------
27
28 cargo install cargo-vendor-filterer # once; not packaged in Debian
29 debian/rules vendor
30
31 That target regenerates debian/rust-vendor/ (filtered down to the tier-1/2
32 *-*-linux-gnu* targets, which is why no Windows/macOS/BSD-only crate is
33 vendored), blanks the per-crate checksum files so the crates can be patched,
34 regenerates debian/source/include-binaries and the XS-Vendored-Sources-Rust
35 field of debian/control, and commits the result.
36
37 Crates cannot be patched through debian/patches (dpkg-source would then also
38 carry the vendored copies in the diff), so vendor patches live in their own
39 quilt series, debian/patches/rust-vendor/, applied at build time by
40 dh_quilt_patch via QUILT_PATCH_DIR/QUILT_PC (see debian/rules).
41
42
43 Profile-guided optimization
44 ---------------------------
45
46 On amd64 and arm64, override_dh_auto_build builds an instrumented multicall
47 binary, then runs upstream's util/build-pgo.sh to exercise it with the training
48 workloads it ships and merge the raw profiles into debian/pgo/coreutils.profdata,
49 which the real build then consumes through -Cprofile-use (PGO_RUSTFLAGS in
50 debian/rules).
51
52 The instrumented binary is built by debian/rules, with the same "make
53 build-coreutils" command that builds the shipped one, rather than by the
54 script's own step 1. This matters: a profile only applies to a build matching
55 the one it was collected from, and the script builds "--features unix" while
56 the package builds --no-default-features with an explicit list of utilities
57 plus feat_systemd_logind, feat_external_libstdbuf, openssl and selinux. Train
58 the wrong binary and -Cprofile-use finds no data for those symbols, reports
59 nothing, and PGO quietly becomes a no-op. d/p/pgo-use-prebuilt-binary.patch
60 adds the --instrumented-binary option used to hand the script our binary.
61
62 It is deliberately limited to those two arches: the training step has to *run*
63 the instrumented binary (so cross builds are out) and it roughly doubles the
64 build time, which s390x and the 32-bit arches cannot afford. Build it without
65 PGO with:
66
67 DEB_BUILD_OPTIONS=nopgo dpkg-buildpackage -b
68
69 llvm-profdata has to match the LLVM rustc was built against, so debian/rules
70 looks for /usr/lib/llvm-<N>/bin/llvm-profdata with <N> taken from
71 "rustc --version --verbose" (falling back to a rustup toolchain's own copy,
72 which is what makes a local test build work). If neither is there, PGO is
73 skipped and the build proceeds normally.
74
75 OpenSSL
76 -------
77
78 The checksum utilities are built with the upstream "openssl" feature, so
79 cksum/md5sum/sha*sum use libcrypto instead of the pure-Rust digests.
80 OPENSSL_NO_VENDOR=1 is exported so openssl-sys links Debian's shared
81 libcrypto: the vendored openssl-src crate is never compiled, and no copy of
82 OpenSSL ends up in the binary package.
83
84
85 tldr examples
86 -------------
87
88 improve-man.diff adds an EXAMPLES section to every manpage, taken from the
89 tldr-pages project. Upstream downloads that archive at documentation build
90 time, which a Debian build cannot do, so a copy trimmed down to the English
91 pages (pages/common and pages/linux) is shipped as debian/tldr.zip and copied
92 into docs/ by override_dh_auto_configure. Refresh it with:
93
94 curl -L https://github.com/tldr-pages/tldr/releases/latest/download/tldr.zip \
95 -o /tmp/tldr.zip
96 rm -rf /tmp/tldr && mkdir /tmp/tldr && cd /tmp/tldr && \
97 unzip -q /tmp/tldr.zip 'pages/common/*' 'pages/linux/*' 'LICENSE*' && \
98 zip -qr9 debian/tldr.zip .