From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/cargo-ebuild:master commit in: src/
Date: Wed, 25 Aug 2021 15:35:05 +0000 (UTC) [thread overview]
Message-ID: <1629904289.b01082acb7bb01817247bd5947b9d59294a885fb.gyakovlev@gentoo> (raw)
commit: b01082acb7bb01817247bd5947b9d59294a885fb
Author: Luca Barbato <lu_zero <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 29 15:16:48 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> 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 <lu_zero <AT> gentoo.org>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> 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 {
next reply other threads:[~2021-08-25 15:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-25 15:35 Georgy Yakovlev [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-01-04 20:23 [gentoo-commits] proj/cargo-ebuild:master commit in: src/ Georgy Yakovlev
2023-01-04 19:51 Georgy Yakovlev
2023-01-04 19:51 Georgy Yakovlev
2021-10-07 19:03 Georgy Yakovlev
2021-08-26 7:51 Georgy Yakovlev
2021-08-25 15:35 Georgy Yakovlev
2021-08-25 15:35 Georgy Yakovlev
2021-08-03 4:58 Georgy Yakovlev
2021-08-02 6:57 Georgy Yakovlev
2021-06-19 22:34 Georgy Yakovlev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1629904289.b01082acb7bb01817247bd5947b9d59294a885fb.gyakovlev@gentoo \
--to=gyakovlev@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox