Skip to content

Commit

Permalink
Merge branch 'main' into homebrew-multiple-license
Browse files Browse the repository at this point in the history
  • Loading branch information
cxreiff authored Aug 20, 2024
2 parents 0088843 + 3e71a33 commit 507f9e7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1-prerelease.7/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1-prerelease.10/cargo-dist-installer.sh | sh"
- name: Cache cargo-dist
uses: actions/upload-artifact@v4
with:
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
Nothing Yet!


# Version 0.21.1 (2024-08-20)

This patch release fixes several bugs and provides some quality of life improvements. The most substantial changes are to the shell installer, which now does more precise glibc version checks based on exactly which platform each binary was built on.

* @gankra [make glibc version reqs per-platform in shell installer](https://github.com/axodotdev/cargo-dist/pull/1346)
* @gankra [cleanup error handling in shell installer](https://github.com/axodotdev/cargo-dist/pull/1347)
* @gankra [remove overzealous cargo version check](https://github.com/axodotdev/cargo-dist/pull/1322)
* @ashleygwilliams [add generated note at top of workflow](https://github.com/axodotdev/cargo-dist/pull/1324)
* @alexanderjophus [improved init when user unchecks homebrew installer](https://github.com/axodotdev/cargo-dist/pull/1329)
* @sts10 [fix grammar in readme](https://github.com/axodotdev/cargo-dist/pull/1319)
* @mistydemeo [fix installing sysdeps with Homebrew using Homebrew 4.3.17](https://github.com/axodotdev/cargo-dist/pull/1348)


# Version 0.21.0 (2024-08-13)

This release contains one major new feature and several bugfixes.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/axodotdev/cargo-dist"
homepage = "https://opensource.axo.dev/cargo-dist/"
version = "0.21.1-prerelease.8"
version = "0.21.1"

[workspace.dependencies]
# intra-workspace deps (you need to bump these versions when you cut releases too!
cargo-dist-schema = { version = "=0.21.1-prerelease.8", path = "cargo-dist-schema" }
axoproject = { version = "=0.21.1-prerelease.8", path = "axoproject", default-features = false, features = ["cargo-projects", "generic-projects", "npm-projects"] }
cargo-dist-schema = { version = "=0.21.1", path = "cargo-dist-schema" }
axoproject = { version = "=0.21.1", path = "axoproject", default-features = false, features = ["cargo-projects", "generic-projects", "npm-projects"] }

# first-party deps
axocli = { version = "0.2.0" }
Expand Down Expand Up @@ -75,7 +75,7 @@ publish = false
# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.21.1-prerelease.7"
cargo-dist-version = "0.21.1-prerelease.10"
# CI backends to support
ci = "github"
# The installers to generate for each app
Expand Down
27 changes: 21 additions & 6 deletions cargo-dist/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use camino::Utf8Path;
pub fn fetch_brew_env(
dist_graph: &DistGraph,
working_dir: &Utf8Path,
) -> DistResult<Option<String>> {
) -> DistResult<Option<Vec<String>>> {
if let Some(brew) = &dist_graph.tools.brew {
if Utf8Path::new("Brewfile").exists() {
// Uses `brew bundle exec` to just print its own environment,
Expand All @@ -24,24 +24,39 @@ pub fn fetch_brew_env(
.arg("exec")
.arg("--")
.arg("/usr/bin/env")
// Splits outputs by NUL bytes instead of newlines.
// Ensures we don't get confused about env vars which
// themselves contain newlines.
.arg("-0")
.current_dir(working_dir)
.output()?;

return Ok(Some(String::from_utf8_lossy(&result.stdout).to_string()));
let s = String::from_utf8_lossy(&result.stdout).to_string();
// Split into lines based on the \0 separator
let output = s
// Trim the newline first before trimming the last NUL
.trim_end()
// There's typically a trailing NUL, which we want gone too
.trim_end_matches('\0')
.split('\0')
.map(String::from)
.collect();

return Ok(Some(output));
}
}

Ok(None)
}

/// Takes a string in KEY=value environment variable format and
/// Takes a set of strings in KEY=value environment variable format and
/// parses it into a BTreeMap. The string syntax is sh-compatible, and also the
/// format returned by `env`.
/// Note that we trust the parsed string to contain a given key only once;
/// Note that we trust the set to contain a given key only once;
/// if specified more than once, only the final occurrence will be included.
pub fn parse_env(env_string: &str) -> DistResult<SortedMap<&str, &str>> {
pub fn parse_env(env: &[String]) -> DistResult<SortedMap<&str, &str>> {
let mut parsed = SortedMap::new();
for line in env_string.trim_end().split('\n') {
for line in env {
let Some((key, value)) = line.split_once('=') else {
return Err(DistError::EnvParseError {
line: line.to_owned(),
Expand Down

0 comments on commit 507f9e7

Please sign in to comment.