Skip to content

Commit

Permalink
Merge pull request nix-community#353 from nix-community/update-rust
Browse files Browse the repository at this point in the history
rust: update 1.75 -> 1.78
  • Loading branch information
nikstur authored Jun 9, 2024
2 parents 547c7bf + 1b4d62e commit 56ed078
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions rust/tool/shared/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl SecureTempDirExt for TempDir {
fn create_secure_file(&self, path: &Path) -> Result<fs::File> {
fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.mode(0o600)
.open(path)
Expand Down
5 changes: 0 additions & 5 deletions rust/tool/systemd/src/architecture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@ use lanzaboote_tool::architecture::Architecture;

/// Systemd-specific architecture helpers
pub trait SystemdArchitectureExt {
fn systemd_stub_filename(&self) -> PathBuf;
fn systemd_filename(&self) -> PathBuf;
}

impl SystemdArchitectureExt for Architecture {
fn systemd_stub_filename(&self) -> PathBuf {
format!("linux{}.efi.stub", self.efi_representation()).into()
}

fn systemd_filename(&self) -> PathBuf {
format!("systemd-boot{}.efi", self.efi_representation()).into()
}
Expand Down
13 changes: 8 additions & 5 deletions rust/tool/systemd/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use sha2::{Digest, Sha256};
use tempfile::TempDir;

use lanzaboote_tool::architecture::Architecture;
use lzbt_systemd::architecture::SystemdArchitectureExt;

/// Returns the host platform system
/// in the system double format for
Expand Down Expand Up @@ -98,7 +97,7 @@ pub fn setup_generation_link_from_toplevel(
/// Accepts the temporary directory as a parameter so that the invoking function retains control of
/// it (and when it goes out of scope).
pub fn setup_toplevel(tmpdir: &Path) -> Result<PathBuf> {
let system = Architecture::from_nixos_system(SYSTEM)?;
let architecture = Architecture::from_nixos_system(SYSTEM)?;

// Generate a random toplevel name so that multiple toplevel paths can live alongside each
// other in the same directory.
Expand All @@ -107,7 +106,7 @@ pub fn setup_toplevel(tmpdir: &Path) -> Result<PathBuf> {
fs::create_dir_all(&fake_store_path)?;

let test_systemd = systemd_location_from_env()?;
let systemd_stub_filename = system.systemd_stub_filename();
let systemd_stub_filename = systemd_stub_filename(&architecture);
let test_systemd_stub = format!(
"{test_systemd}/lib/systemd/boot/efi/{systemd_stub_filename}",
systemd_stub_filename = systemd_stub_filename.display()
Expand Down Expand Up @@ -146,9 +145,9 @@ pub fn lanzaboote_install(
) -> Result<Output> {
// To simplify the test setup, we use the systemd stub here instead of the lanzaboote stub. See
// the comment in setup_toplevel for details.
let system = Architecture::from_nixos_system(SYSTEM)?;
let architecture = Architecture::from_nixos_system(SYSTEM)?;
let test_systemd = systemd_location_from_env()?;
let systemd_stub_filename = system.systemd_stub_filename();
let systemd_stub_filename = systemd_stub_filename(&architecture);
let test_systemd_stub = format!(
"{test_systemd}/lib/systemd/boot/efi/{systemd_stub_filename}",
systemd_stub_filename = systemd_stub_filename.display()
Expand Down Expand Up @@ -259,3 +258,7 @@ pub fn image_path(esp: &TempDir, version: u64, toplevel: &Path) -> Result<PathBu
"EFI/Linux/nixos-generation-{version}-{stub_input_hash}.efi"
)))
}

fn systemd_stub_filename(architecture: &Architecture) -> PathBuf {
format!("linux{}.efi.stub", architecture.efi_representation()).into()
}
2 changes: 1 addition & 1 deletion rust/uefi/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "1.75.0"
channel = "1.78.0"
components = [ "rust-src" ]
targets = [ "x86_64-unknown-uefi", "aarch64-unknown-uefi" ]

0 comments on commit 56ed078

Please sign in to comment.