From: Saul Wold <sgw@linux.intel.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: "Hart, Darren" <darren.hart@intel.com>,
bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [PATCH] fetch2/git: Clean up sortable_revision
Date: Wed, 22 May 2013 15:27:29 -0700 [thread overview]
Message-ID: <519D4651.2030506@linux.intel.com> (raw)
In-Reply-To: <1368958678.32727.92.camel@ted>
On 05/19/2013 03:17 AM, Richard Purdie wrote:
> Now we no longer try and provide increasing values from the fetcher,
> we can simplify the function structure for the sortable_revision
> pieces and move the AUTOINC handling directly into the function
> which needs it, simplifying the code.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index dd1cc93..f8f8244 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -616,7 +616,10 @@ def get_srcrev(d):
> raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
>
> if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
> - return urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0])
> + autoinc, rev = urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0])
> + if autoinc:
> + return "AUTOINC+" + rev
> + return rev
>
> #
> # Mutiple SCMs are in SRC_URI so we resort to SRCREV_FORMAT
> @@ -625,18 +628,14 @@ def get_srcrev(d):
> if not format:
> raise FetchError("The SRCREV_FORMAT variable must be set when multiple SCMs are used.")
>
> - autoinc = False
> - autoinc_templ = 'AUTOINC+'
> + seenautoinc = False
> for scm in scms:
> ud = urldata[scm]
> for name in ud.names:
> - rev = ud.method.sortable_revision(scm, ud, d, name)
> - if rev.startswith(autoinc_templ):
> - if not autoinc:
> - autoinc = True
> - format = "%s%s" % (autoinc_templ, format)
> - rev = rev[len(autoinc_templ):]
> -
> + autoinc, rev = ud.method.sortable_revision(scm, ud, d, name)
> + if autoinc and not seenautoinc:
> + rev = "AUTOINC+" + rev
> + seenautoinc
Should this be: seenautoinc = True ??
Sau!
> format = format.replace(name, rev)
>
> return format
> @@ -1280,14 +1279,8 @@ class FetchMethod(object):
> return rev
>
> def sortable_revision(self, url, ud, d, name):
> - """
> -
> - """
> - if hasattr(self, "_sortable_revision"):
> - return self._sortable_revision(url, ud, d)
> -
> latest_rev = self._build_revision(url, ud, d, name)
> - return 'AUTOINC+%s' % str(latest_rev)
> + return True, str(latest_rev)
>
> def generate_revision_key(self, url, ud, d, name):
> key = self._revision_key(url, ud, d, name)
> diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py
> index 58e80c8..5d9e5f9 100644
> --- a/bitbake/lib/bb/fetch2/bzr.py
> +++ b/bitbake/lib/bb/fetch2/bzr.py
> @@ -132,12 +132,12 @@ class Bzr(FetchMethod):
>
> return output.strip()
>
> - def _sortable_revision(self, url, ud, d):
> + def sortable_revision(self, url, ud, d, name):
> """
> Return a sortable revision number which in our case is the revision number
> """
>
> - return self._build_revision(url, ud, d)
> + return False, self._build_revision(url, ud, d)
>
> def _build_revision(self, url, ud, d):
> return ud.revision
> diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
> index cbf929e..9a779d2 100644
> --- a/bitbake/lib/bb/fetch2/svn.py
> +++ b/bitbake/lib/bb/fetch2/svn.py
> @@ -178,12 +178,12 @@ class Svn(FetchMethod):
>
> return revision
>
> - def _sortable_revision(self, url, ud, d):
> + def sortable_revision(self, url, ud, d, name):
> """
> Return a sortable revision number which in our case is the revision number
> """
>
> - return self._build_revision(url, ud, d)
> + return False, self._build_revision(url, ud, d)
>
> def _build_revision(self, url, ud, d):
> return ud.revision
>
>
>
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/bitbake-devel
>
prev parent reply other threads:[~2013-05-22 22:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-19 10:17 [PATCH] fetch2/git: Clean up sortable_revision Richard Purdie
2013-05-19 16:59 ` Darren Hart
2013-05-22 22:27 ` Saul Wold [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=519D4651.2030506@linux.intel.com \
--to=sgw@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=darren.hart@intel.com \
--cc=richard.purdie@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.