Skip to content

Commit

Permalink
pantry.tgz url should base on $PKGX_DIST_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Feb 18, 2025
1 parent e681f59 commit 2105171
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 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 crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pkgx"
description = "Run anything"
authors = ["Max Howell <[email protected]>", "Jacob Heider <[email protected]>"]
license = "Apache-2.0"
version = "2.3.1"
version = "2.3.2"
edition = "2021"
repository = "https://github.com/pkgxdev/pkgx"

Expand Down
2 changes: 1 addition & 1 deletion crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libpkgx"
description = "Install and run `pkgx` packages"
authors = ["Max Howell <[email protected]>", "Jacob Heider <[email protected]>"]
license = "Apache-2.0"
version = "0.3.2"
version = "0.3.3"
edition = "2021"
repository = "https://github.com/pkgxdev/pkgx"

Expand Down
7 changes: 4 additions & 3 deletions crates/lib/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
fn main() {
let dist_url = option_env!("PKGX_DIST_URL").unwrap_or("https://dist.tea.xyz");
let default_pantry_url = format!("{dist_url}/pantry.tgz");
let pantry_url = option_env!("PKGX_PANTRY_TARBALL_URL").unwrap_or(&default_pantry_url);
let default_pantry_tarball_filename = "pantry.tgz";
let pantry_url =
option_env!("PKGX_PANTRY_TARBALL_FILENAME").unwrap_or(default_pantry_tarball_filename);

println!("cargo:rustc-env=PKGX_DIST_URL={dist_url}");
println!("cargo:rustc-env=PKGX_PANTRY_TARBALL_URL={pantry_url}");
println!("cargo:rustc-env=PKGX_PANTRY_TARBALL_FILENAME={pantry_url}");
}
8 changes: 6 additions & 2 deletions crates/lib/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ pub async fn update(config: &Config, conn: &mut Connection) -> Result<(), Box<dy
}

async fn replace(config: &Config, conn: &mut Connection) -> Result<(), Box<dyn Error>> {
let url = env!("PKGX_PANTRY_TARBALL_URL");
let url = format!(
"{}/{}",
config.dist_url,
env!("PKGX_PANTRY_TARBALL_FILENAME")
);
let dest = &config.pantry_dir;

std::fs::create_dir_all(dest)?;
Expand All @@ -56,7 +60,7 @@ async fn replace(config: &Config, conn: &mut Connection) -> Result<(), Box<dyn E
.open(dest)?;
dir.lock_exclusive()?;

download_and_extract_pantry(url, dest).await?;
download_and_extract_pantry(&url, dest).await?;

pantry_db::cache(config, conn)?;

Expand Down

0 comments on commit 2105171

Please sign in to comment.