Skip to content

Commit

Permalink
Merge pull request #450 from cgwalters/bump-msrv
Browse files Browse the repository at this point in the history
Bump MSRV to 1.66.0
  • Loading branch information
jmarrero committed May 5, 2023
2 parents fc9a520 + 1f32f94 commit 25bd46c
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ permissions:
env:
CARGO_TERM_COLOR: always
# Pinned toolchain for linting
ACTION_LINTS_TOOLCHAIN: 1.59.0
ACTION_LINTS_TOOLCHAIN: 1.66.0

jobs:
tests-stable:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "Apache-2.0"
version = "0.2.9"
authors = ["Colin Walters <walters@verbum.org>"]
edition = "2021"
rust-version = "1.58.1"
rust-version = "1.66.0"

# See https://github.com/cgwalters/cargo-vendor-filterer
[package.metadata.vendor-filter]
Expand Down
6 changes: 3 additions & 3 deletions src/bios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ impl Bios {
// We also add part_gpt because in some cases probing of the partition map can fail such
// as in a container, but we always use GPT.
#[cfg(target_arch = "x86_64")]
cmd.args(&["--target", "i386-pc"])
.args(&["--boot-directory", boot_dir.to_str().unwrap()])
.args(&["--modules", "mdraid1x part_gpt"])
cmd.args(["--target", "i386-pc"])
.args(["--boot-directory", boot_dir.to_str().unwrap()])
.args(["--modules", "mdraid1x part_gpt"])
.arg(device);

#[cfg(target_arch = "powerpc64")]
Expand Down
2 changes: 2 additions & 0 deletions src/bootupd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ pub(crate) fn get_components() -> Components {
}

#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
#[allow(clippy::box_default)]
insert_component(&mut components, Box::new(efi::Efi::default()));

#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
#[allow(clippy::box_default)]
insert_component(&mut components, Box::new(bios::Bios::default()));

components
Expand Down
4 changes: 3 additions & 1 deletion src/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ pub(crate) trait Component {
pub(crate) fn new_from_name(name: &str) -> Result<Box<dyn Component>> {
let r: Box<dyn Component> = match name {
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
#[allow(clippy::box_default)]
"EFI" => Box::new(crate::efi::Efi::default()),
#[cfg(any(target_arch = "x86_64", target_arch = "powerpc64"))]
#[allow(clippy::box_default)]
"BIOS" => Box::new(crate::bios::Bios::default()),
_ => anyhow::bail!("No component {}", name),
};
Expand Down Expand Up @@ -114,7 +116,7 @@ pub(crate) fn write_update_metadata(
let sysroot = openat::Dir::open(sysroot)?;
let dir = sysroot.sub_dir(BOOTUPD_UPDATES_DIR)?;
let name = component_update_data_name(component);
dir.write_file_with(&name, 0o644, |w| -> Result<_> {
dir.write_file_with(name, 0o644, |w| -> Result<_> {
Ok(serde_json::to_writer(w, &meta)?)
})?;
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/efi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ impl Component for Efi {
// TODO - add some sort of API that allows directly setting the working
// directory to a file descriptor.
let r = std::process::Command::new("cp")
.args(&["-rp", "--reflink=auto"])
.args(["-rp", "--reflink=auto"])
.arg(&srcdir_name)
.arg(&destdir)
.arg(destdir)
.current_dir(format!("/proc/self/fd/{}", src_root.as_raw_fd()))
.status()?;
if !r.success() {
Expand Down Expand Up @@ -262,7 +262,7 @@ impl Component for Efi {

// Fork off mv() because on overlayfs one can't rename() a lower level
// directory today, and this will handle the copy fallback.
Command::new("mv").args(&[&efisrc, &dest_efidir]).run()?;
Command::new("mv").args([&efisrc, &dest_efidir]).run()?;
}

// Query the rpm database and list the package and build times for all the
Expand Down
23 changes: 11 additions & 12 deletions src/filetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub(crate) struct ApplyUpdateOptions {
pub(crate) fn syncfs(d: &openat::Dir) -> Result<()> {
let d = d.sub_dir(".").expect("subdir");
let mut c = std::process::Command::new("sync");
let c = c.args(&["-f", "."]);
let c = c.args(["-f", "."]);
unsafe {
c.pre_exec(move || {
nix::unistd::fchdir(d.as_raw_fd()).expect("fchdir");
Expand Down Expand Up @@ -357,8 +357,8 @@ mod tests {
use std::io::Write;

fn run_diff(a: &openat::Dir, b: &openat::Dir) -> Result<FileTreeDiff> {
let ta = FileTree::new_from_dir(&a)?;
let tb = FileTree::new_from_dir(&b)?;
let ta = FileTree::new_from_dir(a)?;
let tb = FileTree::new_from_dir(b)?;
let diff = ta.diff(&tb)?;
Ok(diff)
}
Expand All @@ -374,7 +374,7 @@ mod tests {
let c = t.path().join("c");
let r = std::process::Command::new("cp")
.arg("-rp")
.args(&[a, &c])
.args([a, &c])
.status()?;
if !r.success() {
bail!("failed to cp");
Expand Down Expand Up @@ -415,9 +415,8 @@ mod tests {
skip_removals: true,
..Default::default()
};
test_one_apply(&a, &b, None).context("testing apply (with removals)")?;
test_one_apply(&a, &b, Some(&skip_removals))
.context("testing apply (skipping removals)")?;
test_one_apply(a, b, None).context("testing apply (with removals)")?;
test_one_apply(a, b, Some(&skip_removals)).context("testing apply (skipping removals)")?;
Ok(())
}

Expand All @@ -438,7 +437,7 @@ mod tests {
assert_eq!(diff.count(), 0);
{
let mut bar = a.write_file("foo/bar", 0o644)?;
bar.write("foobarcontents".as_bytes())?;
bar.write_all("foobarcontents".as_bytes())?;
}
let diff = run_diff(&a, &b)?;
assert_eq!(diff.count(), 1);
Expand All @@ -457,14 +456,14 @@ mod tests {
b.create_dir("foo", 0o755)?;
{
let mut bar = b.write_file("foo/bar", 0o644)?;
bar.write("foobarcontents".as_bytes())?;
bar.write_all("foobarcontents".as_bytes())?;
}
let diff = run_diff(&a, &b)?;
assert_eq!(diff.count(), 0);
test_apply(&pa, &pb).context("testing apply 2")?;
{
let mut bar2 = b.write_file("foo/bar", 0o644)?;
bar2.write("foobarcontents2".as_bytes())?;
bar2.write_all("foobarcontents2".as_bytes())?;
}
let diff = run_diff(&a, &b)?;
assert_eq!(diff.count(), 1);
Expand Down Expand Up @@ -496,7 +495,7 @@ mod tests {
let newsubp = Path::new(relp).join("subdir");
fs::create_dir_all(b.join(&newsubp))?;
fs::write(b.join(&newsubp).join("newgrub.x64"), "newgrub data")?;
fs::remove_file(b.join(&relp).join("shim.x64"))?;
fs::remove_file(b.join(relp).join("shim.x64"))?;
{
let a = openat::Dir::open(&a)?;
let b = openat::Dir::open(&b)?;
Expand All @@ -516,7 +515,7 @@ mod tests {
String::from_utf8(std::fs::read(a.join(&newsubp).join("newgrub.x64"))?)?,
"newgrub data"
);
assert!(!a.join(&relp).join("shim.x64").exists());
assert!(!a.join(relp).join("shim.x64").exists());
Ok(())
}
}
6 changes: 3 additions & 3 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub(crate) fn ensure_writable_mount<P: AsRef<Path>>(p: P) -> Result<()> {
return Ok(());
}
let status = std::process::Command::new("mount")
.args(&["-o", "remount,rw"])
.args(["-o", "remount,rw"])
.arg(p)
.status()?;
if !status.success() {
Expand Down Expand Up @@ -128,7 +128,7 @@ pub(crate) fn parse_rpm_metadata(stdout: Vec<u8>) -> Result<ContentMetadata> {
/// files in the EFI system partition, or for grub2-install file
pub(crate) fn rpm_query(sysroot_path: &str, path: &Path) -> Result<Command> {
let mut c = ostreeutil::rpm_cmd(sysroot_path);
c.args(&["-q", "--queryformat", "%{nevra},%{buildtime} ", "-f"]);
c.args(["-q", "--queryformat", "%{nevra},%{buildtime} ", "-f"]);

match path.file_name().expect("filename").to_str() {
Some("EFI") => {
Expand All @@ -139,7 +139,7 @@ pub(crate) fn rpm_query(sysroot_path: &str, path: &Path) -> Result<Command> {
}));
}
Some("grub2-install") => {
c.arg(&path);
c.arg(path);
}
_ => {
bail!("Unsupported file/directory {:?}", path)
Expand Down

0 comments on commit 25bd46c

Please sign in to comment.