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
79 changes: 72 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
#
# The build and the tests with the oldest and the newest rustc on x86_64,
# the same with musl, the build and the tests on i686, the tests on FAT,
# the lints for twelve targets, the formatting, the documentation, the C
# library with its header and its tests, the package cargo publish
# the lints for twelve targets, the formatting, the documentation with the
# man page of fsmanifest, the completions of fsmanifest in their shells,
# the C library with its header and its tests, the packages cargo publish
# uploads, the dependency check and the sign-offs.
#
# The tests and the lints run without and with the feature capi, the C
Expand Down Expand Up @@ -376,6 +377,62 @@ jobs:
RUSTDOCFLAGS: -D warnings
run: cargo doc --locked --workspace --no-deps

- name: Install groff
run: |
sudo apt-get update -q
sudo apt-get install -y -q --no-install-recommends groff-base

- name: Check the man page of fsmanifest
# groff renders it with every warning turned on. It exits with 0
# whatever it warns about, so a warning fails the step here.
run: |
warnings=$(groff -mandoc -ww -z src/fsmanifest/fsmanifest.1 2>&1)
if [ -n "$warnings" ]; then
echo "$warnings"
echo "::error::groff warns about src/fsmanifest/fsmanifest.1"
exit 1
fi

completions:
name: Completions of fsmanifest
runs-on: ubuntu-26.04
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Install zsh and fish
# bash is the runner's own.
run: |
sudo apt-get update -q
sudo apt-get install -y -q --no-install-recommends zsh fish

- name: Install rustc
run: |
rustup toolchain install stable --profile minimal
rustup default stable
rustc --version

- name: Build fsmanifest
# The completions take the names of the features from it.
run: cargo build --locked -p fsmanifest

- name: Check the syntax
run: |
bash -n src/fsmanifest/completions/fsmanifest.bash
zsh -n src/fsmanifest/completions/_fsmanifest
fish -n src/fsmanifest/completions/fsmanifest.fish

- name: Test the completion for bash
run: src/fsmanifest/tests/completions.py bash target/debug/fsmanifest

- name: Test the completion for zsh
run: src/fsmanifest/tests/completions.py zsh target/debug/fsmanifest

- name: Test the completion for fish
run: src/fsmanifest/tests/completions.py fish target/debug/fsmanifest

header:
name: uapi16.h
runs-on: ubuntu-26.04
Expand Down Expand Up @@ -613,6 +670,13 @@ jobs:
cd target/package/uapi16-*/
CARGO_TARGET_DIR=$RUNNER_TEMP/package cargo test --locked

- name: cargo package --workspace
# Packages fsmanifest as well. On its own the tool can't be
# packaged before uapi16 is on crates.io, since its package
# depends on uapi16 without the path. With --workspace cargo
# builds the packaged tool against the packaged library.
run: cargo package --locked --workspace

deps:
name: Dependencies
runs-on: ubuntu-26.04
Expand All @@ -622,11 +686,12 @@ jobs:
with:
persist-credentials: false

