Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove pixi global support on powerpc64le #2616

Closed
wants to merge 7 commits into from
Closed
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
4 changes: 0 additions & 4 deletions .github/workflows/trampoline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ jobs:
target: aarch64-unknown-linux-musl
os: ubuntu-latest

- name: "Linux-powerpc64le"
target: powerpc64le-unknown-linux-gnu
os: ubuntu-latest

- name: "macOS-x86"
target: x86_64-apple-darwin
os: macos-13
Expand Down
Binary file not shown.
Binary file not shown.
91 changes: 52 additions & 39 deletions src/global/trampoline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ const TRAMPOLINE_BIN: &[u8] = include_bytes!(
"../../crates/pixi_trampoline/trampolines/pixi-trampoline-x86_64-pc-windows-msvc.exe.zst"
);

#[cfg(target_arch = "powerpc64")]
#[cfg(target_endian = "little")]
#[cfg(target_os = "linux")]
const TRAMPOLINE_BIN: &[u8] = include_bytes!(
"../../crates/pixi_trampoline/trampolines/pixi-trampoline-powerpc64le-unknown-linux-gnu.zst"
);

#[cfg(target_arch = "x86_64")]
#[cfg(target_os = "linux")]
const TRAMPOLINE_BIN: &[u8] = include_bytes!(
Expand Down Expand Up @@ -342,6 +335,11 @@ impl Trampoline {
}

/// Returns the decompressed trampoline binary
#[cfg(not(all(
target_arch = "powerpc64",
target_endian = "little",
target_os = "linux"
)))]
pub fn decompressed_trampoline() -> &'static [u8] {
// A static variable to hold the cached decompressed trampoline binary
static DECOMPRESSED_TRAMPOLINE_BIN: LazyLock<Vec<u8>> = LazyLock::new(|| {
Expand All @@ -353,44 +351,59 @@ impl Trampoline {
}

async fn write_trampoline(&self) -> miette::Result<()> {
let trampoline_path = self.trampoline_path();

// We need to check that there's indeed a trampoline at the path
if trampoline_path.is_file().not()
|| Trampoline::is_trampoline(&self.trampoline_path())
.await?
.not()
#[cfg(all(
target_arch = "powerpc64",
target_endian = "little",
target_os = "linux"
))]
{
tokio_fs::create_dir_all(self.root_path.join(TRAMPOLINE_CONFIGURATION))
.await
.into_diagnostic()?;
tokio_fs::write(
self.trampoline_path(),
Trampoline::decompressed_trampoline(),
)
.await
.into_diagnostic()?;
miette::bail!("powerpc64le is not supported for pixi global yet. If you need this, please open an issue on the pixi repository.");
}

// If the path doesn't exist yet, create a hard link to the shared trampoline binary
// If creating a hard link doesn't succeed, try copying
// Hard-linking might for example fail because the file-system enforces a maximum number of hard-links per file
if !self.path().exists()
&& tokio_fs::hard_link(&trampoline_path, self.path())
.await
.is_err()
#[cfg(not(all(
target_arch = "powerpc64",
target_endian = "little",
target_os = "linux"
)))]
{
tokio_fs::copy(&trampoline_path, self.path())
let trampoline_path = self.trampoline_path();

// We need to check that there's indeed a trampoline at the path
if trampoline_path.is_file().not()
|| Trampoline::is_trampoline(&self.trampoline_path())
.await?
.not()
{
tokio_fs::create_dir_all(self.root_path.join(TRAMPOLINE_CONFIGURATION))
.await
.into_diagnostic()?;
tokio_fs::write(
self.trampoline_path(),
Trampoline::decompressed_trampoline(),
)
.await
.into_diagnostic()?;
}
}

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
tokio_fs::set_permissions(self.path(), std::fs::Permissions::from_mode(0o755))
.await
.into_diagnostic()?;
// If the path doesn't exist yet, create a hard link to the shared trampoline binary
// If creating a hard link doesn't succeed, try copying
// Hard-linking might for example fail because the file-system enforces a maximum number of hard-links per file
if !self.path().exists()
&& tokio_fs::hard_link(&trampoline_path, self.path())
.await
.is_err()
{
tokio_fs::copy(&trampoline_path, self.path())
.await
.into_diagnostic()?;
}

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
tokio_fs::set_permissions(self.path(), std::fs::Permissions::from_mode(0o755))
.await
.into_diagnostic()?;
}
}

Ok(())
Expand Down
Loading