Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ jobs:
run: gh release upload --clobber
v${{ github.event.inputs.version }}
../$FILENAME.tar.xz
working-directory:
${{ env.FILENAME }}
working-directory: ${{ env.FILENAME }}
env:
# using this token rather than github.token due to `release not found` bug
# https://github.com/pkgxdev/cli/issues/5252
Expand Down Expand Up @@ -90,6 +89,15 @@ jobs:
with:
name: srcs

# debian:buster is archived, so we need to fix its sources.list
- name: fix debian:buster
if: ${{ matrix.platform.container == 'debian:buster-slim' }}
run: sed -i 's/deb.debian.org/archive.debian.org/g' /etc/apt/sources.list

- run: |
apt-get update
apt-get install curl gcc perl-modules openssl make xz-utils --yes

- uses: pkgxdev/setup@v4
with:
+: ${{ matrix.platform.pkgs }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.ca-cert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
container: debian:buster-slim
container: debian:bullseye-slim
steps:
- uses: actions/checkout@v5
- run: apt-get update && apt-get install -y curl gcc perl make
Expand All @@ -30,7 +30,7 @@ jobs:
test:
needs: build
runs-on: ubuntu-latest
container: debian:buster-slim
container: debian:bullseye-slim
steps:
- uses: actions/download-artifact@v6
with:
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- run: pkgx -qq git --version
- run: pkgx -s git --version
- run: pkgx -j +git
- run: pkgx git\* --version # test star constraints are valid
- run: pkgx git\* --version # test star constraints are valid
- run: pkgx /usr/bin/awk --version
- run: pkgx +yarnpkg.com yarn --version
- run: pkgx +yarnpkg.com -- yarn --version
Expand All @@ -129,9 +129,11 @@ jobs:
- run: pkgx -v +agg
# testing we correctly handle +pkg syntax for pkgs with no env
- run: pkgx +curl.se/ca-certs
# regression test: cargo has deep deps on linux that exercise range intersection
- run: pkgx +cargo

- run: '! pkgx flubber-flubbles' # cmd not found machinery
- run: '! pkgx --sync flubber-flubbles' # cmd not found machinery separate if branch
- run: "! pkgx flubber-flubbles" # cmd not found machinery
- run: "! pkgx --sync flubber-flubbles" # cmd not found machinery separate if branch

# create a fork bomb, but since it’s via pkgx we prevent it
- run: |
Expand Down Expand Up @@ -166,7 +168,7 @@ jobs:
pkgx -Q

- run: if [ $(find ~/.pkgx -name .tmp\* -type d | wc -l) -gt 0 ]; then
exit 1;
exit 1;
fi

- name: --shebang test 1
Expand All @@ -178,7 +180,7 @@ jobs:
- name: --shebang test 2
run: test $(pkgx -q! echo fail hi) = hi

- name: '@latest'
- name: "@latest"
run: |
pkgx semverator eq $(pkgx krampus=0.2.0 --version) 0.2.0
pkgx semverator gt $(pkgx krampus@latest --version) 0.2.0
Expand Down Expand Up @@ -230,7 +232,7 @@ jobs:
test-minimal-container:
needs: fmt
runs-on: ubuntu-latest
container: debian:buster-slim
container: debian:bullseye-slim
steps:
- uses: actions/checkout@v5
- run: apt-get update && apt-get install -y curl make gcc perl
Expand Down
67 changes: 41 additions & 26 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions 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 <mxcl@me.com>", "Jacob Heider <jacob@pkgx.dev>"]
license = "Apache-2.0"
version = "2.7.0"
version = "2.7.1"
edition = "2021"
repository = "https://github.com/pkgxdev/pkgx"

Expand All @@ -15,13 +15,13 @@ indicatif = "0.18.3"
nix = { version = "0.30.1", features = ["process"] }
serde_json = "1.0.135"
serde = { version = "1.0", features = ["derive"] }
libpkgx = { version = "0.7.0", path = "../lib" }
libpkgx = { version = "0.7.1", path = "../lib" }
console = { version = "0.16", default-features = false, features = [
"ansi-parsing",
] }

[target.'cfg(not(target_os = "macos"))'.dependencies]
rusqlite = { version = "0.33.0", features = ["bundled"] }
rusqlite = { version = "0.37.0", features = ["bundled"] }
native-tls = { version = "0.2", features = ["vendored"] }
# ^^ this is a transitive dependency
# ^^ we vendor OpenSSL ∵ we want to be standalone and just work inside minimal docker images
9 changes: 5 additions & 4 deletions crates/cli/src/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ pub fn dump(
}

let programs = pantry_db::programs_for_project(&project, &conn)?;
let companions = pantry_db::companions_for_projects(&[project.clone()], &conn)?
.iter()
.map(|c| c.to_string())
.collect::<Vec<String>>();
let companions =
pantry_db::companions_for_projects(std::slice::from_ref(&project), &conn)?
.iter()
.map(|c| c.to_string())
.collect::<Vec<String>>();

let pkg = JsonV2Pkg {
path: installation.path,
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/execve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn execve(
// Replace the process with the new command, arguments, and environment
let execve_result = nix_execve(&c_command, &c_args, &c_env);
if execve_result.is_err() {
let errno = execve_result.unwrap_err();
let Err(errno) = execve_result;
return Err(format!("execve failed with errno: {}", errno).into());
}

Expand Down
6 changes: 3 additions & 3 deletions 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 <mxcl@me.com>", "Jacob Heider <jacob@pkgx.dev>"]
license = "Apache-2.0"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
repository = "https://github.com/pkgxdev/pkgx"

Expand All @@ -13,7 +13,7 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
anyhow = "1.0.95"
dirs-next = "2.0"
libsemverator = { version = "0.10.0", features = ["serde"] }
libsemverator = { version = "0.10.1", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9"
tokio = { version = "1.43", features = ["full", "rt-multi-thread"] }
Expand All @@ -33,4 +33,4 @@ fs2 = "0.4.3"
tempfile = "3.16.0"

[target.'cfg(not(target_os = "macos"))'.dependencies]
rusqlite = { version = "0.33.0", features = ["bundled"] }
rusqlite = { version = "0.37.0", features = ["bundled"] }
4 changes: 2 additions & 2 deletions crates/lib/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ fn get_user_agent() -> String {
let os = std::env::consts::OS;
let arch = std::env::consts::ARCH;
let group = env::var("PKGX_USER_AGENT_GROUP");
let name = if group.is_ok() {
format!("pkgx[{}]", group.unwrap())
let name = if let Ok(valid_group) = group {
format!("pkgx[{}]", valid_group)
} else {
"pkgx".to_string()
};
Expand Down
10 changes: 3 additions & 7 deletions crates/lib/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ where
}
});

let stream = stream
.map_err(|e| futures::io::Error::new(futures::io::ErrorKind::Other, e))
.into_async_read();
let stream = stream.map_err(futures::io::Error::other).into_async_read();
let stream = stream.compat();

// Step 2: Create a XZ decoder
Expand Down Expand Up @@ -169,8 +167,7 @@ async fn symlink(installation: &Installation, config: &Config) -> Result<(), Box
};
let most_minor = versions
.iter()
.filter(|(version, _)| minor_range.satisfies(version))
.next_back()
.rfind(|(version, _)| minor_range.satisfies(version))
.ok_or_else(|| {
anyhow::anyhow!(
"Could not find most minor version for {}",
Expand All @@ -189,8 +186,7 @@ async fn symlink(installation: &Installation, config: &Config) -> Result<(), Box

let most_major = versions
.iter()
.filter(|(version, _)| major_range.satisfies(version))
.next_back()
.rfind(|(version, _)| major_range.satisfies(version))
.ok_or_else(|| anyhow::anyhow!("Could not find most major version"))?;

if most_major.0 != installation.pkg.version {
Expand Down
4 changes: 1 addition & 3 deletions crates/lib/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ async fn download_and_extract_pantry(url: &str, dest: &PathBuf) -> Result<(), Bo

let stream = rsp.bytes_stream();

let stream = stream
.map_err(|e| futures::io::Error::new(futures::io::ErrorKind::Other, e))
.into_async_read();
let stream = stream.map_err(futures::io::Error::other).into_async_read();
let stream = stream.compat();

let decoder = XzDecoder::new(stream);
Expand Down