openSUSE:Build Service Concept GitUpstreamSupport
概述
许多项目使用 git 作为他们的首选版本控制系统。为了创建一个简单流畅的工作流程,osc 和 obs 需要支持 git 树作为软件包源资源。
使用场景
当前工作流程
检出/克隆软件包,修改并提交
osc: osc co <prj> <pkg> cd <prj>/<pkg>
git: git clone <URL> <mypath> cd <mypath> work, branch, work, merge, commit, push create <tarball> mv <tarball> <prjdir> osc: adapt specfile osc build
git: fix error create <tarball> mv <tarball> <prjdir>
osc: osc adapt specfile osc build osc addremove osc commit
此工作流程需要许多步骤,容易出错且耗时过长。
建议的工作流程
检出/克隆软件包,修改并提交(使用 tarball 上传)
osc git clone <obsPRJ> <obsPKG> <gitURL> <localpath> [<branch2track>/defaultbranch:osc]
- 检出 BS 项目
- cd <obsPRJ>/<obsPKG>
- 将 git 仓库克隆到 <localpath>
- 使用以下内容编写 _git_repo 元文件:
- git_url=<gitURL>
- git_path=<localpath>
- git_branch=<branch2track>
- git_diff_head=FETCH_HEAD(=从服务器克隆的最新修订版)
- git_revision=<sha1>(=树中使用的修订号)
cd <localpath> normal work in git repository - no tarball creation needed cd ..
一个目标是保持当前 git 工作流程,而不是包装/干扰 git。
osc git refresh
- 从 INDEX 或 HEAD 或 FETCH_HEAD 生成补丁(待定)
- 从 INDEX 或 HEAD 或 FETCH_HEAD 生成 tar(待定)并写入 git_revision !
- 将补丁添加到 spec 文件
osc build cd <localpath> fix error cd .. osc git refresh osc build osc commit
此工作流程更容易且不易出错。
检出/克隆软件包,修改并提交(使用源服务)
此工作流程的扩展将使用源服务,并且仅提交包含修订号和补丁的文件,而不是完整的 tarball。源服务将在服务器上获取给定的修订版并创建一个 tarball。这将节省上传带宽,但显然对本地构建不利。
使用 _git_repo 文件(启用 git 插件)刷新现有的 Build Service 软件包
osc co <obsPRJ> <obsPKG>
检测到 _git_repo 会自动触发
git clone <gitURL> <localpath> (gitURL and localpath as defined in _git_repo) cd localpath git checkout -b <branch2track> <git_revision> (branch2track and git_revision as defined in _git_repo) patches found in the osc tree are applied on top of <git_revision>
Git 分支 <branch2track> 现在与提交的版本处于相同状态。根据需要进行 git 树内的正常工作。 osc git refresh,osc build,osc commit。
将 git 仓库功能添加到现有的 Build Service 软件包
更新现有软件包以使用 git 仓库。
osc co <obsPRJ> <obsPKG>
这是一个正常的检出。
osc git clone <gitURL> <localpath> <branch2track>
- 将 git 仓库克隆到 <localpath>
- 使用以下内容编写 _git_repo 元文件:
- git_url=<gitURL>
- git_path=<localpath>
- git_branch=<branch2track>
- git_diff_head=FETCH_HEAD(=从服务器克隆的最新修订版)
- git_revision=<sha1>(=树中使用的修订号)
待办事项:处理现有的补丁/tarball ! 目前
- “Source:”标签用于 git-tarball
- 不允许“外部”/非 git 补丁
其他工作流程
为不同的 Build Service 软件包使用不同的 git 分支
_git_repo 文件中定义的 git_branch 使得可以跟踪相同 git 树的不同分支以用于不同的软件包。
例如,分支 bash-stable 用于软件包 Base:System/bash,分支 bash-unstable 用于软件包 Devel:Incubating/bash。
:
