]> git.proxmox.com Git - proxmox.git/commitdiff
build: use weak and namespaced features
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 22 Aug 2022 09:24:04 +0000 (11:24 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 26 Aug 2022 08:35:00 +0000 (10:35 +0200)
to reduce the creep of optional dependencies being exposed as features.

this requires cargo 0.63 (and debcargo built against at least that
version), but greatly reduces the number of binary packages and provides
generated, while still allowing sensible selection of optional
dependencies via the explicit feature meant for pulling them in.

diff stat for running `make  deb` after this change:
 proxmox-http/debian/control         | 226 ++++--------------------------------
 proxmox-router/debian/control       |  74 +-----------
 proxmox-schema/debian/control       |  53 ++-------
 proxmox-subscription/debian/control |  17 +--
 proxmox-sys/debian/control          |  51 +++-----
 proxmox-tfa/debian/control          | 110 ++----------------
 6 files changed, 72 insertions(+), 459 deletions(-)

the 'dep:' prefix marks something on the RHS inside the features section
as dependency, it's only allowed if the string after it is an optional
dependency an no explicit feature of the same name exists. if all
pointers to the optional dependency in the features section are marked
as such, the optional dependency itself will not be exposed as a feature
(either on the cargo or debian/control level).

the '?' suffix marks dependencies as "weak", which only enables the
optional dependency + its feature(s) if the optional dependency itself
is also enabled. it has no effect on d/control since such a relationship
is not encodable in Debian package relations, but it does affect cargo
dependency resolution and allows skipping the build of unneeded optional
dependencies in some cases.

with no packages/crates depending on the no longer exposed automatically
generated features/packages, so these are safe to remove even though
it's technically a breaking change.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
proxmox-http/Cargo.toml
proxmox-router/Cargo.toml
proxmox-schema/Cargo.toml
proxmox-subscription/Cargo.toml
proxmox-sys/Cargo.toml
proxmox-tfa/Cargo.toml

index f12dfc6c14fa7f0f756a40c81e50306ad51123ab..541c5dd22cf645929713f23bcc98594acf99e8a8 100644 (file)
@@ -31,17 +31,19 @@ proxmox-lang = { path = "../proxmox-lang", optional = true, version = "1.1" }
 [features]
 default = []
 
-client = [ "futures", "http-helpers", "hyper/full", "openssl", "tokio/io-util", "tokio-openssl" ]
-client-trait = [ "http" ]
-http-helpers = [ "base64", "http", "proxmox-sys", "serde_json", "url" ]
+client = [ "dep:futures", "http-helpers", "dep:hyper", "hyper?/full", "dep:openssl", "dep:tokio", "tokio?/io-util", "dep:tokio-openssl" ]
+client-trait = [ "dep:http" ]
+http-helpers = [ "dep:base64", "dep:http", "dep:proxmox-sys", "dep:serde_json", "dep:url" ]
 websocket = [
-    "base64",
-    "futures",
-    "hyper",
-    "openssl",
-    "proxmox-sys",
-    "proxmox-io/tokio",
-    "proxmox-lang",
-    "tokio/io-util",
-    "tokio/sync",
+    "dep:base64",
+    "dep:futures",
+    "dep:hyper",
+    "dep:openssl",
+    "dep:proxmox-sys",
+    "dep:proxmox-io",
+    "proxmox-io?/tokio",
+    "dep:proxmox-lang",
+    "dep:tokio",
+    "tokio?/io-util",
+    "tokio?/sync",
 ]
index 9ca27d7cb82267dbadae7c2fd0c13ad4a5473295..57334a20d5959adc5e38cff093085fa09d2e89bf 100644 (file)
@@ -30,5 +30,5 @@ proxmox-async = { path = "../proxmox-async", version = "0.4.1" }
 
 [features]
 default = [ "cli" ]
-cli = [ "env_logger", "libc", "rustyline", "tokio" ]
+cli = [ "dep:env_logger", "dep:libc", "dep:rustyline", "dep:tokio" ]
 test-harness = [ "proxmox-schema/test-harness" ]
index c08405b1e0479ac91fb080da211b8a578215d469..63807f75e1d0f77ffc7816ffb57f5651dc2f707c 100644 (file)
@@ -30,8 +30,8 @@ proxmox-api-macro = { path = "../proxmox-api-macro", version = "1.0.3" }
 [features]
 default = []
 
-api-macro = ["proxmox-api-macro"]
-upid-api-impl = [ "libc", "nix" ]
+api-macro = ["dep:proxmox-api-macro"]
+upid-api-impl = [ "dep:libc", "dep:nix" ]
 
 # Testing only
 test-harness = []
index d58420a3580c0ae41694b40b4503bd3f49ba0b4c..0d9f0dac7842b9eed5fa699224724df631aed042 100644 (file)
@@ -27,4 +27,4 @@ proxmox-schema = { path = "../proxmox-schema", version = "1.3.3", features = ["a
 
 [features]
 default = []
-api-types = ["proxmox-schema"]
+api-types = ["dep:proxmox-schema"]
index 7321ce589cacb68d6e2d4f6501255e2ca5cd7a9d..41386114766a5c82b249a6e580f7bcc75ac1ce4f 100644 (file)
@@ -29,8 +29,8 @@ proxmox-time = { path = "../proxmox-time", version = "1.0.0" }
 
 [features]
 default = []
-sortable-macro = ["proxmox-sortable-macro"]
-logrotate = ["zstd"]
+sortable-macro = ["dep:proxmox-sortable-macro"]
+logrotate = ["dep:zstd"]
 acl = []
 crypt = []
 timer = []
index fbcf685f708a6a7516e7beedc2e681cc594c1c17..43539dda2148f6a56334f8f3a38a8699dcda2084 100644 (file)
@@ -28,6 +28,6 @@ webauthn-rs = { version = "0.3", optional = true }
 
 [features]
 default = []
-u2f = [ "libc", "serde_json", "serde/derive" ]
-api = [ "u2f", "webauthn-rs", "proxmox-uuid", "proxmox-time" ]
-api-types = [ "proxmox-schema" ]
+u2f = [ "dep:libc", "dep:serde_json", "serde/derive" ]
+api = [ "u2f", "dep:webauthn-rs", "dep:proxmox-uuid", "dep:proxmox-time" ]
+api-types = [ "dep:proxmox-schema" ]