fmt
CI / build (push) Failing after 1m56s
CI / snap (push) Has been skipped

This commit is contained in:
2026-07-22 14:36:28 +02:00
parent 48248fdf9c
commit 768e1c4f78
7 changed files with 32 additions and 47 deletions
+2 -7
View File
@@ -170,13 +170,8 @@ pub fn parse_changelog_footer(path: &Path) -> Result<(String, String), Box<dyn s
)
})?;
let mut content = String::new();
file.read_to_string(&mut content).map_err(|e| {
format!(
"Failed to read changelog '{}': {}",
path.display(),
e
)
})?;
file.read_to_string(&mut content)
.map_err(|e| format!("Failed to read changelog '{}': {}", path.display(), e))?;
// Find the last maintainer line (format: -- Name <email> Date)
let re = Regex::new(r"--\s*([^<]+?)\s*<([^>]+)>\s*")?;
+1 -4
View File
@@ -168,10 +168,7 @@ mod tests {
ctx.copy_path(&src_dir, &dest_dir).unwrap();
// The regular file was copied.
assert_eq!(
ctx.read_file(&dest_dir.join("real.txt")).unwrap(),
"data"
);
assert_eq!(ctx.read_file(&dest_dir.join("real.txt")).unwrap(), "data");
// The symlink was reproduced as a symlink (not followed).
let meta = std::fs::symlink_metadata(dest_dir.join("dangling")).unwrap();
assert!(meta.file_type().is_symlink());
+2 -6
View File
@@ -48,12 +48,8 @@ fn copy_dir_recursive(src: &Path, dest: &Path) -> io::Result<()> {
Err(e) => {
return Err(io::Error::new(
e.kind(),
format!(
"Failed to read metadata of '{}': {}",
src_path.display(),
e
),
))
format!("Failed to read metadata of '{}': {}", src_path.display(), e),
));
}
};
+2 -4
View File
@@ -148,12 +148,10 @@ pub async fn build(
)
})?;
if !status.success() {
return Err(
"apt-get update failed inside the build context. \
return Err("apt-get update failed inside the build context. \
If this is a local build, try executing with sudo, \
or re-run with RUST_LOG=debug for more details."
.into(),
);
.into());
}
// Install essential packages
+5 -8
View File
@@ -126,8 +126,7 @@ pub async fn get_ordered_series(dist: &str) -> Result<Vec<SeriesInformation>, Bo
})?;
let series_info = &dist_data.series;
let content = if Path::new(series_info.local.as_str()).exists() {
std::fs::read_to_string(format!("/usr/share/distro-info/{dist}.csv"))
.map_err(|e| {
std::fs::read_to_string(format!("/usr/share/distro-info/{dist}.csv")).map_err(|e| {
format!(
"Failed to read distribution series data for '{dist}' \
from '{}': {}. The 'distro-info' package provides these CSV files.",
@@ -237,7 +236,8 @@ pub fn get_sources_url(base_url: &str, series: &str, pocket: &str, component: &s
///
/// Example: ubuntu => http://archive.ubuntu.com/ubuntu
pub fn get_base_url(dist: &str) -> Result<String, Box<dyn Error>> {
DATA.dist.get(dist)
DATA.dist
.get(dist)
.map(|d| d.base_url.clone())
.ok_or_else(|| {
format!(
@@ -281,9 +281,7 @@ pub async fn get_keyring_urls(series: &str) -> Result<Vec<String>, Box<dyn Error
Ok(urls)
}
} else {
let series_num = get_debian_series_number(series)
.await?
.ok_or_else(|| {
let series_num = get_debian_series_number(series).await?.ok_or_else(|| {
format!(
"Could not determine the version number for Debian series '{series}'. \
Make sure the 'distro-info' package is installed, which provides the \
@@ -349,8 +347,7 @@ pub async fn get_debian_series_number(series: &str) -> Result<Option<String>, Bo
})?;
let series_info = &dist_data.series;
let content = if Path::new(series_info.local.as_str()).exists() {
std::fs::read_to_string(series_info.local.as_str())
.map_err(|e| {
std::fs::read_to_string(series_info.local.as_str()).map_err(|e| {
format!(
"Failed to read Debian series data from '{}': {}. \
The 'distro-info' package provides this file.",
+2 -3
View File
@@ -247,9 +247,8 @@ fn main() {
let context = match type_str {
"local" => ContextConfig::Local,
"ssh" => {
let endpoint = args
.get_one::<String>("endpoint")
.unwrap_or_else(|| {
let endpoint =
args.get_one::<String>("endpoint").unwrap_or_else(|| {
error!(
"An --endpoint is required to create an ssh context. \
Expected format: [ssh://][user@]host[:port]"
+4 -1
View File
@@ -104,7 +104,10 @@ fn copy_dir_all(src: &Path, dst: &Path) -> Result<(), Box<dyn Error>> {
// Reproduce symlinks as symlinks rather than following them, so that
// dangling/absolute symlinks do not abort the copy.
if std::fs::symlink_metadata(&src_path)?.file_type().is_symlink() {
if std::fs::symlink_metadata(&src_path)?
.file_type()
.is_symlink()
{
let target = std::fs::read_link(&src_path)?;
let _ = std::fs::remove_file(&dst_path);
symlink(&target, &dst_path)?;