Skip to content

Commit be9e617

Browse files
authored
Merge pull request #458 from steveklabnik/update-deps
Upgrade many dependencies
2 parents c73ba68 + 9acb099 commit be9e617

17 files changed

+368
-273
lines changed

Cargo.lock

Lines changed: 305 additions & 206 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ s3 = { path = "src/s3" }
2020
migrate = { path = "src/migrate" }
2121
rand = "0.3"
2222
time = "0.1"
23-
git2 = "0.4"
23+
git2 = "0.5"
2424
flate2 = "0.2"
25-
semver = "0.2"
26-
url = "0.5.0"
27-
postgres = { version = "0.11", features = ["time"] }
28-
r2d2 = "0.6.0"
29-
r2d2_postgres = "0.10"
25+
semver = "0.5"
26+
url = "1.2.1"
27+
postgres = { version = "0.12", features = ["with-time"] }
28+
r2d2 = "0.7.0"
29+
r2d2_postgres = "0.11"
3030
openssl = "0.7"
3131
curl = "0.2"
3232
oauth2 = "0.1"
@@ -36,20 +36,20 @@ rustc-serialize = "0.3"
3636
license-exprs = "^1.3"
3737
dotenv = "0.8.0"
3838

39-
conduit = "0.7"
40-
conduit-conditional-get = "0.7"
41-
conduit-cookie = "0.7"
42-
conduit-json-parser = "0.7"
43-
conduit-log-requests = "0.7"
44-
conduit-middleware = "0.7"
45-
conduit-router = "0.7"
46-
conduit-static = "0.7"
47-
conduit-git-http-backend = "0.7"
48-
civet = "0.8"
39+
conduit = "0.8"
40+
conduit-conditional-get = "0.8"
41+
conduit-cookie = "0.8"
42+
conduit-json-parser = "0.8"
43+
conduit-log-requests = "0.8"
44+
conduit-middleware = "0.8"
45+
conduit-router = "0.8"
46+
conduit-static = "0.8"
47+
conduit-git-http-backend = "0.8"
48+
civet = "0.9"
4949

5050

5151
[dev-dependencies]
52-
conduit-test = "0.7"
52+
conduit-test = "0.8"
5353
bufstream = "0.1"
5454

5555
[features]

src/bin/delete-crate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use cargo_registry::{Crate, env};
2121
#[allow(dead_code)]
2222
fn main() {
2323
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
24-
postgres::SslMode::None).unwrap();
24+
postgres::TlsMode::None).unwrap();
2525
{
2626
let tx = conn.transaction().unwrap();
2727
delete(&tx);
@@ -30,7 +30,7 @@ fn main() {
3030
}
3131
}
3232

