Initial import
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
78ee4d1ac7
commit
fdc011f21a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/afterburn-4.1.0.crate
|
115
0001-Use-pnet_-subcrates.patch
Normal file
115
0001-Use-pnet_-subcrates.patch
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
From 96d1972ca872559fc70ad847a53bf9e20417e505 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||||
|
Date: Sun, 28 Apr 2019 10:43:24 +0200
|
||||||
|
Subject: [PATCH] Use pnet_* subcrates
|
||||||
|
|
||||||
|
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||||
|
---
|
||||||
|
src/main.rs | 1 -
|
||||||
|
src/network.rs | 2 +-
|
||||||
|
src/providers/digitalocean/mod.rs | 2 +-
|
||||||
|
src/providers/packet/mod.rs | 2 +-
|
||||||
|
src/providers/vagrant_virtualbox/mod.rs | 6 +++---
|
||||||
|
src/util/mod.rs | 4 ++--
|
||||||
|
6 files changed, 8 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/main.rs b/src/main.rs
|
||||||
|
index 337f3da..9743425 100644
|
||||||
|
--- a/src/main.rs
|
||||||
|
+++ b/src/main.rs
|
||||||
|
@@ -22,7 +22,6 @@ extern crate ipnetwork;
|
||||||
|
extern crate nix;
|
||||||
|
extern crate openssh_keys;
|
||||||
|
extern crate openssl;
|
||||||
|
-extern crate pnet;
|
||||||
|
extern crate reqwest;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate serde_derive;
|
||||||
|
diff --git a/src/network.rs b/src/network.rs
|
||||||
|
index f084a75..d12037d 100644
|
||||||
|
--- a/src/network.rs
|
||||||
|
+++ b/src/network.rs
|
||||||
|
@@ -16,7 +16,7 @@
|
||||||
|
//! interface unit files. All that is left is to write the resulting string to
|
||||||
|
//! the necessary unit.
|
||||||
|
|
||||||
|
-use pnet::util::MacAddr;
|
||||||
|
+use pnet_base::MacAddr;
|
||||||
|
use std::net::IpAddr;
|
||||||
|
use std::string::String;
|
||||||
|
use std::string::ToString;
|
||||||
|
diff --git a/src/providers/digitalocean/mod.rs b/src/providers/digitalocean/mod.rs
|
||||||
|
index eeaa7c2..e6ad868 100644
|
||||||
|
--- a/src/providers/digitalocean/mod.rs
|
||||||
|
+++ b/src/providers/digitalocean/mod.rs
|
||||||
|
@@ -21,7 +21,7 @@ use std::str::FromStr;
|
||||||
|
use ipnetwork;
|
||||||
|
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
|
||||||
|
use openssh_keys::PublicKey;
|
||||||
|
-use pnet::util::MacAddr;
|
||||||
|
+use pnet_base::MacAddr;
|
||||||
|
|
||||||
|
use crate::errors::*;
|
||||||
|
use crate::network;
|
||||||
|
diff --git a/src/providers/packet/mod.rs b/src/providers/packet/mod.rs
|
||||||
|
index f471baf..3a42520 100644
|
||||||
|
--- a/src/providers/packet/mod.rs
|
||||||
|
+++ b/src/providers/packet/mod.rs
|
||||||
|
@@ -23,7 +23,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use openssh_keys::PublicKey;
|
||||||
|
-use pnet::util::MacAddr;
|
||||||
|
+use pnet_base::MacAddr;
|
||||||
|
|
||||||
|
use crate::errors::*;
|
||||||
|
use crate::network::{self, Device, Interface, NetworkRoute, Section};
|
||||||
|
diff --git a/src/providers/vagrant_virtualbox/mod.rs b/src/providers/vagrant_virtualbox/mod.rs
|
||||||
|
index e4d4109..5d5ee40 100644
|
||||||
|
--- a/src/providers/vagrant_virtualbox/mod.rs
|
||||||
|
+++ b/src/providers/vagrant_virtualbox/mod.rs
|
||||||
|
@@ -21,7 +21,7 @@ use std::time::Duration;
|
||||||
|
|
||||||
|
use hostname;
|
||||||
|
use openssh_keys::PublicKey;
|
||||||
|
-use pnet;
|
||||||
|
+use pnet_datalink;
|
||||||
|
|
||||||
|
use crate::errors::*;
|
||||||
|
use crate::network;
|
||||||
|
@@ -52,8 +52,8 @@ impl VagrantVirtualboxProvider {
|
||||||
|
Err("eth1 was not found!".into())
|
||||||
|
}
|
||||||
|
|
||||||
|
- fn find_eth1() -> Option<pnet::datalink::NetworkInterface> {
|
||||||
|
- let mut ifaces = pnet::datalink::interfaces();
|
||||||
|
+ fn find_eth1() -> Option<pnet_datalink::NetworkInterface> {
|
||||||
|
+ let mut ifaces = pnet_datalink::interfaces();
|
||||||
|
ifaces.retain(|i| i.name == "eth1");
|
||||||
|
if !ifaces.is_empty() {
|
||||||
|
Some(ifaces[0].clone())
|
||||||
|
diff --git a/src/util/mod.rs b/src/util/mod.rs
|
||||||
|
index 80ab3c7..daa49b1 100644
|
||||||
|
--- a/src/util/mod.rs
|
||||||
|
+++ b/src/util/mod.rs
|
||||||
|
@@ -16,7 +16,7 @@
|
||||||
|
|
||||||
|
use crate::errors::*;
|
||||||
|
use crate::retry;
|
||||||
|
-use pnet;
|
||||||
|
+use pnet_datalink;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::{BufRead, BufReader, Read};
|
||||||
|
use std::path::Path;
|
||||||
|
@@ -52,7 +52,7 @@ pub fn key_lookup<R: Read>(delim: char, key: &str, reader: R) -> Result<Option<S
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn dns_lease_key_lookup(key: &str) -> Result<String> {
|
||||||
|
- let interfaces = pnet::datalink::interfaces();
|
||||||
|
+ let interfaces = pnet_datalink::interfaces();
|
||||||
|
trace!("interfaces - {:?}", interfaces);
|
||||||
|
|
||||||
|
retry::Retry::new()
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
19
afterburn-fix-metadata.diff
Normal file
19
afterburn-fix-metadata.diff
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
--- afterburn-4.1.0/Cargo.toml 1970-01-01T00:00:00+00:00
|
||||||
|
+++ afterburn-4.1.0/Cargo.toml 2019-04-27T07:55:33.077957+00:00
|
||||||
|
@@ -64,11 +64,14 @@
|
||||||
|
[dependencies.openssl]
|
||||||
|
version = "^0.10.20"
|
||||||
|
|
||||||
|
-[dependencies.pnet]
|
||||||
|
+[dependencies.pnet_base]
|
||||||
|
+version = "0.22"
|
||||||
|
+
|
||||||
|
+[dependencies.pnet_datalink]
|
||||||
|
version = "0.22"
|
||||||
|
|
||||||
|
[dependencies.reqwest]
|
||||||
|
-version = "^0.9.15"
|
||||||
|
+version = "^0.9.13"
|
||||||
|
|
||||||
|
[dependencies.serde]
|
||||||
|
version = "1.0"
|
119
rust-afterburn.spec
Normal file
119
rust-afterburn.spec
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
# Generated by rust2rpm
|
||||||
|
%bcond_without check
|
||||||
|
|
||||||
|
%global crate afterburn
|
||||||
|
|
||||||
|
Name: rust-%{crate}
|
||||||
|
Version: 4.1.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Simple cloud provider agent
|
||||||
|
|
||||||
|
# Upstream license specification: Apache-2.0
|
||||||
|
License: ASL 2.0
|
||||||
|
URL: https://crates.io/crates/afterburn
|
||||||
|
Source: %{crates_source}
|
||||||
|
# Initial patched metadata
|
||||||
|
# * Switch to split version of pnet_*
|
||||||
|
# * Downgrade reqwest to 0.9.13 temporarily
|
||||||
|
Patch0: afterburn-fix-metadata.diff
|
||||||
|
# Finish splitting pnet_*
|
||||||
|
Patch0001: 0001-Use-pnet_-subcrates.patch
|
||||||
|
|
||||||
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
|
BuildRequires: rust-packaging
|
||||||
|
BuildRequires: (crate(base64/default) >= 0.10.1 with crate(base64/default) < 0.11.0)
|
||||||
|
BuildRequires: (crate(byteorder/default) >= 1.3.0 with crate(byteorder/default) < 2.0.0)
|
||||||
|
BuildRequires: (crate(clap/default) >= 2.33.0 with crate(clap/default) < 3.0.0)
|
||||||
|
BuildRequires: (crate(error-chain) >= 0.12.0 with crate(error-chain) < 0.13.0)
|
||||||
|
BuildRequires: (crate(hostname/default) >= 0.1.0 with crate(hostname/default) < 0.2.0)
|
||||||
|
BuildRequires: (crate(ipnetwork/default) >= 0.14.0 with crate(ipnetwork/default) < 0.15.0)
|
||||||
|
BuildRequires: (crate(mime/default) >= 0.3.0 with crate(mime/default) < 0.4.0)
|
||||||
|
BuildRequires: (crate(nix/default) >= 0.13.0 with crate(nix/default) < 0.14.0)
|
||||||
|
BuildRequires: (crate(openssh-keys/default) >= 0.4.1 with crate(openssh-keys/default) < 0.5.0)
|
||||||
|
BuildRequires: (crate(openssl/default) >= 0.10.20 with crate(openssl/default) < 0.11.0)
|
||||||
|
BuildRequires: (crate(pnet_base/default) >= 0.22.0 with crate(pnet_base/default) < 0.23.0)
|
||||||
|
BuildRequires: (crate(pnet_datalink/default) >= 0.22.0 with crate(pnet_datalink/default) < 0.23.0)
|
||||||
|
BuildRequires: (crate(reqwest/default) >= 0.9.13 with crate(reqwest/default) < 0.10.0)
|
||||||
|
BuildRequires: (crate(serde-xml-rs/default) >= 0.3.0 with crate(serde-xml-rs/default) < 0.4.0)
|
||||||
|
BuildRequires: (crate(serde/default) >= 1.0.0 with crate(serde/default) < 2.0.0)
|
||||||
|
BuildRequires: (crate(serde_derive/default) >= 1.0.0 with crate(serde_derive/default) < 2.0.0)
|
||||||
|
BuildRequires: (crate(serde_json/default) >= 1.0.0 with crate(serde_json/default) < 2.0.0)
|
||||||
|
BuildRequires: (crate(slog-async/default) >= 2.1.0 with crate(slog-async/default) < 3.0.0)
|
||||||
|
BuildRequires: (crate(slog-scope/default) >= 4.1.0 with crate(slog-scope/default) < 4.2.0)
|
||||||
|
BuildRequires: (crate(slog-term/default) >= 2.2.0 with crate(slog-term/default) < 3.0.0)
|
||||||
|
BuildRequires: (crate(slog/default) >= 2.0.0 with crate(slog/default) < 3.0.0)
|
||||||
|
BuildRequires: (crate(slog/max_level_trace) >= 2.0.0 with crate(slog/max_level_trace) < 3.0.0)
|
||||||
|
BuildRequires: (crate(slog/release_max_level_info) >= 2.0.0 with crate(slog/release_max_level_info) < 3.0.0)
|
||||||
|
BuildRequires: (crate(tempdir/default) >= 0.3.0 with crate(tempdir/default) < 0.4.0)
|
||||||
|
BuildRequires: (crate(tempfile/default) >= 3.0.7 with crate(tempfile/default) < 4.0.0)
|
||||||
|
BuildRequires: (crate(users/default) >= 0.9.1 with crate(users/default) < 0.10.0)
|
||||||
|
%if %{with check}
|
||||||
|
BuildRequires: (crate(mockito/default) >= 0.17.0 with crate(mockito/default) < 0.18.0)
|
||||||
|
%endif
|
||||||
|
BuildRequires: systemd
|
||||||
|
|
||||||
|
%global _description \
|
||||||
|
A simple cloud provider agent.
|
||||||
|
|
||||||
|
%description %{_description}
|
||||||
|
|
||||||
|
%package -n %{crate}
|
||||||
|
Summary: %{summary}
|
||||||
|
%{?systemd_requires}
|
||||||
|
|
||||||
|
%description -n %{crate} %{_description}
|
||||||
|
|
||||||
|
%files -n %{crate}
|
||||||
|
%license LICENSE
|
||||||
|
%doc README.md
|
||||||
|
%{_bindir}/afterburn
|
||||||
|
%{_unitdir}/afterburn.service
|
||||||
|
%{_unitdir}/afterburn-checkin.service
|
||||||
|
%{_unitdir}/afterburn-firstboot-checkin.service
|
||||||
|
%{_unitdir}/afterburn-sshkeys@.service
|
||||||
|
|
||||||
|
%post -n %{crate}
|
||||||
|
%systemd_post afterburn.service
|
||||||
|
%systemd_post afterburn-checkin.service
|
||||||
|
%systemd_post afterburn-firstboot-checkin.service
|
||||||
|
%systemd_post afterburn-sshkeys@.service
|
||||||
|
|
||||||
|
%preun -n %{crate}
|
||||||
|
%systemd_preun afterburn.service
|
||||||
|
%systemd_preun afterburn-checkin.service
|
||||||
|
%systemd_preun afterburn-firstboot-checkin.service
|
||||||
|
%systemd_preun afterburn-sshkeys@.service
|
||||||
|
|
||||||
|
%postun -n %{crate}
|
||||||
|
%systemd_postun afterburn.service
|
||||||
|
%systemd_postun afterburn-checkin.service
|
||||||
|
%systemd_postun afterburn-firstboot-checkin.service
|
||||||
|
%systemd_postun afterburn-sshkeys@.service
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{crate}-%{version_no_tilde} -p1
|
||||||
|
# afterburn-sshkeys@.service is by default enabled for the 'core' user in
|
||||||
|
# Fedora CoreOS.
|
||||||
|
# Based on https://github.com/coreos/afterburn/blob/master/Makefile.
|
||||||
|
sed -e 's,@DEFAULT_INSTANCE@,core,' < \
|
||||||
|
systemd/afterburn-sshkeys@.service.in > \
|
||||||
|
systemd/afterburn-sshkeys@.service
|
||||||
|
%cargo_prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cargo_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%cargo_install
|
||||||
|
%{__install} -Dpm0644 -t %{buildroot}%{_unitdir} \
|
||||||
|
systemd/*.service
|
||||||
|
|
||||||
|
%if %{with check}
|
||||||
|
%check
|
||||||
|
%cargo_test
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Apr 27 09:55:54 CEST 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.1.0-1
|
||||||
|
- Initial package
|
Loading…
Reference in New Issue
Block a user