Removes dependency on escargot

pull/845/head
Tpt 9 months ago committed by Thomas Tanon
parent 83aa8170ea
commit 58699f36f3
  1. 13
      Cargo.lock
  2. 1
      Cargo.toml
  3. 1
      cli/Cargo.toml
  4. 90
      cli/src/main.rs
  5. 1
      lints/test_debian_compatibility.py

13
Cargo.lock generated

@ -545,18 +545,6 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "escargot"
version = "0.5.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f474c6844cbd04e783d0f25757583db4f491770ca618bedf2fb01815fc79939"
dependencies = [
"log",
"once_cell",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "fastrand" name = "fastrand"
version = "2.0.2" version = "2.0.2"
@ -1086,7 +1074,6 @@ dependencies = [
"assert_cmd", "assert_cmd",
"assert_fs", "assert_fs",
"clap", "clap",
"escargot",
"flate2", "flate2",
"oxhttp", "oxhttp",
"oxigraph", "oxigraph",

@ -36,7 +36,6 @@ clap = "4.0"
codspeed-criterion-compat = "2.3.3" codspeed-criterion-compat = "2.3.3"
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
digest = "0.10" digest = "0.10"
escargot = "0.5"
flate2 = "1.0" flate2 = "1.0"
getrandom = "0.2.8" getrandom = "0.2.8"
hex = "0.4" hex = "0.4"

@ -40,7 +40,6 @@ url.workspace = true
[dev-dependencies] [dev-dependencies]
assert_cmd.workspace = true assert_cmd.workspace = true
assert_fs.workspace = true assert_fs.workspace = true
escargot.workspace = true
predicates.workspace = true predicates.workspace = true
[lints] [lints]

@ -1865,19 +1865,15 @@ mod tests {
use std::fs::remove_dir_all; use std::fs::remove_dir_all;
use std::io::read_to_string; use std::io::read_to_string;
fn cli_command() -> Result<Command> { fn cli_command() -> Command {
Ok(Command::from_std( let mut command = Command::new(env!("CARGO"));
escargot::CargoBuild::new() command.arg("run").arg("--bin").arg("oxigraph").arg("--");
.bin("oxigraph") command
.manifest_path(format!("{}/Cargo.toml", env!("CARGO_MANIFEST_DIR")))
.run()?
.command(),
))
} }
fn initialized_cli_store(data: &'static str) -> Result<TempDir> { fn initialized_cli_store(data: &'static str) -> Result<TempDir> {
let store_dir = TempDir::new()?; let store_dir = TempDir::new()?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1889,8 +1885,8 @@ mod tests {
Ok(store_dir) Ok(store_dir)
} }
fn assert_cli_state(store_dir: &TempDir, data: &'static str) -> Result<()> { fn assert_cli_state(store_dir: &TempDir, data: &'static str) {
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1899,17 +1895,15 @@ mod tests {
.assert() .assert()
.stdout(data) .stdout(data)
.success(); .success();
Ok(())
} }
#[test] #[test]
fn cli_help() -> Result<()> { fn cli_help() {
cli_command()? cli_command()
.assert() .assert()
.failure() .failure()
.stdout("") .stdout("")
.stderr(predicate::str::starts_with("Oxigraph")); .stderr(predicate::str::contains("Oxigraph"));
Ok(())
} }
#[test] #[test]
@ -1917,7 +1911,7 @@ mod tests {
let store_dir = TempDir::new()?; let store_dir = TempDir::new()?;
let input_file = NamedTempFile::new("input.ttl")?; let input_file = NamedTempFile::new("input.ttl")?;
input_file.write_str("<s> <http://example.com/p> <http://example.com/o> .")?; input_file.write_str("<s> <http://example.com/p> <http://example.com/o> .")?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1928,7 +1922,7 @@ mod tests {
.assert() .assert()
.success(); .success();
cli_command()? cli_command()
.arg("optimize") .arg("optimize")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1936,7 +1930,7 @@ mod tests {
.success(); .success();
let output_file = NamedTempFile::new("output.nt")?; let output_file = NamedTempFile::new("output.nt")?;
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1957,7 +1951,7 @@ mod tests {
let input_file = NamedTempFile::new("input.nq")?; let input_file = NamedTempFile::new("input.nq")?;
input_file input_file
.write_str("<http://example.com/s> <http://example.com/p> <http://example.com/o> <http://example.com/g> .")?; .write_str("<http://example.com/s> <http://example.com/p> <http://example.com/o> <http://example.com/g> .")?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1967,7 +1961,7 @@ mod tests {
.success(); .success();
let output_file = NamedTempFile::new("output.nq")?; let output_file = NamedTempFile::new("output.nq")?;
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1988,7 +1982,7 @@ mod tests {
encoder encoder
.write_all(b"<http://example.com/s> <http://example.com/p> <http://example.com/o> .")?; .write_all(b"<http://example.com/s> <http://example.com/p> <http://example.com/o> .")?;
file.write_binary(&encoder.finish()?)?; file.write_binary(&encoder.finish()?)?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("-l") .arg("-l")
.arg(store_dir.path()) .arg(store_dir.path())
@ -1997,7 +1991,7 @@ mod tests {
.assert() .assert()
.success(); .success();
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("-l") .arg("-l")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2016,7 +2010,7 @@ mod tests {
input_file.write_str( input_file.write_str(
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n",
)?; )?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("-l") .arg("-l")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2028,7 +2022,7 @@ mod tests {
.success(); .success();
let output_file = NamedTempFile::new("output.nt")?; let output_file = NamedTempFile::new("output.nt")?;
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("-l") .arg("-l")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2049,7 +2043,7 @@ mod tests {
let input_file = NamedTempFile::new("input")?; let input_file = NamedTempFile::new("input")?;
input_file input_file
.write_str("<http://example.com/s> <http://example.com/p> <http://example.com/o> .")?; .write_str("<http://example.com/s> <http://example.com/p> <http://example.com/o> .")?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("-l") .arg("-l")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2061,7 +2055,7 @@ mod tests {
.success(); .success();
let output_file = NamedTempFile::new("output")?; let output_file = NamedTempFile::new("output")?;
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2081,7 +2075,7 @@ mod tests {
#[test] #[test]
fn cli_load_from_stdin_and_dump_to_stdout() -> Result<()> { fn cli_load_from_stdin_and_dump_to_stdout() -> Result<()> {
let store_dir = TempDir::new()?; let store_dir = TempDir::new()?;
cli_command()? cli_command()
.arg("load") .arg("load")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2091,7 +2085,7 @@ mod tests {
.assert() .assert()
.success(); .success();
cli_command()? cli_command()
.arg("dump") .arg("dump")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2111,7 +2105,7 @@ mod tests {
let backup_dir = TempDir::new()?; let backup_dir = TempDir::new()?;
remove_dir_all(backup_dir.path())?; // The directory should not exist yet remove_dir_all(backup_dir.path())?; // The directory should not exist yet
cli_command()? cli_command()
.arg("backup") .arg("backup")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2123,7 +2117,8 @@ mod tests {
assert_cli_state( assert_cli_state(
&store_dir, &store_dir,
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n",
) );
Ok(())
} }
#[test] #[test]
@ -2131,7 +2126,7 @@ mod tests {
let store_dir = initialized_cli_store( let store_dir = initialized_cli_store(
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .",
)?; )?;
cli_command()? cli_command()
.arg("query") .arg("query")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2152,7 +2147,7 @@ mod tests {
let store_dir = initialized_cli_store( let store_dir = initialized_cli_store(
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .",
)?; )?;
cli_command()? cli_command()
.arg("query") .arg("query")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2175,7 +2170,7 @@ mod tests {
let input_file = NamedTempFile::new("input.rq")?; let input_file = NamedTempFile::new("input.rq")?;
input_file.write_str("SELECT ?s WHERE { ?s ?p ?o }")?; input_file.write_str("SELECT ?s WHERE { ?s ?p ?o }")?;
let output_file = NamedTempFile::new("output.tsv")?; let output_file = NamedTempFile::new("output.tsv")?;
cli_command()? cli_command()
.arg("query") .arg("query")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2192,7 +2187,7 @@ mod tests {
#[test] #[test]
fn cli_ask_update_inline() -> Result<()> { fn cli_ask_update_inline() -> Result<()> {
let store_dir = TempDir::new()?; let store_dir = TempDir::new()?;
cli_command()? cli_command()
.arg("update") .arg("update")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2205,13 +2200,14 @@ mod tests {
assert_cli_state( assert_cli_state(
&store_dir, &store_dir,
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n",
) );
Ok(())
} }
#[test] #[test]
fn cli_construct_update_stdin() -> Result<()> { fn cli_construct_update_stdin() -> Result<()> {
let store_dir = TempDir::new()?; let store_dir = TempDir::new()?;
cli_command()? cli_command()
.arg("update") .arg("update")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2223,7 +2219,8 @@ mod tests {
assert_cli_state( assert_cli_state(
&store_dir, &store_dir,
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n",
) );
Ok(())
} }
#[test] #[test]
@ -2233,7 +2230,7 @@ mod tests {
input_file.write_str( input_file.write_str(
"INSERT DATA { <http://example.com/s> <http://example.com/p> <http://example.com/o> }", "INSERT DATA { <http://example.com/s> <http://example.com/p> <http://example.com/o> }",
)?; )?;
cli_command()? cli_command()
.arg("update") .arg("update")
.arg("--location") .arg("--location")
.arg(store_dir.path()) .arg(store_dir.path())
@ -2244,7 +2241,8 @@ mod tests {
assert_cli_state( assert_cli_state(
&store_dir, &store_dir,
"<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n", "<http://example.com/s> <http://example.com/p> <http://example.com/o> .\n",
) );
Ok(())
} }
#[test] #[test]
@ -2252,7 +2250,7 @@ mod tests {
let input_file = NamedTempFile::new("input.ttl")?; let input_file = NamedTempFile::new("input.ttl")?;
input_file.write_str("@prefix schema: <http://schema.org/> .\n<http://example.com#me> a schema:Person ;\n\tschema:name \"Foo Bar\"@en .\n")?; input_file.write_str("@prefix schema: <http://schema.org/> .\n<http://example.com#me> a schema:Person ;\n\tschema:name \"Foo Bar\"@en .\n")?;
let output_file = NamedTempFile::new("output.rdf")?; let output_file = NamedTempFile::new("output.rdf")?;
cli_command()? cli_command()
.arg("convert") .arg("convert")
.arg("--from-file") .arg("--from-file")
.arg(input_file.path()) .arg(input_file.path())
@ -2268,8 +2266,8 @@ mod tests {
} }
#[test] #[test]
fn cli_convert_from_default_graph_to_named_graph() -> Result<()> { fn cli_convert_from_default_graph_to_named_graph() {
cli_command()? cli_command()
.arg("convert") .arg("convert")
.arg("--from-format") .arg("--from-format")
.arg("trig") .arg("trig")
@ -2282,12 +2280,11 @@ mod tests {
.assert() .assert()
.stdout("<http://example.com/s> <http://example.com/p> <http://example.com/o> <http://example.com/t> .\n") .stdout("<http://example.com/s> <http://example.com/p> <http://example.com/o> <http://example.com/t> .\n")
.success(); .success();
Ok(())
} }
#[test] #[test]
fn cli_convert_from_named_graph() -> Result<()> { fn cli_convert_from_named_graph() {
cli_command()? cli_command()
.arg("convert") .arg("convert")
.arg("--from-format") .arg("--from-format")
.arg("trig") .arg("trig")
@ -2298,7 +2295,6 @@ mod tests {
.write_stdin("@base <http://example.com/> . <s> <p> <o> . <g> { <sg> <pg> <og> . }") .write_stdin("@base <http://example.com/> . <s> <p> <o> . <g> { <sg> <pg> <og> . }")
.assert() .assert()
.stdout("<http://example.com/sg> <http://example.com/pg> <http://example.com/og> .\n"); .stdout("<http://example.com/sg> <http://example.com/pg> <http://example.com/og> .\n");
Ok(())
} }
#[test] #[test]

@ -8,7 +8,6 @@ TARGET_DEBIAN_VERSIONS = ["sid"]
IGNORE_PACKAGES = {"oxigraph-js", "oxigraph-testsuite", "pyoxigraph", "sparql-smith"} IGNORE_PACKAGES = {"oxigraph-js", "oxigraph-testsuite", "pyoxigraph", "sparql-smith"}
ALLOWED_MISSING_PACKAGES = { ALLOWED_MISSING_PACKAGES = {
"codspeed-criterion-compat", "codspeed-criterion-compat",
"escargot",
"json-event-parser", "json-event-parser",
"oxhttp", "oxhttp",
"oxiri", "oxiri",

Loading…
Cancel
Save