From 7ed70e3229f7f514faf6e37fc49642546c954b39 Mon Sep 17 00:00:00 2001 From: cat_in_136 Date: Wed, 12 Jun 2024 01:18:33 +0900 Subject: [PATCH 1/3] upgrade rpm crates and so on --- Cargo.toml | 6 +++--- src/config/file_info.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fcc4495..000e2a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,11 +12,11 @@ version = "0.14.1" edition = "2021" [dependencies] -glob = "0.3.0" -rpm = { version = "0.13.1", default-features = false } +glob = "0.3" +rpm = { version = "0.14", default-features = false } toml = "0.7" cargo_toml = "0.15" -clap = { version = "4.3", features = ["derive"] } +clap = { version = "~4.3", features = ["derive"] } color-print = "0.3" thiserror = "1" elf = "0.7" diff --git a/src/config/file_info.rs b/src/config/file_info.rs index c520735..e4ce6e7 100644 --- a/src/config/file_info.rs +++ b/src/config/file_info.rs @@ -161,7 +161,7 @@ impl FileInfo<'_, '_, '_, '_, '_> { rpm_file_option = rpm_file_option.is_config(); } if self.config_noreplace { - rpm_file_option = rpm_file_option.is_no_replace(); + rpm_file_option = rpm_file_option.is_config_noreplace(); } if self.doc { rpm_file_option = rpm_file_option.is_doc(); From 80768dc9bcc5024de8e10f3258ee4ad388847afc Mon Sep 17 00:00:00 2001 From: cat_in_136 Date: Thu, 13 Jun 2024 00:40:08 +0900 Subject: [PATCH 2/3] upgrade toml and cargo_toml dependency libraries --- src/config/file_info.rs | 2 +- src/config/mod.rs | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/config/file_info.rs b/src/config/file_info.rs index e4ce6e7..83dfae9 100644 --- a/src/config/file_info.rs +++ b/src/config/file_info.rs @@ -302,7 +302,7 @@ mod test { #[test] fn test_new() { - let manifest = Manifest::from_path("Cargo.toml").unwrap(); + let manifest = Manifest::from_path("./Cargo.toml").unwrap(); let metadata = manifest.package.unwrap().metadata.unwrap(); let metadata = metadata .as_table() diff --git a/src/config/mod.rs b/src/config/mod.rs index e821485..5de5a66 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -40,7 +40,7 @@ impl Config { workspace_base_path: Option<&Path>, extra_metadata_src: &[ExtraMetadataSource], ) -> Result { - let manifest_path = Self::create_cargo_toml_path(project_base_path); + let manifest_path = Self::create_cargo_toml_path(project_base_path)?; let manifest = if let Some(p) = workspace_base_path { // HACK when workspace used, manifest is generated from slice directly instead of @@ -52,7 +52,7 @@ impl Config { .map_err(|e| Error::FileIo(manifest_path.clone(), e))?; let mut manifest = Manifest::from_slice_with_metadata(&cargo_toml_content)?; - let workspace_manifest_path = Self::create_cargo_toml_path(p); + let workspace_manifest_path = Self::create_cargo_toml_path(p)?; let workspace_manifest = Manifest::from_path(&workspace_manifest_path).map_err(|err| match err { CargoTomlError::Io(e) => { @@ -84,8 +84,9 @@ impl Config { }) } - pub(crate) fn create_cargo_toml_path>(base_path: P) -> PathBuf { - base_path.as_ref().join("Cargo.toml") + pub(crate) fn create_cargo_toml_path>(base_path: P) -> Result { + let path = base_path.as_ref().join("Cargo.toml"); + path.canonicalize().or_else(|e| Err(Error::FileIo(path, e))) } fn table_to_dependencies(table: &Table) -> Result, ConfigError> { @@ -415,9 +416,15 @@ documentation.workspace = true #[test] fn test_new() { + let cargo_toml_path = std::env::current_dir().unwrap().join("Cargo.toml"); + let config = Config::new(Path::new(""), None, &[]).unwrap(); assert_eq!(config.manifest.package.unwrap().name, "cargo-generate-rpm"); - assert_eq!(config.manifest_path, PathBuf::from("Cargo.toml")); + assert_eq!(config.manifest_path, cargo_toml_path); + + let config = Config::new(std::env::current_dir().unwrap().as_path(), None, &[]).unwrap(); + assert_eq!(config.manifest.package.unwrap().name, "cargo-generate-rpm"); + assert_eq!(config.manifest_path, cargo_toml_path); } #[test] From cfb4384dcefb2f5e6ee8af90e0d913fd6cfa5728 Mon Sep 17 00:00:00 2001 From: cat_in_136 Date: Sat, 22 Jun 2024 21:05:16 +0900 Subject: [PATCH 3/3] add to README an announce of retiring support of RPMv3 (e.g., centos7) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b598cfb..a8d20ab 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ using the [`rpm`](https://crates.io/crates/rpm) crate. ![Rust](https://github.com/cat-in-136/cargo-generate-rpm/workflows/Rust/badge.svg) [![cargo-generate-rpm at crates.io](https://img.shields.io/crates/v/cargo-generate-rpm.svg)](https://crates.io/crates/cargo-generate-rpm) +Legacy systems requiring RPMv3 (e.g. CentOS 7) are no longer supported due to rpm-rs compatibility. +Use versions prior to 0.15 for such a system. + ## Install ```sh @@ -222,9 +225,6 @@ Similarly, if using a custom build profile with, for example, `--profile custom` The default payload compress type of the generated RPM file is zstd. You can specify the payload compress type with `--payload-compress TYPE`: none, gzip, or zstd. -For the legacy system (e.g. centos7), specify legacy compress type explicitly e.g. `--payload-compress none`. - - ### Scriptlet Flags and Prog Settings Scriptlet settings can be configured via `*_script_flags` and `*_script_prog` settings.