# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CRATES="
	addr2line@0.24.2
	adler2@2.0.0
	aead@0.5.2
	aes-gcm@0.10.3
	aes@0.8.4
	ahash@0.8.11
	aho-corasick@1.1.3
	allocator-api2@0.2.21
	android-tzdata@0.1.1
	android_system_properties@0.1.5
	anstream@0.6.18
	anstyle-parse@0.2.6
	anstyle-query@1.1.2
	anstyle-wincon@3.0.7
	anstyle@1.0.10
	anyhow@1.0.97
	arc-swap@1.7.1
	argon2@0.5.3
	arrayvec@0.5.2
	assert-json-diff@2.0.2
	async-compression@0.4.21
	async-stream-impl@0.3.6
	async-stream@0.3.6
	async-trait@0.1.88
	atomic-waker@1.1.2
	autocfg@1.4.0
	aws-credential-types@1.2.2
	aws-runtime@1.5.6
	aws-sdk-config@1.65.0
	aws-sdk-s3@1.79.0
	aws-sigv4@1.3.0
	aws-smithy-async@1.2.5
	aws-smithy-checksums@0.63.1
	aws-smithy-eventstream@0.60.8
	aws-smithy-http-client@1.0.0
	aws-smithy-http@0.62.0
	aws-smithy-json@0.61.3
	aws-smithy-runtime-api@1.7.4
	aws-smithy-runtime@1.8.0
	aws-smithy-types@1.3.0
	aws-smithy-xml@0.60.9
	aws-types@1.3.6
	backoff@0.4.0
	backtrace@0.3.74
	base64-simd@0.8.0
	base64@0.13.1
	base64@0.21.7
	base64@0.22.1
	base64ct@1.7.3
	bincode@1.3.3
	bitflags@1.3.2
	bitflags@2.9.0
	blake2@0.10.6
	block-buffer@0.10.4
	bumpalo@3.17.0
	bytemuck@1.22.0
	byteorder@1.5.0
	bytes-utils@0.1.4
	bytes@1.10.1
	bytesize@1.3.2
	byteview@0.6.1
	cc@1.2.16
	cfg-if@1.0.0
	cfg_aliases@0.1.1
	cfg_aliases@0.2.1
	chrono@0.4.40
	cipher@0.4.4
	clap@2.34.0
	clap@4.5.32
	clap_builder@4.5.32
	clap_derive@4.5.32
	clap_lex@0.7.4
	colorchoice@1.0.3
	compare@0.0.6
	core-foundation-sys@0.8.7
	core-foundation@0.9.4
	cpufeatures@0.2.17
	crc-catalog@2.4.0
	crc-fast@1.2.0
	crc32c@0.6.8
	crc32fast@1.4.2
	crc64fast-nvme@1.2.0
	crc@3.2.1
	crossbeam-channel@0.5.14
	crossbeam-epoch@0.9.18
	crossbeam-queue@0.3.12
	crossbeam-skiplist@0.1.3
	crossbeam-utils@0.8.21
	crypto-common@0.1.6
	ctr@0.9.2
	darling@0.20.10
	darling_core@0.20.10
	darling_macro@0.20.10
	dashmap@4.0.2
	dashmap@6.1.0
	deranged@0.4.0
	derivative@2.2.0
	digest@0.10.7
	displaydoc@0.2.5
	double-ended-peekable@0.1.0
	dyn-clone@1.0.19
	either@1.15.0
	encoding_rs@0.8.35
	enum_dispatch@0.3.13
	env_logger@0.10.2
	equivalent@1.0.2
	err-derive@0.3.1
	errno@0.3.10
	fallible-iterator@0.3.0
	fallible-streaming-iterator@0.1.9
	fastrand@2.3.0
	fixedbitset@0.4.2
	fjall@2.11.2
	fnv@1.0.7
	foldhash@0.1.5
	form_urlencoded@1.2.1
	futures-channel@0.3.31
	futures-core@0.3.31
	futures-executor@0.3.31
	futures-io@0.3.31
	futures-macro@0.3.31
	futures-sink@0.3.31
	futures-task@0.3.31
	futures-util@0.3.31
	futures@0.3.31
	generic-array@0.14.7
	gethostname@0.4.3
	getrandom@0.2.15
	getrandom@0.3.2
	ghash@0.5.1
	gimli@0.31.1
	git-version-macro@0.3.9
	git-version@0.3.9
	guardian@1.3.0
	h2@0.3.26
	h2@0.4.8
	hashbrown@0.12.3
	hashbrown@0.14.5
	hashbrown@0.15.2
	hashlink@0.10.0
	heck@0.3.3
	heck@0.5.0
	heed-traits@0.8.0
	heed-types@0.8.0
	heed@0.11.0
	hermit-abi@0.3.9
	hermit-abi@0.5.0
	hex@0.4.3
	hexdump@0.1.2
	hmac@0.12.1
	home@0.5.11
	http-body-util@0.1.3
	http-body@0.4.6
	http-body@1.0.1
	http-range-header@0.3.1
	http-range@0.1.5
	http@0.2.12
	http@1.3.1
	httparse@1.10.1
	httpdate@1.0.3
	humantime@2.2.0
	hyper-rustls@0.24.2
	hyper-rustls@0.26.0
	hyper-timeout@0.4.1
	hyper-util@0.1.10
	hyper@0.14.32
	hyper@1.6.0
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.61
	icu_collections@1.5.0
	icu_locid@1.5.0
	icu_locid_transform@1.5.0
	icu_locid_transform_data@1.5.0
	icu_normalizer@1.5.0
	icu_normalizer_data@1.5.0
	icu_properties@1.5.1
	icu_properties_data@1.5.0
	icu_provider@1.5.0
	icu_provider_macros@1.5.0
	ident_case@1.0.1
	idna@1.0.3
	idna_adapter@1.2.0
	indexmap@1.9.3
	indexmap@2.8.0
	inout@0.1.4
	instant@0.1.13
	interval-heap@0.0.5
	ipnet@2.11.0
	ipnetwork@0.20.0
	is-terminal@0.4.16
	is_terminal_polyfill@1.70.1
	itertools@0.10.5
	itertools@0.12.1
	itoa@1.0.15
	jobserver@0.1.32
	js-sys@0.3.77
	json-patch@1.4.0
	jsonpath-rust@0.4.0
	k8s-openapi@0.21.1
	kube-client@0.88.1
	kube-core@0.88.1
	kube-derive@0.88.1
	kube-runtime@0.88.1
	kube@0.88.1
	kuska-handshake@0.2.0
	kuska-sodiumoxide@0.2.5-0
	lazy_static@1.5.0
	libc@0.2.171
	libsodium-sys@0.2.7
	libsqlite3-sys@0.35.0
	linux-raw-sys@0.4.15
	linux-raw-sys@0.9.3
	litemap@0.7.5
	lmdb-rkv-sys@0.11.2
	lock_api@0.4.12
	log@0.4.26
	lru@0.12.5
	lsm-tree@2.10.3
	lz4_flex@0.11.3
	matchers@0.1.0
	md-5@0.10.6
	memchr@2.7.4
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.8.5
	mio@1.0.3
	mktemp@0.5.1
	multer@3.1.0
	multimap@0.8.3
	nix@0.29.0
	no-std-net@0.6.0
	nom@7.1.3
	nu-ansi-term@0.46.0
	num-bigint@0.2.6
	num-complex@0.2.4
	num-conv@0.1.0
	num-integer@0.1.46
	num-iter@0.1.45
	num-rational@0.2.4
	num-traits@0.2.19
	num@0.2.1
	num_cpus@1.16.0
	object@0.36.7
	once_cell@1.21.1
	opaque-debug@0.3.1
	openssl-probe@0.1.6
	opentelemetry-contrib@0.9.0
	opentelemetry-otlp@0.10.0
	opentelemetry-prometheus@0.10.0
	opentelemetry@0.17.0
	ordered-float@2.10.1
	outref@0.5.2
	overload@0.1.1
	page_size@0.4.2
	parking_lot@0.11.2
	parking_lot@0.12.3
	parking_lot_core@0.8.6
	parking_lot_core@0.9.10
	parse_duration@2.1.1
	password-hash@0.5.0
	paste@1.0.15
	path-absolutize@3.1.1
	path-dedot@3.1.1
	pem@3.0.5
	percent-encoding@2.3.1
	pest@2.7.15
	pest_derive@2.7.15
	pest_generator@2.7.15
	pest_meta@2.7.15
	petgraph@0.6.5
	pin-project-internal@1.1.10
	pin-project-lite@0.2.16
	pin-project@1.1.10
	pin-utils@0.1.0
	pkg-config@0.3.32
	pnet_base@0.34.0
	pnet_datalink@0.34.0
	pnet_sys@0.34.0
	polyval@0.6.2
	powerfmt@0.2.0
	ppv-lite86@0.2.21
	pretty_env_logger@0.5.0
	proc-macro-error-attr@1.0.4
	proc-macro-error@1.0.4
	proc-macro2@1.0.94
	prometheus@0.13.4
	prost-build@0.9.0
	prost-derive@0.9.0
	prost-types@0.9.0
	prost@0.9.0
	protobuf@2.28.0
	quick-xml@0.26.0
	quick_cache@0.6.16
	quote@1.0.40
	r-efi@5.2.0
	r2d2@0.8.10
	r2d2_sqlite@0.31.0
	rand@0.8.5
	rand@0.9.1
	rand_chacha@0.3.1
	rand_chacha@0.9.0
	rand_core@0.6.4
	rand_core@0.9.3
	redox_syscall@0.2.16
	redox_syscall@0.5.10
	regex-automata@0.1.10
	regex-automata@0.4.9
	regex-lite@0.1.6
	regex-syntax@0.6.29
	regex-syntax@0.8.5
	regex@1.11.1
	reqwest@0.11.27
	ring@0.17.14
	rmp-serde@1.3.0
	rmp@0.8.14
	roxmltree@0.19.0
	rusqlite@0.37.0
	rustc-demangle@0.1.24
	rustc-hash@2.1.1
	rustc_version@0.4.1
	rustix@0.38.44
	rustix@1.0.3
	rustls-native-certs@0.6.3
	rustls-native-certs@0.7.3
	rustls-pemfile@1.0.4
	rustls-pemfile@2.2.0
	rustls-pki-types@1.11.0
	rustls-webpki@0.101.7
	rustls-webpki@0.102.8
	rustls@0.21.12
	rustls@0.22.4
	rustversion@1.0.20
	ryu@1.0.20
	same-file@1.0.6
	schannel@0.1.27
	scheduled-thread-pool@0.2.7
	schemars@0.8.22
	schemars_derive@0.8.22
	scopeguard@1.2.0
	sct@0.7.1
	secrecy@0.8.0
	security-framework-sys@2.14.0
	security-framework@2.11.1
	self_cell@1.2.0
	semver@1.0.26
	serde-value@0.7.0
	serde@1.0.219
	serde_bytes@0.11.17
	serde_derive@1.0.219
	serde_derive_internals@0.29.1
	serde_json@1.0.140
	serde_spanned@0.6.8
	serde_urlencoded@0.7.1
	serde_yaml@0.9.34+deprecated
	sha1@0.10.6
	sha2@0.10.8
	sharded-slab@0.1.7
	shlex@1.3.0
	signal-hook-registry@1.4.2
	slab@0.4.9
	smallvec@1.14.0
	socket2@0.5.8
	spin@0.9.8
	stable_deref_trait@1.2.0
	static_init@1.0.3
	static_init_macro@1.0.4
	std-semaphore@0.1.0
	strsim@0.11.1
	structopt-derive@0.4.18
	structopt@0.3.26
	subtle@2.6.1
	syn@1.0.109
	syn@2.0.100
	sync_wrapper@0.1.2
	synchronoise@1.0.1
	synstructure@0.12.6
	synstructure@0.13.1
	syslog-tracing@0.3.1
	system-configuration-sys@0.5.0
	system-configuration@0.5.1
	tempfile@3.19.1
	termcolor@1.4.1
	textwrap@0.11.0
	thiserror-impl@1.0.69
	thiserror-impl@2.0.12
	thiserror@1.0.69
	thiserror@2.0.12
	thread_local@1.1.8
	time-core@0.1.4
	time-macros@0.2.21
	time@0.3.40
	timeago@0.4.2
	tinystr@0.7.6
	tokio-io-timeout@1.2.0
	tokio-macros@2.5.0
	tokio-rustls@0.24.1
	tokio-rustls@0.25.0
	tokio-stream@0.1.17
	tokio-util@0.6.10
	tokio-util@0.7.14
	tokio@1.44.1
	toml@0.8.20
	toml_datetime@0.6.8
	toml_edit@0.22.24
	tonic-build@0.6.2
	tonic@0.6.2
	tower-http@0.4.4
	tower-layer@0.3.3
	tower-service@0.3.3
	tower@0.4.13
	tracing-attributes@0.1.28
	tracing-core@0.1.33
	tracing-futures@0.2.5
	tracing-journald@0.3.1
	tracing-log@0.2.0
	tracing-subscriber@0.3.19
	tracing@0.1.41
	try-lock@0.2.5
	typenum@1.18.0
	ucd-trie@0.1.7
	unicode-ident@1.0.18
	unicode-segmentation@1.12.0
	unicode-width@0.1.14
	unicode-xid@0.2.6
	universal-hash@0.5.1
	unsafe-libyaml@0.2.11
	untrusted@0.9.0
	url@2.5.4
	utf16_iter@1.0.5
	utf8_iter@1.0.4
	utf8parse@0.2.2
	utoipa-gen@5.3.1
	utoipa@5.3.1
	uuid@1.4.1
	valuable@0.1.1
	value-log@1.9.0
	varint-rs@2.2.0
	vcpkg@0.2.15
	version_check@0.9.5
	vsimd@0.8.0
	walkdir@2.5.0
	want@0.3.1
	wasi@0.11.0+wasi-snapshot-preview1
	wasi@0.14.2+wasi-0.2.4
	wasm-bindgen-backend@0.2.100
	wasm-bindgen-futures@0.4.50
	wasm-bindgen-macro-support@0.2.100
	wasm-bindgen-macro@0.2.100
	wasm-bindgen-shared@0.2.100
	wasm-bindgen@0.2.100
	web-sys@0.3.77
	which@4.4.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.9
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.52.0
	windows-link@0.1.1
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnullvm@0.52.6
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	winnow@0.7.4
	winreg@0.50.0
	wit-bindgen-rt@0.39.0
	write16@1.0.0
	writeable@0.5.5
	xmlparser@0.13.6
	xxhash-rust@0.8.15
	yoke-derive@0.7.5
	yoke@0.7.5
	zerocopy-derive@0.7.35
	zerocopy-derive@0.8.23
	zerocopy@0.7.35
	zerocopy@0.8.23
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.1
	zerovec-derive@0.10.3
	zerovec@0.10.4
	zstd-safe@7.2.3
	zstd-sys@2.0.14+zstd.1.5.7
	zstd@0.13.3