- name: Check the crates uapi16 depends on
- name: Check the crates the workspace depends on
# Cargo.lock lists every dependency, for all targets and features,
# the build and test dependencies included: libc, pathrs, rustix,
# serde_core, serde_json and sha2 with the crates they need, those
# for other operating systems among them. The tests turn on
# the build and test dependencies included. uapi16 has libc,
# pathrs, rustix, serde_core, serde_json and sha2 with the crates
# they need, those for other operating systems among them, and
# fsmanifest adds lexopt, which needs none. The tests turn on
# preserve_order of serde_json, which adds foldhash and indexmap
# with the crates it needs. serde_json and serde_core name serde
# and serde_derive for cfg(any()), which no target has, so that
Expand All @@ -635,7 +700,7 @@ jobs:
env:
EXPECTED: >-
bitflags block-buffer cfg-if cpufeatures crypto-common digest either equivalent errno fastrand
foldhash getrandom hashbrown hybrid-array indexmap itertools itoa libc linux-raw-sys memchr
foldhash getrandom hashbrown hybrid-array indexmap itertools itoa lexopt libc linux-raw-sys memchr
once_cell pathrs proc-macro2 quote r-efi rustix rustversion serde serde_core serde_derive
serde_json sha2 static_assertions syn tempfile thiserror thiserror-impl typenum unicode-ident
windows-link windows-sys zmij
Expand Down
132 changes: 91 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# The C library of a release, for x86_64 and for aarch64: a tarball of
# libuapi16 for each, with a directory at its top that is laid out as
# install.sh installs and has the license texts in share/licenses/uapi16,
# built against glibc 2.34 so that it works there and with every newer
# glibc. Each tarball gets a build provenance attestation.
# The C library and fsmanifest of a release, for x86_64 and for aarch64:
# a tarball of libuapi16 and the tool for each, with a directory at its
# top that is laid out as install.sh installs, with fsmanifest in bin and
# its man page and completions in share, and with the license texts in
# share/licenses/uapi16, built against glibc 2.34 so that it works there
# and with every newer glibc. Each tarball gets a build provenance
# attestation.
#
# A tag v* gets a draft release with the two tarballs and SHA256SUMS, with
# the message of the tag as its notes. Nothing is signed here:
Expand Down Expand Up @@ -59,9 +61,9 @@ jobs:
runner: ubuntu-26.04-arm
rustup-init: 9f608c142e0e38a78957d0661ba1dfaf0b6fb37184cfaa4b9a0aa57af6184282
# AlmaLinux 9.8, whose glibc is 2.34. The linker binds every glibc
# symbol the library uses to the newest version of it in the glibc it
# links against, and a glibc without that version can't load the
# library. The runner's glibc is newer.
# symbol the library and fsmanifest use to the newest version of it in
# the glibc it links against, and a glibc without that version can't
# load them. The runner's glibc is newer.
container:
image: quay.io/almalinuxorg/almalinux@sha256:3b958c0ee1c6f610f39a23143117ebcf5812a17aa42b0b09ebdb6fed18da3ae5 # 9.8-20261114
env:
Expand All @@ -71,9 +73,9 @@ jobs:
steps:
- name: Install dependencies
# git for the checkout, the C compiler that links the shared
# library and builds the examples, and pkg-config, which the
# examples take their flags from. readelf, nm and objdump are in
# the image.
# library and fsmanifest and builds the examples, and pkg-config,
# which the examples take their flags from. readelf, nm and objdump
# are in the image.
run: dnf install -y -q --setopt=install_weak_deps=False gcc git-core pkgconf-pkg-config

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -83,14 +85,20 @@ jobs:
- name: Version
# The version of the crate, which is the version of the library. A
# tag has to name it: v0.1.0 for 0.1.0. install.sh reads it the
# same way.
# same way. fsmanifest goes into the tarball of that version, so it
# has to have the same one.
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref_name }}
ARCH: ${{ matrix.arch }}
run: |
version=$(sed -n '/^version = "\(.*\)"$/{s//\1/p;q;}' src/uapi16/Cargo.toml)
[ -n "$version" ] || { echo "::error::src/uapi16/Cargo.toml has no version"; exit 1; }
tool=$(sed -n '/^version = "\(.*\)"$/{s//\1/p;q;}' src/fsmanifest/Cargo.toml)
if [ "$tool" != "$version" ]; then
echo "::error::src/fsmanifest/Cargo.toml has the version '$tool', and the library has $version"
exit 1
fi
if [ "$EVENT" = push ] && [ "$REF" != "v$version" ]; then
echo "::error::the tag $REF does not name $version, the version of src/uapi16/Cargo.toml"
exit 1
Expand Down Expand Up @@ -123,15 +131,27 @@ jobs:
- name: Build the static and the shared library
run: src/uapi16/build.sh -- --locked

- name: Build fsmanifest
# With the rustc and in the container the library is built with, so
# against the same glibc.
run: cargo build --locked --release -p fsmanifest

- name: Install into the directory of the tarball
# What install.sh installs into a prefix of its own, which becomes
# the directory at the top of the tarball and has its name.
# uapi16.pc names that prefix, so in the tarball it names the
# directory two levels above uapi16.pc instead, wherever the tarball
# is unpacked.
# the directory at the top of the tarball and has its name, and
# fsmanifest in bin of it with its man page and its completions in
# share. uapi16.pc names that prefix, so in the tarball it names
# the directory two levels above uapi16.pc instead, wherever the
# tarball is unpacked.
run: |
prefix=$RUNNER_TEMP/$NAME
src/uapi16/install.sh --prefix="$prefix"
install -D -m 0755 target/release/fsmanifest "$prefix/bin/fsmanifest"
install -D -m 0644 src/fsmanifest/fsmanifest.1 "$prefix/share/man/man1/fsmanifest.1"
completions=src/fsmanifest/completions
install -D -m 0644 "$completions/fsmanifest.bash" "$prefix/share/bash-completion/completions/fsmanifest"
install -D -m 0644 "$completions/_fsmanifest" "$prefix/share/zsh/site-functions/_fsmanifest"
install -D -m 0644 "$completions/fsmanifest.fish" "$prefix/share/fish/vendor_completions.d/fsmanifest.fish"
pc=$prefix/lib/pkgconfig/uapi16.pc
sed -i \
-e 's|^prefix=.*|prefix=${pcfiledir}/../..|' \
Expand All @@ -146,26 +166,31 @@ jobs:
cat "$pc"

