From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 4B4678AE4B for ; Mon, 22 Aug 2022 11:24:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 426FC2D3E9 for ; Mon, 22 Aug 2022 11:24:17 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 22 Aug 2022 11:24:15 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 89CE1433FD for ; Mon, 22 Aug 2022 11:24:09 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Mon, 22 Aug 2022 11:24:04 +0200 Message-Id: <20220822092404.323172-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.161 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pbs-devel] [PATCH proxmox] build: use weak and namespaced features X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Aug 2022 09:24:17 -0000 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 --- sent as patch to wait for cargo 0.63 regressions before applying proxmox-http/Cargo.toml | 26 ++++++++++++++------------ proxmox-router/Cargo.toml | 2 +- proxmox-schema/Cargo.toml | 4 ++-- proxmox-subscription/Cargo.toml | 2 +- proxmox-sys/Cargo.toml | 4 ++-- proxmox-tfa/Cargo.toml | 6 +++--- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/proxmox-http/Cargo.toml b/proxmox-http/Cargo.toml index f12dfc6..541c5dd 100644 --- a/proxmox-http/Cargo.toml +++ b/proxmox-http/Cargo.toml @@ -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", ] diff --git a/proxmox-router/Cargo.toml b/proxmox-router/Cargo.toml index 9ca27d7..57334a2 100644 --- a/proxmox-router/Cargo.toml +++ b/proxmox-router/Cargo.toml @@ -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" ] diff --git a/proxmox-schema/Cargo.toml b/proxmox-schema/Cargo.toml index c08405b..63807f7 100644 --- a/proxmox-schema/Cargo.toml +++ b/proxmox-schema/Cargo.toml @@ -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 = [] diff --git a/proxmox-subscription/Cargo.toml b/proxmox-subscription/Cargo.toml index d58420a..0d9f0da 100644 --- a/proxmox-subscription/Cargo.toml +++ b/proxmox-subscription/Cargo.toml @@ -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"] diff --git a/proxmox-sys/Cargo.toml b/proxmox-sys/Cargo.toml index 7321ce5..4138611 100644 --- a/proxmox-sys/Cargo.toml +++ b/proxmox-sys/Cargo.toml @@ -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 = [] diff --git a/proxmox-tfa/Cargo.toml b/proxmox-tfa/Cargo.toml index fbcf685..43539dd 100644 --- a/proxmox-tfa/Cargo.toml +++ b/proxmox-tfa/Cargo.toml @@ -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" ] -- 2.30.2