From owner-svn-ports-head@freebsd.org Tue Oct 30 10:15:12 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FF5010DE508; Tue, 30 Oct 2018 10:15:12 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E14C7BC65; Tue, 30 Oct 2018 10:15:11 +0000 (UTC) (envelope-from luca.pizzamiglio@gmail.com) Received: by mail-lj1-f177.google.com with SMTP id c4-v6so10768069lja.4; Tue, 30 Oct 2018 03:15:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NdkyyucqEHfBfn4X4/xbxSookDbgN9245swtvl0EUUA=; b=Qs2ncUcp2iSw4rEodmHYtRth1apZ6CtiVwI0ubBmMd4qDK9WDWmAM5/SgLIkd/6y0o YPs5XkoedjPp9LEXuWFL+b5/2yjNfMlJQoVWOU6yobWnoNns12GfBkBUYnSJPq92HuF5 16+DxuCsQaXIb3JE70GubMmnzd5GwGjc9pfXGdOgP340HiibI7Fp0JnF7hfchad8vObe +7iT20c9sD2vcBNJAtK56AHYPYyNiPByiDD7BrcNceb6gskAhL+JGfGS8IfOvTJMmB4/ /VGCG7zmEEuOb+xFcfWd42+RFJrTcPiriuVgRaQxXjQ1CJIIP4BreV4A/Z2Fhd4oB5Y+ EKEg== X-Gm-Message-State: AGRZ1gJnUqVyyiNefdnT7GiJTskBPa2q//QWYsmfraWz2/SKO/fsuX0J MuQwRyvqWjqdeD2c8B+QfK4n3d9dn3E= X-Google-Smtp-Source: AJdET5f+RFqZtGMyPN/qndMj0+9y7lOD4+e7UiHE0pc01SGSxOh8WJNx0uGtWAOIx6ci4C8gMr+ZPA== X-Received: by 2002:a2e:594a:: with SMTP id n71-v6mr11288647ljb.175.1540893012097; Tue, 30 Oct 2018 02:50:12 -0700 (PDT) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id p63-v6sm3597035lfg.46.2018.10.30.02.50.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 02:50:11 -0700 (PDT) Received: by mail-lf1-f45.google.com with SMTP id d7-v6so8337709lfi.2; Tue, 30 Oct 2018 02:50:11 -0700 (PDT) X-Received: by 2002:a19:4402:: with SMTP id r2mr1321361lfa.111.1540893010755; Tue, 30 Oct 2018 02:50:10 -0700 (PDT) MIME-Version: 1.0 References: <201810171315.w9HDFrgI039873@repo.freebsd.org> <20181024083541.4q726xezswwqe2xo@atuin.in.mat.cc> In-Reply-To: From: Luca Pizzamiglio Date: Tue, 30 Oct 2018 10:49:53 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r482294 - head/devel/sccache To: Jan Beich Cc: Mathieu Arnold , svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 10:15:12 -0000 Thanks for this elegant solution. I've tried to patch the openssl-0.9.24 crate to support openssl 1.1.1, but I didn't spent to much time to make I'll test and adopt you solution. On Wed, Oct 24, 2018 at 6:17 PM Jan Beich wrote: > Luca Pizzamiglio writes: > > > Rust dependencies (crates) are statically linked in the final executable, > > so if a dependency crate fails to build, the whole application failed to > > build. Crates are not shared library, they are shared API statically > linked > > to the final executable. > > Crates aren't immutable, see below. > > diff --git devel/sccache/Makefile devel/sccache/Makefile > index 7a2f12352ecb..17d610fdd656 100644 > --- devel/sccache/Makefile > +++ devel/sccache/Makefile > @@ -2,7 +2,7 @@ > > PORTNAME= sccache > DISTVERSION= 2.8.0.alpha0 > -PORTREVISION= 1 > +PORTREVISION= 2 > CATEGORIES= devel > > MAINTAINER= pizzamig@FreeBSD.org > @@ -39,7 +39,6 @@ CARGO_CRATES= adler32-1.0.3 \ > base64-0.9.2 \ > bincode-0.8.0 \ > bincode-1.0.1 \ > - bitflags-0.9.1 \ > bitflags-1.0.4 \ > buf_redux-0.6.3 \ > bufstream-0.1.3 \ > @@ -145,7 +144,6 @@ CARGO_CRATES= adler32-1.0.3 \ > num_cpus-1.8.0 \ > number_prefix-0.2.8 \ > openssl-0.10.11 \ > - openssl-0.9.24 \ > openssl-sys-0.9.35 \ > owning_ref-0.3.3 \ > parking_lot-0.6.4 \ > @@ -282,16 +280,11 @@ CARGO_CRATES= adler32-1.0.3 \ > xattr-0.2.2 \ > zip-0.4.2 > > -.include > - > -.if ${OPSYS} == FreeBSD && ${OSVERSION} > 1200084 > -IGNORE= openssl 1.1.1 is incompatible with the reqwest 0.8.8 > dependencies > -.endif > - > do-install-DOCS-on: > @${MKDIR} ${STAGEDIR}${DOCSDIR} > ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} > > post-install: > ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/sccache > -.include > + > +.include > diff --git devel/sccache/distinfo devel/sccache/distinfo > index 3168794b1eb1..9f1b09ac1b4f 100644 > --- devel/sccache/distinfo > +++ devel/sccache/distinfo > @@ -29,8 +29,6 @@ SHA256 (rust/crates/bincode-0.8.0.tar.gz) = > e103c8b299b28a9c6990458b7013dc4a8356 > SIZE (rust/crates/bincode-0.8.0.tar.gz) = 71632 > SHA256 (rust/crates/bincode-1.0.1.tar.gz) = > 9f2fb9e29e72fd6bc12071533d5dc7664cb01480c59406f656d7ac25c7bd8ff7 > SIZE (rust/crates/bincode-1.0.1.tar.gz) = 14071 > -SHA256 (rust/crates/bitflags-0.9.1.tar.gz) = > 4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5 > -SIZE (rust/crates/bitflags-0.9.1.tar.gz) = 12406 > SHA256 (rust/crates/bitflags-1.0.4.tar.gz) = > 228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12 > SIZE (rust/crates/bitflags-1.0.4.tar.gz) = 15282 > SHA256 (rust/crates/buf_redux-0.6.3.tar.gz) = > b9279646319ff816b05fb5897883ece50d7d854d12b59992683d4f8a71b0f949 > @@ -241,8 +239,6 @@ SHA256 (rust/crates/number_prefix-0.2.8.tar.gz) = > dbf9993e59c894e3c08aa1c2712914 > SIZE (rust/crates/number_prefix-0.2.8.tar.gz) = 5493 > SHA256 (rust/crates/openssl-0.10.11.tar.gz) = > 6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc > SIZE (rust/crates/openssl-0.10.11.tar.gz) = 164328 > -SHA256 (rust/crates/openssl-0.9.24.tar.gz) = > a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985 > -SIZE (rust/crates/openssl-0.9.24.tar.gz) = 149235 > SHA256 (rust/crates/openssl-sys-0.9.35.tar.gz) = > 912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129 > SIZE (rust/crates/openssl-sys-0.9.35.tar.gz) = 44854 > SHA256 (rust/crates/owning_ref-0.3.3.tar.gz) = > cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37 > diff --git devel/sccache/files/patch-openssl-0.10 > devel/sccache/files/patch-openssl-0.10 > new file mode 100644 > index 000000000000..dc4d413348ef > --- /dev/null > +++ devel/sccache/files/patch-openssl-0.10 > @@ -0,0 +1,204 @@ > +https://github.com/sfackler/rust-native-tls/commit/f1a7ea94752c > + > +--- Cargo.lock 2018-09-10 20:16:55 UTC > ++++ Cargo.lock > +@@ -122,11 +122,6 @@ dependencies = [ > + > + [[package]] > + name = "bitflags" > +-version = "0.9.1" > +-source = "registry+https://github.com/rust-lang/crates.io-index" > +- > +-[[package]] > +-name = "bitflags" > + version = "1.0.4" > + source = "registry+https://github.com/rust-lang/crates.io-index" > + > +@@ -943,7 +938,7 @@ source = "registry+ > https://github.com/rust-lang/crates > + dependencies = [ > + "lazy_static 0.2.11 (registry+ > https://github.com/rust-lang/crates.io-index)", > + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", > +- "openssl 0.9.24 (registry+https://github.com/rust-lang/crates.io-index > )", > ++ "openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index > )", > + "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index > )", > + "security-framework 0.1.16 (registry+ > https://github.com/rust-lang/crates.io-index)", > + "security-framework-sys 0.1.16 (registry+ > https://github.com/rust-lang/crates.io-index)", > +@@ -1021,18 +1016,6 @@ dependencies = [ > + > + [[package]] > + name = "openssl" > +-version = "0.9.24" > +-source = "registry+https://github.com/rust-lang/crates.io-index" > +-dependencies = [ > +- "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index > )", > +- "foreign-types 0.3.2 (registry+ > https://github.com/rust-lang/crates.io-index)", > +- "lazy_static 1.1.0 (registry+ > https://github.com/rust-lang/crates.io-index)", > +- "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", > +- "openssl-sys 0.9.35 (registry+ > https://github.com/rust-lang/crates.io-index)", > +-] > +- > +-[[package]] > +-name = "openssl" > + version = "0.10.11" > + source = "registry+https://github.com/rust-lang/crates.io-index" > + dependencies = [ > +@@ -2318,7 +2301,6 @@ dependencies = [ > + "checksum base64 0.9.2 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "85415d2594767338a74a30c1d370b2f3262ec1b4ed2d7bba5b3faf4de40467d9" > + "checksum bincode 0.8.0 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e" > + "checksum bincode 1.0.1 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "9f2fb9e29e72fd6bc12071533d5dc7664cb01480c59406f656d7ac25c7bd8ff7" > +-"checksum bitflags 0.9.1 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" > + "checksum bitflags 1.0.4 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" > + "checksum buf_redux 0.6.3 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "b9279646319ff816b05fb5897883ece50d7d854d12b59992683d4f8a71b0f949" > + "checksum bufstream 0.1.3 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32" > +@@ -2424,7 +2406,6 @@ dependencies = [ > + "checksum num_cpus 1.8.0 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" > + "checksum number_prefix 0.2.8 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "dbf9993e59c894e3c08aa1c2712914e9e6bf1fcbfc6bef283e2183df345a4fee" > + "checksum openssl 0.10.11 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc" > +-"checksum openssl 0.9.24 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "a3605c298474a3aa69de92d21139fb5e2a81688d308262359d85cdd0d12a7985" > + "checksum openssl-sys 0.9.35 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129" > + "checksum owning_ref 0.3.3 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" > + "checksum parking_lot 0.6.4 (registry+ > https://github.com/rust-lang/crates.io-index)" = > "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" > +--- cargo-crates/native-tls-0.1.5/Cargo.toml.orig 2018-01-11 > 17:27:31 UTC > ++++ cargo-crates/native-tls-0.1.5/Cargo.toml > +@@ -34,6 +34,6 @@ version = "0.1.15" > + [target."cfg(any(target_os = \"macos\", target_os = > \"ios\"))".dependencies.tempdir] > + version = "0.3" > + [target."cfg(not(any(target_os = \"windows\", target_os = \"macos\", > target_os = \"ios\")))".dependencies.openssl] > +-version = "0.9.23" > ++version = "0.10.1" > + [target."cfg(target_os = \"windows\")".dependencies.schannel] > + version = "0.1.7" > +--- cargo-crates/native-tls-0.1.5/src/imp/openssl.rs.orig 2018-01-11 > 17:27:24 UTC > ++++ cargo-crates/native-tls-0.1.5/src/imp/openssl.rs > +@@ -6,25 +6,25 @@ use std::error; > + use self::openssl::pkcs12; > + use self::openssl::error::ErrorStack; > + use self::openssl::ssl::{self, SslMethod, SslConnectorBuilder, > SslConnector, SslAcceptorBuilder, > +- SslAcceptor, MidHandshakeSslStream, > SslContextBuilder}; > ++ SslAcceptor, MidHandshakeSslStream, > SslContextBuilder, SslOptions}; > + use self::openssl::x509::X509; > + > + use Protocol; > + > + fn supported_protocols(protocols: &[Protocol], ctx: &mut > SslContextBuilder) { > + // This constant is only defined on OpenSSL 1.0.2 and above, so > manually do it. > +- let ssl_op_no_ssl_mask = ssl::SSL_OP_NO_SSLV2 | ssl::SSL_OP_NO_SSLV3 > | ssl::SSL_OP_NO_TLSV1 | > +- ssl::SSL_OP_NO_TLSV1_1 | > +- ssl::SSL_OP_NO_TLSV1_2; > ++ let ssl_op_no_ssl_mask = SslOptions::NO_SSLV2 | SslOptions::NO_SSLV3 > | SslOptions::NO_TLSV1 | > ++ SslOptions::NO_TLSV1_1 | > ++ SslOptions::NO_TLSV1_2; > + > + ctx.clear_options(ssl_op_no_ssl_mask); > + let mut options = ssl_op_no_ssl_mask; > + for protocol in protocols { > + let op = match *protocol { > +- Protocol::Sslv3 => ssl::SSL_OP_NO_SSLV3, > +- Protocol::Tlsv10 => ssl::SSL_OP_NO_TLSV1, > +- Protocol::Tlsv11 => ssl::SSL_OP_NO_TLSV1_1, > +- Protocol::Tlsv12 => ssl::SSL_OP_NO_TLSV1_2, > ++ Protocol::Sslv3 => SslOptions::NO_SSLV3, > ++ Protocol::Tlsv10 => SslOptions::NO_TLSV1, > ++ Protocol::Tlsv11 => SslOptions::NO_TLSV1_1, > ++ Protocol::Tlsv12 => SslOptions::NO_TLSV1_2, > + Protocol::__NonExhaustive => unreachable!(), > + }; > + options &= !op; > +@@ -64,7 +64,7 @@ impl From for Error { > + > + impl From for Error { > + fn from(err: ErrorStack) -> Error { > +- ssl::Error::Ssl(err).into() > ++ err.into() > + } > + } > + > +@@ -132,11 +132,9 @@ pub enum HandshakeError { > + impl From> for HandshakeError { > + fn from(e: ssl::HandshakeError) -> HandshakeError { > + match e { > +- ssl::HandshakeError::SetupFailure(e) => { > +- HandshakeError::Failure(Error(ssl::Error::Ssl(e))) > +- } > ++ ssl::HandshakeError::SetupFailure(e) => > HandshakeError::Failure(e.into()), > + ssl::HandshakeError::Failure(e) => > HandshakeError::Failure(Error(e.into_error())), > +- ssl::HandshakeError::Interrupted(s) => { > ++ ssl::HandshakeError::WouldBlock(s) => { > + HandshakeError::Interrupted(MidHandshakeTlsStream(s)) > + } > + } > +@@ -157,8 +155,10 @@ impl TlsConnectorBuilder { > + try!(self.0.set_certificate(&pkcs12.0.cert)); > + try!(self.0.set_private_key(&pkcs12.0.pkey)); > + try!(self.0.check_private_key()); > +- for cert in pkcs12.0.chain { > +- try!(self.0.add_extra_chain_cert(cert)); > ++ if let Some(chain) = pkcs12.0.chain { > ++ for cert in chain { > ++ try!(self.0.add_extra_chain_cert(cert)); > ++ } > + } > + Ok(()) > + } > +@@ -183,7 +183,7 @@ pub struct TlsConnector(SslConnector); > + > + impl TlsConnector { > + pub fn builder() -> Result { > +- let builder = try!(SslConnectorBuilder::new(SslMethod::tls())); > ++ let builder = try!(SslConnector::builder(SslMethod::tls())); > + Ok(TlsConnectorBuilder(builder)) > + } > + > +@@ -199,7 +199,12 @@ impl TlsConnector { > + where > + S: io::Read + io::Write, > + { > +- let s = > try!(self.0.danger_connect_without_providing_domain_for_certificate_verification_and_server_name_indication(stream)); > ++ let c = try!(self.0.configure()); > ++ let s = try!( > ++ c.use_server_name_indication(false) > ++ .verify_hostname(false) > ++ .connect("", stream) > ++ ); > + Ok(TlsStream(s)) > + } > + } > +@@ -248,12 +253,14 @@ pub struct TlsAcceptor(SslAcceptor); > + > + impl TlsAcceptor { > + pub fn builder(pkcs12: Pkcs12) -> Result { > +- let builder = try!(SslAcceptorBuilder::mozilla_intermediate( > +- SslMethod::tls(), > +- &pkcs12.0.pkey, > +- &pkcs12.0.cert, > +- &pkcs12.0.chain, > +- )); > ++ let mut builder = > try!(SslAcceptor::mozilla_intermediate(SslMethod::tls())); > ++ try!(builder.set_private_key(&pkcs12.0.pkey)); > ++ try!(builder.set_certificate(&pkcs12.0.cert)); > ++ if let Some(chain) = pkcs12.0.chain { > ++ for cert in chain { > ++ try!(builder.add_extra_chain_cert(cert)); > ++ } > ++ } > + Ok(TlsAcceptorBuilder(builder)) > + } > + > +@@ -307,12 +314,11 @@ impl TlsStream { > + > + pub fn shutdown(&mut self) -> io::Result<()> { > + match self.0.shutdown() { > +- Ok(_) | > +- Err(ssl::Error::ZeroReturn) => Ok(()), > +- Err(ssl::Error::Stream(e)) | > +- Err(ssl::Error::WantRead(e)) | > +- Err(ssl::Error::WantWrite(e)) => Err(e), > +- Err(e) => return Err(io::Error::new(io::ErrorKind::Other, > e)), > ++ Ok(_) => Ok(()), > ++ Err(ref e) if e.code() == ssl::ErrorCode::ZERO_RETURN => > Ok(()), > ++ Err(e) => Err(e.into_io_error().unwrap_or_else( > ++ |e| io::Error::new(io::ErrorKind::Other, e), > ++ )), > + } > + } > + >