Skip to content

Commit

Permalink
Merge pull request #265 from amazonlinux/metadata
Browse files Browse the repository at this point in the history
updata: Update metadata generation tool
  • Loading branch information
sam-aws authored Nov 6, 2019
2 parents 043fe5a + 2ad1d47 commit 228420e
Show file tree
Hide file tree
Showing 15 changed files with 1,058 additions and 205 deletions.
126 changes: 126 additions & 0 deletions workspaces/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions workspaces/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ members = [
"updater/signpost",
"updater/tough",
"updater/tough_schema",
"updater/update_metadata",
"updater/updog",

"tuftool",
Expand Down
3 changes: 3 additions & 0 deletions workspaces/api/data_store_version/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ edition = "2018"
lazy_static = "1.2"
log = "0.4"
regex = "1.1"
serde = { version = "1.0", features = ["derive"] }
serde_plain = "0.3.0"

snafu = "0.5"

[build-dependencies]
Expand Down
14 changes: 14 additions & 0 deletions workspaces/api/data_store_version/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ It is especially helpful during data store migrations, and is also used for data

#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_plain;

use lazy_static::lazy_static;
use regex::Regex;
use serde::{Serialize, Serializer};
use snafu::{OptionExt, ResultExt};
use std::path::Path;
use std::path::PathBuf;
Expand Down Expand Up @@ -92,12 +95,23 @@ impl FromStr for Version {
}
}

derive_deserialize_from_str!(Version, "Valid data-store version");

impl fmt::Display for Version {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "v{}.{}", self.major, self.minor)
}
}

impl Serialize for Version {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: Serializer,
{
serializer.serialize_str(&format!("{}.{}", self.major, self.minor))
}
}

impl Version {
#[allow(dead_code)]
pub fn new(major: VersionComponent, minor: VersionComponent) -> Self {
Expand Down
1 change: 1 addition & 0 deletions workspaces/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ skip = [
{ name = "tough", licenses = [] },
{ name = "tough_schema", licenses = [] },
{ name = "tuftool", licenses = [] },
{ name = "update_metadata", licenses = [] },
{ name = "updog", licenses = [] },
{ name = "webpki-roots", licenses = [] },

Expand Down
21 changes: 21 additions & 0 deletions workspaces/updater/update_metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "update_metadata"
version = "0.1.0"
authors = ["Samuel Mendoza-Jonas <[email protected]>"]
edition = "2018"
publish = false

[dependencies]
chrono = { version = "0.4.9", features = ["serde"] }
data_store_version = { path = "../../api/data_store_version" }
rand = "0.7.0"
regex = "1.1"
semver = { version = "0.9.0", features = ["serde"] }
serde = { version = "1.0.100", features = ["derive"] }
serde_json = "1.0.40"
serde_plain = "0.3.0"
snafu = "0.5.0"

[lib]
name = "update_metadata"
path = "src/lib.rs"
Loading

0 comments on commit 228420e

Please sign in to comment.