diff --git a/core-server-kit/curated/app-misc/meilisearch/autogen.py b/core-server-kit/curated/app-misc/meilisearch/autogen.py deleted file mode 100644 index 83c3a9207..000000000 --- a/core-server-kit/curated/app-misc/meilisearch/autogen.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python3 - -import os -import toml - - -async def get_unidic_artifact(hub): - info_url = "https://formulae.brew.sh/api/formula/mecab-unidic.json" - info = await hub.pkgtools.fetch.get_page(info_url, is_json=True) - - return hub.pkgtools.ebuild.Artifact(url=info["urls"]["stable"]["url"]) - - -async def generate(hub, **pkginfo): - github_user = github_repo = "meilisearch" - - pkginfo["github_user"] = github_user - pkginfo["github_repo"] = github_repo - - release_info = await hub.pkgtools.github.release_gen(hub, github_user, github_repo) - pkginfo.update(release_info) - - src_artifact = pkginfo["artifacts"][0] - pkginfo["artifacts"] = { - "global": [src_artifact], - } - - await src_artifact.ensure_fetched() - src_artifact.extract() - - src_path = os.path.join( - src_artifact.extract_path, f"{github_user}-{github_repo}-{pkginfo['sha'][:7]}" - ) - - cargo_lock_path = os.path.join(src_path, "Cargo.lock") - await hub.pkgtools.rust.add_crates_bundle( - hub, pkginfo, cargo_lock_path=cargo_lock_path - ) - - meili_package_path = os.path.join(src_path, "meilisearch", "Cargo.toml") - with open(meili_package_path, "r") as meili_package_file: - meili_package_data = toml.load(meili_package_file) - - dashboard_metadata = meili_package_data["package"]["metadata"]["mini-dashboard"] - - dashboard_url = pkginfo["dashboard_url"] = dashboard_metadata["assets-url"] - dashboard_sha = dashboard_metadata["sha1"] - - pkginfo["artifacts"]["mini-dashboard"] = [hub.pkgtools.ebuild.Artifact( - url=dashboard_url, - final_name=f"{github_repo}-mini-dashboard-{dashboard_sha}.zip", - ) - ] - unidic = await get_unidic_artifact(hub) - - pkginfo["artifacts"]["global"].append(unidic) - - ebuild = hub.pkgtools.ebuild.BreezyBuild(**pkginfo, unidic=unidic) - ebuild.push() - -# vim: ts=4 sw=4 noet diff --git a/core-server-kit/curated/app-misc/meilisearch/autogen.yaml b/core-server-kit/curated/app-misc/meilisearch/autogen.yaml new file mode 100644 index 000000000..1818e4c4e --- /dev/null +++ b/core-server-kit/curated/app-misc/meilisearch/autogen.yaml @@ -0,0 +1,8 @@ +meilisearch_rule: + generator: github-1 + packages: + - meilisearch: + github: + query: releases + extensions: + - rust \ No newline at end of file diff --git a/core-server-kit/curated/app-misc/meilisearch/templates/meilisearch.tmpl b/core-server-kit/curated/app-misc/meilisearch/templates/meilisearch.tmpl index b9957b6c0..d71661e3f 100644 --- a/core-server-kit/curated/app-misc/meilisearch/templates/meilisearch.tmpl +++ b/core-server-kit/curated/app-misc/meilisearch/templates/meilisearch.tmpl @@ -21,6 +21,8 @@ BDEPEND=" S="${WORKDIR}/{{ github_user }}-{{ github_repo }}-{{ sha[:7] }}" +RESTRICT="network-sandbox" + MEILI_DATA_DIR="/var/lib/${PN}" pkg_setup() { @@ -28,30 +30,12 @@ pkg_setup() { 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 '')" ) @@ -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}"