Skip to content

fix finding binaries in the PKGX_PANTRY_DIR#1253

Merged
jhheider merged 2 commits intomainfrom
fix-pantry-dir
Mar 27, 2026
Merged

fix finding binaries in the PKGX_PANTRY_DIR#1253
jhheider merged 2 commits intomainfrom
fix-pantry-dir

Conversation

@jhheider
Copy link
Copy Markdown
Contributor

reported by Boom on discord

update the db using the pantry dir, if set. this ensures newly developed binaries are usable (and local pantries).

reported by Boom on discord

update the db using the pantry dir, if set. this ensures newly developed binaries are usable (and local pantries).
@jhheider jhheider marked this pull request as ready for review March 27, 2026 17:42
Copilot AI review requested due to automatic review settings March 27, 2026 17:42
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts pantry sync behavior so that when PKGX_PANTRY_DIR is set (eg. a local pantry clone), the system can rebuild/update the pantry database instead of refusing to sync—making newly developed binaries and local pantry changes discoverable.

Changes:

  • Change sync::update() to call sync::ensure() when PKGX_PANTRY_DIR is set, rather than returning an error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 34 to 38
pub async fn update(config: &Config, conn: &mut Connection) -> Result<(), Box<dyn Error>> {
if std::env::var("PKGX_PANTRY_DIR").is_ok() {
return Err("PKGX_PANTRY_DIR is set, refusing to update pantry")?;
return ensure(config, conn).await;
}
replace(config, conn).await
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

When PKGX_PANTRY_DIR is set, update() now calls ensure(), which will call replace() (download + archive.unpack(dest)) if pantry_dir/projects is missing. That means a misconfigured PKGX_PANTRY_DIR can cause us to extract the pantry tarball into an arbitrary user-provided directory (potentially overwriting files), whereas we previously refused to update in this mode. Consider keeping the safety guard: if PKGX_PANTRY_DIR is set, only rebuild/cache the DB when pantry_dir/projects exists; otherwise return a clear error about the invalid pantry dir rather than downloading/extracting into it.

Copilot uses AI. Check for mistakes.
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 27, 2026

Coverage Status

coverage: 90.234% (+0.1%) from 90.097%
when pulling 1745529 on fix-pantry-dir
into d732ae4 on main.

Copilot AI review requested due to automatic review settings March 27, 2026 18:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jhheider jhheider merged commit 112ebdc into main Mar 27, 2026
22 checks passed
@jhheider jhheider deleted the fix-pantry-dir branch March 27, 2026 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants