From: Ross Burton <ross.burton@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH][RFC] classes: add gitupstream class
Date: Thu, 17 Nov 2016 15:50:35 +0000 [thread overview]
Message-ID: <1479397835-26630-1-git-send-email-ross.burton@intel.com> (raw)
This class lets you use BBCLASSEXTEND to add a variant of the recipe that
fetches from git instead of a tarball.
For example:
BBCLASSEXTEND = "gitupstream"
SRC_URI_class-gitupstream = "git://git.example.com/example"
SRCREV_class-gitupstream = "abcd1234"
This variant will have DEFAULT_PREFERENCE set to -1 so it needs to be selected
to be used, and any git-specific tweaks can be done with the class-gitupstream
override, for example:
DEPENDS_append_class-gitupstream = " gperf-native"
do_configure_prepend_class-gitupstream() {
touch ${S}/README
}
It currently only supports creating a git variant of the target recipe, not
native or nativesdk.
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
meta/classes/gitupstream.bbclass | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 meta/classes/gitupstream.bbclass
diff --git a/meta/classes/gitupstream.bbclass b/meta/classes/gitupstream.bbclass
new file mode 100644
index 0000000..64aab61
--- /dev/null
+++ b/meta/classes/gitupstream.bbclass
@@ -0,0 +1,23 @@
+CLASSOVERRIDE = "class-gitupstream"
+
+# TODO doesn't let you gitupstream a native recipe yet
+
+python gitupstream_virtclass_handler () {
+ # Do nothing if this is inherited, as it's for BBCLASSEXTEND
+ if "gitupstream" not in (e.data.getVar('BBCLASSEXTEND', True) or ""):
+ bb.warn("Don't inherit gitupstream, use BBCLASSEXTEND")
+ return
+
+ # TODO sanity check somehow?
+
+ d.setVar("DEFAULT_PREFERENCE", "-1")
+ d.setVar("S", "${WORKDIR}/git")
+
+ # Modify the SRCREV, if the recipe hasn't used PV_class-gitupstream to
+ # assign a +gitX PV already.
+ pv = d.getVar("PV", True)
+ if "+git" not in pv:
+ d.setVar("PV", pv + "+git${SRCPV}")
+}
+addhandler gitupstream_virtclass_handler
+gitupstream_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise"
--
2.8.1
next reply other threads:[~2016-11-17 15:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-17 15:50 Ross Burton [this message]
2016-11-17 16:07 ` [PATCH][RFC] classes: add gitupstream class Burton, Ross
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=1479397835-26630-1-git-send-email-ross.burton@intel.com \
--to=ross.burton@intel.com \
--cc=openembedded-core@lists.openembedded.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