Bug 1716518 - Upgrade plist to v0.5.5. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D117834
This commit is contained in:
Mike Hommey 2021-06-15 22:17:27 +00:00
Родитель 687ed79ff6
Коммит d0d4ba922b
8 изменённых файлов: 43 добавлений и 21 удалений

6
Cargo.lock сгенерированный
Просмотреть файл

@ -3882,12 +3882,12 @@ dependencies = [
[[package]]
name = "plist"
version = "0.5.4"
version = "0.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50ce7c785e06e3a9e6f546c1a30d3d59111a31a21bc294fb1496241a572c9a00"
checksum = "9b59eb8d91dfa89208ec74a920e3b55f840476cf46568026c18dbaa2999e0d48"
dependencies = [
"base64 0.10.1",
"humantime",
"chrono",
"indexmap",
"line-wrap",
"serde",

2
third_party/rust/plist/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"5e4640942c85072981f5fe3b3777d088b7360c8e0b51207defbd52315046d3e7","LICENCE":"5b0ae40d1a35f7ae6591a28e44771240e6a88cb03a66c9189a45b9681639b466","README.md":"98860ec5d46ac8f1d3a3f33600629b942f774a35a511ddedffc9a227a3822e2c","rustfmt.toml":"9bbb759b3914c49c8060bcdeeb7786f4aec083d30bcfe236bbd48d8388d06103","src/date.rs":"6378f0919e01cd41c2862fbc4d4029915a7d48324ede584daea0b5b1324cbb51","src/de.rs":"dad0b0409227223deb2778a3f63c7d355c1b642f406fc448e59224de61882770","src/dictionary.rs":"9b8194d3e339a300de5d0fb39529d976a5f86947f3997086594d2be2f795859b","src/error.rs":"2ed8ce5c33071847abb00b27472be352d5bceb92a6ad0b8724f630570e956430","src/integer.rs":"131f528878adc5c0f33c8ad1563c06b397cb2ae5148c2bb9318203a2477d70e0","src/lib.rs":"1fa5d06242ec2731f16d244e070710476caf165eb1707a1d688357928eae2310","src/ser.rs":"ea4ed049abef09c7230b94296a3d050ade3228cfededea2c17383028b594fe10","src/serde_tests.rs":"98fc0063223ded619054caa4a1c95fbb37d8a9613e2a5bdf4f15ccf3ed3c9e8a","src/stream/binary_reader.rs":"f5a38d624d3af99f57b78837d253b72ddb8d7a08e6c117648fae4654005beef6","src/stream/binary_writer.rs":"1b10bbf287ad48be3a82c36cebbc32f7232fff42995142e09f98d2a2eb1fb628","src/stream/mod.rs":"2482d63cd50cceaf4b4fc46ddb11119b1a7c55bf3350e69ce2546317ff3f89e2","src/stream/xml_reader.rs":"629cc6b975c7c88c75fe1f0e8e39b65b41fb5442f487ce8b19f99dfa90c02cf5","src/stream/xml_writer.rs":"076a2eeb3daae3737efb514ab647673dcee00b81ce0849c968c6245f36f95d53","src/uid.rs":"adb51121ee251941f173d83417631cd2fdfbc7104998205c538d93e4b3c3e676","src/value.rs":"8fca3d563723a55be3fc6f71cd17fe7e6ad33240d83d20e6420e718033c066cd","tests/data/binary.plist":"728985bb53486a92fdcc901a3c08a904835f0225efab7b85be2734e2dcd4af83","tests/data/binary_NSKeyedArchiver.plist":"54dc8b87acd364de6b2160ff805514bc04bf0577e4f57d08d7f3578d218362f0","tests/data/binary_circular_array.plist":"825aed6ce83a8abdbe15d4686ce35157f4eb861bd792f0ce790115fb4ec48805","tests/data/binary_zero_offset_size.plist":"020953c8211989d01b5edf42e025560f46ece3b604ceda03708819bd2587a1a1","tests/data/book.plist":"3b18050f073cab956f38f1775e89dedc88d1e56dd388bc99e277efb19e50dffd","tests/data/utf16_bplist.plist":"c0b7d33001021df98d8631c604c8471e74e4b4599bac51a8bed149ca82adbcd5","tests/data/xml.plist":"9669e8ad25a661ca052d30d8d74b7495e859a0a7faf01f2aeade7fcebb2aa5b7","tests/data/xml_error.plist":"3718f7dd2c716a4a6c36d1f7055b78d86c982c812c19964f85a6f62eff1589ea","tests/fuzzer.rs":"ea9e7812c936e4c1e42ce234513fa8c839277222c0746c069d62e7b77870b858"},"package":"50ce7c785e06e3a9e6f546c1a30d3d59111a31a21bc294fb1496241a572c9a00"}
{"files":{"Cargo.toml":"6aa3f3fc9add0eca0664cee0ad9b97a86b532964d053a09a860979e6ad94c0ab","LICENCE":"5b0ae40d1a35f7ae6591a28e44771240e6a88cb03a66c9189a45b9681639b466","README.md":"98860ec5d46ac8f1d3a3f33600629b942f774a35a511ddedffc9a227a3822e2c","rustfmt.toml":"9bbb759b3914c49c8060bcdeeb7786f4aec083d30bcfe236bbd48d8388d06103","src/date.rs":"c14f616d03708b44b53c4e7037129f31e07e9f45dc63e282bdd2d744a52c3b95","src/de.rs":"dad0b0409227223deb2778a3f63c7d355c1b642f406fc448e59224de61882770","src/dictionary.rs":"9b8194d3e339a300de5d0fb39529d976a5f86947f3997086594d2be2f795859b","src/error.rs":"2ed8ce5c33071847abb00b27472be352d5bceb92a6ad0b8724f630570e956430","src/integer.rs":"131f528878adc5c0f33c8ad1563c06b397cb2ae5148c2bb9318203a2477d70e0","src/lib.rs":"1fa5d06242ec2731f16d244e070710476caf165eb1707a1d688357928eae2310","src/ser.rs":"ea4ed049abef09c7230b94296a3d050ade3228cfededea2c17383028b594fe10","src/serde_tests.rs":"9b273b56936bfc88ecd8e763b3d49c5e911dc7267f1794437959cb61b2c6cdd3","src/stream/binary_reader.rs":"e3fe72e3c6bf6bf4dd271919018c9f8bfd90d4ddf203c80242f8f6ca705b1d49","src/stream/binary_writer.rs":"1b10bbf287ad48be3a82c36cebbc32f7232fff42995142e09f98d2a2eb1fb628","src/stream/mod.rs":"2482d63cd50cceaf4b4fc46ddb11119b1a7c55bf3350e69ce2546317ff3f89e2","src/stream/xml_reader.rs":"b7de932fa9f521eaa13a908a01235d8a1d66b2254425a361268b6ccb9e35996d","src/stream/xml_writer.rs":"6bbd2beed1e82aa8de4f3523a5a483b5132e8e7c2119bf789555d88f2dadbb9a","src/uid.rs":"adb51121ee251941f173d83417631cd2fdfbc7104998205c538d93e4b3c3e676","src/value.rs":"8fca3d563723a55be3fc6f71cd17fe7e6ad33240d83d20e6420e718033c066cd","tests/data/binary.plist":"728985bb53486a92fdcc901a3c08a904835f0225efab7b85be2734e2dcd4af83","tests/data/binary_NSKeyedArchiver.plist":"54dc8b87acd364de6b2160ff805514bc04bf0577e4f57d08d7f3578d218362f0","tests/data/binary_circular_array.plist":"825aed6ce83a8abdbe15d4686ce35157f4eb861bd792f0ce790115fb4ec48805","tests/data/binary_zero_offset_size.plist":"020953c8211989d01b5edf42e025560f46ece3b604ceda03708819bd2587a1a1","tests/data/book.plist":"3b18050f073cab956f38f1775e89dedc88d1e56dd388bc99e277efb19e50dffd","tests/data/utf16_bplist.plist":"c0b7d33001021df98d8631c604c8471e74e4b4599bac51a8bed149ca82adbcd5","tests/data/xml.plist":"9669e8ad25a661ca052d30d8d74b7495e859a0a7faf01f2aeade7fcebb2aa5b7","tests/data/xml_error.plist":"3718f7dd2c716a4a6c36d1f7055b78d86c982c812c19964f85a6f62eff1589ea","tests/fuzzer.rs":"ea9e7812c936e4c1e42ce234513fa8c839277222c0746c069d62e7b77870b858"},"package":"9b59eb8d91dfa89208ec74a920e3b55f840476cf46568026c18dbaa2999e0d48"}

