Skip to content

Commit

Permalink
eclass: Support rust.eclass and RUST_OPTIONAL as well
Browse files Browse the repository at this point in the history
Closes: #714
Signed-off-by: Michał Górny <[email protected]>
Closes: #718
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
mgorny committed Nov 22, 2024
1 parent e4bbab1 commit 1f35e60
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pkgcheck/checks/eclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,9 @@ class RubyMissingDeps(results.VersionResult, results.Warning):


class RustMissingDeps(results.VersionResult, results.Warning):
"""Package sets ``CARGO_OPTIONAL`` but does not use ``${RUST_DEPEND}``."""
"""Package sets ``RUST_OPTIONAL`` but does not use ``${RUST_DEPEND}``."""

desc = "sets CARGO_OPTIONAL but does not use ${RUST_DEPEND}"
desc = "sets RUST_OPTIONAL (or CARGO_OPTIONAL) but does not use ${RUST_DEPEND}"


class TmpfilesMissingDeps(results.VersionResult, results.Warning):
Expand All @@ -543,6 +543,7 @@ class EclassManualDepsCheck(Check):
dependencies = (
# eclass, variable, one of deps, class
("cargo", "CARGO_OPTIONAL", {"dev-lang/rust", "dev-lang/rust-bin"}, RustMissingDeps),
("rust", "RUST_OPTIONAL", {"dev-lang/rust", "dev-lang/rust-bin"}, RustMissingDeps),
("go-module", "GO_OPTIONAL", {"dev-lang/go"}, GoMissingDeps),
(
"ruby-ng",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{"__class__": "RustMissingDeps", "category": "EclassManualDepsCheck", "package": "RustMissingDeps", "version": "1"}
{"__class__": "RustMissingDeps", "category": "EclassManualDepsCheck", "package": "RustMissingDeps", "version": "3"}
{"__class__": "RustMissingDeps", "category": "EclassManualDepsCheck", "package": "RustMissingDeps", "version": "4"}
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,21 @@ diff -Naur standalone/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-1.eb
SLOT="0"
+
+BDEPEND="${RUST_DEPEND}"
diff -Naur standalone/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-3.ebuild fixed/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-3.ebuild
--- standalone/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-3.ebuild
+++ fixed/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-3.ebuild
@@ -8,3 +8,5 @@ DESCRIPTION="Optional inherit without deps"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
+
+BDEPEND="${RUST_DEPEND}"
diff -Naur standalone/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-4.ebuild fixed/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-4.ebuild
--- standalone/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-4.ebuild
+++ fixed/EclassManualDepsCheck/RustMissingDeps/RustMissingDeps-4.ebuild
@@ -8,3 +8,5 @@ DESCRIPTION="Optional inherit without deps"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
+
+BDEPEND="${RUST_DEPEND}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
inherit rust

DESCRIPTION="Normal non-optional inherit"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
EAPI=7

RUST_OPTIONAL=1

inherit rust

DESCRIPTION="Optional inherit without deps"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
EAPI=7

RUST_OPTIONAL=1

inherit cargo

DESCRIPTION="Optional inherit without deps"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
4 changes: 4 additions & 0 deletions testdata/repos/standalone/eclass/cargo.eclass
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# cargo eclass

if [[ -n ${CARGO_OPTIONAL} ]]; then
RUST_OPTIONAL=1
fi

inherit rust

CARGO_CRATE_URIS=${CRATES}
Expand Down

0 comments on commit 1f35e60

Please sign in to comment.