# Copyright 2021-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# Autogenerated by pycargoebuild 0.7

EAPI=8

CRATES="
	abscissa_core@0.6.0
	abscissa_derive@0.6.0
	addr2line@0.19.0
	adler@1.0.2
	aho-corasick@1.0.1
	android_system_properties@0.1.5
	anyhow@1.0.70
	arc-swap@1.6.0
	askama@0.11.1
	askama_derive@0.11.2
	askama_escape@0.10.3
	askama_shared@0.12.2
	atom_syndication@0.12.1
	atty@0.2.14
	auditable-extract@0.3.2
	auditable-info@0.7.0
	auditable-serde@0.6.0
	autocfg@1.1.0
	backtrace@0.3.67
	base64@0.13.1
	binfarce@0.2.1
	bitflags@1.3.2
	block-buffer@0.10.4
	bumpalo@3.12.1
	byteorder@1.4.3
	bytes@1.4.0
	camino@1.1.4
	canonical-path@2.0.2
	cargo-edit-9@0.9.3
	cargo-platform@0.1.2
	cargo_metadata@0.14.2
	cc@1.0.79
	cfg-if@1.0.0
	chrono@0.4.24
	clap@3.2.24
	clap_derive@3.2.24
	clap_lex@0.2.4
	codespan-reporting@0.11.1
	color-eyre@0.6.2
	combine@4.6.6
	comrak@0.18.0
	concolor-control@0.0.7
	concolor-query@0.0.4
	core-foundation-sys@0.8.4
	core-foundation@0.9.3
	cpufeatures@0.2.7
	crates-index@0.19.8
	crossbeam-channel@0.5.8
	crossbeam-deque@0.8.3
	crossbeam-epoch@0.9.14
	crossbeam-utils@0.8.15
	crypto-common@0.1.6
	cxx-build@1.0.94
	cxx@1.0.94
	cxxbridge-flags@1.0.94
	cxxbridge-macro@1.0.94
	darling@0.14.4
	darling_core@0.14.4
	darling_macro@0.14.4
	derive_builder@0.12.0
	derive_builder_core@0.12.0
	derive_builder_macro@0.12.0
	deunicode@0.4.3
	digest@0.10.6
	diligent-date-parser@0.1.4
	dirs-next@2.0.0
	dirs-sys-next@0.1.2
	dunce@1.0.4
	either@1.8.1
	encoding_rs@0.8.32
	entities@1.0.1
	env_proxy@0.4.1
	errno-dragonfly@0.1.2
	errno@0.3.1
	eyre@0.6.8
	fastrand@1.9.0
	fixedbitset@0.4.2
	fnv@1.0.7
	foreign-types-shared@0.1.1
	foreign-types@0.3.2
	form_urlencoded@1.1.0
	fs-err@2.9.0
	generic-array@0.14.7
	getrandom@0.2.9
	gimli@0.27.2
	git2@0.16.1
	gumdrop@0.8.1
	gumdrop_derive@0.8.1
	hashbrown@0.12.3
	heck@0.4.1
	hermit-abi@0.1.19
	hermit-abi@0.2.6
	hermit-abi@0.3.1
	hex@0.4.3
	home@0.5.5
	humansize@1.1.1
	humantime-serde@1.1.1
	humantime@2.1.0
	iana-time-zone-haiku@0.1.1
	iana-time-zone@0.1.56
	ident_case@1.0.1
	idna@0.3.0
	indenter@0.3.3
	indexmap@1.9.3
	instant@0.1.12
	io-lifetimes@1.0.10
	itertools@0.10.5
	itoa@1.0.6
	jobserver@0.1.26
	js-sys@0.3.61
	kstring@1.0.6
	lazy_static@1.4.0
	libc@0.2.142
	libgit2-sys@0.14.2+1.5.1
	libssh2-sys@0.2.23
	libz-sys@1.1.8
	link-cplusplus@1.0.8
	linux-raw-sys@0.3.4
	log@0.4.17
	matchers@0.1.0
	memchr@2.5.0
	memoffset@0.8.0
	mime@0.3.17
	mime_guess@2.0.4
	minimal-lexical@0.2.1
	miniz_oxide@0.6.2
	native-tls@0.2.11
	never@0.1.0
	nom@7.1.3
	nu-ansi-term@0.46.0
	num-integer@0.1.45
	num-traits@0.2.15
	num_cpus@1.15.0
	object@0.30.3
	once_cell@1.17.1
	openssl-macros@0.1.1
	openssl-probe@0.1.5
	openssl-src@111.25.3+1.1.1t
	openssl-sys@0.9.87
	openssl@0.10.52
	os_str_bytes@6.5.0
	overload@0.1.1
	owo-colors@3.5.0
	pathdiff@0.2.1
	percent-encoding@2.2.0
	petgraph@0.6.3
	pin-project-lite@0.2.9
	pkg-config@0.3.26
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro2@1.0.56
	quick-xml@0.28.2
	quote@1.0.26
	rayon-core@1.11.0
	rayon@1.7.0
	redox_syscall@0.2.16
	redox_syscall@0.3.5
	redox_users@0.4.3
	regex-automata@0.1.10
	regex-syntax@0.6.29
	regex-syntax@0.7.1
	regex@1.8.1
	ring@0.16.20
	rust-embed-impl@6.5.0
	rust-embed-utils@7.5.0
	rust-embed@6.6.1
	rustc-demangle@0.1.23
	rustc-hash@1.1.0
	rustix@0.37.15
	rustls@0.20.8
	ryu@1.0.13
	same-file@1.0.6
	schannel@0.1.21
	scopeguard@1.1.0
	scratch@1.0.5
	sct@0.7.0
	secrecy@0.8.0
	security-framework-sys@2.8.0
	security-framework@2.8.2
	semver@1.0.17
	serde@1.0.160
	serde_derive@1.0.160
	serde_json@1.0.96
	serde_spanned@0.6.1
	sha2@0.10.6
	sharded-slab@0.1.4
	slug@0.1.4
	smallvec@1.10.0
	smol_str@0.2.0
	socks@0.3.4
	spin@0.5.2
	strsim@0.10.0
	subprocess@0.2.9
	syn@1.0.109
	syn@2.0.15
	synstructure@0.12.6
	tempfile@3.5.0
	termcolor@1.2.0
	terminal_size@0.2.6
	textwrap@0.16.0
	thiserror-impl@1.0.40
	thiserror@1.0.40
	thread_local@1.1.7
	tinyvec@1.6.0
	tinyvec_macros@0.1.1
	toml@0.5.11
	toml@0.7.3
	toml_datetime@0.6.1
	toml_edit@0.13.4
	toml_edit@0.19.8
	topological-sort@0.2.2
	tracing-attributes@0.1.24
	tracing-core@0.1.30
	tracing-log@0.1.3
	tracing-subscriber@0.3.17
	tracing@0.1.38
	typed-arena@2.0.2
	typenum@1.16.0
	unicase@2.6.0
	unicode-bidi@0.3.13
	unicode-ident@1.0.8
	unicode-normalization@0.1.22
	unicode-width@0.1.10
	unicode-xid@0.2.4
	unicode_categories@0.1.1
	untrusted@0.7.1
	ureq@2.6.2
	url@2.3.1
	valuable@0.1.0
	vcpkg@0.2.15
	version_check@0.9.4
	wait-timeout@0.2.0
	walkdir@2.3.3
	wasi@0.11.0+wasi-snapshot-preview1
	wasm-bindgen-backend@0.2.84
	wasm-bindgen-macro-support@0.2.84
	wasm-bindgen-macro@0.2.84
	wasm-bindgen-shared@0.2.84
	wasm-bindgen@0.2.84
	web-sys@0.3.61
	webpki-roots@0.22.6
	webpki@0.22.0
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.5
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-sys@0.42.0
	windows-sys@0.45.0
	windows-sys@0.48.0
	windows-targets@0.42.2
	windows-targets@0.48.0
	windows@0.48.0
	windows_aarch64_gnullvm@0.42.2
	windows_aarch64_gnullvm@0.48.0
	windows_aarch64_msvc@0.42.2
	windows_aarch64_msvc@0.48.0
	windows_i686_gnu@0.42.2
	windows_i686_gnu@0.48.0
	windows_i686_msvc@0.42.2
	windows_i686_msvc@0.48.0
	windows_x86_64_gnu@0.42.2
	windows_x86_64_gnu@0.48.0
	windows_x86_64_gnullvm@0.42.2
	windows_x86_64_gnullvm@0.48.0
	windows_x86_64_msvc@0.42.2
	windows_x86_64_msvc@0.48.0
	winnow@0.4.1
	xml-rs@0.8.4
	zeroize@1.6.0
