diff options
Diffstat (limited to 'net/rabbiteer/files')
-rw-r--r-- | net/rabbiteer/files/patch-README.md | 20 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-cargo-crates_rustc-serialize-0.3.24_src_serialize.rs | 13 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-powerpc | 62 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_client.rs | 266 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_error.rs | 71 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_main.rs | 171 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_output.rs | 175 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_publish.rs | 137 | ||||
-rw-r--r-- | net/rabbiteer/files/patch-src_subscribe.rs | 147 |
9 files changed, 0 insertions, 1062 deletions
diff --git a/net/rabbiteer/files/patch-README.md b/net/rabbiteer/files/patch-README.md deleted file mode 100644 index 3b9cf3741a08..000000000000 --- a/net/rabbiteer/files/patch-README.md +++ /dev/null @@ -1,20 +0,0 @@ ---- README.md.orig 2018-10-14 19:59:57 UTC -+++ README.md -@@ -77,7 +77,7 @@ Publishing pushes data from stdin or a file to an exch - OPTIONS: - -c, --content-type <content_type> Content type such as application/json. Inferred from filename if - possible. -- -e, --exchange <exchange> Exchange to publish to [default ] -+ -e, --exchange <exchange> Exchange to publish to [default ""] - -f, --file <file> Filename (- is stdin) [default: -] - -H, --header <header>... Header on the form "My-Header: Value" - -r, --routing-key <routing_key> Routing key [default: ] -@@ -120,7 +120,7 @@ stdout or as files to a directory. - FLAGS: - -i, --info Include delivery info (and headers). - OPTIONS: -- -e, --exchange <exchange> Exchange to subscribe to -+ -e, --exchange <exchange> Exchange to subscribe to [default ""] - -o, --output <output> Output directory (- is stdout) [default: -] - -r, --routing-key <routing_key> Routing key [default: #] - diff --git a/net/rabbiteer/files/patch-cargo-crates_rustc-serialize-0.3.24_src_serialize.rs b/net/rabbiteer/files/patch-cargo-crates_rustc-serialize-0.3.24_src_serialize.rs deleted file mode 100644 index 2ec700f0bcf5..000000000000 --- a/net/rabbiteer/files/patch-cargo-crates_rustc-serialize-0.3.24_src_serialize.rs +++ /dev/null @@ -1,13 +0,0 @@ -https://github.com/rust-lang-deprecated/rustc-serialize/commit/75ce92452a5f7c25a58fdea81e5f6f888630a2c9 - ---- cargo-crates/rustc-serialize-0.3.24/src/serialize.rs.orig 2024-02-10 11:58:37 UTC -+++ cargo-crates/rustc-serialize-0.3.24/src/serialize.rs -@@ -1152,7 +1152,7 @@ impl<'a, T: ?Sized> Decodable for Cow<'a, T> - where T: ToOwned, T::Owned: Decodable - { - #[inline] -- fn decode<D: Decoder>(d: &mut D) -> Result<Cow<'static, T>, D::Error> { -+ fn decode<D: Decoder>(d: &mut D) -> Result<Cow<'a, T>, D::Error> { - Ok(Cow::Owned(try!(Decodable::decode(d)))) - } - } diff --git a/net/rabbiteer/files/patch-powerpc b/net/rabbiteer/files/patch-powerpc deleted file mode 100644 index f63acd3a6c59..000000000000 --- a/net/rabbiteer/files/patch-powerpc +++ /dev/null @@ -1,62 +0,0 @@ ---- cargo-crates/libc-0.2.49/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig 2020-03-17 20:35:43 UTC -+++ cargo-crates/libc-0.2.49/src/unix/bsd/freebsdlike/freebsd/mod.rs -@@ -1486,6 +1486,9 @@ cfg_if! { - } else if #[cfg(target_arch = "powerpc64")] { - mod powerpc64; - pub use self::powerpc64::*; -+ } else if #[cfg(target_arch = "powerpc")] { -+ mod powerpc; -+ pub use self::powerpc::*; - } else { - // Unknown target_arch - } ---- cargo-crates/libc-0.2.49/src/unix/bsd/freebsdlike/freebsd/powerpc.rs.orig 2021-06-23 22:40:24 UTC -+++ cargo-crates/libc-0.2.49/src/unix/bsd/freebsdlike/freebsd/powerpc.rs -@@ -0,0 +1,47 @@ -+pub type c_char = u8; -+pub type c_long = i32; -+pub type c_ulong = u32; -+pub type wchar_t = i32; -+pub type time_t = i64; -+pub type suseconds_t = i32; -+pub type register_t = i32; -+ -+s! { -+ pub struct stat { -+ pub st_dev: ::dev_t, -+ pub st_ino: ::ino_t, -+ pub st_mode: ::mode_t, -+ pub st_nlink: ::nlink_t, -+ pub st_uid: ::uid_t, -+ pub st_gid: ::gid_t, -+ pub st_rdev: ::dev_t, -+ pub st_atime: ::time_t, -+ pub st_atime_nsec: ::c_long, -+ pub st_mtime: ::time_t, -+ pub st_mtime_nsec: ::c_long, -+ pub st_ctime: ::time_t, -+ pub st_ctime_nsec: ::c_long, -+ pub st_size: ::off_t, -+ pub st_blocks: ::blkcnt_t, -+ pub st_blksize: ::blksize_t, -+ pub st_flags: ::fflags_t, -+ pub st_gen: u32, -+ pub st_lspare: i32, -+ pub st_birthtime: ::time_t, -+ pub st_birthtime_nsec: ::c_long, -+ } -+} -+ -+// should be pub(crate), but that requires Rust 1.18.0 -+cfg_if! { -+ if #[cfg(libc_const_size_of)] { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; -+ } else { -+ #[doc(hidden)] -+ pub const _ALIGNBYTES: usize = 4 - 1; -+ } -+} -+ -+pub const MAP_32BIT: ::c_int = 0x00080000; -+pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 diff --git a/net/rabbiteer/files/patch-src_client.rs b/net/rabbiteer/files/patch-src_client.rs deleted file mode 100644 index 7951ad581d21..000000000000 --- a/net/rabbiteer/files/patch-src_client.rs +++ /dev/null @@ -1,266 +0,0 @@ ---- src/client.rs.orig 2018-10-14 20:00:28 UTC -+++ src/client.rs -@@ -1,14 +1,14 @@ --use std::io; --use error::RbtError; --use amqp::{self, Session, Options, Channel}; --use amqp::protocol::basic::{Deliver, BasicProperties}; -+use amqp::protocol::basic::{BasicProperties, Deliver}; - use amqp::Basic; -+use amqp::{self, Channel, Options, Session}; - use amqp::{Table, TableEntry}; -+use error::RbtError; -+use std::io; - -+use std::error::Error; -+use std::sync::mpsc; - use std::thread; - use std::time::Duration; --use std::sync::mpsc; --use std::error::Error; - - pub struct Sendable { - pub exchange: String, -@@ -18,21 +18,20 @@ pub struct Sendable { - pub file_name: String, - pub reader: Box<io::Read>, - pub priority: u8, -- pub rpctimeout: u64 -+ pub rpctimeout: u64, - } - --pub type ReceiveCb = FnMut(&mut Channel, Deliver, BasicProperties, Vec<u8>) -> Result<(), RbtError> + Send; -+pub type ReceiveCb = -+ FnMut(&mut Channel, Deliver, BasicProperties, Vec<u8>) -> Result<(), RbtError> + Send; - - pub struct Receiver { -- pub exchange:String, -+ pub exchange: String, - pub routing_key: Option<String>, - pub auto_ack: bool, -- pub callback:Box<ReceiveCb>, -+ pub callback: Box<ReceiveCb>, - } - -- --pub fn open_send(o:Options, s:Sendable, r:Option<Receiver>) -> Result<(),RbtError> { -- -+pub fn open_send(o: Options, s: Sendable, r: Option<Receiver>) -> Result<(), RbtError> { - // open the channel - let (mut session, mut channel) = _open(o)?; - -@@ -49,7 +48,10 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei - - // put filename in headers if we read from file - if s.file_name != "-" && !headers.contains_key("fileName") { -- headers.insert("fileName".to_owned(), TableEntry::LongString(String::from(s.file_name))); -+ headers.insert( -+ "fileName".to_owned(), -+ TableEntry::LongString(String::from(s.file_name)), -+ ); - } - - // send properties -@@ -73,8 +75,8 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei - props.correlation_id = Some("rabbiteer here".to_owned()); - - true -- }, -- None => false -+ } -+ None => false, - }; - - // read input input buffer -@@ -87,12 +89,14 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei - - if isrpc { - let (tx, rx) = mpsc::channel(); -- thread::Builder::new().name("consumer_thread".to_string()).spawn(move || { -- channel.start_consuming(); -- tx.send(channel).unwrap(); -- }).unwrap(); -+ thread::Builder::new() -+ .name("consumer_thread".to_string()) -+ .spawn(move || { -+ channel.start_consuming(); -+ tx.send(channel).unwrap(); -+ }) -+ .unwrap(); - -- - let timeout = s.rpctimeout; - if timeout == 0 { - // Block forever until recieve -@@ -103,7 +107,7 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei - match res { - Ok(mut ch) => { - ch.close(200, "Bye")?; -- } -+ } - Err(err) => { - if err.description() == "timed out waiting on channel".to_string() { - println!("Error timeout"); -@@ -121,10 +125,9 @@ pub fn open_send(o:Options, s:Sendable, r:Option<Recei - Ok(()) - } - -- - // narrow the string to a TableEntry type by trying to parse to known - // JSON types: bool, double and fall back on string. --fn narrow(str:&str) -> TableEntry { -+fn narrow(str: &str) -> TableEntry { - let boolv = str.parse::<bool>(); - if !boolv.is_err() { - TableEntry::Bool(boolv.unwrap()) -@@ -138,19 +141,22 @@ fn narrow(str:&str) -> TableEntry { - } - } - -- --fn _open(o:Options) -> Result<(Session, Channel),RbtError> { --// errln!("Connecting to amqp://{}:{}@{}:{}/{}", --// o.login, o.password, o.host, o.port, o.vhost); -+fn _open(o: Options) -> Result<(Session, Channel), RbtError> { -+ // errln!("Connecting to amqp://{}:{}@{}:{}/{}", -+ // o.login, o.password, o.host, o.port, o.vhost); - let mut session = Session::new(o)?; - let channel = session.open_channel(1)?; - Ok((session, channel)) - } - - impl amqp::Consumer for Receiver { -- fn handle_delivery(&mut self, channel:&mut Channel, deliver:Deliver, -- headers:BasicProperties, body:Vec<u8>){ -- -+ fn handle_delivery( -+ &mut self, -+ channel: &mut Channel, -+ deliver: Deliver, -+ headers: BasicProperties, -+ body: Vec<u8>, -+ ) { - let delivery_tag = deliver.delivery_tag.clone(); - - if self.auto_ack { -@@ -160,12 +166,15 @@ impl amqp::Consumer for Receiver { - - // and deliver to callback - ((self.callback)(channel, deliver, headers, body)).unwrap_or_else(::error::handle); -- - } - } - --pub fn open_receive(o:Options, q:Option<String>, force_declare: bool, r:Receiver) -> Result<(),RbtError> { -- -+pub fn open_receive( -+ o: Options, -+ q: Option<String>, -+ force_declare: bool, -+ r: Receiver, -+) -> Result<(), RbtError> { - // open session/channel - let (_, mut channel) = _open(o)?; - -@@ -178,22 +187,33 @@ pub fn open_receive(o:Options, q:Option<String>, force - Ok(()) - } - -- --fn do_open_receive(channel:&mut Channel, q:Option<String>, force_declare: bool, r:Receiver) -> Result<String,RbtError> { -- -+fn do_open_receive( -+ channel: &mut Channel, -+ q: Option<String>, -+ force_declare: bool, -+ r: Receiver, -+) -> Result<String, RbtError> { - let mut auto_delete = false; - let mut bind_routing_key = r.routing_key.clone(); -- -+ - let queue_name = match q { - Some(q) => { - // Force the declaration of this queue - if force_declare { - // queue, passive, durable, exclusive, auto_delete, nowait, arguments -- let queue_declare = channel.queue_declare(q, false, false, auto_delete, auto_delete, false, Table::new())?; -+ let queue_declare = channel.queue_declare( -+ q, -+ false, -+ false, -+ auto_delete, -+ auto_delete, -+ false, -+ Table::new(), -+ )?; - - // name is auto generated - queue_declare.queue -- }else{ -+ } else { - q - } - } -@@ -205,25 +225,33 @@ fn do_open_receive(channel:&mut Channel, q:Option<Stri - } - - // queue, passive, durable, exclusive, auto_delete, nowait, arguments -- let queue_declare = -- channel.queue_declare( -- q.clone().unwrap_or("".to_owned()) , -- false, false, -- auto_delete, auto_delete, false, Table::new())?; -+ let queue_declare = channel.queue_declare( -+ q.clone().unwrap_or("".to_owned()), -+ false, -+ false, -+ auto_delete, -+ auto_delete, -+ false, -+ Table::new(), -+ )?; - - // name is auto generated - queue_declare.queue -- - } - }; - - // Only bind if we have a routing key - May be an existing queue - if let Some(routing_key) = bind_routing_key { - // bind queue to the exchange, which already must be declared. -- -+ - if r.exchange != "" { -- channel.queue_bind(queue_name.clone(), r.exchange.clone(), routing_key.clone(), -- false, Table::new())?; -+ channel.queue_bind( -+ queue_name.clone(), -+ r.exchange.clone(), -+ routing_key.clone(), -+ false, -+ Table::new(), -+ )?; - } - } - -@@ -232,8 +260,16 @@ fn do_open_receive(channel:&mut Channel, q:Option<Stri - - // start consuming the queue. - // callback, queue, consumer_tag, no_local, no_ack, exclusive, nowait, arguments -- channel.basic_consume(r, queue_name.clone(), consumer_tag, false, -- false, false, false, Table::new())?; -+ channel.basic_consume( -+ r, -+ queue_name.clone(), -+ consumer_tag, -+ false, -+ false, -+ false, -+ false, -+ Table::new(), -+ )?; - - Ok(queue_name) - } diff --git a/net/rabbiteer/files/patch-src_error.rs b/net/rabbiteer/files/patch-src_error.rs deleted file mode 100644 index 7ed75cd906a5..000000000000 --- a/net/rabbiteer/files/patch-src_error.rs +++ /dev/null @@ -1,71 +0,0 @@ ---- src/error.rs.orig 2018-10-14 20:00:28 UTC -+++ src/error.rs -@@ -1,10 +1,10 @@ -+use amqp::AMQPError; -+use clap; -+use rustc_serialize::json; -+use std::convert::From; - use std::fmt; - use std::io; --use std::convert::From; --use amqp::AMQPError; - use std::string::FromUtf8Error; --use rustc_serialize::json; --use clap; - - #[macro_export] - macro_rules! errln( -@@ -21,9 +21,8 @@ macro_rules! rbterr( - }} - ); - -- - pub enum RbtError { -- Message(String), // Plain error message -+ Message(String), // Plain error message - AMQP(AMQPError), - IO(io::Error), - UTF8(FromUtf8Error), -@@ -31,27 +30,24 @@ pub enum RbtError { - Clap(clap::Error), - } - -- - impl fmt::Display for RbtError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - RbtError::Message(ref s) => write!(f, "Error: {}", s), -- RbtError::AMQP(ref e) => write!(f, "{}", e), -- RbtError::IO(ref e) => write!(f, "{}", e), -- RbtError::UTF8(ref e) => write!(f, "{}", e), -- RbtError::JSON(ref e) => write!(f, "{}", e), -- RbtError::Clap(ref e) => write!(f, "{}", e), -+ RbtError::AMQP(ref e) => write!(f, "{}", e), -+ RbtError::IO(ref e) => write!(f, "{}", e), -+ RbtError::UTF8(ref e) => write!(f, "{}", e), -+ RbtError::JSON(ref e) => write!(f, "{}", e), -+ RbtError::Clap(ref e) => write!(f, "{}", e), - } - } - } - -- --pub fn handle(e:RbtError) { -+pub fn handle(e: RbtError) { - errln!("{}", e); - ::std::process::exit(1); - } - -- - macro_rules! from( - ($t:ty, $p:tt) => { - impl From<$t> for RbtError { -@@ -70,7 +66,7 @@ from!(clap::Error, Clap); - from!(String, Message); - - impl From<&'static str> for RbtError { -- fn from(s:&str) -> RbtError { -+ fn from(s: &str) -> RbtError { - RbtError::Message(String::from(s)) - } - } diff --git a/net/rabbiteer/files/patch-src_main.rs b/net/rabbiteer/files/patch-src_main.rs deleted file mode 100644 index 032c42f464f9..000000000000 --- a/net/rabbiteer/files/patch-src_main.rs +++ /dev/null @@ -1,171 +0,0 @@ ---- src/main.rs.orig 2018-10-14 20:00:28 UTC -+++ src/main.rs -@@ -1,36 +1,41 @@ --extern crate rustc_serialize; - extern crate amqp; --extern crate rand; - extern crate conduit_mime_types as mime; -+extern crate rand; -+extern crate rustc_serialize; - extern crate url; --#[macro_use] extern crate clap; -+#[macro_use] -+extern crate clap; - --#[macro_use] mod error; -+#[macro_use] -+mod error; - mod client; - mod output; - mod publish; - mod subscribe; - -+use clap::{App, Arg, SubCommand}; -+use error::RbtError; -+use rustc_serialize::json::Json; - use std::env; - use std::fs; --use clap::{Arg, App, SubCommand}; -+use std::panic; - use url::Url; --use rustc_serialize::json::Json; --use error::RbtError; - -- - fn main() { -+ panic::set_hook(Box::new(|_panic| { -+ // chill -+ })); -+ - _main().unwrap_or_else(error::handle); - } - --static HOST:&'static str = "127.0.0.1"; --static PORT:&'static str = "5672"; --static USER:&'static str = "guest"; --static PASS:&'static str = "guest"; --static VHST:&'static str = ""; -+static HOST: &'static str = "127.0.0.1"; -+static PORT: &'static str = "5672"; -+static USER: &'static str = "guest"; -+static PASS: &'static str = "guest"; -+static VHST: &'static str = ""; - --fn _main() -> Result<(),RbtError> { -- -+fn _main() -> Result<(), RbtError> { - let matches = App::new("Rabbiteer") - .version(crate_version!()) - .author("Martin Algesten <martin@algesten.se>") -@@ -124,7 +129,7 @@ fn _main() -> Result<(),RbtError> { - .short("e") - .long("exchange") - .takes_value(true) -- .required(true)) -+ .default_value("")) - .arg(Arg::with_name("routing_key") - .help("Routing key") - .short("r") -@@ -167,11 +172,11 @@ fn _main() -> Result<(),RbtError> { - - // start with defaults. - let mut opts = amqp::Options { -- host: value_t!(matches, "host", String)?, -- port: value_t!(matches, "port", u16)?, -- login: value_t!(matches, "user", String)?, -+ host: value_t!(matches, "host", String)?, -+ port: value_t!(matches, "port", u16)?, -+ login: value_t!(matches, "user", String)?, - password: value_t!(matches, "password", String)?, -- vhost: value_t!(matches, "vhost", String)?, -+ vhost: value_t!(matches, "vhost", String)?, - ..Default::default() - }; - -@@ -183,7 +188,7 @@ fn _main() -> Result<(),RbtError> { - parse_url(&mut opts, urlstr)?; - } - -- fn if_differs(opt:Option<&str>, def:&str, set:&mut FnMut(String) -> ()) { -+ fn if_differs(opt: Option<&str>, def: &str, set: &mut FnMut(String) -> ()) { - if let Some(v) = opt { - if v != def { - set(v.to_string()); -@@ -191,44 +196,46 @@ fn _main() -> Result<(),RbtError> { - } - } - -- if_differs(matches.value_of("host"), HOST, &mut|v|{ opts.host = v }); -- if_differs(matches.value_of("port"), PORT, &mut|v|{ opts.port = v.parse::<u16>().unwrap() }); -- if_differs(matches.value_of("user"), USER, &mut|v|{ opts.login = v }); -- if_differs(matches.value_of("password"), PASS, &mut|v|{ opts.password = v }); -- if_differs(matches.value_of("vhost"), VHST, &mut|v|{ opts.vhost = v }); -+ if_differs(matches.value_of("host"), HOST, &mut |v| { -+ opts.host = v -+ }); -+ if_differs(matches.value_of("port"), PORT, &mut |v| { -+ opts.port = v.parse::<u16>().unwrap() -+ }); -+ if_differs(matches.value_of("user"), USER, &mut |v| { -+ opts.login = v -+ }); -+ if_differs(matches.value_of("password"), PASS, &mut |v| { -+ opts.password = v -+ }); -+ if_differs(matches.value_of("vhost"), VHST, &mut |v| { -+ opts.vhost = v -+ }); - - // depending on subcommand, we do one or the other - match matches.subcommand_name() { -- - // execute publish command - Some("publish") => { -- - // the args after the "publish command - let subm = matches.subcommand_matches("publish").unwrap(); - - publish::do_publish(opts, subm) -+ } - -- }, -- - // execute subscribe command - Some("subscribe") => { -- - // the args after the "subscribe" command - let subm = matches.subcommand_matches("subscribe").unwrap(); - - subscribe::do_subscribe(opts, subm) -+ } - -- }, -- - _ => rbterr!("Need subcommand. Try --help"), - } -- - } - -- -- - // update the opts object with the given url --fn parse_url(opts:&mut amqp::Options, urlstr:String) -> Result<(),RbtError> { -+fn parse_url(opts: &mut amqp::Options, urlstr: String) -> Result<(), RbtError> { - if let Ok(url) = Url::parse(urlstr.as_ref()) { - if url.scheme() != "amqp" { - rbterr!("Unknown scheme: {}", url); -@@ -256,12 +263,9 @@ fn parse_url(opts:&mut amqp::Options, urlstr:String) - - } - } - -- -- - // update the opts object with the conf --fn parse_conf(opts:&mut amqp::Options) -> bool { -- -- let mut update = |connopt:Option<&Json>| -> bool { -+fn parse_conf(opts: &mut amqp::Options) -> bool { -+ let mut update = |connopt: Option<&Json>| -> bool { - if let Some(conn) = connopt { - if conn.is_object() { - if let Json::String(ref v) = conn["host"] { diff --git a/net/rabbiteer/files/patch-src_output.rs b/net/rabbiteer/files/patch-src_output.rs deleted file mode 100644 index 4d6ccb1292eb..000000000000 --- a/net/rabbiteer/files/patch-src_output.rs +++ /dev/null @@ -1,175 +0,0 @@ ---- src/output.rs.orig 2018-09-09 07:55:09 UTC -+++ src/output.rs -@@ -1,10 +1,11 @@ --use rustc_serialize::json::{self, Json, Object}; --use rustc_serialize::base64::{self, ToBase64}; --use amqp::protocol::basic::{Deliver, BasicProperties}; -+#![allow(deprecated, soft_unstable)] -+ -+use amqp::protocol::basic::{BasicProperties, Deliver}; - use amqp::{Table, TableEntry}; - use error::RbtError; -+use rustc_serialize::base64::{self, ToBase64}; -+use rustc_serialize::json::{self, Json, Object}; - -- - #[derive(RustcEncodable)] - struct MsgDeliver { - consumer_tag: String, -@@ -27,24 +28,27 @@ struct Msg { - data: Json, - } - --pub fn build_output(info:bool, deliver:&Deliver, -- props:&BasicProperties, body:Vec<u8>) -> Result<Vec<u8>,RbtError> { -+pub fn build_output( -+ info: bool, -+ deliver: &Deliver, -+ props: &BasicProperties, -+ body: Vec<u8>, -+) -> Result<Vec<u8>, RbtError> { - if info { -- - // delivery info - let mdel = MsgDeliver { -- consumer_tag:deliver.consumer_tag.clone(), -- delivery_tag:deliver.delivery_tag.clone(), -- redelivered:deliver.redelivered.clone(), -- exchange:deliver.exchange.clone(), -- routing_key:deliver.routing_key.clone(), -+ consumer_tag: deliver.consumer_tag.clone(), -+ delivery_tag: deliver.delivery_tag.clone(), -+ redelivered: deliver.redelivered.clone(), -+ exchange: deliver.exchange.clone(), -+ routing_key: deliver.routing_key.clone(), - }; - - let content_type = props.content_type.clone().unwrap_or(String::from("")); - - // properties - let mut mprops = MsgProps { -- content_type:content_type.clone(), -+ content_type: content_type.clone(), - headers: Object::new(), - }; - -@@ -57,9 +61,9 @@ pub fn build_output(info:bool, deliver:&Deliver, - - // and put it together - let msg = Msg { -- deliver:mdel, -- props:mprops, -- data:data, -+ deliver: mdel, -+ props: mprops, -+ data: data, - }; - - // encode -@@ -67,9 +71,7 @@ pub fn build_output(info:bool, deliver:&Deliver, - - // convert to bytes - Ok(js.to_string().as_bytes().to_owned()) -- - } else { -- - let content_type = props.content_type.clone().unwrap_or(String::from("")); - - match content_type.as_ref() { -@@ -82,32 +84,26 @@ pub fn build_output(info:bool, deliver:&Deliver, - - // convert to bytes - Ok(js.to_string().as_bytes().to_owned()) -- }, -+ } - - // just return untranslated bytes -- _ => Ok(body) -+ _ => Ok(body), - } -- - } - } - -- --fn figure_out_body(content_type:String, body:Vec<u8>) -> Result<Json,RbtError> { -- -+fn figure_out_body(content_type: String, body: Vec<u8>) -> Result<Json, RbtError> { - // depending on content type, do something - match content_type.as_ref() { - "application/json" => Ok(Json::from_str(&String::from_utf8(body)?)?), - _ => Ok(match content_type.find("text/") { - Some(_) => Json::String(String::from_utf8(body)?), -- _ => Json::String(body.to_base64(base64::STANDARD)) -- }) -+ _ => Json::String(body.to_base64(base64::STANDARD)), -+ }), - } -- - } - -- -- --fn table_to_json(table:&Table) -> Object { -+fn table_to_json(table: &Table) -> Object { - let mut ret = Object::new(); - for (skey, entry) in table { - ret.insert(skey.clone().to_string(), entry_to_json(&entry)); -@@ -115,33 +111,35 @@ fn table_to_json(table:&Table) -> Object { - ret - } - --fn entry_to_json(entry:&TableEntry) -> Json { -+fn entry_to_json(entry: &TableEntry) -> Json { - match *entry { -- TableEntry::Bool(v) => Json::Boolean(v), -- TableEntry::ShortShortInt(v) => Json::I64(v as i64), -- TableEntry::ShortShortUint(v) => Json::U64(v as u64), -- TableEntry::ShortInt(v) => Json::I64(v as i64), -- TableEntry::ShortUint(v) => Json::U64(v as u64), -- TableEntry::LongInt(v) => Json::I64(v as i64), -- TableEntry::LongUint(v) => Json::U64(v as u64), -- TableEntry::LongLongInt(v) => Json::I64(v), -- TableEntry::LongLongUint(v) => Json::U64(v), -- TableEntry::Float(v) => Json::F64(v as f64), -- TableEntry::Double(v) => Json::F64(v), -- TableEntry::LongString(ref v) => Json::String(v.clone()), -- TableEntry::Void => Json::Null, -- TableEntry::FieldTable(ref v) => Json::Object(table_to_json(&v)), -- TableEntry::Timestamp(v) => Json::U64(v as u64), // maybe string date? -+ TableEntry::Bool(v) => Json::Boolean(v), -+ TableEntry::ShortShortInt(v) => Json::I64(v as i64), -+ TableEntry::ShortShortUint(v) => Json::U64(v as u64), -+ TableEntry::ShortInt(v) => Json::I64(v as i64), -+ TableEntry::ShortUint(v) => Json::U64(v as u64), -+ TableEntry::LongInt(v) => Json::I64(v as i64), -+ TableEntry::LongUint(v) => Json::U64(v as u64), -+ TableEntry::LongLongInt(v) => Json::I64(v), -+ TableEntry::LongLongUint(v) => Json::U64(v), -+ TableEntry::Float(v) => Json::F64(v as f64), -+ TableEntry::Double(v) => Json::F64(v), -+ TableEntry::LongString(ref v) => Json::String(v.clone()), -+ TableEntry::Void => Json::Null, -+ TableEntry::FieldTable(ref v) => Json::Object(table_to_json(&v)), -+ TableEntry::Timestamp(v) => Json::U64(v as u64), // maybe string date? - TableEntry::FieldArray(ref vs) => { -- let mut ret:Vec<Json> = Vec::new(); -- for v in vs { ret.push(entry_to_json(v)) } -+ let mut ret: Vec<Json> = Vec::new(); -+ for v in vs { -+ ret.push(entry_to_json(v)) -+ } - Json::Array(ret) -- }, -+ } - TableEntry::DecimalValue(decimals, v) => { -- let ten:f64 = (10 as u64).pow(decimals as u32) as f64; -- let dec:f64 = (v as f64) / ten; -+ let ten: f64 = (10 as u64).pow(decimals as u32) as f64; -+ let dec: f64 = (v as f64) / ten; - Json::F64(dec) -- }, -+ } - //_ => Err(format!("Cant translate {:?}", entry)), - // TableEntry::ShortString(ref v) => Ok(Json::String(v.clone())), - } diff --git a/net/rabbiteer/files/patch-src_publish.rs b/net/rabbiteer/files/patch-src_publish.rs deleted file mode 100644 index 62f55785ff8b..000000000000 --- a/net/rabbiteer/files/patch-src_publish.rs +++ /dev/null @@ -1,137 +0,0 @@ ---- src/publish.rs.orig 2018-10-14 20:00:28 UTC -+++ src/publish.rs -@@ -1,41 +1,38 @@ --use std::io::{self, Write}; - use amqp; --use amqp::protocol::basic::{Deliver, BasicProperties}; -+use amqp::protocol::basic::{BasicProperties, Deliver}; -+use amqp::Channel; - use clap::ArgMatches; --use std::fs; --use std::path::Path; --use mime; - use client; - use error::RbtError; -+use mime; - use output; --use amqp::{Channel}; -+use std::fs; -+use std::io::{self, Write}; - use std::panic; -+use std::path::Path; - -- - // helper function to turn a filename - // into a mime-type --fn type_from_file(file:&String) -> Result<String,RbtError> { -+fn type_from_file(file: &String) -> Result<String, RbtError> { - let t = mime::Types::new().or(Err("Failed to read mime types"))?; - let path = Path::new(&file); - let mime = t.mime_for_path(&path); - Ok(mime.to_owned()) - } - -- --pub fn do_publish(opts:amqp::Options, matches:&ArgMatches) -> Result<(),RbtError> { -- -+pub fn do_publish(opts: amqp::Options, matches: &ArgMatches) -> Result<(), RbtError> { - // either stdin or a file - let file = value_t!(matches, "file", String)?; -- let rpc = matches.is_present("rpc"); -+ let rpc = matches.is_present("rpc"); - let reader: Box<io::Read> = match file.as_ref() { - "-" => Box::new(io::stdin()), -- _ => Box::new(fs::File::open(&file)?), -+ _ => Box::new(fs::File::open(&file)?), - }; - - // either - or the name of the file -- let file_name:&str = match file.as_ref() { -+ let file_name: &str = match file.as_ref() { - "-" => "-", -- _ => { -+ _ => { - // XXX fix unwrapping - let ostr = Path::new(&file).file_name().unwrap(); - ostr.to_str().unwrap() -@@ -48,51 +45,49 @@ pub fn do_publish(opts:amqp::Options, matches:&ArgMatc - let c = matches.value_of("content_type").unwrap_or("-").to_string(); - match c.as_ref() { - "-" => type_from_file(&file)?, -- _ => c, -+ _ => c, - } - }; - -- - // the sendable wraps up the parsed parts - let sendable = client::Sendable { -- exchange: value_t!(matches, "exchange", String)?, -- routing_key: value_t!(matches, "routing_key", String)?, -+ exchange: value_t!(matches, "exchange", String)?, -+ routing_key: value_t!(matches, "routing_key", String)?, - content_type: content_type, -- headers: values_t!(matches, "header", String).unwrap_or(vec![]), -- file_name: file_name.to_owned(), -- reader: reader, -- priority: value_t!(matches, "priority", u8).unwrap_or(0), -- rpctimeout: value_t!(matches, "rpctimeout", u64).unwrap_or(0) -+ headers: values_t!(matches, "header", String).unwrap_or(vec![]), -+ file_name: file_name.to_owned(), -+ reader: reader, -+ priority: value_t!(matches, "priority", u8).unwrap_or(0), -+ rpctimeout: value_t!(matches, "rpctimeout", u64).unwrap_or(0), - }; - - // if we are doing an rpc with replyTo/correlationId, we set up a receiver - let rpc_receive = match rpc { - false => None, -- true => { -- let receive = -- move |channel: &mut Channel, deliver:Deliver, props:BasicProperties, body:Vec<u8>| -> -- Result<(),RbtError> { -- let msg = output::build_output(false, &deliver, &props, body)?; -+ true => { -+ let receive = move |channel: &mut Channel, -+ deliver: Deliver, -+ props: BasicProperties, -+ body: Vec<u8>| -+ -> Result<(), RbtError> { -+ let msg = output::build_output(false, &deliver, &props, body)?; - -- // just write to stdout -- let stdout = io::stdout(); -+ // just write to stdout -+ let stdout = io::stdout(); - -- // lock until end of scope -- let mut handle = stdout.lock(); -+ // lock until end of scope -+ let mut handle = stdout.lock(); - -- handle.write(&msg)?; -- handle.write(b"\n")?; -- handle.flush()?; -- -- // closing the channel -- channel.close(200, "Bye")?; -- panic::set_hook(Box::new(|_| { -- })); -- // Until amqp library finds a way to exit consumer, terminate consumer_thread here. -- panic!(); -- -- -- }; -+ handle.write(&msg)?; -+ handle.write(b"\n")?; -+ handle.flush()?; -+ -+ // closing the channel -+ channel.close(200, "Bye")?; -+ panic::set_hook(Box::new(|_| {})); -+ // Until amqp library finds a way to exit consumer, terminate consumer_thread here. -+ panic!(); -+ }; - - let receiver = client::Receiver { - exchange: "".to_owned(), diff --git a/net/rabbiteer/files/patch-src_subscribe.rs b/net/rabbiteer/files/patch-src_subscribe.rs deleted file mode 100644 index a0c11a159813..000000000000 --- a/net/rabbiteer/files/patch-src_subscribe.rs +++ /dev/null @@ -1,147 +0,0 @@ ---- src/subscribe.rs.orig 2018-10-14 20:00:28 UTC -+++ src/subscribe.rs -@@ -1,23 +1,21 @@ --use std::io::{self, Write}; --use rand::{thread_rng, Rng, distributions::Alphanumeric}; --use amqp::protocol::basic::{Deliver, BasicProperties}; --use amqp::{self, TableEntry, Channel}; -+use amqp::protocol::basic::{BasicProperties, Deliver}; -+use amqp::{self, Channel, TableEntry}; - use clap::ArgMatches; --use std::fs; --use std::path::Path; --use mime; - use client; --use output; - use error::RbtError; -+use mime; -+use output; -+use rand::{distributions::Alphanumeric, thread_rng, Rng}; -+use std::fs; -+use std::io::{self, Write}; - use std::panic; -+use std::path::Path; - -- --pub fn do_subscribe(opts:amqp::Options, matches:&ArgMatches) -> Result<(),RbtError> { -- -+pub fn do_subscribe(opts: amqp::Options, matches: &ArgMatches) -> Result<(), RbtError> { - let output = value_t!(matches, "output", String)?; -- let queue : Option<String> = matches.value_of("queue").map(str::to_owned); -- let force_declare : bool = matches.is_present("declare"); -- let info = matches.is_present("info"); -+ let queue: Option<String> = matches.value_of("queue").map(str::to_owned); -+ let force_declare: bool = matches.is_present("declare"); -+ let info = matches.is_present("info"); - let single = matches.is_present("single"); - - // type lookup map -@@ -33,14 +31,15 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa - } - } - -- let receive = move |channel: &mut Channel, deliver:Deliver, props:BasicProperties, body:Vec<u8>| -> -- Result<(),RbtError> { -- -+ let receive = move |channel: &mut Channel, -+ deliver: Deliver, -+ props: BasicProperties, -+ body: Vec<u8>| -+ -> Result<(), RbtError> { - let msg = output::build_output(info, &deliver, &props, body)?; - - match output.as_ref() { - "-" => { -- - // just write to stdout - let stdout = io::stdout(); - -@@ -50,10 +49,8 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa - handle.write(&msg)?; - handle.write(b"\n")?; - handle.flush()?; -- -- }, -- _ => { -- -+ } -+ _ => { - // extract file name from headers, or fall back on random - let file_name = file_name_of(&props, &types); - -@@ -70,60 +67,60 @@ pub fn do_subscribe(opts:amqp::Options, matches:&ArgMa - - let mut f = fs::File::create(path)?; - f.write_all(&msg)?; -- - } -- - } - - // maybe end here? - if single { - // closing the channel - channel.close(200, "Bye")?; -- panic::set_hook(Box::new(|_| { -- })); -+ panic::set_hook(Box::new(|_| {})); - // Until amqp library finds a way to exit consumer, terminate consumer_thread here. - panic!(); - } - - Ok(()) -- - }; - - let receiver = client::Receiver { - exchange: value_t!(matches, "exchange", String)?, - routing_key: matches.value_of("routing_key").map(str::to_owned), -- auto_ack: ! matches.is_present("noack"), -+ auto_ack: !matches.is_present("noack"), - callback: Box::new(receive), - }; - - client::open_receive(opts, queue, force_declare, receiver) - } - --fn file_name_of(props:&BasicProperties, types:&mime::Types) -> String { -+fn file_name_of(props: &BasicProperties, types: &mime::Types) -> String { -+ let content_type = props -+ .content_type -+ .clone() -+ .unwrap_or("application/octet-stream".to_owned()); - -- let content_type = -- props.content_type.clone().unwrap_or("application/octet-stream".to_owned()); -- - // figure out a good extension for this content type -- let ext = types.get_extension(&content_type) -+ let ext = types -+ .get_extension(&content_type) - .and_then(|x| Some(x[0].clone())) - .or_else(|| Some("bin".to_owned())) - .unwrap(); - - // prefer a fileName from headers, but fall back on - // a random name. -- props.headers.clone() -+ props -+ .headers -+ .clone() - .and_then(|x| match x.get("fileName") { - Some(&TableEntry::LongString(ref f)) => Some((*f).clone()), -- _ => None -+ _ => None, - }) - .or_else(|| Some(gen_rand_name(ext))) - .unwrap() - } - --fn gen_rand_name(ext:String) -> String { -+fn gen_rand_name(ext: String) -> String { - // generate 16 ascii chars -- let mut rand:String = thread_rng().sample_iter(&Alphanumeric).take(16).collect(); -+ let mut rand: String = thread_rng().sample_iter(&Alphanumeric).take(16).collect(); - rand.push_str("."); - rand.push_str(&ext); - rand |