10
third_party/rust/plist/Cargo.toml поставляемый
Просмотреть файл

@ -13,10 +13,10 @@
[package]
edition = "2018"
name = "plist"
version = "0.5.4"
version = "0.5.5"
authors = ["Ed Barnard <eabarnard@gmail.com>"]
description = "A rusty plist parser. Supports Serde serialization."
documentation = "https://docs.rs/plist/0.5.4/plist/"
documentation = "https://docs.rs/plist/0.5.5/plist/"
keywords = ["plist", "parser"]
categories = ["config", "encoding", "parser-implementations"]
license = "MIT"
@ -24,8 +24,10 @@ repository = "https://github.com/ebarnard/rust-plist/"
[dependencies.base64]
version = "0.10.1"
[dependencies.humantime]
version = "2.0.0"
[dependencies.chrono]
version = "0.4.11"
features = ["std"]
default-features = false
[dependencies.indexmap]
version = "1.0.2"

33
third_party/rust/plist/src/date.rs поставляемый
Просмотреть файл

@ -1,4 +1,4 @@
use humantime;
use chrono::{DateTime, FixedOffset, SecondsFormat, Utc};
use std::{
fmt,
time::{Duration, SystemTime, UNIX_EPOCH},
@ -20,13 +20,15 @@ impl Date {
const PLIST_EPOCH_UNIX_TIMESTAMP: Duration = Duration::from_secs(978_307_200);
pub(crate) fn from_rfc3339(date: &str) -> Result<Self, ()> {
let offset: DateTime<FixedOffset> = DateTime::parse_from_rfc3339(date).map_err(|_| ())?;
Ok(Date {
inner: humantime::parse_rfc3339(date).map_err(|_| ())?,
inner: offset.with_timezone(&Utc).into(),
})
}
pub(crate) fn to_rfc3339(&self) -> String {
format!("{}", humantime::format_rfc3339(self.inner))
let datetime: DateTime<Utc> = self.inner.into();
datetime.to_rfc3339_opts(SecondsFormat::Secs, true)
}
pub(crate) fn from_seconds_since_plist_epoch(
@ -72,8 +74,7 @@ impl Date {
impl fmt::Debug for Date {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
let rfc3339 = humantime::format_rfc3339(self.inner);
<humantime::Rfc3339Timestamp as fmt::Display>::fmt(&rfc3339, f)
write!(f, "{}", self.to_rfc3339())
}
}
@ -154,3 +155,25 @@ pub mod serde_impls {
}
}
}
#[cfg(test)]
mod testing {
use super::*;
#[test]
fn date_roundtrip() {
let date_str = "1981-05-16T11:32:06Z";
let date = Date::from_rfc3339(date_str).expect("should parse");
let generated_str = date.to_rfc3339();
assert_eq!(date_str, generated_str);
}
#[test]
fn far_past_date() {
let date_str = "1920-01-01T00:00:00Z";
Date::from_rfc3339(date_str).expect("should parse");
}
}

4
third_party/rust/plist/src/serde_tests.rs поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
use serde::{de::DeserializeOwned, ser::Serialize};
use std::{collections::BTreeMap, fmt::Debug, time::SystemTime};
use std::{collections::BTreeMap, fmt::Debug};
use crate::{
stream::{private::Sealed, Event, Writer},
@ -344,7 +344,7 @@ struct TypeWithDate {
#[test]
fn type_with_date() {
let date: Date = SystemTime::now().into();
let date = Date::from_rfc3339("1920-01-01T00:10:00Z").unwrap();
let obj = TypeWithDate {
a: Some(28),

Просмотреть файл

@ -409,7 +409,6 @@ impl<R: Read + Seek> Iterator for BinaryReader<R> {
#[cfg(test)]
mod tests {
use humantime::parse_rfc3339_weak;
use std::{fs::File, path::Path};
use super::*;
@ -428,7 +427,7 @@ mod tests {
String("Author".into()),
String("William Shakespeare".into()),
String("Birthdate".into()),
Date(parse_rfc3339_weak("1981-05-16 11:32:06").unwrap().into()),
Date(super::Date::from_rfc3339("1981-05-16T11:32:06Z").unwrap()),
String("EmptyArray".into()),
StartArray(Some(0)),
EndCollection,

Просмотреть файл

@ -218,7 +218,6 @@ fn from_xml_error(err: XmlReaderError) -> Error {
#[cfg(test)]
mod tests {
use humantime::parse_rfc3339_weak;
use std::{fs::File, path::Path};
use super::*;
@ -246,7 +245,7 @@ mod tests {
String("Data".to_owned()),
Data(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]),
String("Birthdate".to_owned()),
Date(parse_rfc3339_weak("1981-05-16 11:32:06").unwrap().into()),
Date(super::Date::from_rfc3339("1981-05-16T11:32:06Z").unwrap()),
String("Blank".to_owned()),
String("".to_owned()),
String("BiggestNumber".to_owned()),

Просмотреть файл

@ -291,7 +291,6 @@ fn base64_encode_plist(data: &[u8], indent: usize) -> String {
#[cfg(test)]
mod tests {
use humantime::parse_rfc3339_weak;
use std::io::Cursor;
use super::*;
@ -316,7 +315,7 @@ mod tests {
Event::String("Data".to_owned()),
Event::Data(vec![0, 0, 0, 190, 0, 0, 0, 3, 0, 0, 0, 30, 0, 0, 0]),
Event::String("Birthdate".to_owned()),
Event::Date(parse_rfc3339_weak("1981-05-16 11:32:06").unwrap().into()),
Event::Date(super::Date::from_rfc3339("1981-05-16T11:32:06Z").unwrap()),
Event::String("Comment".to_owned()),
Event::String("2 < 3".to_owned()), // make sure characters are escaped
Event::String("BiggestNumber".to_owned()),