"

inherit cargo

DESCRIPTION="Audit Cargo.lock for crates with security vulnerabilities"
HOMEPAGE="https://rustsec.org https://github.com/rustsec/cargo-audit"
SRC_URI="
	https://github.com/RustSec/rustsec/archive/refs/tags/${PN}/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="|| ( Apache-2.0 MIT )"
# Dependent crate licenses
LICENSE+=" Apache-2.0 BSD-2 BSD ISC MIT MPL-2.0 Unicode-DFS-2016"
SLOT="0"
KEYWORDS="~amd64 ~ppc64"
IUSE="fix"

RDEPEND="dev-libs/openssl:="
DEPEND="${RDEPEND}"

S="${WORKDIR}/rustsec-${PN}-v${PV}"

QA_FLAGS_IGNORED="usr/bin/${PN}"

# requires checkout of vuln db/network
PROPERTIES="test_network"
RESTRICT="test"

src_configure() {
	local myfeatures=(
		$(usev fix)
		vendored-libgit2
	)

	cargo_src_configure
}

src_compile() {
	# normally we can pass --bin cargo-audit
	# to build single workspace member, but we need to cd
	# for tests to be discovered properly
	cd cargo-audit || die
	cargo_src_compile
}

src_install() {
	cargo_src_install --path cargo-audit
	local DOCS=( cargo-audit/{README.md,audit.toml.example} )
	einstalldocs
}