From 715ca5808ab50daf9782661102f1d887085a6016 Mon Sep 17 00:00:00 2001 From: Marcel Hellwig Date: Wed, 15 Feb 2023 15:19:12 +0100 Subject: [PATCH] don't require a homepage this is not necessary, neither for cargo nor for bitbake and for our internal projects we typically don't set it, so let's skip it plz :) --- src/bitbake.template | 2 +- src/main.rs | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/bitbake.template b/src/bitbake.template index 86e3c2d..20cec51 100644 --- a/src/bitbake.template +++ b/src/bitbake.template @@ -25,8 +25,8 @@ LIC_FILES_CHKSUM = " \ {lic_files}" SUMMARY = "{summary}" -HOMEPAGE = "{homepage}" LICENSE = "{license}" +{homepage} # includes this file if it exists but does not fail # this is useful for anything you may want to override from diff --git a/src/main.rs b/src/main.rs index 7f298ff..fc30138 100644 --- a/src/main.rs +++ b/src/main.rs @@ -306,17 +306,14 @@ fn real_main(options: Args, config: &mut Config) -> CliResult { let homepage = metadata .homepage .as_ref() - .map_or_else( - || { - println!("No package.homepage set in your Cargo.toml, trying package.repository"); - metadata - .repository - .as_ref() - .ok_or_else(|| anyhow!("No package.repository set in your Cargo.toml")) - }, - Ok, - )? - .trim(); + .or_else(|| { + println!("No package.homepage set in your Cargo.toml, trying package.repository"); + metadata.repository.as_ref().or_else(|| { + println!("No package.repository set in your Cargo.toml"); + None + }) + }) + .map_or_else(String::new, |s| format!("HOMEPAGE = \"{}\"", s.trim())); // package license let license = metadata.license.as_ref().map_or_else(