Skip to content

Commit cef43e0

Browse files
jirutkampolanski
authored andcommitted
testing/rustic: build with openssl instead of bundled rustls
Patch backported from rustic-rs/rustic_core#110
1 parent 5a4770a commit cef43e0

File tree

3 files changed

+290
-0
lines changed

3 files changed

+290
-0
lines changed

testing/rustic/APKBUILD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,32 @@ arch="all !s390x" # fails to build nix crate
1111
makedepends="
1212
cargo
1313
cargo-auditable
14+
openssl-dev
1415
zstd-dev
1516
"
1617
subpackages="
1718
$pkgname-bash-completion
1819
$pkgname-fish-completion
1920
$pkgname-zsh-completion
2021
"
22+
# NOTE: Keep in sync with rustic_core in Cargo.toml.
23+
_core_ver=0.1.2
2124
source="https://github.com/rustic-rs/rustic/archive/v$pkgver/rustic-$pkgver.tar.gz
25+
https://github.com/rustic-rs/rustic_core/archive/$_core_ver/rustic_core-$_core_ver.tar.gz
2226
make-self-update-optional.patch
2327
fix-abscissa_core-features.patch
28+
rustic_core-add-tls-native.patch
29+
build-with-system-tls.patch
2430
"
2531
options="net" # fetch dependencies
2632

2733
# Disable self-update feature.
2834
_cargo_opts="--no-default-features --frozen"
2935

