Skip to content

Stop build script from rewriting README during cargo package#37

Merged
RAprogramm merged 1 commit intonew_versionfrom
codex/fix-build.rs-modification-during-publish
Sep 17, 2025
Merged

Stop build script from rewriting README during cargo package#37
RAprogramm merged 1 commit intonew_versionfrom
codex/fix-build.rs-modification-during-publish

Conversation

@RAprogramm
Copy link
Owner

Summary

  • detect cargo package verification in the build script and only verify the README instead of rewriting it
  • extend the README generator with an explicit verification helper and an OutOfSync error
  • add focused tests for the new verification path and depend on tempfile for fixtures

Testing

  • cargo +nightly fmt --
  • cargo clippy -- -D warnings
  • cargo build --all-targets
  • cargo test --all
  • cargo doc --no-deps
  • cargo +1.89.0 package --locked --allow-dirty

https://chatgpt.com/codex/tasks/task_e_68ca4a6d2940832b9aafec1856dd0419

@RAprogramm RAprogramm merged commit b4553a0 into new_version Sep 17, 2025
2 checks passed
@RAprogramm RAprogramm deleted the codex/fix-build.rs-modification-during-publish branch September 17, 2025 05:55
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +32 to +40
fn is_packaged_manifest(manifest_dir: &Path) -> bool {
let mut seen_target = false;
for component in manifest_dir.components() {
match component {
Component::Normal(name) => {
if seen_target && name == "package" {
return true;
}
seen_target = name == "target";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Detect packaged builds without assuming default target dir

The new is_packaged_manifest helper only flags packaging when the manifest directory contains consecutive path components named target and package. cargo package indeed produces …/target/package/… by default, but when a user sets CARGO_TARGET_DIR to a custom directory (e.g., CARGO_TARGET_DIR=build on CI), the generated path becomes …/build/package/… and the function never sees a "target" component. In those setups the build script will continue to call sync_readme during packaging, rewriting files inside the package and re‑introducing the original failure. The detection needs to look for the package component irrespective of the parent directory or use an explicit environment signal from Cargo.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant