没有合适的资源?快使用搜索试试~ 我知道了~
首页quilt patch管理
资源详情
资源评论
资源推荐
How To Survive With Many Patches
or
Introduction to Quilt
∗
Andreas Gr¨unbacher, SuSE Labs
agruen@suse.de
June 12, 2005
Abstract
After lo oking at different strategies for dealing with software packages
that consist of a base software package on top of which a number of patches
are applied, this document introduces the script collection quilt, which was
specifically written to help deal with multiple patches and common patch
management tasks.
1 Introduction
In the old days, vendor specific software packages in the open source world
consisted of a file with the official version of the software, plus a patch file
with the additional changes needed to adapt the package to specific needs. The
official software package was usually contained in a package.tar.gz file, while
the patch was found in package.diff. Instead of modifying the official package
sources, local changes were kept separate. When building the software package,
the tar archive was extracted, and the patch was applied.
Over time, the patch file ended up containing several independent changes.
Of those changes, some were integrated into later versions of the software, while
other add-ons or adaptations remain external. Whenever a new official version
was integrated, the patch needed to be revised: changes that were already
integrated in the official version needed to be split from changes that were not.
A big improvement was to allow multiple patches in a vendor package, and
this is also how patches are handled today: a number of patches is applied
on top of each other. Each patch usually c onsists of a logically related set
of changes. When some patches get integrated upstream, those patches can
simply be removed from the vendor specific package. The remaining patches
∗
Quilt is a GPL licensed project hosted on GNU Savannah. Some ideas for this document
were taken from docco.txt in Andrew Morton’s patch management scripts package [1]. The
text in the examples was taken from A Midsummer Night’s Dream by William Shakespeare.
frequently continue to apply cleanly. Some of the remaining patches may have
to be maintained across a range of upstream versions because they are too
specific for the upstream software package, etc. These patches often get out of
sync, and need to be updated.
For the majority of packages, the numb e r of patches remains relatively low,
so maintaining those patches without tools is feasible. A number of packages
have dozens of patches, however. At the extreme end is the kernel source package
(kernel-source-2.4.x ) with more than 1 000 patches. The difficulty of managing
such a vast number of patches without tools can easily be imagined.
This document discusses different strategies of dealing with large sets of
patches. Patches are usually generated by the diff utility, and applied with the
patch utility. Different patch file formats are defined as part of the specification
of the diff utility in POSIX.1 [3]. The most commonly used format today,
unified diff, is not covered by POSIX.1, however. A good description of patch
file formats is found in the GNU diff info pages [4].
The question we try to answer in this document is how patches are best kept
up to date in face of changes both to the upstream software package, and to
the patches that precede them. After looking at some existing approaches, a
collection of patch management scripts known as quilt is describ e d [2], starting
with basic concepts, and progressing towards more advanced tasks.
2 Existing Approaches
The minimal solution for updating a patch is to apply all preceding patches.
Then, a copy of the resulting source tree is created.
1
The next patch in the
sequence of patches (which is the one to be updated) is applied to only one of
these source trees. This source tree is then modified until it reflects the desired
result. The new version of the patch is distilled by comparing the two source
trees with diff, and writing the result into a file.
This simple approach is rather error prone, and leaves much to be desired.
Several people have independently written scripts that automate and improve
upon this process.
A version control system like CVS or RCS may be a reasonable alternative
in some cases. The version control system is brought in the state of the working
tree with a number of patches applied. Then the next patch is applied. After
the working tree is updated as required, a diff between the repository copy and
the working tree is created (with cvs diff, e tc). In this scenario the version
control system is used to store and compare against the old repository version
only. The full version control overhead is paid, while only a small fraction of its
functionality is needed. Switching between different patches is not simplified.
1
The two copies can also be hard-linked with each o ther , which significantly speeds up
both the copying and the final “diffing”. If hard links are used, care must be taken that the
tools used to update one copy of the source tree will create new files, and will not overwrite
shared files. Editors like emacs and vi, and utilities like patch, support this.
2
One of the most advanced approaches is Andrew Morton’s patch manage-
ment scripts [1]. The author of this document found that none of the available
solutions would scale up to the specific requirements of the SUSE kernel-source
package, and started to improve Andrew Morton’s scripts until they became
what they are now [2].
3 Quilt: Basic Concepts and Operation
The remainder of this document discusses the script collection quilt.
With quilt, all work occurs within a single directory tree. Since version 0.30,
commands can be invoked from anywhere within the source tree. Commands
are of the form “quilt cmd,” similar to CVS commands. They can be abbreviated
as long as the specified part of the command is unique. All commands print
some help text with “quilt cmd -h.”
Quilt manages a stack of patches. Patches are applied incrementally on top
of the base tree plus all preceding patches. They can be pushed on top of the
stack (quilt push), and popped off the stack (quilt pop). Commands are available
for querying the contents of the series file (quilt series, see below), the contents
of the stack (quilt applied, quilt previous, quilt top), and the patches that are not
applied at a particular moment (quilt next, quilt unapplied). By default, mos t
commands apply to the topmost patch on the stack.
When files in the working directory are changed, those changes become part
of the working state of the topmost patch, provided that those files are part of
the patch. Files that are not part of a patch must be added before modifying
them so that quilt is aware of the original versions of the files. The quilt refresh
command regenerates a patch. After the refresh, the patch and the working
state are the same.
Patch files are located in the patches sub-directory of the source tree (se e
Figure 1). The QUILT
PATCHES environment variable can be used to override
this location. The patches directory may contain sub-directories. patches may
also be a symbolic link instead of a directory.
A file called series contains a list of patch file names that defines the order in
which patches are applied. Unless there are means by which series files can be
generated automatically (see Section 5.8), they are usually provided along with
a set of patches. In series, each patch file name is on a separate line. Patch files
are identified by pathnames that are relative to the patches directory; patches
may be in sub-directories below the patches directory. Lines in the series file
that start with a hash character (#) are ignored. When quilt adds, removes,
or renames patches, it automatically up dates the series file. Users of quilt can
modify series files while some patches are applied, as long as the applied patches
remain in their original order.
Different series files can be used to assemble patches in different ways, cor-
responding for example to different development branches.
Before a patch is applied (or “pushed on the stack”), copies of all files the
3
剩余11页未读,继续阅读
内核老工人
- 粉丝: 8
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- zigbee-cluster-library-specification
- JSBSim Reference Manual
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1