From 20dc599d542129801d18f25f51c96e42e0f96291 Mon Sep 17 00:00:00 2001 From: Robert Fairley Date: Fri, 7 Feb 2020 20:15:37 +0000 Subject: [PATCH] Update to 4.3.1 Signed-off-by: Robert Fairley --- .gitignore | 1 + ...oviders-vagrant-fix-deprecated-calls.patch | 37 ++++++++ ...-afterburn-update-to-new-reqwest-API.patch | 87 +++++++++++++++++++ afterburn-fix-metadata.diff | 55 ++++++------ rust-afterburn.spec | 16 +++- sources | 2 +- 6 files changed, 166 insertions(+), 32 deletions(-) create mode 100644 0001-Revert-providers-vagrant-fix-deprecated-calls.patch create mode 100644 0002-Revert-afterburn-update-to-new-reqwest-API.patch diff --git a/.gitignore b/.gitignore index 7177f95..bf0f05e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /afterburn-4.1.2.crate /afterburn-4.1.3.crate /afterburn-4.2.0.crate +/afterburn-4.3.1.crate diff --git a/0001-Revert-providers-vagrant-fix-deprecated-calls.patch b/0001-Revert-providers-vagrant-fix-deprecated-calls.patch new file mode 100644 index 0000000..f221385 --- /dev/null +++ b/0001-Revert-providers-vagrant-fix-deprecated-calls.patch @@ -0,0 +1,37 @@ +This reverts commit 7e870a1d51935c5ca8954b4b006387bbbf719d65. +--- + src/providers/vagrant_virtualbox/mod.rs | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +diff --git a/src/providers/vagrant_virtualbox/mod.rs b/src/providers/vagrant_virtualbox/mod.rs +index 975ae9c..4c45bc2 100644 +--- a/src/providers/vagrant_virtualbox/mod.rs ++++ b/src/providers/vagrant_virtualbox/mod.rs +@@ -68,10 +68,7 @@ impl MetadataProvider for VagrantVirtualboxProvider { + fn attributes(&self) -> Result> { + let mut out = HashMap::with_capacity(2); + +- let hostname = hostname::get() +- .chain_err(|| "unable to get hostname")? +- .to_string_lossy() +- .into_owned(); ++ let hostname = hostname::get_hostname().ok_or("unable to get hostname")?; + let ip = VagrantVirtualboxProvider::get_ip()?; + + out.insert("VAGRANT_VIRTUALBOX_HOSTNAME".to_string(), hostname); +@@ -81,11 +78,7 @@ impl MetadataProvider for VagrantVirtualboxProvider { + } + + fn hostname(&self) -> Result> { +- let hostname = hostname::get() +- .chain_err(|| "unable to get hostname")? +- .to_string_lossy() +- .into_owned(); +- Ok(Some(hostname)) ++ Ok(hostname::get_hostname()) + } + + fn ssh_keys(&self) -> Result> { +-- +2.25.0 + diff --git a/0002-Revert-afterburn-update-to-new-reqwest-API.patch b/0002-Revert-afterburn-update-to-new-reqwest-API.patch new file mode 100644 index 0000000..1a18947 --- /dev/null +++ b/0002-Revert-afterburn-update-to-new-reqwest-API.patch @@ -0,0 +1,87 @@ +This reverts commit 322105d38f386363e088fa4a21984230241eed2c. +--- + src/retry/client.rs | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/src/retry/client.rs b/src/retry/client.rs +index 0771767..41d19e2 100644 +--- a/src/retry/client.rs ++++ b/src/retry/client.rs +@@ -23,7 +23,8 @@ use std::borrow::Cow; + use std::io::Read; + use std::time::Duration; + +-use reqwest::{self, blocking, header, Method}; ++use reqwest::header; ++use reqwest::{self, Method, Request}; + use slog_scope::info; + + use serde; +@@ -94,7 +95,7 @@ impl Deserializer for Raw { + + #[derive(Debug, Clone)] + pub struct Client { +- client: blocking::Client, ++ client: reqwest::Client, + headers: header::HeaderMap, + retry: Retry, + return_on_404: bool, +@@ -102,7 +103,7 @@ pub struct Client { + + impl Client { + pub fn try_new() -> Result { +- let client = blocking::Client::builder() ++ let client = reqwest::Client::builder() + .build() + .chain_err(|| "failed to initialize client")?; + Ok(Client { +@@ -183,7 +184,7 @@ where + url: String, + body: Option, + d: D, +- client: blocking::Client, ++ client: reqwest::Client, + headers: header::HeaderMap, + retry: Retry, + return_on_404: bool, +@@ -203,7 +204,7 @@ where + T: for<'de> serde::Deserialize<'de>, + { + let url = reqwest::Url::parse(self.url.as_str()).chain_err(|| "failed to parse uri")?; +- let mut req = blocking::Request::new(Method::GET, url); ++ let mut req = Request::new(Method::GET, url); + req.headers_mut().extend(self.headers.clone().into_iter()); + + self.retry.clone().retry(|attempt| { +@@ -216,7 +217,7 @@ where + let url = reqwest::Url::parse(self.url.as_str()).chain_err(|| "failed to parse uri")?; + + self.retry.clone().retry(|attempt| { +- let mut builder = blocking::Client::new() ++ let mut builder = reqwest::Client::new() + .post(url.clone()) + .headers(self.headers.clone()) + .header(header::CONTENT_TYPE, self.d.content_type()); +@@ -241,7 +242,7 @@ where + }) + } + +- fn dispatch_request(&self, req: &blocking::Request) -> Result> ++ fn dispatch_request(&self, req: &Request) -> Result> + where + T: for<'de> serde::Deserialize<'de>, + { +@@ -273,8 +274,8 @@ where + + /// Reqwests Request struct doesn't implement `Clone`, + /// so we have to do it here. +-fn clone_request(req: &blocking::Request) -> blocking::Request { +- let mut newreq = blocking::Request::new(req.method().clone(), req.url().clone()); ++fn clone_request(req: &Request) -> Request { ++ let mut newreq = Request::new(req.method().clone(), req.url().clone()); + newreq + .headers_mut() + .extend(req.headers().clone().into_iter()); +-- +2.25.0 + diff --git a/afterburn-fix-metadata.diff b/afterburn-fix-metadata.diff index dcf49a3..1937794 100644 --- a/afterburn-fix-metadata.diff +++ b/afterburn-fix-metadata.diff @@ -1,36 +1,33 @@ ---- afterburn-4.2.0/Cargo.toml 1970-01-01T00:00:00+00:00 -+++ afterburn-4.2.0/Cargo.toml 2020-01-09T19:12:17.608171+00:00 -@@ -50,13 +50,13 @@ - version = "0.1" +--- afterburn-4.3.1/Cargo.toml 2020-01-21T15:19:26+00:00 ++++ afterburn-4.3.1/Cargo.toml 2020-02-07T18:51:22.734139+00:00 +@@ -45,10 +45,10 @@ + default-features = false + + [dependencies.hostname] +-version = "0.3" ++version = "0.1" [dependencies.ipnetwork] --version = "^0.15.0" +-version = "^0.16.0" +version = "^0.14.0" - [dependencies.mime] - version = "0.3" + [dependencies.maplit] + version = "^1.0.2" +@@ -66,14 +66,13 @@ + version = "^0.10.26" - [dependencies.nix] --version = "^0.15.0" -+version = "^0.16.0" - - [dependencies.openssh-keys] - version = "^0.4.1" -@@ -93,7 +93,7 @@ - version = "2.1" - - [dependencies.slog-scope] --version = "~4.1" -+version = "4.1" - - [dependencies.slog-term] - version = "2.4" -@@ -114,7 +114,7 @@ - version = "^1.0" - - [dev-dependencies.mockito] --version = "^0.21.0" + [dependencies.pnet_base] +-version = "^0.25.0" +version = "^0.22.0" - [features] - cl-legacy = ["update-ssh-keys"] + [dependencies.pnet_datalink] +-version = "^0.25.0" ++version = "^0.22.0" + + [dependencies.reqwest] +-version = "^0.10.1" +-features = ["blocking"] ++version = "^0.9.24" + + [dependencies.serde] + version = "1.0" diff --git a/rust-afterburn.spec b/rust-afterburn.spec index 3c70601..e422099 100644 --- a/rust-afterburn.spec +++ b/rust-afterburn.spec @@ -7,8 +7,8 @@ %global crate afterburn Name: rust-%{crate} -Version: 4.2.0 -Release: 3%{?dist} +Version: 4.3.1 +Release: 1%{?dist} Summary: Simple cloud provider agent # Upstream license specification: Apache-2.0 @@ -17,6 +17,15 @@ URL: https://crates.io/crates/afterburn Source: %{crates_source} # Initial patched metadata Patch0: afterburn-fix-metadata.diff +# Use deprecated get_hostname calls so that hostname 0.1 can be used as +# a dependency. TODO: remove patch once at least hostname 0.2 is packaged +# in Fedora. +# https://github.com/svartalf/hostname/blob/master/CHANGELOG.md#020---2019-11-09 +Patch1: 0001-Revert-providers-vagrant-fix-deprecated-calls.patch +# Use older request API so reqwest 0.9.24 can be used as a dependency. +# TODO: remove patch once at least request 0.10.0 is packaged in Fedora. +# https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md#v0100 +Patch2: 0002-Revert-afterburn-update-to-new-reqwest-API.patch ExclusiveArch: %{rust_arches} @@ -104,6 +113,9 @@ cp -a dracut/* %{buildroot}%{dracutmodulesdir} %endif %changelog +* Fri Feb 07 2020 Robert Fairley - 4.3.1-1 +- Update to 4.3.1 + * Thu Jan 30 2020 Fedora Release Engineering - 4.2.0-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/sources b/sources index 00e8526..f424aa4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (afterburn-4.2.0.crate) = 350e17f9da230aee60ce0e52f70baa7f501d2fbc7292eeb7a1c70f463bd79d50058ac5a22772ec0ccb1820eada5ca08a807ccc9d191f9f6069fb7ced14e63a34 +SHA512 (afterburn-4.3.1.crate) = 773c0fc1bf1727075a3f68331497998745e419b5c2109059a6bcf4bd25f7345c7c4bc3e092713d7f90fe8ed6e2ac1f090d35b1fe6d05075d5a20d9dc6654c3da