fix finding binaries in the PKGX_PANTRY_DIR#1253
Conversation
reported by Boom on discord update the db using the pantry dir, if set. this ensures newly developed binaries are usable (and local pantries).
There was a problem hiding this comment.
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 callsync::ensure()whenPKGX_PANTRY_DIRis set, rather than returning an error.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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 |
There was a problem hiding this comment.
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.
6f8f53e to
1745529
Compare
There was a problem hiding this comment.
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.
reported by Boom on discord
update the db using the pantry dir, if set. this ensures newly developed binaries are usable (and local pantries).