Skip to content

Commit

Permalink
release 0.2.3 (#848)
Browse files Browse the repository at this point in the history
* let build scripts fetch date and version numbers from CHANGELOG, making it the single source of truth

* release 0.2.3
  • Loading branch information
squell authored Jul 11, 2024
1 parent 948363f commit b3b90d2
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 20 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [0.2.3] - 2024-07-11

### Changed
- Portability: sudo-rs now is compatible with s390x-unknown-linux-gnu
- Removed unneeded code & fix hints given by newer Rust version

### Fixed
- `visudo` would not properly truncate a `sudoers` file
- high CPU load when child process did not terminate after closure of a terminal

## [0.2.2] - 2024-02-02

### Changed
Expand Down Expand Up @@ -111,6 +121,7 @@
- Use canonicalized paths for the executed binaries
- Simplified CLI help to only display supported actions

[0.2.3]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/trifectatechfoundation/sudo-rs/compare/v0.2.0-dev.20230711...v0.2.0
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sudo-rs"
description = "A memory safe implementation of sudo and su."
version = "0.2.2"
version = "0.2.3"
license = "Apache-2.0 OR MIT"
edition = "2021"
repository = "https://github.com/trifectatechfoundation/sudo-rs"
Expand Down
2 changes: 1 addition & 1 deletion docs/man/su.1.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- ---
title: SU(1) sudo-rs 0.2.2 | sudo-rs
title: SU(1) sudo-rs 0.2.3 | sudo-rs
--- -->

# NAME
Expand Down
2 changes: 1 addition & 1 deletion docs/man/sudo.8.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- ---
title: SUDO(8) sudo-rs 0.2.2 | sudo-rs
title: SUDO(8) sudo-rs 0.2.3 | sudo-rs
--- -->

# NAME
Expand Down
2 changes: 1 addition & 1 deletion docs/man/visudo.8.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- ---
title: VISUDO(8) sudo-rs 0.2.2 | sudo-rs
title: VISUDO(8) sudo-rs 0.2.3 | sudo-rs
--- -->

# NAME
Expand Down
2 changes: 1 addition & 1 deletion util/Dockerfile-release
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM rust:1-slim-bullseye
FROM rust:1.79-slim-bullseye
RUN apt-get update -y && apt-get install -y clang libclang-dev libpam0g-dev
4 changes: 3 additions & 1 deletion util/build-release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env bash

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

set -eo pipefail

# Fetch the date from the changelog
DATE=$(grep -m1 '^##' "$PROJECT_DIR"/CHANGELOG.md | grep -o '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}')

# Build binaries
docker build --pull --tag "$BUILDER_IMAGE_TAG" --file "$SCRIPT_DIR/Dockerfile-release" "$SCRIPT_DIR"
docker run --rm --user "$(id -u):$(id -g)" -v "$PROJECT_DIR:/build" -w "/build" "$BUILDER_IMAGE_TAG" cargo clean
Expand Down
32 changes: 23 additions & 9 deletions util/update-version.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
#!/usr/bin/env bash

if [ "$#" -lt 1 ]; then
echo "Missing new version"
exit 1
fi

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
PROJECT_DIR=$(dirname "$SCRIPT_DIR")
NEW_VERSION="$1"

echo "Updating version in Cargo.toml"
sed -i 's/^version\s*=\s*".*"/version = "'"$NEW_VERSION"'"/' "$PROJECT_DIR/Cargo.toml"
# Fetch current version
CURRENT_VERSION=$(sed -n '/version\s*=\s*"\([^"]*\)"/{s//\1/p;q}' "$PROJECT_DIR/Cargo.toml")

# Fetch new version from changelog
NEW_VERSION=$(grep -m1 '^##' "$PROJECT_DIR"/CHANGELOG.md | grep -o "\[[0-9]\+.[0-9]\+.[0-9]\+\]" | tr -d '[]')

if [ -z "$NEW_VERSION" ]; then
echo "Could not fetch version from CHANGELOG.md; you probably made a mistake."
exit 1
fi

if [ "$CURRENT_VERSION" \> "$NEW_VERSION" ]; then
echo "New version number must be higher than current version: $CURRENT_VERSION"
echo "Create a new changelog entry before running this script!"
exit 1
fi

if [ "$CURRENT_VERSION" == "$NEW_VERSION" ]; then
echo "Cargo.toml was already at $NEW_VERSION"
else
echo "Updating version in Cargo.toml to $NEW_VERSION"
sed -i 's/^version\s*=\s*".*"/version = "'"$NEW_VERSION"'"/' "$PROJECT_DIR/Cargo.toml"
fi

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

echo "Rebuilding project"
(cd $PROJECT_DIR && cargo build --release)

echo "Version changes complete, you must still fill in the changelog entries"

0 comments on commit b3b90d2

Please sign in to comment.