From: Khem Raj <raj.khem@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Chris Larson <chris_larson@mentor.com>
Subject: Re: [PATCH] metadata_scm: use rev-parse rather than show-ref
Date: Thu, 4 Nov 2010 11:17:41 -0700 [thread overview]
Message-ID: <20101104181741.GC21548@gmail.com> (raw)
In-Reply-To: <1288880282-13579-1-git-send-email-kergoth@gmail.com>
On (04/11/10 07:18), Chris Larson wrote:
> From: Chris Larson <chris_larson@mentor.com>
>
> show-ref will show all matching refs, so a "show-ref HEAD" will show not just
> the local HEAD, but the fetched remote ones as well. This isn't what we want
> for this function, so change it to use rev-parse with --verify, and also
> change it to use --short, to shorten the hash to a more palatable length.
>
> Signed-off-by: Chris Larson <chris_larson@mentor.com>
seems to hold on my limited testing
Acked-by: Khem Raj <raj.khem@gmail.com>
> ---
> classes/metadata_scm.bbclass | 22 +++++++++++++---------
> 1 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/classes/metadata_scm.bbclass b/classes/metadata_scm.bbclass
> index ffc6a8a..f79ea19 100644
> --- a/classes/metadata_scm.bbclass
> +++ b/classes/metadata_scm.bbclass
> @@ -63,14 +63,18 @@ def base_get_metadata_svn_revision(path, d):
> return revision
>
> def base_get_metadata_git_branch(path, d):
> - branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("PATH", 1))).read().rstrip()
> -
> - if len(branch) != 0:
> - return branch.replace("refs/heads/", "")
> - return "<unknown>"
> + try:
> + rev = oe_run(d, ["git", "symbolic-ref", "HEAD"], cwd=path).rstrip()
> + except oe.process.CmdError:
> + rev = "<unknown>"
> + else:
> + rev = rev.replace("refs/heads/", "")
> + return rev
>
> def base_get_metadata_git_revision(path, d):
> - rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip()
> - if len(rev) != 0:
> - return rev
> - return "<unknown>"
> + try:
> + rev = oe_run(d, ["git", "rev-parse", "--verify", "--short", "HEAD"],
> + cwd=path).rstrip()
> + except oe.process.CmdError:
> + rev = "<unknown>"
> + return rev
> --
> 1.7.2.3
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
prev parent reply other threads:[~2010-11-04 18:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-04 14:18 [PATCH] metadata_scm: use rev-parse rather than show-ref Chris Larson
2010-11-04 17:03 ` Tim Harvey
2010-11-04 18:17 ` Khem Raj [this message]
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=20101104181741.GC21548@gmail.com \
--to=raj.khem@gmail.com \
--cc=chris_larson@mentor.com \
--cc=openembedded-devel@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