"
RUST_MIN_VER="1.81.0"

inherit cargo systemd

DESCRIPTION="Garage, an S3-compatible distributed object store for self-hosted deployments"
HOMEPAGE="https://garagehq.deuxfleurs.fr/"
SRC_URI="
	https://git.deuxfleurs.fr/Deuxfleurs/garage/archive/v${PV}.tar.gz -> ${P}.tar.gz
	${CARGO_CRATE_URIS}
"

LICENSE="AGPL-3"
LICENSE+="
	Apache-2.0 BSD-2 BSD Boost-1.0 ISC MIT MPL-2.0 Unicode-3.0 ZLIB
"
# WARNING  Crate 'jsonpath-rust-0.4.0.crate' (in 'jsonpath-rust-0.4.0') uses license-file='LICENSE', please
#          inspect the license manually and add it *separately* from crate licenses
# => MIT
# WARNING  Crate 'kuska-handshake-0.2.0.crate' (in 'kuska-handshake-0.2.0') uses license-file='LICENSE',
#          please inspect the license manually and add it *separately* from crate licenses
# => AGPL-3
SLOT="0"
KEYWORDS="~amd64"
S=${WORKDIR}/${PN}/src/garage

RDEPEND="
        acct-group/garage
        acct-user/garage
"

src_install() {
        cargo_src_install
        systemd_dounit "${FILESDIR}/garage.service"
	newinitd "${FILESDIR}/garage.initd" garage
	newconfd "${FILESDIR}/garage.confd" garage
}

pkg_postinst() {
	if [[ -z "${REPLACING_VERSIONS}" ]]; then
		einfo it appears you are installing garage for the first time
		einfo please fill /etc/garage.toml before starting it
		einfo https://garagehq.deuxfleurs.fr/documentation/cookbook/real-world/#deploying-and-configuring-garage
	fi
}