Skip to content

Commit b3b90d2

Browse files
authored
release 0.2.3 (#848)
* let build scripts fetch date and version numbers from CHANGELOG, making it the single source of truth * release 0.2.3
1 parent 948363f commit b3b90d2

9 files changed

+47
-20
lines changed

CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## [0.2.3] - 2024-07-11
4+
5+
### Changed
6+
- Portability: sudo-rs now is compatible with s390x-unknown-linux-gnu
7+
- Removed unneeded code & fix hints given by newer Rust version
8+
9+
### Fixed
10+
- `visudo` would not properly truncate a `sudoers` file
11+
- high CPU load when child process did not terminate after closure of a terminal
12+
313
## [0.2.2] - 2024-02-02
414

515
### Changed
@@ -111,6 +121,7 @@
111121
- Use canonicalized paths for the executed binaries
112122
- Simplified CLI help to only display supported actions
113123

124+
[0.2.3]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.2...v0.2.3
114125
[0.2.2]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.1...v0.2.2
115126
[0.2.1]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.0...v0.2.1
116127
[0.2.0]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.0-dev.20230711...v0.2.0

Cargo.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "sudo-rs"
33
description = "A memory safe implementation of sudo and su."
4-
version = "0.2.2"
4+
version = "0.2.3"
55
license = "Apache-2.0 OR MIT"
66
edition = "2021"
77
repository = "https://github.com/trifectatechfoundation/sudo-rs"

docs/man/su.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- ---
2-
title: SU(1) sudo-rs 0.2.2 | sudo-rs
2+
title: SU(1) sudo-rs 0.2.3 | sudo-rs
33
--- -->
44

55
# NAME

docs/man/sudo.8.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- ---
2-
title: SUDO(8) sudo-rs 0.2.2 | sudo-rs
2+
title: SUDO(8) sudo-rs 0.2.3 | sudo-rs
33
--- -->
44

55
# NAME

docs/man/visudo.8.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- ---
2-
title: VISUDO(8) sudo-rs 0.2.2 | sudo-rs
2+
title: VISUDO(8) sudo-rs 0.2.3 | sudo-rs
33
--- -->
44

55
# NAME

util/Dockerfile-release

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
FROM rust:1-slim-bullseye
1+
FROM rust:1.79-slim-bullseye
22
RUN apt-get update -y && apt-get install -y clang libclang-dev libpam0g-dev

util/build-release.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env bash
22

3-
DATE="2023-09-21"
43
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
54
PROJECT_DIR=$(dirname "$SCRIPT_DIR")
65
SUDO_RS_VERSION="$(cargo metadata --format-version 1 --manifest-path "$PROJECT_DIR/Cargo.toml" | jq '.packages[] | select(.name=="sudo-rs") | .version' -r)"
@@ -9,6 +8,9 @@ TARGET_DIR_BASE="$PROJECT_DIR/target/pkg"
98

109
set -eo pipefail
1110

11+
# Fetch the date from the changelog
12+
DATE=$(grep -m1 '^##' "$PROJECT_DIR"/CHANGELOG.md | grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}')
13+
1214
# Build binaries
1315
docker build --pull --tag "$BUILDER_IMAGE_TAG" --file "$SCRIPT_DIR/Dockerfile-release" "$SCRIPT_DIR"
1416
docker run --rm --user "$(id -u):$(id -g)" -v "$PROJECT_DIR:/build" -w "/build" "$BUILDER_IMAGE_TAG" cargo clean

util/update-version.sh

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
#!/usr/bin/env bash
22

3-
if [ "$#" -lt 1 ]; then
4-
echo "Missing new version"
5-
exit 1
6-
fi
7-
83
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
94
PROJECT_DIR=$(dirname "$SCRIPT_DIR")
105
NEW_VERSION="$1"
116

12-
echo "Updating version in Cargo.toml"
13-
sed -i 's/^version\s*=\s*".*"/version = "'"$NEW_VERSION"'"/' "$PROJECT_DIR/Cargo.toml"
7+
# Fetch current version
8+
CURRENT_VERSION=$(sed -n '/version\s*=\s*"\([^"]*\)"/{s//\1/p;q}' "$PROJECT_DIR/Cargo.toml")
9+
10+
# Fetch new version from changelog
11+
NEW_VERSION=$(grep -m1 '^##' "$PROJECT_DIR"/CHANGELOG.md | grep -o "\[[0-9]\+.[0-9]\+.[0-9]\+\]" | tr -d '[]')
12+
13+
if [ -z "$NEW_VERSION" ]; then
14+
echo "Could not fetch version from CHANGELOG.md; you probably made a mistake."
15+
exit 1
16+
fi
17+
18+
if [ "$CURRENT_VERSION" \> "$NEW_VERSION" ]; then
19+
echo "New version number must be higher than current version: $CURRENT_VERSION"
20+
echo "Create a new changelog entry before running this script!"
21+
exit 1
22+
fi
23+
24+
if [ "$CURRENT_VERSION" == "$NEW_VERSION" ]; then
25+
echo "Cargo.toml was already at $NEW_VERSION"
26+
else
27+
echo "Updating version in Cargo.toml to $NEW_VERSION"
28+
sed -i 's/^version\s*=\s*".*"/version = "'"$NEW_VERSION"'"/' "$PROJECT_DIR/Cargo.toml"
29+
fi
1430

1531
echo "Updating version in man pages"
1632
sed -i 's/^title: SU(1) sudo-rs .*/title: SU(1) sudo-rs '"$NEW_VERSION"' | sudo-rs/' "$PROJECT_DIR"/docs/man/su.1.md
@@ -19,5 +35,3 @@ sed -i 's/^title: VISUDO(8) sudo-rs .*/title: VISUDO(8) sudo-rs '"$NEW_VERSION"'
1935

2036
echo "Rebuilding project"
2137
(cd $PROJECT_DIR && cargo build --release)
22-
23-
echo "Version changes complete, you must still fill in the changelog entries"

0 commit comments

Comments
 (0)