Merge pull request #1170 from CraftSpider/update-deps

Update remaining out-of-date dependencies
This commit is contained in:
Mark 2024-04-01 07:27:06 -07:00 committed by GitHub
commit a451f97084
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 744 additions and 369 deletions

790
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -17,11 +17,11 @@ repository = "https://github.com/tectonic-typesetting/tectonic/"
readme = "CARGO_README.md"
keywords = ["tex", "latex", "typesetting", "font"]
categories = [
"command-line-interface",
"parser-implementations",
"rendering",
"science",
"text-processing",
"command-line-interface",
"parser-implementations",
"rendering",
"science",
"text-processing",
]
license = "MIT"
edition = "2018"
@ -33,27 +33,27 @@ codecov = { repository = "tectonic-typesetting/tectonic", service = "github" }
[workspace]
members = [
"crates/bridge_flate",
"crates/bridge_freetype2",
"crates/bridge_graphite2",
"crates/bridge_harfbuzz",
"crates/bridge_icu",
"crates/bundles",
"crates/cfg_support",
"crates/dep_support",
"crates/docmodel",
"crates/engine_bibtex",
"crates/engine_spx2html",
"crates/engine_xdvipdfmx",
"crates/engine_xetex",
"crates/errors",
"crates/geturl",
"crates/io_base",
"crates/pdf_io",
"crates/status_base",
"crates/xdv",
"crates/xetex_format",
"crates/xetex_layout",
"crates/bridge_flate",
"crates/bridge_freetype2",
"crates/bridge_graphite2",
"crates/bridge_harfbuzz",
"crates/bridge_icu",
"crates/bundles",
"crates/cfg_support",
"crates/dep_support",
"crates/docmodel",
"crates/engine_bibtex",
"crates/engine_spx2html",
"crates/engine_xdvipdfmx",
"crates/engine_xetex",
"crates/errors",
"crates/geturl",
"crates/io_base",
"crates/pdf_io",
"crates/status_base",
"crates/xdv",
"crates/xetex_format",
"crates/xetex_layout",
]
[lib]
@ -61,7 +61,7 @@ name = "tectonic"
crate-type = ["rlib"]
[dependencies]
byte-unit = "^4.0"
byte-unit = "^5.0"
cfg-if = "1.0"
error-chain = "^0.12"
flate2 = { version = "^1.0.19", default-features = false, features = ["zlib"] }
@ -69,8 +69,8 @@ fs2 = "^0.4"
lazy_static = "^1.4"
libc = "^0.2"
md-5 = "^0.10"
open = "^4.0"
quick-xml = "^0.28"
open = "^5.0"
quick-xml = "^0.31"
serde = { version = "^1.0", features = ["derive"], optional = true }
sha2 = "^0.10"
clap = { version = "4.5.1", features = ["derive"] }
@ -90,11 +90,12 @@ tectonic_xetex_layout = { path = "crates/xetex_layout", version = "0.0.0-dev.0"
tempfile = "^3.1"
termcolor = "^1.1"
tokio = "^1.0"
toml = { version = "^0.7", optional = true }
toml = { version = "^0.8", optional = true }
url = "^2.0"
watchexec = "^2.3.0"
watchexec-filterer-globset = "1.2"
watchexec-signals = "1.0"
watchexec = "^3.0"
watchexec-filterer-globset = "3.0"
watchexec-signals = "2.0"
watchexec-supervisor = "1.0"
zip = { version = "^0.6", default-features = false, features = ["deflate"] }
[features]
@ -114,8 +115,8 @@ geturl-curl = ["tectonic_bundles/geturl-curl", "tectonic_geturl/curl"]
geturl-reqwest = ["tectonic_bundles/geturl-reqwest", "tectonic_geturl/reqwest"]
native-tls-vendored = [
"tectonic_bundles/native-tls-vendored",
"tectonic_geturl/native-tls-vendored",
"tectonic_bundles/native-tls-vendored",
"tectonic_geturl/native-tls-vendored",
]
# developer feature to compile with the necessary flags for profiling tectonic.
@ -124,8 +125,10 @@ profile = []
[dev-dependencies]
filetime = "^0.2"
futures = "0.3"
headers = "0.3"
hyper = { version = "0.14", features = ["server"] }
headers = "0.4"
http-body-util = "0.1.0"
hyper = { version = "1.0.0", features = ["server", "http1", "http2"] }
hyper-util = { version = "0.1", features = ["server", "http1", "http2", "tokio"] }
tempfile = "^3.1"
[package.metadata.vcpkg]
@ -139,21 +142,21 @@ overlay-triplets-path = "dist/vcpkg-triplets"
[package.metadata.vcpkg.target]
x86_64-apple-darwin = { install = ["freetype", "harfbuzz[graphite2]", "icu"] }
aarch64-apple-darwin = { triplet = "arm64-osx", install = [
"freetype",
"harfbuzz[graphite2]",
"icu",
"freetype",
"harfbuzz[graphite2]",
"icu",
] }
x86_64-unknown-linux-gnu = { install = [
"fontconfig",
"freetype",
"harfbuzz[graphite2]",
"icu",
"fontconfig",
"freetype",
"harfbuzz[graphite2]",
"icu",
] }
x86_64-pc-windows-msvc = { triplet = "x64-windows-static-release", install = [
"fontconfig",
"freetype",
"harfbuzz[graphite2]",
"icu",
"fontconfig",
"freetype",
"harfbuzz[graphite2]",
"icu",
] }
[package.metadata.internal_dep_versions]

View File

@ -20,7 +20,7 @@ edition = "2018"
[dependencies]
serde = { version = "^1.0", features = ["derive"] }
tectonic_errors = { path = "../errors", version = "0.0.0-dev.0" }
toml = { version = "^0.7" }
toml = { version = "^0.8" }
[package.metadata.internal_dep_versions]
tectonic_errors = "5c9ba661edf5ef669f24f9904f99cca369d999e7"

View File

@ -45,6 +45,7 @@ steps:
- bash: |
set -xeuo pipefail
export TECTONIC_KCOV_RUN=1
cargo kcov --no-clean-rebuild -- --include-path="$(pwd)" --exclude-pattern=/tests/
displayName: cargo kcov

View File

@ -1,17 +1,17 @@
use clap::Parser;
use std::{convert::Infallible, env, path::PathBuf, sync::Arc};
use std::{env, path::PathBuf, sync::Arc};
use tectonic::{config::PersistentConfig, errors::Result, tt_error};
use tectonic_status_base::StatusBackend;
use tokio::runtime;
use watchexec::command::Program;
use watchexec::{
action::{Action, Outcome, PreSpawn},
command::{Command, Shell},
config::InitConfig,
event::ProcessEnd,
Watchexec,
Id, Watchexec,
};
use watchexec_filterer_globset::GlobsetFilterer;
use watchexec_signals::Signal;
use watchexec_supervisor::job::{CommandState, Job, Ticket};
use watchexec_supervisor::ProcessEnd;
use crate::v2cli::{CommandCustomizations, TectonicCommand};
@ -48,32 +48,36 @@ impl WatchCommand {
let mut cmds = Vec::new();
#[cfg(windows)]
let shell = Shell::Cmd;
let shell = Shell::cmd();
#[cfg(unix)]
let shell = Shell::Unix("bash".to_string());
let shell = Shell::new("bash");
for x in self.execute.iter() {
let x = x.trim();
if !x.is_empty() {
let cmd = Command::Shell {
shell: shell.clone(),
args: vec![],
command: format!("\"{exe_name}\" -X {}", x),
let cmd = Command {
program: Program::Shell {
shell: shell.clone(),
command: format!("\"{exe_name}\" -X {}", x),
args: vec![],
},
options: Default::default(),
};
cmds.push(cmd)
cmds.push((Id::default(), Arc::new(cmd)))
}
}
if cmds.is_empty() {
cmds.push(Command::Exec {
prog: exe_name,
args: vec!["-X".to_string(), "build".to_string()],
});
let cmd = Command {
program: Program::Exec {
prog: exe_name.into(),
args: vec!["-X".to_string(), "build".to_string()],
},
options: Default::default(),
};
cmds.push((Id::default(), Arc::new(cmd)));
}
let mut runtime_config = watchexec::config::RuntimeConfig::default();
runtime_config.commands(cmds);
let current_dir = env::current_dir()?;
let filter = GlobsetFilterer::new(
@ -87,14 +91,39 @@ impl WatchCommand {
.await
.unwrap();
runtime_config
.pathset([&current_dir])
.filterer(Arc::new(filter))
.on_pre_spawn(|pre_spawn: PreSpawn| async move {
println!("[Running `{}`]", pre_spawn.command);
Ok::<_, Infallible>(())
async fn end_task(end: Ticket, job: Job) {
end.await;
job.run(|ctx| match ctx.current {
CommandState::Finished {
status: ProcessEnd::Success,
..
} => {
println!("[Finished Running. Exit Status: 0]")
}
CommandState::Finished {
status: ProcessEnd::ExitError(err),
..
} => {
println!("[Finished Running. Exit Status: {}]", err.get())
}
_ => (),
})
.on_action(|action: Action| async move {
.await;
}
let cmds = Arc::new(cmds);
let exec_handler = Watchexec::new_async(move |mut action| {
let cmds = Arc::clone(&cmds);
Box::new(async move {
if action.get_job(cmds[0].0).is_none() {
for (id, cmd) in &*cmds {
let job = action.get_or_create_job(*id, || Arc::clone(cmd));
job.set_spawn_hook(|_, ctx| {
println!("[Running `{}`]", ctx.command);
});
}
}
for event in &*action.events {
let is_kill = event.signals().any(|signal| {
matches!(
@ -105,36 +134,27 @@ impl WatchCommand {
| Signal::ForceStop
)
});
if is_kill {
action.outcome(Outcome::Exit);
return Ok::<_, Infallible>(());
}
for complete in event.completions() {
match complete {
Some(ProcessEnd::Success) => {
println!("[Finished Running. Exit Status: 0]")
}
Some(ProcessEnd::ExitError(err)) => {
println!("[Finished Running. Exit Status: {}]", err.get())
}
_ => (),
}
if is_kill {
action.list_jobs().for_each(|(_, job)| {
job.stop();
});
return action;
}
let paths = event.paths().collect::<Vec<_>>();
if !paths.is_empty() {
action.outcome(Outcome::IfRunning(
Box::new(Outcome::DoNothing),
Box::new(Outcome::Start),
));
return Ok(());
for (_, job) in action.list_jobs() {
job.start().await;
let end = job.to_wait();
tokio::spawn(end_task(end, job));
}
return action;
}
}
Ok(())
});
let exec_handler = Watchexec::new(InitConfig::default(), runtime_config);
action
})
});
match exec_handler {
Err(e) => {
@ -146,6 +166,10 @@ impl WatchCommand {
Ok(1)
}
Ok(exec_handler) => {
exec_handler
.config
.pathset([&current_dir])
.filterer(Arc::new(filter));
exec_handler.main().await.unwrap().unwrap();
Ok(0)
}

View File

@ -15,7 +15,7 @@
//! For an example of how to use this module, see `src/bin/tectonic/main.rs`,
//! which contains tectonic's main CLI program.
use byte_unit::Byte;
use byte_unit::{Byte, UnitType};
use quick_xml::{events::Event, NsReader};
use std::{
collections::{HashMap, HashSet},
@ -1638,11 +1638,11 @@ impl ProcessingSession {
}
let real_path = root.join(name);
let byte_len = Byte::from_bytes(file.data.len() as u128);
let byte_len = Byte::from_u128(file.data.len() as u128).unwrap();
status.note_highlighted(
"Writing ",
&format!("`{}`", real_path.display()),
&format!(" ({})", byte_len.get_appropriate_unit(true)),
&format!(" ({})", byte_len.get_appropriate_unit(UnitType::Binary)),
);
let mut f = File::create(&real_path)?;

View File

@ -1,11 +1,16 @@
use flate2::{write::GzEncoder, GzBuilder};
use futures::channel::oneshot::Canceled;
use headers::HeaderMapExt;
use http_body_util::{Either, Empty, Full};
use hyper::body::{Body, Bytes};
use hyper::header::{self, HeaderValue};
use hyper::server::Server;
use hyper::service::{make_service_fn, service_fn};
use hyper::{Body, Method, Request, Response, StatusCode};
use hyper::server::conn::http1;
use hyper::service::service_fn;
use hyper::{Method, Request, Response, StatusCode};
use hyper_util::rt::TokioIo;
use std::collections::HashMap;
use std::convert::Infallible;
use std::error::Error;
use std::future::Future;
use std::io::{self, Write};
use std::net::SocketAddr;
@ -19,6 +24,7 @@ use tectonic::driver::ProcessingSessionBuilder;
use tectonic::io::OpenResult;
use tectonic::status::termcolor::TermcolorStatusBackend;
use tectonic::status::ChatterLevel;
use tokio::net::TcpListener;
use tokio::runtime;
mod util;
@ -102,7 +108,7 @@ struct TarIndexService {
local_addr: Mutex<Option<SocketAddr>>,
}
type ResponseFuture = Pin<Box<dyn Future<Output = Response<Body>> + Send + Sync + 'static>>;
type ResponseFuture<B> = Pin<Box<dyn Future<Output = Response<B>> + Send + Sync + 'static>>;
impl TarIndexService {
fn new(tar_index: TarIndex) -> TarIndexService {
@ -121,7 +127,10 @@ impl TarIndexService {
*self.tar_index.lock().unwrap() = tar_index;
}
fn response(&self, req: Request<Body>) -> ResponseFuture {
fn response(
&self,
req: Request<impl Body>,
) -> ResponseFuture<Either<Empty<Bytes>, Full<Bytes>>> {
match (
req.method(),
req.uri().path(),
@ -138,14 +147,16 @@ impl TarIndexService {
))
.unwrap(),
);
Box::pin(async move { resp.body(Body::empty()).unwrap() })
Box::pin(async move { resp.body(Either::Left(Empty::new())).unwrap() })
}
(&Method::HEAD, "/bundle.tar", None) => {
self.log_request(TectonicRequest::Head(req.uri().path().to_owned()));
Box::pin(async move { Response::new(Body::empty()) })
Box::pin(async move { Response::new(Either::Left(Empty::new())) })
}
(&Method::GET, "/bundle.tar", Some(range)) => {
if let Some((Bound::Included(l), Bound::Included(h))) = range.iter().next() {
if let Some((Bound::Included(l), Bound::Included(h))) =
range.satisfiable_ranges(u64::MAX).next()
{
let tar_index = self.tar_index.lock().unwrap();
let name = tar_index
.map
@ -156,8 +167,8 @@ impl TarIndexService {
resp.headers_mut()
.unwrap()
.typed_insert(headers::ContentRange::bytes(l..=h, None).unwrap());
let body = (tar_index.tar[l as usize..=h as usize]).to_vec().into();
Box::pin(async move { resp.body(body).unwrap() })
let body = tar_index.tar[l as usize..=h as usize].to_vec().into();
Box::pin(async move { resp.body(Either::Right(body)).unwrap() })
} else {
panic!("unexpected");
}
@ -165,12 +176,12 @@ impl TarIndexService {
(&Method::GET, "/bundle.tar.index.gz", None) => {
self.log_request(TectonicRequest::Index);
let resp = self.tar_index.lock().unwrap().index.to_vec().into();
Box::pin(async move { Response::new(resp) })
Box::pin(async move { Response::new(Either::Right(resp)) })
}
_ => Box::pin(async move {
Response::builder()
.status(StatusCode::NOT_FOUND)
.body(Body::empty())
.body(Either::Left(Empty::new()))
.unwrap()
}),
}
@ -195,7 +206,7 @@ where
R: FnOnce(Arc<TarIndexService>, &str),
{
// Automatically select a port
let addr = ([127, 0, 0, 1], 0).into();
let addr = SocketAddr::from(([127, 0, 0, 1], 0));
let tar_service = Arc::new(TarIndexService::new(tar_index.unwrap_or_else(|| {
let root = Path::new(&env!("CARGO_MANIFEST_DIR"))
@ -217,27 +228,43 @@ where
.unwrap();
let tar_service_clone = Arc::clone(&tar_service);
async fn ignore_cancel(f: impl Future<Output = Result<(), Box<dyn Error>>>) {
if let Err(err) = f.await {
if err.downcast_ref::<Canceled>().is_none() {
panic!("{}", err);
}
}
}
rt.block_on(async move {
let server = Server::bind(&addr).serve(make_service_fn(move |_| {
let tar_service_clone = Arc::clone(&tar_service_clone);
async move {
Ok::<_, Infallible>(service_fn(move |req| {
let server = tokio::task::spawn(ignore_cancel(async move {
let listener = TcpListener::bind(addr).await?;
// server is listening now
tar_service.set_local_addr(listener.local_addr().unwrap());
let url = tar_service.url();
url_available_tx.send(url).unwrap();
loop {
let (stream, _) = listener.accept().await?;
let io = TokioIo::new(stream);
let tar_service_clone = Arc::clone(&tar_service_clone);
let service = service_fn(move |req| {
let tar_service = Arc::clone(&tar_service_clone);
async move { Ok::<_, Infallible>(tar_service.response(req).await) }
}))
});
let conn = http1::Builder::new().serve_connection(io, service);
if let Err(err) = conn.await {
println!("Error serving connection: {:?}", err);
}
}
}));
// server is listening now
tar_service.set_local_addr(server.local_addr());
let url = tar_service.url();
url_available_tx.send(url).unwrap();
let graceful = server.with_graceful_shutdown(async move {
server_shutdown_rx.await.unwrap();
});
graceful.await
server_shutdown_rx.await.unwrap();
server.abort();
})
});
@ -249,7 +276,7 @@ where
// Shut down server
let _ = server_shutdown_tx.send(());
server_thread.join().unwrap().unwrap();
server_thread.join().unwrap();
// Check tectonic's requests.
let requests = tar_service.requests.lock().unwrap();

View File

@ -1058,7 +1058,7 @@ fn extra_search_paths() {
#[cfg(all(feature = "serialization", not(target_arch = "mips")))]
#[test]
fn v2_watch_succeeds() {
if KCOV_WORDS.len() > 0 {
if KCOV_WORDS.len() > 0 || env::var("TECTONIC_KCOV_RUN").is_ok() {
return; // See run_tectonic_until() for an explanation of why this test must be skipped
}
@ -1107,8 +1107,8 @@ fn v2_watch_succeeds() {
// success_or_panic(&output);
let stdout = String::from_utf8_lossy(&output.stdout);
let stderr = String::from_utf8_lossy(&output.stderr);
println!("stdout:\n{}", stdout);
println!("stderr:\n{}", stderr);
println!("-- stdout --\n{}\n-- end stdout --", stdout);
println!("-- stderr --\n{}\n-- end stderr --", stderr);
thread.join().unwrap();