- name: Add the license texts
# The license of libuapi16, and the licenses of what is linked into
# it: the Rust standard library, with the license texts of the
# toolchain, and every crate of Cargo.lock that is linked, with the
# license files of its source. cargo tree lists those crates, and
# leaves out procedural macros and the dependencies of builds and
# tests, which are not linked. A crate without a license file fails
# the job.
# The license of libuapi16 and fsmanifest, and the licenses of what
# is linked into them: the Rust standard library, with the license
# texts of the toolchain, and every crate of Cargo.lock that is
# linked into either, with the license files of its source. cargo
# tree lists those crates for each of the two, and leaves out
# procedural macros and the dependencies of builds and tests, which
# are not linked. A crate without a license file fails the job.
run: |
licenses=$RUNNER_TEMP/$NAME/share/licenses/uapi16
mkdir -p "$licenses/rust" "$licenses/crates"
cp src/uapi16/LICENSE "$licenses/LICENSE"
doc=$(rustc --print sysroot)/share/doc/rust
cp "$doc/COPYRIGHT" "$doc/LICENSE-APACHE" "$doc/LICENSE-MIT" "$licenses/rust/"
cargo tree --locked -p uapi16 --features capi -e normal,no-proc-macro --prefix none \
--format '{p}' | sed 's/ (\*)$//' | LC_ALL=C sort -u > "$RUNNER_TEMP/tree"
{
cargo tree --locked -p uapi16 --features capi -e normal,no-proc-macro --prefix none \
--format '{p}'
cargo tree --locked -p fsmanifest -e normal,no-proc-macro --prefix none --format '{p}'
} | sed 's/ (\*)$//' | LC_ALL=C sort -u > "$RUNNER_TEMP/tree"
registry=${CARGO_HOME:-$HOME/.cargo}/registry/src
: > "$RUNNER_TEMP/crates"
bad=0
while read -r name version source; do
[ "$name" != uapi16 ] || continue
case $name in
uapi16 | fsmanifest) continue ;;
esac
crate=$name-${version#v}
if [ -n "$source" ]; then
echo "::error::$crate is not from crates.io: $source"
Expand Down Expand Up @@ -204,8 +229,11 @@ jobs:

- name: Check the layout of the tarball
# Only the directory of the tarball's name at the top, and in it
# what install.sh installs, the links of the shared library and the
# license texts, with a directory of license files for every crate.
# what install.sh installs, the links of the shared library,
# fsmanifest with its man page and its completions, and the license
# texts, with a directory of license files for every crate. And
# fsmanifest runs: it says the version of the tarball, and it writes
# and checks the manifest of a small tree.
run: |
top=$(tar -tzf "dist/$TARBALL" | cut -d / -f 1 | LC_ALL=C sort -u)
if [ "$top" != "$NAME" ]; then
Expand All @@ -214,10 +242,16 @@ jobs:
fi
cd "$RUNNER_TEMP/unpacked/$NAME"
licenses=share/licenses/uapi16
man=share/man/man1/fsmanifest.1
bash=share/bash-completion/completions/fsmanifest
zsh=share/zsh/site-functions/_fsmanifest
fish=share/fish/vendor_completions.d/fsmanifest.fish
{
printf '%s\n' include include/uapi16.h lib lib/libuapi16.a lib/libuapi16.so \
printf '%s\n' bin bin/fsmanifest include include/uapi16.h lib lib/libuapi16.a lib/libuapi16.so \
lib/libuapi16.so.0 "lib/libuapi16.so.$VERSION" lib/pkgconfig lib/pkgconfig/uapi16.pc \
share share/licenses "$licenses" "$licenses/LICENSE" "$licenses/rust" \
share share/man share/man/man1 "$man" share/bash-completion share/bash-completion/completions \
"$bash" share/zsh share/zsh/site-functions "$zsh" share/fish share/fish/vendor_completions.d \
"$fish" share/licenses "$licenses" "$licenses/LICENSE" "$licenses/rust" \
"$licenses/rust/COPYRIGHT" "$licenses/rust/LICENSE-APACHE" "$licenses/rust/LICENSE-MIT" \
"$licenses/crates"
sed "s|^|$licenses/crates/|" "$RUNNER_TEMP/crates"
Expand All @@ -230,9 +264,11 @@ jobs:
LC_ALL=C comm -13 "$RUNNER_TEMP/expected" "$RUNNER_TEMP/found" | sed 's/^/not expected: /'
exit 1
fi
for f in include/uapi16.h lib/libuapi16.a "lib/libuapi16.so.$VERSION" lib/pkgconfig/uapi16.pc; do
for f in bin/fsmanifest include/uapi16.h lib/libuapi16.a "lib/libuapi16.so.$VERSION" \
lib/pkgconfig/uapi16.pc "$man" "$bash" "$zsh" "$fish"; do
[ -f "$f" ] && [ ! -L "$f" ] || { echo "::error::$f is not a regular file"; exit 1; }
done
[ -x bin/fsmanifest ] || { echo "::error::bin/fsmanifest is not executable"; exit 1; }
for l in lib/libuapi16.so lib/libuapi16.so.0; do
[ "$(readlink "$l")" = "libuapi16.so.$VERSION" ] ||
{ echo "::error::$l does not link to libuapi16.so.$VERSION"; exit 1; }
Expand All @@ -241,6 +277,18 @@ jobs:
[ -n "$(ls -A "$licenses/crates/$crate")" ] ||
{ echo "::error::$licenses/crates/$crate is empty"; exit 1; }
done < "$RUNNER_TEMP/crates"
said=$(bin/fsmanifest --version) || { echo "::error::bin/fsmanifest does not run"; exit 1; }
if [ "$said" != "fsmanifest $VERSION" ]; then
echo "::error::bin/fsmanifest --version says '$said' and not 'fsmanifest $VERSION'"
exit 1
fi
tree=$RUNNER_TEMP/fsmanifest
mkdir -p "$tree/dir"
echo data > "$tree/file"
ln "$tree/file" "$tree/dir/link"
ln -s file "$tree/symlink"
bin/fsmanifest generate "$tree" "$tree.manifest"
bin/fsmanifest check "$tree.manifest"
echo "the layout is right, with the license files of $(wc -l < "$RUNNER_TEMP/crates") crates"

- name: Check what the shared library exports
Expand All @@ -266,19 +314,21 @@ jobs:
fi
echo "$count functions at LIBUAPI16_0.1.0"

- name: Check the glibc the shared library needs
- name: Check the glibc the shared library and fsmanifest need
# No symbol of a glibc newer than 2.34, and none of GLIBC_PRIVATE.
run: |
so=$RUNNER_TEMP/unpacked/$NAME/lib/libuapi16.so.$VERSION
versions=$(objdump -T "$so" | grep -o 'GLIBC_[A-Z0-9_.]*' | sort -u -V)
for v in $versions; do
newest=$(printf '%s\n' "$v" GLIBC_2.34 | sort -V | tail -n 1)
case $v in
GLIBC_[0-9]*) [ "$newest" = GLIBC_2.34 ] ;;
*) false ;;
esac || { echo "::error::$so needs $v, which glibc 2.34 does not have"; exit 1; }
for elf in "lib/libuapi16.so.$VERSION" bin/fsmanifest; do
file=$RUNNER_TEMP/unpacked/$NAME/$elf
versions=$(objdump -T "$file" | grep -o 'GLIBC_[A-Z0-9_.]*' | sort -u -V)
for v in $versions; do
newest=$(printf '%s\n' "$v" GLIBC_2.34 | sort -V | tail -n 1)
case $v in
GLIBC_[0-9]*) [ "$newest" = GLIBC_2.34 ] ;;
*) false ;;
esac || { echo "::error::$file needs $v, which glibc 2.34 does not have"; exit 1; }
done
echo "$elf: glibc versions:" $versions
done
echo "glibc versions:" $versions

- name: Build and run the examples
# The six programs of examples/, built against the unpacked tarball
Expand Down
14 changes: 14 additions & 0 deletions Cargo.lock

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

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

[workspace]
members = ["src/uapi16"]
members = ["src/fsmanifest", "src/uapi16"]
# cargo update picks dependency versions that support rust-version.
resolver = "3"

Expand All @@ -12,6 +12,8 @@ rust-version = "1.85"
license = "LGPL-2.1-or-later"

[workspace.dependencies]
# Parses the command line of fsmanifest.
lexopt = "0.3.2"
# Looks up the names of users and groups, which rustix has no call for.
# Stay on 0.2 like pathrs, errno, getrandom and sha2's cpufeatures, so
# that no build has two versions of libc.
Expand Down
Loading
Loading