3036
prepare() {
37+
mkdir -p vendor
38+
mv "$srcdir"/rustic_core-$_core_ver vendor/rustic_core
39+
3140
default_prepare
3241

3342
# Rust target triple.
@@ -65,6 +74,9 @@ package() {
6574

6675
sha512sums="
6776
44b1e2be7336f74e832c33d06101b2ad1ba79123926bd00f3e4884cd49abd75e727e26636451bc393d154ec438fd9168ae9dce8bfa4ec9ffd371b89b6b426dcd rustic-0.6.1.tar.gz
77+
a3883df06f927e5a0f786e21ae7bec2d2f6090afbd30828bfe8f16bc706cb755688f6d74e5336fc1fce1cbeb750c954e84039084fcfc2fcc1ffcf560f77c576e rustic_core-0.1.2.tar.gz
6878
f63047855f5e01ea547b921af54e81dc63559e4dee15811e6cfdbf5e503543bb76b0d2612b660c7adff1751e5564186e386145f61f50d0188e5d8215c2586962 make-self-update-optional.patch
6979
ef26d102a32cea39ccd69cd5fe20cc18ef9a5157dbbb1b90ae640922d88c3739947ed2900f6e902ea9583f51be66d32cedddf298b306e3d24a6529d9163da5d1 fix-abscissa_core-features.patch
80+
8d8b40f01ba324987130737b119aaa1a8a330a90263206c7f6eea8c4ba82c35297964a429bc25f87d2a91653f52d1837bca5d305cec684b5aff9df302f2220b7 rustic_core-add-tls-native.patch
81+
e64ba6947ea0eda3074f267fd05e831b9c66850755200233cd155a7c9b184fb0391a3d5199e5fbc1c2fbdc9d47c277aeb2b00df3f530b1c7fc3c0605a7acfc25 build-with-system-tls.patch
7082
"
Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
Link with system-provided openssl instead of bundling rustls.
2+
3+
This depends on rustic_core-add-tls-native.patch.
4+
5+
--- a/Cargo.toml
6+
+++ b/Cargo.toml
7+
@@ -102,7 +102,7 @@
8+
[target.'cfg(not(windows))'.dependencies]
9+
libc = "0.2.150"
10+
[workspace.dependencies]
11+
-rustic_core = { version = "0.1.2", features = ["cli"] }
12+
+rustic_core = { version = "0.1.2", default-features = false, features = ["cli", "tls-native"] }
13+
abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] }
14+
15+
# logging
16+
@@ -200,3 +200,6 @@
17+
lto = true
18+
debug-assertions = false
19+
codegen-units = 1
20+
+
21+
+[patch.crates-io]
22+
+rustic_core = { path = "vendor/rustic_core" }
23+
--- a/Cargo.lock
24+
+++ b/Cargo.lock
25+
@@ -1080,6 +1080,21 @@
26+
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
27+
28+
[[package]]
29+
+name = "foreign-types"
30+
+version = "0.3.2"
31+
+source = "registry+https://github.com/rust-lang/crates.io-index"
32+
+checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
33+
+dependencies = [
34+
+ "foreign-types-shared",
35+
+]
36+
+
37+
+[[package]]
38+
+name = "foreign-types-shared"
39+
+version = "0.1.1"
40+
+source = "registry+https://github.com/rust-lang/crates.io-index"
41+
+checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
42+
+
43+
+[[package]]
44+
name = "form_urlencoded"
45+
version = "1.2.0"
46+
source = "registry+https://github.com/rust-lang/crates.io-index"
47+
@@ -1360,6 +1375,19 @@
48+
]
49+
50+
[[package]]
51+
+name = "hyper-tls"
52+
+version = "0.5.0"
53+
+source = "registry+https://github.com/rust-lang/crates.io-index"
54+
+checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
55+
+dependencies = [
56+
+ "bytes",
57+
+ "hyper",
58+
+ "native-tls",
59+
+ "tokio",
60+
+ "tokio-native-tls",
61+
+]
62+
+
63+
+[[package]]
64+
name = "iana-time-zone"
65+
version = "0.1.58"
66+
source = "registry+https://github.com/rust-lang/crates.io-index"
67+
@@ -1681,6 +1709,24 @@
68+
]
69+
70+
[[package]]
71+
+name = "native-tls"
72+
+version = "0.2.11"
73+
+source = "registry+https://github.com/rust-lang/crates.io-index"
74+
+checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
75+
+dependencies = [
76+
+ "lazy_static",
77+
+ "libc",
78+
+ "log",
79+
+ "openssl",
80+
+ "openssl-probe",
81+
+ "openssl-sys",
82+
+ "schannel",
83+
+ "security-framework",
84+
+ "security-framework-sys",
85+
+ "tempfile",
86+
+]
87+
+
88+
+[[package]]
89+
name = "nix"
90+
version = "0.27.1"
91+
source = "registry+https://github.com/rust-lang/crates.io-index"
92+
@@ -1757,12 +1803,50 @@
93+
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
94+
95+
[[package]]
96+
+name = "openssl"
97+
+version = "0.10.62"
98+
+source = "registry+https://github.com/rust-lang/crates.io-index"
99+
+checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671"
100+
+dependencies = [
101+
+ "bitflags 2.4.1",
102+
+ "cfg-if 1.0.0",
103+
+ "foreign-types",
104+
+ "libc",
105+
+ "once_cell",
106+
+ "openssl-macros",
107+
+ "openssl-sys",
108+
+]
109+
+
110+
+[[package]]
111+
+name = "openssl-macros"
112+
+version = "0.1.1"
113+
+source = "registry+https://github.com/rust-lang/crates.io-index"
114+
+checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
115+
+dependencies = [
116+
+ "proc-macro2",
117+
+ "quote",
118+
+ "syn 2.0.39",
119+
+]
120+
+
121+
+[[package]]
122+
name = "openssl-probe"
123+
version = "0.1.5"
124+
source = "registry+https://github.com/rust-lang/crates.io-index"
125+
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
126+
127+
[[package]]
128+
+name = "openssl-sys"
129+
+version = "0.9.98"
130+
+source = "registry+https://github.com/rust-lang/crates.io-index"
131+
+checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
132+
+dependencies = [
133+
+ "cc",
134+
+ "libc",
135+
+ "pkg-config",
136+
+ "vcpkg",
137+
+]
138+
+
139+
+[[package]]
140+
name = "option-ext"
141+
version = "0.2.0"
142+
source = "registry+https://github.com/rust-lang/crates.io-index"
143+
@@ -2112,21 +2196,23 @@
144+
"http-body",
145+
"hyper",
146+
"hyper-rustls",
147+
+ "hyper-tls",
148+
"ipnet",
149+
"js-sys",
150+
"log",
151+
"mime",
152+
+ "native-tls",
153+
"once_cell",
154+
"percent-encoding",
155+
"pin-project-lite",
156+
"rustls",
157+
- "rustls-native-certs",
158+
"rustls-pemfile",
159+
"serde",
160+
"serde_json",
161+
"serde_urlencoded",
162+
"system-configuration",
163+
"tokio",
164+
+ "tokio-native-tls",
165+
"tokio-rustls",
166+
"tokio-util",
167+
"tower-service",
168+
@@ -2239,8 +2325,6 @@
169+
[[package]]
170+
name = "rustic_core"
171+
version = "0.1.2"
172+
-source = "registry+https://github.com/rust-lang/crates.io-index"
173+
-checksum = "a5932066f9e144fc15043c4e0b9a82bfa16c83910243318bdafbb38496c1518a"
174+
dependencies = [
175+
"aes256ctr_poly1305aes",
176+
"aho-corasick",
177+
@@ -2327,18 +2411,6 @@
178+
]
179+
180+
[[package]]
181+
-name = "rustls-native-certs"
182+
-version = "0.6.3"
183+
-source = "registry+https://github.com/rust-lang/crates.io-index"
184+
-checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
185+
-dependencies = [
186+
- "openssl-probe",
187+
- "rustls-pemfile",
188+
- "schannel",
189+
- "security-framework",
190+
-]
191+
-
192+
-[[package]]
193+
name = "rustls-pemfile"
194+
version = "1.0.4"
195+
source = "registry+https://github.com/rust-lang/crates.io-index"
196+
@@ -2960,6 +3032,16 @@
197+
]
198+
199+
[[package]]
200+
+name = "tokio-native-tls"
201+
+version = "0.3.1"
202+
+source = "registry+https://github.com/rust-lang/crates.io-index"
203+
+checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
204+
+dependencies = [
205+
+ "native-tls",
206+
+ "tokio",
207+
+]
208+
+
209+
+[[package]]
210+
name = "tokio-rustls"
211+
version = "0.24.1"
212+
source = "registry+https://github.com/rust-lang/crates.io-index"
213+
@@ -3193,6 +3275,12 @@
214+
version = "0.1.0"
215+
source = "registry+https://github.com/rust-lang/crates.io-index"
216+
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
217+
+
218+
+[[package]]
219+
+name = "vcpkg"
220+
+version = "0.2.15"
221+
+source = "registry+https://github.com/rust-lang/crates.io-index"
222+
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
223+
224+
[[package]]
225+
name = "version_check"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Patch-Source: https://github.com/rustic-rs/rustic_core/pull/110 (backported)
2+
--
3+
From a5360816832236b814da86cd8518c02b3fc3eb05 Mon Sep 17 00:00:00 2001
4+
From: Jakub Jirutka <[email protected]>
5+
Date: Sat, 30 Dec 2023 20:28:47 +0100
6+
Subject: [PATCH] feat: Add tls-native, tls-rustls features to allow building
7+
w/o Rustls
8+
9+
diff --git a/Cargo.toml b/Cargo.toml
10+
index 1582c6b..4d60eef 100644
11+
--- a/vendor/rustic_core/Cargo.toml
12+
+++ b/vendor/rustic_core/Cargo.toml
13+
@@ -35,10 +35,13 @@ harness = true
14+
edition = "2021"
15+
16+
[features]
17+
-default = []
18+
+default = ["tls-rustls"]
19+
cli = ["merge", "clap"]
20+
merge = ["dep:merge"]
21+
clap = ["dep:clap"]
22+
+# tls-native and tls-rustls are mutually exclusive.
23+
+tls-native = ["reqwest/native-tls"]
24+
+tls-rustls = ["reqwest/rustls-tls-native-roots"]
25+
26+
[package.metadata.docs.rs]
27+
all-features = true
28+
@@ -96,7 +99,7 @@ walkdir = "2.4.0"
29+
30+
# rest backend
31+
backoff = "0.4.0"
32+
-reqwest = { version = "0.11.22", default-features = false, features = ["json", "rustls-tls-native-roots", "stream", "blocking"] }
33+
+reqwest = { version = "0.11.22", default-features = false, features = ["json", "stream", "blocking"] }
34+
url = "2.4.1"
35+
36+
# rclone backend
37+
diff --git a/src/lib.rs b/src/lib.rs
38+
index 04bda03..387b218 100644
39+
--- a/vendor/rustic_core/src/lib.rs
40+
+++ b/vendor/rustic_core/src/lib.rs
41+
@@ -139,6 +139,9 @@ This crate exposes a few features for controlling dependency usage.
42+
#![allow(rustdoc::private_intra_doc_links)]
43+
#![allow(clippy::needless_raw_string_hashes)]
44+
45+
+#[cfg(all(feature = "tls-native", feature = "tls-rustls"))]
46+
+compile_error!("features \"tls-native\" and \"tls-rustls\" cannot be enabled at the same time. Please disable one of them.");
47+
+
48+
pub(crate) mod archiver;
49+
pub(crate) mod backend;
50+
pub(crate) mod blob;
51+
--
52+
2.43.0
53+

0 commit comments

Comments
 (0)