返回介绍

3.8.11. Source stamps connector

发布于 2023-09-20 23:50:40 字数 5773 浏览 0 评论 0 收藏 0

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.11. Source stamps connector

class buildbot.db.sourcestamps.SourceStampsConnectorComponent

This class manages source stamps, as stored in the database. A source stamp uniquely identifies a particular version of a single codebase. Source stamps are identified by their ID. It is safe to use sourcestamp ID equality as a proxy for source stamp equality. For example, all builds of a particular version of a codebase will share the same sourcestamp ID. This equality does not extend to patches: two sourcestamps generated with exactly the same patch will have different IDs.

Relative source stamps have a revision of None, meaning “whatever the latest is when this sourcestamp is interpreted”. While such source stamps may correspond to a wide array of revisions over the lifetime of a Buildbot installation, they will only ever have one ID.

An instance of this class is available at master.db.sourcestamps.

Sourcestamps are represented by dictionaries with the following keys:

  • ssid

  • branch (branch, or None for default branch)

  • revision (revision, or None to indicate the latest revision, in which case this is a relative source stamp)

  • patchid (ID of the patch)

  • patch_body (body of the patch, or None)

  • patch_level (directory stripping level of the patch, or None)

  • patch_subdir (subdirectory in which to apply the patch, or None)

  • patch_author (author of the patch, or None)

  • patch_comment (comment for the patch, or None)

  • repository (repository containing the source; never None)

  • project (project this source is for; never None)

  • codebase (codebase this stamp is in; never None)

  • created_at (timestamp when this stamp was first created)

Note that the patch body is a bytestring, not a unicode string.

findSourceStampId(branch=None, revision=Node, repository=None, project=None, patch_body=None, patch_level=None, patch_author=None, patch_comment=None, patch_subdir=None)
Parameters:
  • branch (unicode string or None) –

  • revision (unicode string or None) –

  • repository (unicode string or None) –

  • project (unicode string or None) –

  • codebase (unicode string (required)) –

  • patch_body (bytes or unicode string or None) – patch body

  • patch_level (integer or None) – patch level

  • patch_author (unicode string or None) – patch author

  • patch_comment (unicode string or None) – patch comment

  • patch_subdir (unicode string or None) – patch subdir

Returns:

ssid, via Deferred

Create a new SourceStamp instance with the given attributes, or find an existing one. In either case, return its ssid. The arguments all have the same meaning as in an ssdict.

If a new SourceStamp is created, its created_at is set to the current time.

getSourceStamp(ssid)
Parameters:
  • ssid – sourcestamp to get

  • no_cache (boolean) – bypass cache and always fetch from database

Returns:

ssdict, or None, via Deferred

Get an ssdict representing the given source stamp, or None if no such source stamp exists.

getSourceStamps()
Returns:

list of ssdict, via Deferred

Get all sourcestamps in the database. You probably don’t want to do this! This method will be extended to allow appropriate filtering.

getSourceStampsForBuild(buildid)
Parameters:

buildid – build ID

Returns:

list of ssdict, via Deferred

Get sourcestamps related to a build.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文