[bitbake-devel] [PATCH] fetch2: Shorten long srcrevs

Martin Jansa martin.jansa at gmail.com
Sun May 19 12:32:55 UTC 2013


On Sun, May 19, 2013 at 01:21:55PM +0300, Richard Purdie wrote:
> The long srcrevs are mainly used or the workdir construction as well as
> the package version. The long entries are hashes generated by the git fetcher
> and other scms using a similar revision mechanism.
> 
> We need these to change when the package changes however collisions are
> unlikely to happen within the domains we care about. The long revisions
> have generated negative user feedback due to the use in path and file
> names.
> 
> This patch therefore truncates the revisions to 10 characters maximum.

What about 7 characters like git log --oneline is using?

SRCREVs in recipes are still supposed to be 40 characters for git,
right? Because otherwise this part needs to be changed too:

lib/bb/fetch2/git.py
            # Ensure anything that doesn't look like a sha256
            # checksum/revision is translated into one
            if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):

Cheers,

> This should be safe in the contexts where these revisions are used as
> the chances of spatially close collisions is very low (distant
> collisions are not a major issue in the way we use these).
> 
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
> ---
> CC'd various people who I believe might have feelings about this. The
> patch depends on the sortable_revisions patch I just sent out.
> 
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index f8f8244..402329d 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -617,6 +617,8 @@ def get_srcrev(d):
>  
>      if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
>          autoinc, rev = urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0])
> +        if len(rev) > 10:
> +            rev = rev[:10]
>          if autoinc:
>              return "AUTOINC+" + rev
>          return rev
> @@ -633,6 +635,8 @@ def get_srcrev(d):
>          ud = urldata[scm]
>          for name in ud.names:
>              autoinc, rev = ud.method.sortable_revision(scm, ud, d, name)
> +            if len(rev) > 10:
> +                rev = rev[:10]
>              if autoinc and not seenautoinc:
>                  rev = "AUTOINC+" + rev
>                  seenautoinc
> 
> 

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/bitbake-devel/attachments/20130519/238171fd/attachment-0001.sig>


More information about the bitbake-devel mailing list