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

EAPI=8

CRATES="
	addr2line@0.25.1
	adler2@2.0.1
	aead@0.5.2
	aes-gcm@0.10.3
	aes@0.8.4
	ahash@0.8.12
	aho-corasick@1.1.4
	allocator-api2@0.2.21
	android_system_properties@0.1.5
	anstream@0.6.21
	anstyle-parse@0.2.7
	anstyle-query@1.1.5
	anstyle-wincon@3.0.11
	anstyle@1.0.13
	anyhow@1.0.100
	arc-swap@1.8.0
	argon2@0.5.3
	arrayvec@0.5.2
	assert-json-diff@2.0.2
	async-compression@0.4.37
	async-stream-impl@0.3.6
	async-stream@0.3.6
	async-trait@0.1.89
	atomic-waker@1.1.2
	autocfg@1.5.0
	aws-credential-types@1.2.11
	aws-runtime@1.5.18
	aws-sdk-config@1.99.0
	aws-sdk-s3@1.102.0
	aws-sigv4@1.3.7
	aws-smithy-async@1.2.7
	aws-smithy-checksums@0.63.6
	aws-smithy-eventstream@0.60.14
	aws-smithy-http-client@1.1.5
	aws-smithy-http@0.62.6
	aws-smithy-json@0.61.9
	aws-smithy-observability@0.2.0
	aws-smithy-runtime-api@1.10.0
	aws-smithy-runtime@1.9.8
	aws-smithy-types@1.3.6
	aws-smithy-xml@0.60.13
	aws-types@1.3.11
	backoff@0.4.0
	backtrace@0.3.76
	base64-simd@0.8.0
	base64@0.13.1
	base64@0.21.7
	base64@0.22.1
	base64ct@1.8.3
	bincode@1.3.3
	bitflags@1.3.2
	bitflags@2.10.0
	blake2@0.10.6
	block-buffer@0.10.4
	bumpalo@3.19.1
	bytemuck@1.24.0
	byteorder@1.5.0
	bytes-utils@0.1.4
	bytes@1.11.0
	bytesize@1.3.3
	byteview@0.6.1
	cc@1.2.54
	cfg-if@1.0.4
	cfg_aliases@0.1.1
	cfg_aliases@0.2.1
	chrono@0.4.43
	cipher@0.4.4
	clap@2.34.0
	clap@4.5.54
	clap_builder@4.5.54
	clap_derive@4.5.49
	clap_lex@0.7.7
	colorchoice@1.0.4
	compare@0.0.6
	compression-codecs@0.4.36
	compression-core@0.4.31
	core-foundation-sys@0.8.7
	core-foundation@0.10.1
	core-foundation@0.9.4
	cpufeatures@0.2.17
	crc-fast@1.10.0
	crc32fast@1.5.0
	crossbeam-channel@0.5.15
	crossbeam-epoch@0.9.18
	crossbeam-queue@0.3.12
	crossbeam-skiplist@0.1.3
	crossbeam-utils@0.8.21
	crypto-common@0.1.7
	ctr@0.9.2
	darling@0.20.11
	darling_core@0.20.11
	darling_macro@0.20.11
	dashmap@4.0.2
	dashmap@6.1.0
	deranged@0.5.5
	derivative@2.2.0
	digest@0.10.7
	displaydoc@0.2.5
	double-ended-peekable@0.1.0
	dyn-clone@1.0.20
	either@1.15.0
	encoding_rs@0.8.35
	enum_dispatch@0.3.13
	env_logger@0.10.2
	equivalent@1.0.2
	errno@0.3.14
	fallible-iterator@0.3.0
	fallible-streaming-iterator@0.1.9
	fastrand@2.3.0
	find-msvc-tools@0.1.8
	fixedbitset@0.4.2
	fjall@2.11.2
	fnv@1.0.7
	foldhash@0.1.5
	form_urlencoded@1.2.2
	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.17
	getrandom@0.3.4
	ghash@0.5.1
	gimli@0.32.3
	git-version-macro@0.3.9
	git-version@0.3.9
	guardian@1.3.0
	h2@0.3.27
	h2@0.4.13
	hashbrown@0.12.3
	hashbrown@0.14.5
	hashbrown@0.15.5
	hashbrown@0.16.1
	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.5.2
	hex@0.4.3
	hexdump@0.1.2
	hmac@0.12.1
	home@0.5.12
	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.4.0
	httparse@1.10.1
	httpdate@1.0.3
	humantime@2.3.0
	hyper-rustls@0.24.2
	hyper-rustls@0.26.0
	hyper-timeout@0.4.1
	hyper-util@0.1.19
	hyper@0.14.32
	hyper@1.8.1
	iana-time-zone-haiku@0.1.2
	iana-time-zone@0.1.64
	icu_collections@2.1.1
	icu_locale_core@2.1.1
	icu_normalizer@2.1.1
	icu_normalizer_data@2.1.1
	icu_properties@2.1.2
	icu_properties_data@2.1.2
	icu_provider@2.1.1
	ident_case@1.0.1
	idna@1.1.0
	idna_adapter@1.2.1
	indexmap@1.9.3
	indexmap@2.13.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.17
	is_terminal_polyfill@1.70.2
	itertools@0.10.5
	itertools@0.12.1
	itoa@1.0.17
	jobserver@0.1.34
	js-sys@0.3.85
	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.180
	libsodium-sys@0.2.7
	libsqlite3-sys@0.35.0
	linux-raw-sys@0.11.0
	linux-raw-sys@0.4.15
	litemap@0.8.1
	lmdb-rkv-sys@0.11.2
	lock_api@0.4.14
	log@0.4.29
	lru@0.12.5
	lsm-tree@2.10.4
	lz4_flex@0.11.5
	matchers@0.2.0
	md-5@0.10.6
	memchr@2.7.6
	mime@0.3.17
	minimal-lexical@0.2.1
	miniz_oxide@0.8.9
	mio@1.1.1
	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.50.3
	num-bigint@0.2.6
	num-complex@0.2.4
	num-conv@0.2.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.17.0
	object@0.37.3
	once_cell@1.21.3
	once_cell_polyfill@1.70.2
	opaque-debug@0.3.1
	openssl-probe@0.1.6
	openssl-probe@0.2.1
	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
	page_size@0.4.2
	parking_lot@0.12.5
	parking_lot_core@0.9.12
	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.6
	percent-encoding@2.3.2
	pest@2.8.5
	pest_derive@2.8.5
	pest_generator@2.8.5
	pest_meta@2.8.5
	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
	potential_utf@0.1.4
	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.106
	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.18
	quote@1.0.44
	r-efi@5.3.0
	r2d2@0.8.10
	r2d2_sqlite@0.31.0
	rand@0.8.5
	rand_chacha@0.3.1
	rand_core@0.6.4
	redox_syscall@0.5.18
	regex-automata@0.4.13
	regex-lite@0.1.8
	regex-syntax@0.8.8
	regex@1.12.2
	reqwest@0.11.27
	ring@0.17.14
	rmp-serde@1.3.1
	rmp@0.8.15
	roxmltree@0.19.0
	rusqlite@0.37.0
	rustc-demangle@0.1.27
	rustc-hash@2.1.1
	rustc_version@0.4.1
	rustix@0.38.44
	rustix@1.1.3
	rustls-native-certs@0.6.3
	rustls-native-certs@0.7.3
	rustls-native-certs@0.8.3
	rustls-pemfile@1.0.4
	rustls-pemfile@2.2.0
	rustls-pki-types@1.14.0
	rustls-webpki@0.101.7
	rustls-webpki@0.102.8
	rustls@0.21.12
	rustls@0.22.4
	rustversion@1.0.22
	ryu@1.0.22
	same-file@1.0.6
	schannel@0.1.28
	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.15.0
	security-framework@2.11.1
	security-framework@3.5.1
	self_cell@1.2.2
	semver@1.0.27
	serde-value@0.7.0
	serde@1.0.228
	serde_bytes@0.11.19
	serde_core@1.0.228
	serde_derive@1.0.228
	serde_derive_internals@0.29.1
	serde_json@1.0.149
	serde_spanned@0.6.9
	serde_urlencoded@0.7.1
	serde_yaml@0.9.34+deprecated
	sha1@0.10.6
	sha2@0.10.9
	sharded-slab@0.1.7
	shlex@1.3.0
	signal-hook-registry@1.4.8
	slab@0.4.11
	smallvec@1.15.1
	socket2@0.5.10
	socket2@0.6.2
	spin@0.10.0
	spin@0.9.8
	stable_deref_trait@1.2.1
	static_init@1.0.4
	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.114
	sync_wrapper@0.1.2
	synchronoise@1.0.1
	synstructure@0.13.2
	syslog-tracing@0.3.1
	system-configuration-sys@0.5.0
	system-configuration-sys@0.6.0
	system-configuration@0.5.1
	system-configuration@0.6.1
	tempfile@3.24.0
	termcolor@1.4.1
	textwrap@0.11.0
	thiserror-impl@1.0.69
	thiserror-impl@2.0.18
	thiserror@1.0.69
	thiserror@2.0.18
	thread_local@1.1.9
	time-core@0.1.8
	time-macros@0.2.26
	time@0.3.46
	timeago@0.4.2
	tinystr@0.8.2
	tokio-io-timeout@1.2.1
	tokio-macros@2.6.0
	tokio-rustls@0.24.1
	tokio-rustls@0.25.0
	tokio-stream@0.1.18
	tokio-util@0.6.10
	tokio-util@0.7.18
	tokio@1.49.0
	toml@0.8.23
	toml_datetime@0.6.11
	toml_edit@0.22.27
	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.31
	tracing-core@0.1.36
	tracing-futures@0.2.5
	tracing-journald@0.3.2
	tracing-log@0.2.0
	tracing-subscriber@0.3.22
	tracing@0.1.44
	try-lock@0.2.5
	typenum@1.19.0
	ucd-trie@0.1.7
	unicode-ident@1.0.22
	unicode-segmentation@1.12.0
	unicode-width@0.1.14
	universal-hash@0.5.1
	unsafe-libyaml@0.2.11
	untrusted@0.9.0
	url@2.5.8
	utf8_iter@1.0.4
	utf8parse@0.2.2
	utoipa-gen@5.4.0
	utoipa@5.4.0
	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.1+wasi-snapshot-preview1
	wasip2@1.0.2+wasi-0.2.9
	wasm-bindgen-futures@0.4.58
	wasm-bindgen-macro-support@0.2.108
	wasm-bindgen-macro@0.2.108
	wasm-bindgen-shared@0.2.108
	wasm-bindgen@0.2.108
	web-sys@0.3.85
	which@4.4.2
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-util@0.1.11
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
	windows-core@0.62.2
	windows-implement@0.60.2
	windows-interface@0.59.3
	windows-link@0.2.1
	windows-registry@0.6.1
	windows-result@0.4.1
	windows-strings@0.5.1
	windows-sys@0.48.0
	windows-sys@0.52.0
	windows-sys@0.59.0
	windows-sys@0.60.2
	windows-sys@0.61.2
	windows-targets@0.48.5
	windows-targets@0.52.6
	windows-targets@0.53.5
	windows_aarch64_gnullvm@0.48.5
	windows_aarch64_gnullvm@0.52.6
	windows_aarch64_gnullvm@0.53.1
	windows_aarch64_msvc@0.48.5
	windows_aarch64_msvc@0.52.6
	windows_aarch64_msvc@0.53.1
	windows_i686_gnu@0.48.5
	windows_i686_gnu@0.52.6
	windows_i686_gnu@0.53.1
	windows_i686_gnullvm@0.52.6
	windows_i686_gnullvm@0.53.1
	windows_i686_msvc@0.48.5
	windows_i686_msvc@0.52.6
	windows_i686_msvc@0.53.1
	windows_x86_64_gnu@0.48.5
	windows_x86_64_gnu@0.52.6
	windows_x86_64_gnu@0.53.1
	windows_x86_64_gnullvm@0.48.5
	windows_x86_64_gnullvm@0.52.6
	windows_x86_64_gnullvm@0.53.1
	windows_x86_64_msvc@0.48.5
	windows_x86_64_msvc@0.52.6
	windows_x86_64_msvc@0.53.1
	winnow@0.7.14
	winreg@0.50.0
	wit-bindgen@0.51.0
	writeable@0.6.2
	xmlparser@0.13.6
	xxhash-rust@0.8.15
	yoke-derive@0.8.1
	yoke@0.8.1
	zerocopy-derive@0.8.33
	zerocopy@0.8.33
	zerofrom-derive@0.1.6
	zerofrom@0.1.6
	zeroize@1.8.2
	zerotrie@0.2.3
	zerovec-derive@0.11.2
	zerovec@0.11.5
	zmij@1.0.16
	zstd-safe@7.2.4
	zstd-sys@2.0.16+zstd.1.5.7
	zstd@0.13.3
"
RUST_MIN_VER="1.89.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
}