From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B33E21580BA for ; Wed, 25 Aug 2021 15:35:10 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A46FAE08F2; Wed, 25 Aug 2021 15:35:09 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EEFE7E08F1 for ; Wed, 25 Aug 2021 15:35:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 29C2633BE58 for ; Wed, 25 Aug 2021 15:35:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7380E8D6 for ; Wed, 25 Aug 2021 15:35:05 +0000 (UTC) From: "Georgy Yakovlev" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Georgy Yakovlev" Message-ID: <1629904289.b01082acb7bb01817247bd5947b9d59294a885fb.gyakovlev@gentoo> Subject: [gentoo-commits] proj/cargo-ebuild:master commit in: src/ X-VCS-Repository: proj/cargo-ebuild X-VCS-Files: src/base.tera src/ebuild.tera src/lib.rs X-VCS-Directories: src/ X-VCS-Committer: gyakovlev X-VCS-Committer-Name: Georgy Yakovlev X-VCS-Revision: b01082acb7bb01817247bd5947b9d59294a885fb X-VCS-Branch: master Date: Wed, 25 Aug 2021 15:35:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6a55364f-57a4-4ece-b1dc-efcd8d65811c X-Archives-Hash: 35c34a844dc647cc4043178f1e64bd01 commit: b01082acb7bb01817247bd5947b9d59294a885fb Author: Luca Barbato gentoo org> AuthorDate: Thu Jul 29 15:16:48 2021 +0000 Commit: Georgy Yakovlev gentoo org> CommitDate: Wed Aug 25 15:11:29 2021 +0000 URL: https://gitweb.gentoo.org/proj/cargo-ebuild.git/commit/?id=b01082ac Move the bulk of the template to base.tera Custom templates can just implement the blocks they care for Signed-off-by: Luca Barbato gentoo.org> Signed-off-by: Georgy Yakovlev gentoo.org> src/base.tera | 33 +++++++++++++++++++++++++++++++++ src/ebuild.tera | 28 +--------------------------- src/lib.rs | 2 ++ 3 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/base.tera b/src/base.tera new file mode 100644 index 0000000..e1f4571 --- /dev/null +++ b/src/base.tera @@ -0,0 +1,33 @@ +{%- block header -%} +# Copyright 2017-{{ this_year }} Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Auto-Generated by cargo-ebuild {{ cargo_ebuild_ver }} +{% endblock %} +EAPI={%- block eapi -%}7{%- endblock %} + +{% block crates -%} +CRATES=" +{% for crate in crates -%} +{{ crate }} +{%- endfor -%}" +{%- endblock %} + +inherit {% block inherit -%}cargo{%- endblock %} + +DESCRIPTION={%- block description -%}"{{ description | trim }}"{%- endblock %} +# Double check the homepage as the cargo_metadata crate +# does not provide this value so instead repository is used +HOMEPAGE={%- block homepage -%}"{{ homepage }}"{%- endblock %} +SRC_URI={%- block src_uri -%}{% raw -%}"$(cargo_crate_uris ${CRATES})"{%- endraw %}{%- endblock %} +# License set may be more restrictive as OR is not respected +# use cargo-license for a more accurate license picture +LICENSE={%- block license -%}"{{ license }}"{%- endblock %} +SLOT={%- block slot -%}"0"{%- endblock %} +KEYWORDS={%- block keyword -%}"~amd64"{%- endblock %} +{% block variables -%} +RESTRICT="mirror" +{%- endblock %} + +{%- block phases -%} +{%- endblock -%} diff --git a/src/ebuild.tera b/src/ebuild.tera index b83675d..9ba9906 100644 --- a/src/ebuild.tera +++ b/src/ebuild.tera @@ -1,27 +1 @@ -# Copyright 2017-{{ this_year }} Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# Auto-Generated by cargo-ebuild {{ cargo_ebuild_ver }} - -EAPI=7 - -CRATES=" -{% for crate in crates -%} -{{ crate }} -{%- endfor -%}" - -inherit cargo - -DESCRIPTION="{{ description | trim }}" -# Double check the homepage as the cargo_metadata crate -# does not provide this value so instead repository is used -HOMEPAGE="{{ homepage }}" -{% raw -%} -SRC_URI="$(cargo_crate_uris ${CRATES})" -{%- endraw %} -# License set may be more restrictive as OR is not respected -# use cargo-license for a more accurate license picture -LICENSE="{{ license }}" -SLOT="0" -KEYWORDS="~amd64" -RESTRICT="mirror" +{%- extends "base.tera" -%} diff --git a/src/lib.rs b/src/lib.rs index 8f53e17..db9d54b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -141,6 +141,8 @@ pub fn write_ebuild( let mut tera = tera::Tera::default(); let mut context = tera::Context::from_serialize(ebuild_data)?; + + tera.add_raw_template("base.tera", include_str!("base.tera"))?; if let Some(template) = template_path { tera.add_template_file(template, Some("ebuild.tera"))?; } else {