Skip to content

Commit

Permalink
Merge pull request #243 from macaroni-os/app-misc/meilisearch
Browse files Browse the repository at this point in the history
app-misc/meilisearch Replace Python autogen with YAML-based generator…
  • Loading branch information
geaaru authored Dec 29, 2024
2 parents fe1f124 + 1de5d80 commit 0d4ae40
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 82 deletions.
61 changes: 0 additions & 61 deletions core-server-kit/curated/app-misc/meilisearch/autogen.py

This file was deleted.

8 changes: 8 additions & 0 deletions core-server-kit/curated/app-misc/meilisearch/autogen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
meilisearch_rule:
generator: github-1
packages:
- meilisearch:
github:
query: releases
extensions:
- rust
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,21 @@ BDEPEND="

S="${WORKDIR}/{{ github_user }}-{{ github_repo }}-{{ sha[:7] }}"

RESTRICT="network-sandbox"

MEILI_DATA_DIR="/var/lib/${PN}"

pkg_setup() {
enewgroup "${PN}"
enewuser "${PN}" -1 -1 "${MEILI_DATA_DIR}" "${PN}"
}

src_prepare() {
default

# Patch lindera-unidic to use the unidic-mecab src downloaded by the ebuild
local lindera_unidic_build=$(find "${WORKDIR}"/cargo_home/gentoo/lindera-unidic-* -iname build.rs)

# Replace the input/unpacked folder with our version
sed -i 's|\(let input_dir =.*\)\("unidic-mecab.*"\)\(.*\)|\1"{{ unidic.final_name.rsplit(".", 1)[0] }}"\3|' "${lindera_unidic_build}"

# Replace the path to the source with the one downloaded by the ebuild
sed -i "s|\(let source_path_for_build =\).*$|\1 Path::new("'"'"${DISTDIR}/{{ unidic.final_name }}"'"'");|" "${lindera_unidic_build}"

if use mini-dashboard; then
# Inject path to downloaded mini-dashboard build
sed -i "s|{{ dashboard_url }}|${DISTDIR}/{{ artifacts["mini-dashboard"][0].final_name }}|g" "${S}"/meilisearch/Cargo.toml

# Replace HTTP fetch with direct file read
sed -i -r 's|(let dashboard_assets_bytes =)(.*)$|\1 std::fs::read(url)?;|' "${S}"/meilisearch/build.rs
fi
src_unpack() {
cargo_src_unpack
}

src_configure() {
CARGO_FEATURES=(
"analytics"
"meilisearch-types/all-tokenizations"
"$(usex mini-dashboard mini-dashboard '')"
)
Expand All @@ -68,7 +52,7 @@ src_compile() {
}

src_install() {
cargo_src_install --path meilisearch --frozen \
cargo_src_install --path crates/meilisearch --frozen \
--no-default-features ${CARGO_FEATURES:+--features "${CARGO_FEATURES[*]}"}

mkdir -p "${ED}"/"${MEILI_DATA_DIR}"
Expand Down

0 comments on commit 0d4ae40

Please sign in to comment.