Skip to content

Commit faed26f

Browse files
authored
Merge branch 'main' into main
2 parents 6d57060 + 3c86c7f commit faed26f

File tree

26 files changed

+625
-242
lines changed

26 files changed

+625
-242
lines changed

.gemini/config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# This config mainly overrides `summary: false` by default
2+
# as it's really noisy.
3+
have_fun: true
4+
code_review:
5+
disable: false
6+
comment_severity_threshold: MEDIUM
7+
max_review_comments: -1
8+
pull_request_opened:
9+
help: false
10+
summary: false # turned off by default
11+
code_review: true
12+
ignore_patterns: []

Cargo.lock

Lines changed: 14 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ inherits = "release"
4343
lto = "yes"
4444

4545
[workspace.dependencies]
46+
anstream = "0.6"
4647
anyhow = "1.0.82"
4748
camino = "1.1.6"
4849
cap-std-ext = "4.0.3"
@@ -55,6 +56,7 @@ indicatif = "0.17.0"
5556
fn-error-context = "0.2.1"
5657
libc = "0.2.154"
5758
openssl = "0.10.72"
59+
owo-colors = { version = "4" }
5860
rustix = { "version" = "1", features = ["thread", "net", "fs", "system", "process", "mount"] }
5961
serde = "1.0.199"
6062
serde_json = "1.0.116"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ start by looking at [ADOPTERS.md](ADOPTERS.md).
4242

4343
## Community discussion
4444

45-
The [GitHub discussion forum](https://github.com/bootc-dev/bootc/discussions) is enabled.
45+
- [Github discussion forum](https://github.com/containers/bootc/discussions) for async discussion
46+
- [#bootc-dev on CNCF Slack](https://cloud-native.slack.com/archives/C08SKSQKG1L) for live chat
4647

4748
This project is also tightly related to the previously mentioned Fedora/CentOS bootc project,
4849
and many developers monitor the relevant discussion forums there. In particular there's a

cli/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ default-run = "bootc"
1414
platforms = ["*-unknown-linux-gnu"]
1515

1616
[dependencies]
17+
anstream = { workspace = true }
1718
anyhow = { workspace = true }
1819
bootc-lib = { version = "1.0", path = "../lib" }
1920
bootc-utils = { path = "../utils" }
2021
tokio = { workspace = true, features = ["macros"] }
2122
log = "0.4.21"
23+
owo-colors = { workspace = true }
2224
tracing = { workspace = true }
2325

2426
[lints]

cli/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! The main entrypoint for bootc, which just performs global initialization, and then
22
//! calls out into the library.
3+
//!
4+
use std::io::Write as _;
5+
36
use anyhow::Result;
47

58
/// The code called after we've done process global init and created
@@ -32,11 +35,15 @@ fn run() -> Result<()> {
3235
}
3336

3437
fn main() {
38+
use owo_colors::OwoColorize;
39+
3540
// In order to print the error in a custom format (with :#) our
3641
// main simply invokes a run() where all the work is done.
3742
// This code just captures any errors.
3843
if let Err(e) = run() {
39-
tracing::error!("{:#}", e);
44+
let mut stderr = anstream::stderr();
45+
// Don't panic if writing fails
46+
let _ = writeln!(stderr, "{}{:#}", "error: ".red(), e);
4047
std::process::exit(1);
4148
}
4249
}

lib/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ readme = "README.md"
77
repository = "https://github.com/bootc-dev/bootc"
88
# The intention is we'll follow semver here, even though this
99
# project isn't actually published as a crate.
10-
version = "1.2.0"
10+
version = "1.3.0"
1111
# In general we try to keep this pinned to what's in the latest RHEL9.
1212
# However right now, we bumped to 1.82 as that's what composefs-rs uses.
1313
rust-version = "1.82.0"

lib/src/cli.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ pub(crate) enum ContainerOpts {
279279
/// Example: --skip nonempty-boot --skip baseimage-root
280280
#[clap(long)]
281281
skip: Vec<String>,
282+
283+
/// Don't truncate the output. By default, only a limited number of entries are
284+
/// shown for each lint, followed by a count of remaining entries.
285+
#[clap(long)]
286+
no_truncate: bool,
282287
},
283288
}
284289

@@ -1012,6 +1017,8 @@ pub fn global_init() -> Result<()> {
10121017
// This shouldn't ever happen
10131018
eprintln!("failed to set name: {e}");
10141019
}
1020+
// Silence SELinux log warnings
1021+
ostree::SePolicy::set_null_log();
10151022
let am_root = rustix::process::getuid().is_root();
10161023
// Work around bootc-image-builder not setting HOME, in combination with podman (really c/common)
10171024
// bombing out if it is unset.
@@ -1095,6 +1102,7 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
10951102
fatal_warnings,
10961103
list,
10971104
skip,
1105+
no_truncate,
10981106
} => {
10991107
if list {
11001108
return lints::lint_list(std::io::stdout().lock());
@@ -1112,7 +1120,14 @@ async fn run_from_opt(opt: Opt) -> Result<()> {
11121120

11131121
let root = &Dir::open_ambient_dir(rootfs, cap_std::ambient_authority())?;
11141122
let skip = skip.iter().map(|s| s.as_str());
1115-
lints::lint(root, warnings, root_type, skip, std::io::stdout().lock())?;
1123+
lints::lint(
1124+
root,
1125+
warnings,
1126+
root_type,
1127+
skip,
1128+
std::io::stdout().lock(),
1129+
no_truncate,
1130+
)?;
11161131
Ok(())
11171132
}
11181133
},

lib/src/fsck.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
use std::fmt::Write as _;
1010
use std::future::Future;
11+
use std::num::NonZeroUsize;
1112
use std::pin::Pin;
1213

13-
use bootc_utils::iterator_split_nonempty_rest_count;
14+
use bootc_utils::collect_until;
1415
use camino::Utf8PathBuf;
1516
use cap_std::fs::{Dir, MetadataExt as _};
1617
use cap_std_ext::cap_std;
@@ -250,9 +251,10 @@ async fn check_fsverity_inner(storage: &Storage) -> FsckResult {
250251
let verity_found_state =
251252
verity_state_of_all_objects(&storage.repo(), verity_state.desired == Tristate::Enabled)
252253
.await?;
253-
let Some((missing, rest)) =
254-
iterator_split_nonempty_rest_count(verity_found_state.missing.iter(), 5)
255-
else {
254+
let Some((missing, rest)) = collect_until(
255+
verity_found_state.missing.iter(),
256+
const { NonZeroUsize::new(5).unwrap() },
257+
) else {
256258
return fsck_ok();
257259
};
258260
let mut err = String::from("fsverity enabled, but objects without fsverity:\n");

lib/src/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ impl InstallAleph {
535535
l.get(oci_spec::image::ANNOTATION_CREATED)
536536
.map(|s| s.as_str())
537537
})
538-
.and_then(crate::status::try_deserialize_timestamp);
538+
.and_then(bootc_utils::try_deserialize_timestamp);
539539
let r = InstallAleph {
540540
image: src_imageref.imgref.name.clone(),
541541
version: imgstate.version().as_ref().map(|s| s.to_string()),

0 commit comments

Comments
 (0)