33-
fn delete(tx: &postgres::Transaction) {
33+
fn delete(tx: &postgres::transaction::Transaction) {
3434
let name = match env::args().nth(1) {
3535
None => { println!("needs a crate-name argument"); return }
3636
Some(s) => s,

src/bin/delete-version.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use cargo_registry::{Crate, Version, env};
2121
#[allow(dead_code)]
2222
fn main() {
2323
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
24-
postgres::SslMode::None).unwrap();
24+
postgres::TlsMode::None).unwrap();
2525
{
2626
let tx = conn.transaction().unwrap();
2727
delete(&tx);
@@ -30,7 +30,7 @@ fn main() {
3030
}
3131
}
3232

33-
fn delete(tx: &postgres::Transaction) {
33+
fn delete(tx: &postgres::transaction::Transaction) {
3434
let name = match env::args().nth(1) {
3535
None => { println!("needs a crate-name argument"); return }
3636
Some(s) => s,

src/bin/fill-in-user-id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct GithubUser {
5151
id: i32,
5252
}
5353

54-
fn update(app: &App, tx: &postgres::Transaction) {
54+
fn update(app: &App, tx: &postgres::transaction::Transaction) {
5555
let mut rows = Vec::new();
5656
let query = "SELECT id, gh_login, gh_access_token, gh_avatar FROM users \
5757
WHERE gh_id IS NULL";

src/bin/migrate.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use cargo_registry::model::Model;
1515
#[allow(dead_code)]
1616
fn main() {
1717
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
18-
postgres::SslMode::None).unwrap();
18+
postgres::TlsMode::None).unwrap();
1919
let migrations = migrations();
2020

2121
let arg = env::args().nth(1);
@@ -26,7 +26,7 @@ fn main() {
2626
}
2727
}
2828

29-
fn apply(tx: postgres::Transaction,
29+
fn apply(tx: postgres::transaction::Transaction,
3030
migrations: Vec<Migration>) -> postgres::Result<()> {
3131
let mut mgr = try!(migrate::Manager::new(tx));
3232
for m in migrations.into_iter() {
@@ -36,7 +36,7 @@ fn apply(tx: postgres::Transaction,
3636
mgr.finish()
3737
}
3838

39-
fn rollback(tx: postgres::Transaction,
39+
fn rollback(tx: postgres::transaction::Transaction,
4040
migrations: Vec<Migration>) -> postgres::Result<()> {
4141
let mut mgr = try!(migrate::Manager::new(tx));
4242
for m in migrations.into_iter().rev() {
@@ -809,7 +809,7 @@ fn migrations() -> Vec<Migration> {
809809
}
810810

811811
// DO NOT UPDATE OR USE FOR NEW MIGRATIONS
812-
fn fix_duplicate_crate_owners(tx: &postgres::Transaction) -> postgres::Result<()> {
812+
fn fix_duplicate_crate_owners(tx: &postgres::transaction::Transaction) -> postgres::Result<()> {
813813
let v: Vec<(i32, i32)> = {
814814
let stmt = try!(tx.prepare("SELECT user_id, crate_id
815815
FROM crate_owners

src/bin/populate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use cargo_registry::env;
2020
#[allow(dead_code)]
2121
fn main() {
2222
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
23-
postgres::SslMode::None).unwrap();
23+
postgres::TlsMode::None).unwrap();
2424
{
2525
let tx = conn.transaction().unwrap();
2626
update(&tx).unwrap();
@@ -29,7 +29,7 @@ fn main() {
2929
}
3030
}
3131

32-
fn update(tx: &postgres::Transaction) -> postgres::Result<()> {
32+
fn update(tx: &postgres::transaction::Transaction) -> postgres::Result<()> {
3333
let ids = env::args().skip(1).filter_map(|arg| {
3434
arg.parse::<i32>().ok()
3535
});

src/bin/transfer-crates.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use cargo_registry::Model;
2020
#[allow(dead_code)]
2121
fn main() {
2222
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
23-
postgres::SslMode::None).unwrap();
23+
postgres::TlsMode::None).unwrap();
2424
{
2525
let tx = conn.transaction().unwrap();
2626
transfer(&tx);
@@ -29,7 +29,7 @@ fn main() {
2929
}
3030
}
3131

32-
fn transfer(tx: &postgres::Transaction) {
32+
fn transfer(tx: &postgres::transaction::Transaction) {
3333
let from = match env::args().nth(1) {
3434
None => { println!("needs a from-user argument"); return }
3535
Some(s) => s,

src/bin/update-downloads.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
let sleep = env::args().nth(2).map(|s| s.parse().unwrap());
2121
loop {
2222
let conn = postgres::Connection::connect(&env("DATABASE_URL")[..],
23-
postgres::SslMode::None).unwrap();
23+
postgres::TlsMode::None).unwrap();
2424
update(&conn).unwrap();
2525
drop(conn);
2626
if daemon {
@@ -54,7 +54,7 @@ fn update(conn: &postgres::GenericConnection) -> postgres::Result<()> {
5454
Ok(())
5555
}
5656

57-
fn collect(tx: &postgres::Transaction,
57+
fn collect(tx: &postgres::transaction::Transaction,
5858
rows: &mut postgres::rows::Rows) -> postgres::Result<Option<i32>> {
5959
use time::Duration;
6060

@@ -145,15 +145,15 @@ mod test {
145145

146146
fn conn() -> postgres::Connection {
147147
postgres::Connection::connect(&env("TEST_DATABASE_URL")[..],
148-
postgres::SslMode::None).unwrap()
148+
postgres::TlsMode::None).unwrap()
149149
}
150150

151-
fn user(conn: &postgres::Transaction) -> User{
151+
fn user(conn: &postgres::transaction::Transaction) -> User{
152152
User::find_or_insert(conn, 2, "login", None, None, None,
153153
"access_token", "api_token").unwrap()
154154
}
155155

156-
fn crate_downloads(tx: &postgres::Transaction, id: i32, expected: usize) {
156+
fn crate_downloads(tx: &postgres::transaction::Transaction, id: i32, expected: usize) {
157157
let stmt = tx.prepare("SELECT * FROM crate_downloads
158158
WHERE crate_id = $1").unwrap();
159159
let dl: i32 = stmt.query(&[&id]).unwrap().iter()

src/db.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ use pg;
77
use pg::GenericConnection;
88
use r2d2;
99
use r2d2_postgres;
10+
use r2d2_postgres::postgres;
1011
use r2d2_postgres::PostgresConnectionManager as PCM;
11-
use r2d2_postgres::SslMode;
12+
use r2d2_postgres::TlsMode;
1213
use conduit::{Request, Response};
1314
use conduit_middleware::Middleware;
1415

@@ -19,8 +20,8 @@ pub type Pool = r2d2::Pool<PCM>;
1920
pub type Config = r2d2::Config<pg::Connection, r2d2_postgres::Error>;
2021
type PooledConnnection = r2d2::PooledConnection<PCM>;
2122

22-
pub fn pool(url: &str, config: r2d2::Config<pg::Connection, r2d2_postgres::Error>) -> Pool {
23-
let mgr = PCM::new(url, SslMode::None).unwrap();
23+
pub fn pool(url: &str, config: r2d2::Config<postgres::Connection, r2d2_postgres::Error>) -> Pool {
24+
let mgr = PCM::new(url, TlsMode::None).unwrap();
2425
r2d2::Pool::new(config, mgr).unwrap()
2526
}
2627

@@ -35,7 +36,7 @@ pub struct Transaction {
3536
// into `PooledConnnection`, but this `Transaction` can be moved around in
3637
// memory, so we need the borrow to be from a stable address. The `Box` will
3738
// provide this stable address.
38-
tx: LazyCell<pg::Transaction<'static>>,
39+
tx: LazyCell<pg::transaction::Transaction<'static>>,
3940
slot: LazyCell<Box<PooledConnnection>>,
4041
commit: Cell<Option<bool>>,
4142

@@ -55,14 +56,14 @@ impl Transaction {
5556
}
5657
}
5758

58-
pub fn conn(&self) -> CargoResult<&pg::Connection> {
59+
pub fn conn(&self) -> CargoResult<&r2d2::PooledConnection<r2d2_postgres::PostgresConnectionManager>> {
5960
if !self.slot.filled() {
6061
let conn = try!(self.app.database.get().map_err(|e| {
6162
internal(format!("failed to get a database connection: {}", e))
6263
}));
6364
self.slot.fill(Box::new(conn));
6465
}
65-
Ok(&***self.slot.borrow().unwrap())
66+
Ok(&**self.slot.borrow().unwrap())
6667
}
6768

6869
fn tx<'a>(&'a self) -> CargoResult<&'a (GenericConnection + 'a)> {
@@ -74,12 +75,12 @@ impl Transaction {
7475
if !self.tx.filled() {
7576
let conn = try!(self.conn());
7677
let t = try!(conn.transaction());
77-
let t = mem::transmute::<_, pg::Transaction<'static>>(t);
78+
let t = mem::transmute::<_, pg::transaction::Transaction<'static>>(t);
7879
self.tx.fill(t);
7980
}
8081
}
8182
let tx = self.tx.borrow();
82-
let tx: &'a pg::Transaction<'static> = tx.unwrap();
83+
let tx: &'a pg::transaction::Transaction<'static> = tx.unwrap();
8384
Ok(tx)
8485
}
8586

@@ -121,7 +122,7 @@ pub trait RequestTransaction {
121122
/// Return the lazily initialized postgres connection for this request.
122123
///
123124
/// The connection will live for the lifetime of the request.
124-
fn db_conn(&self) -> CargoResult<&pg::Connection>;
125+
fn db_conn(&self) -> CargoResult<&r2d2::PooledConnection<r2d2_postgres::PostgresConnectionManager>>;
125126

126127
/// Return the lazily initialized postgres transaction for this request.
127128
///
@@ -136,7 +137,7 @@ pub trait RequestTransaction {
136137
}
137138

138139
impl<'a> RequestTransaction for Request + 'a {
139-
fn db_conn(&self) -> CargoResult<&pg::Connection> {
140+
fn db_conn(&self) -> CargoResult<&r2d2::PooledConnection<r2d2_postgres::PostgresConnectionManager>> {
140141
self.extensions().find::<Transaction>()
141142
.expect("Transaction not present in request")
142143
.conn()

src/keyword.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use conduit::{Request, Response};
66
use conduit_router::RequestParams;
77
use pg::GenericConnection;
88
use pg::rows::Row;
9-
use pg::types::Slice;
109

1110
use {Model, Crate};
1211
use db::RequestTransaction;
@@ -95,7 +94,7 @@ impl Keyword {
9594
try!(conn.execute("DELETE FROM crates_keywords
9695
WHERE keyword_id = ANY($1)
9796
AND crate_id = $2",
98-
&[&Slice(&to_rm), &krate.id]));
97+
&[&to_rm, &krate.id]));
9998
}
10099

101100
if to_add.len() > 0 {

src/krate.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use curl::http;
1212
use license_exprs;
1313
use pg::GenericConnection;
1414
use pg::rows::Row;
15-
use pg::types::{ToSql, Slice};
15+
use pg::types::ToSql;
1616
use pg;
1717
use rustc_serialize::hex::ToHex;
1818
use rustc_serialize::json;
1919
use semver;
2020
use time::{Timespec, Duration};
21-
use url::{self, Url};
21+
use url::Url;
2222

2323
use {Model, User, Keyword, Version};
2424
use app::{App, RequestApp};
@@ -182,17 +182,14 @@ impl Crate {
182182
let url = try!(Url::parse(url).map_err(|_| {
183183
human(format!("`{}` is not a valid url: `{}`", field, url))
184184
}));
185-
match &url.scheme[..] {
185+
match &url.scheme()[..] {
186186
"http" | "https" => {}
187187
s => return Err(human(format!("`{}` has an invalid url \
188188
scheme: `{}`", field, s)))
189189
}
190-
match url.scheme_data {
191-
url::SchemeData::Relative(..) => {}
192-
url::SchemeData::NonRelative(..) => {
193-
return Err(human(format!("`{}` must have relative scheme \
194-
data: {}", field, url)))
195-
}
190+
if url.cannot_be_a_base() {
191+
return Err(human(format!("`{}` must have relative scheme \
192+
data: {}", field, url)))
196193
}
197194
Ok(())
198195
}
@@ -908,7 +905,7 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
908905
AND version_id = ANY($2)
909906
ORDER BY date ASC"));
910907
let mut downloads = Vec::new();
911-
for row in try!(stmt.query(&[&cutoff_date, &Slice(&ids)])).iter() {
908+
for row in try!(stmt.query(&[&cutoff_date, &ids])).iter() {
912909
let download: VersionDownload = Model::from_row(&row);
913910
downloads.push(download.encodable());
914911
}
@@ -925,7 +922,7 @@ pub fn downloads(req: &mut Request) -> CargoResult<Response> {
925922
GROUP BY DATE(version_downloads.date)
926923
ORDER BY DATE(version_downloads.date) ASC"));
927924
let mut extra = Vec::new();
928-
for row in try!(stmt.query(&[&cutoff_date, &krate.id, &Slice(&ids)])).iter() {
925+
for row in try!(stmt.query(&[&cutoff_date, &krate.id, &ids])).iter() {
929926
extra.push(ExtraDownload {
930927
downloads: row.get("downloads"),
931928
date: row.get("date")

src/migrate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ name = "migrate"
88
path = "lib.rs"
99

1010
[dependencies]
11-
postgres = "0.11"
11+
postgres = "0.12"

src/migrate/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ extern crate postgres;
44

55
use std::collections::HashSet;
66

7-
use postgres::Transaction;
7+
use postgres::transaction::Transaction;
88
use postgres::Result as PgResult;
99

1010
struct A<'a, 'b: 'a> {
@@ -72,7 +72,7 @@ fn run(sql: String) -> Step {
7272
}
7373

7474
impl<'a> Manager<'a> {
75-
pub fn new(tx: postgres::Transaction) -> PgResult<Manager> {
75+
pub fn new(tx: Transaction) -> PgResult<Manager> {
7676
let mut mgr = Manager { tx: tx, versions: HashSet::new() };
7777
try!(mgr.load());
7878
Ok(mgr)

0 commit comments

Comments
 (0)