1From f453ec77fa9e6fd961a1f5f0b221260a5a21bba2 Mon Sep 17 00:00:00 2001
2From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
3Date: Tue, 27 Aug 2024 14:08:47 +0300
4Subject: [PATCH] deqp-runner: drop zstd support
5
6Building zstd-sys results in the "foo contains reference to TMPDIR" QA
7error. Revert commit 1adddf3aa89f21b472d8046347ccdfa4612f141b to drop
8zstd dependency.
9
10Upstream-Status: Inappropriate [oe specific]
11Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
12---
13 Cargo.lock | 45 ---------------------------------------------
14 Cargo.toml |  3 ---
15 src/lib.rs | 31 +++++++------------------------
16 3 files changed, 7 insertions(+), 72 deletions(-)
17
18diff --git a/Cargo.lock b/Cargo.lock
19index 8443695e2bd5..50924576a8e3 100644
20--- a/Cargo.lock
21+++ b/Cargo.lock
22@@ -94,7 +94,6 @@ version = "1.0.83"
23 source = "registry+https://github.com/rust-lang/crates.io-index"
24 checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
25 dependencies = [
26- "jobserver",
27  "libc",
28 ]
29
30@@ -271,7 +270,6 @@ dependencies = [
31  "structopt",
32  "tempfile",
33  "toml",
34- "zstd",
35 ]
36
37 [[package]]
38@@ -423,15 +421,6 @@ version = "1.0.9"
39 source = "registry+https://github.com/rust-lang/crates.io-index"
40 checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38"
41
42-[[package]]
43-name = "jobserver"
44-version = "0.1.31"
45-source = "registry+https://github.com/rust-lang/crates.io-index"
46-checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e"
47-dependencies = [
48- "libc",
49-]
50-
51 [[package]]
52 name = "js-sys"
53 version = "0.3.64"
54@@ -544,12 +533,6 @@ version = "11.1.3"
55 source = "registry+https://github.com/rust-lang/crates.io-index"
56 checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
57
58-[[package]]
59-name = "pkg-config"
60-version = "0.3.30"
61-source = "registry+https://github.com/rust-lang/crates.io-index"
62-checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
63-
64 [[package]]
65 name = "plotters"
66 version = "0.3.5"
67@@ -1217,31 +1200,3 @@ name = "xmlparser"
68 version = "0.13.5"
69 source = "registry+https://github.com/rust-lang/crates.io-index"
70 checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd"
71-
72-[[package]]
73-name = "zstd"
74-version = "0.13.1"
75-source = "registry+https://github.com/rust-lang/crates.io-index"
76-checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a"
77-dependencies = [
78- "zstd-safe",
79-]
80-
81-[[package]]
82-name = "zstd-safe"
83-version = "7.1.0"
84-source = "registry+https://github.com/rust-lang/crates.io-index"
85-checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a"
86-dependencies = [
87- "zstd-sys",
88-]
89-
90-[[package]]
91-name = "zstd-sys"
92-version = "2.0.10+zstd.1.5.6"
93-source = "registry+https://github.com/rust-lang/crates.io-index"
94-checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa"
95-dependencies = [
96- "cc",
97- "pkg-config",
98-]
99diff --git a/Cargo.toml b/Cargo.toml
100index ac6295763e87..1fa1344a3105 100644
101--- a/Cargo.toml
102+++ b/Cargo.toml
103@@ -120,9 +120,6 @@ version = "3.2"
104 [dependencies.toml]
105 version = "0.5"
106
107-[dependencies.zstd]
108-version = "0.13.0"
109-
110 [dev-dependencies.criterion]
111 version = "0.3.0"
112
113diff --git a/src/lib.rs b/src/lib.rs
114index e7095267f1cd..ff7bc4f5d025 100644
115--- a/src/lib.rs
116+++ b/src/lib.rs
117@@ -63,7 +63,6 @@ use rayon::prelude::*;
118 use regex::RegexSet;
119 use serde::{Deserialize, Serialize};
120 use std::collections::HashMap;
121-use std::ffi::OsStr;
122 use std::fs::File;
123 use std::io::prelude::*;
124 use std::io::BufReader;
125@@ -76,7 +75,6 @@ use std::time::Duration;
126 use std::time::Instant;
127 use structopt::StructOpt;
128 use timeout::{TimeoutChildExt, TimeoutChildStdout, Timer};
129-use zstd::stream::read::Decoder;
130
131 fn parse_key_val<T, U>(s: &str) -> Result<(T, U), Box<dyn std::error::Error>>
132 where
133@@ -1082,32 +1080,17 @@ pub fn read_lines<I: IntoIterator<Item = impl AsRef<Path>>>(files: I) -> Result<
134     let mut lines: Vec<String> = Vec::new();
135
136     for path in files {
137-        let mut path: &Path = path.as_ref();
138-        let mut path_compressed: PathBuf = path.to_path_buf();
139-
140-        // always try append zst extension (and keep existing one, e.g. .txt)
141-        let ext = if let Some(file_ext) = path.extension().and_then(|ext| ext.to_str()) {
142-            format!("{}.zst", file_ext)
143-        } else {
144-            (".zst").to_string()
145-        };
146-
147-        path_compressed.set_extension(ext);
148-        if path_compressed.exists() {
149-            path = path_compressed.as_ref();
150-        }
151-        let file = File::open(path).with_context(|| format!("opening path: {}", path.display()))?;
152-        let reader: Box<dyn Read> = match path.extension().and_then(OsStr::to_str) {
153-            Some("zst") => Box::new(Decoder::new(file).unwrap()),
154-            _ => Box::new(file),
155-        };
156-
157-        for line in BufReader::new(reader).lines() {
158+        let path = path.as_ref();
159+        for line in BufReader::new(
160+            File::open(path).with_context(|| format!("opening path: {}", path.display()))?,
161+        )
162+        .lines()
163+        {
164             let line = line.with_context(|| format!("reading line from {}", path.display()))?;
165             // In newer dEQP, vk-master.txt just contains a list of .txt
166             // caselist files relative to its current path, so recursively read
167             // thoseand append their contents.
168-            if line.ends_with(".txt") || line.ends_with(".txt.zst") {
169+            if line.ends_with(".txt") {
170                 let sub_path = path.parent().context("Getting path parent dir")?.join(line);
171
172                 lines.extend_from_slice(
173