Chinaunix首页 | 论坛 | 博客
  • 博客访问: 295888
  • 博文数量: 34
  • 博客积分: 3092
  • 博客等级: 中校
  • 技术积分: 1003
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-13 13:21
文章分类

全部博文(34)

文章存档

2020年(2)

2016年(1)

2011年(1)

2010年(11)

2009年(13)

2008年(6)

我的朋友

分类: BSD

2009-07-17 00:32:53

在刚开始的初学者都希望教材就是一撇一捺的学习,但是这样的文档就是没有,所以我还是要改,哪怕是改的面目全非还是要改,要在这些经典上动手脚。
匿名CVS 2009-04-18 2:29 
原文网址:

匿名CVS
目录
什么是匿名CVS?
什么是CVS?
开始使用匿名CVS
使用CVS获取并更新你的代码树
可用的匿名CVS服务器
通过cvs(1)获取源代码中加密代码的一些问题
使用cvs(1)的例子
使用rsh(1)还是ssh(1)?
通过sup(1)镜像CVS仓库
建立一个匿名镜像
 
什么是匿名CVS?
匿名CVS是一种保持本地OpenBSD代码树与当前OpenBSD代码树同步的方法。 除了可以获得目前OpenBSD最尖端的新技术, 它还可以用来获取发行版勘误表中的补丁。
与其它源代码更新技术相比, 匿名CVS的主要优势是可以直接通过核心源代码库或其镜像站点进行更新, 这意味着你可以使用全套的CVS命令来控制系统的整合、更新及执行比较。可在中心源代码库上针对不同历史版本的数据库进行查询。
目前的OpenBSD项目有四个不断更新的源代码库以及两个历史代码库:
src - 存放OpenBSD操作系统的原有源代码。
ports - 存放OpenBSD的Ports。
www - 存放所有OpenBSD的web页面, (包含本页)。
xenocara - 存放OpenBSD的不断更新的X.org v7源代码树。
X11 and XF4 - 收藏着经OpenBSD改写的 XFree86-3 和 XFree86-4 源代码树。 这些代码树放在这里仅仅是为了展示OpenBSD历史, 绝大多数用户没有理由再使用这些代码树。
 
总而言之, 匿名CVS的真正魅力在于它是一个"宽容的"源代码控制系统 - 它尊重你对本地代码的修改并“尽可能”更新你的代码树, 而不是丢给你一个晦涩的错误清单, 让你不得不在继续前解决它们。
什么是CVS?
CVS 是一个源代码控制系统, 用来管理OpenBSD的源代码树。它保存着所有官方发行版及其变更的源代码资料库,同时允许开发人员可在其本地对资料库进行修正。 有两种访问源代码树的级别:
提供给开发者的可读写级别: 那些负责修正代码的开发人员必须有一个能修改源代码树的帐号。 拥有这种帐号的人可以和其他开发人员一起维护OpenBSD代码树。 如果你在某些地方做的很出色并得到了开发团队的认可, 你就可以获得这样的一个帐号。
提供给普通用户的只读级别: 任何人全可以只读地访问CVS仓库, CVS仓库的拷贝也常用这种方式镜像到其他的站点上。
 
CVS的强悍之处在于它可以智能地将中央代码仓库的变更与用户在本地所做的变更整合到一起, 这意味着你当你修改了一个系统组件后再进行升级或更新时, 你的修改不会被"覆盖", CVS会尽最大的可能整合代码树变化和用户自定义变化。
当源代码上的变化和用户自定义变化无法完全整合时, CVS提供一个"软着陆", 向本地拷贝提供注释的变化, 不修改你本地的变化而继续更新其它你请求的模块。
开始使用匿名CVS
尽管你能从一个AnonCVS(CVS匿名服务器)下载整个代码树, 但是你通常可以通过"预装"FTP或OpenBSD发行版CD上的源文件建立原始的本地代码树来节省你大量的时间和带宽, 特别是在你要运行 -稳定版 时, 因为稳定版相对于发行版来说仅有少量文件进行了修改。 提取CD上的源代码树到 /usr/src (假设你已经将CD挂载到了/mnt):

# cd /usr/src
# tar xzf /mnt/src.tar.gz
# cd /usr
# tar xzf /mnt/xenocara.tar.gz
# tar xzf /mnt/ports.tar.gz
 
 

FTP上下载的的源文件被分成了两部分以满足那些仅需要其中一部分的用户, 这两个文件是 sys.tar.gz, 包含了产生内核的文件, 和 src.tar.gz 包含了所有其它的 "用户岛" 工具。 通常, 不管怎样, 这两个文件你都需要安装。 假设下载的文件 src.tar.gz、sys.tar.gz和xenocara.tar.gz位于 /usr:
# cd /usr/src
# tar xzf ../sys.tar.gz
# tar xzf ../src.tar.gz
# cd /usr
# tar xzf xenocara.tar.gz
# tar xzf ports.tar.gz
 
 

并非任何用户全希望解包全部的组件, 但是因为系统必须保持同步, 你需要建立所有的组件的代码树。
你也可以仅使用cvs(1)来为你"校验"源代码仓库。这将在 下一小节 进行讨论。
接下来, /usr/src 将会称为一个仔细校验过的目录, 在这个目录内可以使用所有的 cvs(1) 命令。
使用CVS来获取并更新你的源代码树
CVS是方便地重新获取或更新的本地源代码的一种方法。 你首先需要确定你是想将本地版本跟进为当前版或更新成稳定版。 当前版包含了所有代码最新的变动(甚至一分钟前刚更新的源代码), 相反稳定版仅包含了常规发行版加上勘误表上公布的补丁, 版本仅进行了少量的修正。想更深入的了解各种"风格"的OpenBSD, 看这里。
一旦你决定跟进为哪种版本, 你必须确定使用哪个匿名CVS服务器, 下面提供了一个CVS服务器清单。
一旦你选择好了匿名CVS服务器, 你就可以开始使用它了。购买了CD的用户可以用上述方法从CD上的文件获得本地代码树。 如果你没有CD, 请使用下面的方法获取你的代码树, 这个方法将OpenBSD源代码树导入 /usr/src。

# cd /usr; cvs checkout -P src

上面的命令将会获取当前版的源代码树。 读者当中的很多人可能想获得稳定版的源代码树。获取稳定版的分支你必须在命令后面加上一个版本描述标签, 例如:

# cd /usr; cvs checkout -P -rOPENBSD_4_4 src

或者用 OPENBSD_4_3 表示想获得OpenBSD 4.3的稳定版代码树。
这里的 OPENBSD_4_4 标签是指包含了发行版源代码树及其应用补丁的源代码。
可用的匿名CVS服务器
请先看下面关于 ssh 和 rsh 的说明!
 

Location: University of Erlangen-Nuremberg, Erlangen, Germany.
Maintained by Alexander von Gernler.
Protocols: ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA) 1024 fc:94:b0:c1:e5:b0:98:7c:58:43:99:76:97:ee:9f:b7
(DSA) 1024 a9:00:3f:ba:50:81:16:d1:e9:b8:4f:3c:b2:10:e2:6c
 


Host also known as anoncvs.usa.openbsd.org, anoncvs4.usa.openbsd.org.
Location: Redwood City, CA, USA.
Maintained by Todd C. Miller.
Protocols: rsh, ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 1024 64:de:26:16:c2:ff:1b:c7:24:ed:a4:4a:d7:2f:69:3e
(RSA) 1024 49:67:9a:46:62:8a:3f:4e:b3:63:ca:d6:41:29:2a:2f
(DSA) 1024 a7:75:49:77:f3:47:d1:3c:5e:65:84:84:3b:03:f1:33
 


Location: National Center for Atmospheric Research, Boulder, CO, USA.
Maintained by Todd C. Miller.
Protocols: rsh, ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 2048 80:cd:f6:fc:4f:0e:cb:80:6a:d0:6a:5e:dd:9e:5d:0a
(RSA) 2048 49:6f:4a:be:02:63:0d:c0:54:b0:57:f0:48:7f:ce:16
(DSA) 1024 f9:ab:fc:60:a3:15:8f:9c:47:24:9e:92:15:78:0d:f3
 


Location: Lake in the Hills, IL, USA.
Maintained by Joshua Stein.
Protocols: ssh.
Updated every 3 hours.
SSH fingerprints:
(RSA) 1024 54:74:ca:17:d0:07:c3:53:b7:7e:1d:9b:10:bf:04:37
(DSA) 1024 46:78:40:52:7a:18:f9:0e:68:61:b0:27:29:f9:d9:c4
 


Location: Michigan Technological University, Houghton, Michigan, USA.
Maintained by Chris Linn.
Protocols: ssh.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 2048 d7:91:a2:f4:d2:8d:81:7f:3c:44:91:8f:b5:b9:46:48
(RSA) 2048 de:f1:09:85:a0:db:60:97:d4:95:0d:07:80:4e:ee:68
(DSA) 1024 78:05:5c:c7:ce:7e:6f:c8:6d:b7:e2:7e:ba:06:1c:40
 


Location: Vienna, Austria.
Maintained by Martin Reindl.
Protocols: ssh, ssh port 2022.
Updated every 2 hours from anoncvs1.usa.openbsd.org.
SSH fingerprints:
(RSA) 2048 e4:a7:3a:ab:e1:a7:c8:eb:5c:f4:ff:38:95:6f:81:f2
(DSA) 2048 66:03:a3:bc:46:85:f3:6c:4b:6b:e3:d4:f5:5f:a6:c4
 


Host also known as anoncvs.ca.openbsd.org, openbsd.sunsite.ualberta.ca.
Location: Edmonton, Canada.
Maintained by Bob Beck.
Protocols: ssh, ssh port 2022.
Updated every 2 hours.
 


Location: Toronto, Canada.
Maintained by Brad Smith.
Protocols: ssh, ssh port 2022.
Updated every 2 hours.
 


Location: Elion, Tallinn, Estonia.
Maintained by Rivo Nurges.
Protocols: ssh.
Updated every 2 hours from cvsync.de.openbsd.org.
SSH fingerprints:
(RSA) 1024 e1:12:fb:6b:e5:c0:6a:b3:f8:ca:b1:4c:20:fb:5e:07
(DSA) 1024 bb:5c:44:f4:d9:12:3b:22:08:a9:12:c5:0c:e7:db:49
 


Location: Paris, France.
Maintained by Frank Denis.
Protocols: ssh, ssh port 2022.
Updated every 2 hours from anoncvs3.usa.openbsd.org.
SSH fingerprints:
(RSA1) 2048 4d:60:d8:ab:bc:c6:29:64:b4:45:1b:98:2b:fe:40:7e
(RSA) 2048 01:f1:c4:25:c8:e3:0d:0e:7a:33:94:14:f4:9d:98:5f
(DSA) 2048 73:36:41:46:fd:0a:67:df:e6:c1:4a:6b:02:61:f4:61
 


Location: Nürnberg, Germany.
Maintained by Armin Wolfermann.
Protocols: ssh.
Updated every 4 hours from anoncvs1.usa.openbsd.org.
SSH fingerprints:
(RSA) 1024 f2:73:d2:f6:e3:01:ef:ca:3b:e7:6c:80:b6:bd:bb:84
(DSA) 1024 fb:33:05:62:96:20:cf:88:7e:10:cb:8d:91:72:57:32
 


Location: Budapest, Hungary.
Maintained by Robert Nagy.
Protocols: ssh.
Updated every 3 hours from anoncvs.de.openbsd.org.
 


Host also known as kankoromochi.econ.nagasaki-u.ac.jp.
Location: Nagasaki University, Faculty of Economics, Nagasaki, Japan.
Maintained by Suzuki Itoshi.
Protocols: ssh, pserver.
Updated every 3 hours.
 


Location: TVK, Cable TV and Internet Services, Taurage, Lithuania.
Maintained by Donatas Budvytis.
Protocols: ssh.
Updated every 3 hours from cvsup.no.openbsd.org.
 


Host also known as anoncvs.calyx.nl.
Location: Amsterdam, The Netherlands.
Protocols: ssh.
Updated every 3 hours.
 


Host also known as cvs.inet.no.
Location: Oslo, Norway.
Maintained by Michael Schuldman.
Protocols: ssh, ssh port 2022.
Updated every 4 hours from rsync.de.openbsd.org.
 


Location: Warsaw, Poland.
Maintained by Piotr Klein.
Protocols: ssh.
Updated every 3 hours.
 


Host also known as nina.kerberos.si.
Location: Ljubljana, Slovenia.
Maintained by Mitja Muzenic.
Protocols: ssh.
Updated every 2 hours from cvsync.de.openbsd.org.
 


Location: Stockholm, Sweden.
Maintained by Viktor Holmlund.
Protocols: ssh.
Updated every 3 hours from rsync.de.openbsd.org.
 


Location: DePaul University, Chicago, IL, USA.
Maintained by Eric Pancer.
Protocols: ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 1024 5b:1c:cb:b7:5f:82:82:cc:af:13:21:a4:2c:c2:55:6b
(RSA) 1024 18:0f:97:2a:cf:6c:7f:d4:ca:2b:bc:c8:b9:56:2b:86
(DSA) 1024 65:cb:ce:7c:3e:29:5c:82:0b:9d:fa:b7:bb:e0:4b:47
 


Location: CalPOP, Los Angeles, CA, USA.
Maintained by Brian Brombacher.
Protocols: ssh, ssh port 2022, pserver.
Updated every 3 hours from rt.fm.
SSH fingerprints:
(RSA1) 2048 e4:22:93:81:84:e0:68:8c:0b:d5:1f:78:cd:6f:fa:c3
(RSA) 2048 8f:42:bd:b0:a2:94:df:6b:af:1e:96:03:ea:68:03:d9
(DSA) 1024 26:51:e8:b3:38:88:dc:a8:2a:98:59:86:ab:40:bb:a4
 


Location: New York Internet, New York, NY, USA.
Maintained by Michael Shalayeff.
Protocols: rsh, ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 1024 ff:97:fc:34:c6:09:7f:b2:bd:31:4e:d5:51:ce:f3:44
(RSA) 1024 05:ac:be:be:f8:f6:ab:63:5e:80:6c:be:d3:31:41:cd
(DSA) 1024 89:be:38:4d:2a:1b:1a:db:93:65:9d:36:7f:ee:d2:76
 


Location: Frontier Communications, Rochester, NY, USA.
Maintained by jared r r spiegel.
Protocols: ssh.
Updated every 4 hours from anoncvs.ca.openbsd.org.
 
 

注意: 如果你的服务器信息有误, 请联系
你可能希望运行 traceroute(8) 来寻找理你最近的服务器。 如果一台服务器有问题, 你可以咨询他的维护者。
通过cvs(1)获取源代码中加密代码的一些问题
重要说明: 这里有一些每个人应该知道的有关加密软件的一些问题:
OpenBSD的源代码来自加拿大。 因为通过加拿大独立研究 并根据 加拿大出口控制清单的描述, OpenBSD可以发放到石阶上任何地方。
 
然而, 如果你不在美国或加拿大, 你不应该从位于美国的匿名CVS服务器上下载OpenBSD的源代码。有问题的文件是... src/kerberosIV/*
src/kerberosV/*
src/lib/libdes/*
src/lib/libc/crypt/crypt.c
src/lib/libc/crypt/morecrypt.c
src/sys/crypto
src/sys/netinet
src/usr.sbin/afs/src/rxkad/*
XF4/xc-mit/lib/Xdmcp/Wraphelp.c
XF4/xc-old/lib/Xdmcp/Wraphelp.c
XF4/xc/lib/Xdmcp/Wraphelp.c
 
因为根据美国政府的商业法规, 加密软件仅允许在加拿大或美国分发。
 
使用cvs(1)的例子
注意: 如果你想从一个分支(例如稳定版)更新到当前版, 你需要使用cvs时添加 -A 标签, 除此以外这个标签很少用到。 一些以往的OpenBSD文档在很多例子中使用了这个标签, 但是除非确实需要, 我们不再推荐使用此标签。
一个例子:

$ cd /tmp
$ cvs -d get src/sys/arch/sparc
[将CVS仓库上的文件拷贝到本地]
$ cd src/sys/arch/sparc
$ cvs log locore.s
[显示文件的提交信息]
$ cvs diff -bc -r1.1 -r1.5 locore.s
[显示版本1.1和1.5之间的变化]

为了使用一台cvs ``pserver'' (不使用ssh或rsh, 采用TCP直接连接) 你必须登录:

$ cvs -d :pserver:anoncvs@anoncvs.ca.openbsd.org:/cvs login
(Logging in to )
CVS password: anoncvs
[This writes a line to ~/.cvspass (filename over-ridden by CVS_PASSFILE).]
[An example line from my ~/.cvspass after typing 'blah' for the above ]
[password is: ]
[:pserver:anoncvs@anoncvs5.usa.openbsd.org:/cvs Au'yc ]
[After logging in ONCE every other use of the above CVSROOT will work. ]
$ cvs -d :pserver:anoncvs@anoncvs.ca.openbsd.org:/cvs get ksrc-i386 ksrc-common
[Allows you to retrieve ONLY that necessary to rebuild an i386 kernel. ]

这里是用户怎样通过匿名cvs服务器有规律地更新源代码树:
首先, 开始通过 `get'获取初始源代码树: (如果你跟进当前版):

# cd /usr
# cvs -qd get -P src

(如果你跟进4.4的稳定版):

# cd /usr
# cvs -qd get -rOPENBSD_4_4 -P src
 

以后无论何时, 要`更新'这个代码树: (如果你跟进当前):

# cd /usr/src
# cvs -q up -Pd

(如果你跟进4.4稳定版):

# cd /usr/src
# cvs -q up -rOPENBSD_4_4 -Pd

每次你运行时它将同步你的 /usr/src 树。 它不会损坏任何你修改过的本地设置, 而是将变化整合到你的系统内。
 
说明: 如果你想从另一台服务器上更新你的源代码树(不是你最初获得源代码树的服务器), 或者你最初是从CD建立的本地代码树, 你必须为cvs增加 -d 选项。
# cd /usr/src
# cvs -d -q up -Pd
 
 

更新ports, 和src类似:
(如果你跟进当前版):

# cd /usr
# cvs -qd get -P ports

(如果你跟进4.4的稳定版):

# cd /usr
# cvs -qd get -rOPENBSD_4_4 -P ports
 

以后无论何时, 要"更新"这个代码树: (如果你跟进当前版):

# cd /usr/ports
# cvs -q up -Pd

(如果你跟进4.4的稳定版):

# cd /usr/ports
# cvs -q up -rOPENBSD_4_4 -Pd
 
 

上面的例子中, -q 标签是可选项, 目的仅是最小化cvs输出。 如果你希望欣赏满屏的输出,可以保留这个选项。 应用一个本地补丁模式的变化(这里用cd.c) 包含一个错误报告:

# cd /usr
# cvs diff -u src/sys/scsi/cd.c > /tmp/patch

cvs(1)用户手册 (包含了CVS原始资料) 包含了更详尽的信息。
警告: 使用cvs时你应该仔细选择你的当前目录,无论是你指定的代码树根目录或是一个单独的空间(例如/tmp).一些命令例如"get"可以在当前目录下建立任意的子目录, 以后的升级会递归地充实这些子目录。
匿名cvs服务给经验不足的开发人员提供了一个学习CVS操作的机会并且在获得"委托"访问前完全涉及程序的开发 -- 因为显示有用的技能和高质量的成果后他们自然会获得开发者访问权限。同时, 程序员提供的补丁相对于CVS树会产生它们的"diff", 这将方便整合。
使用rsh(1)还是ssh(1)?
CVS支持三种客户端到服务器访问方式: ssh: 也就是Secure Shell, 它可用于访问匿名CVS服务器, 这是推荐的方式, 因为它是加密的。
rsh: 也就是Remote Shell, 它可用于访问某些CVS服务器, 主要是针对那些无法采用ssh方法访问服务器的用户。
pserver: pserver主要用于那些位于阻碍双方连接的防火墙之后的用户。
 
注意: 对那些希望使用rsh的用户来说, 你必须先将CVS_RSH环境变量指向rsh(1)程序:
对 Korn/Bourne shells:
$ export CVS_RSH=/usr/bin/rsh
 

对 csh/tcsh:
% setenv CVS_RSH /usr/bin/rsh
 
 

默认情况下, OpenBSD的CVS客户端使用ssh ("secure shell": OpenSSH) 与CVS服务器交换信息。
很多的CVS站点基于安全的原因不再提供对 rsh 或 pserver 的支持。 用户本地的问题, 如防火墙或不完善的协议模拟(例如slirp)也可能阻碍你使用rsh。 但是, 如果你希望使用rsh, 你必须将CVS_RSH环境变量指向rsh (一般是 /usr/bin/rsh)。
如果你的本地策略阻止出站连接使用ssh的默认22端口, 你可以尝试使用端口2022。 注意, 不管怎样说, 并非所有的匿名cvs服务器支持对2022的访问。 还有就是, 多数anoncvs服务器不再支持没有密码的访问, 因为在最近的ssh版本中因为安全原因已经禁用了此功能。 另外, 不要总想着开启ssh的压缩功能: CVS 已经压缩了。
用户可以在自己的目录 $HOME/.ssh/config 内进行下列配置文件的指定以避免上面提到的限制和缺陷:

Host anoncvs.ca.openbsd.org
Compression no
Port 2022

CVS启动时有些杂乱; 要使它安静一些你可以这样:

$ export CVS_CLIENT_PORT=-1
 

通过sup(1)镜像CVS仓库
那些想自己镜像CVS树的用户现在可以通过 anoncvs.usa.openbsd.org 或者 anoncvs3.usa.openbsd.org (它们是不同的机器)来实现。 注意这是cvs树, 不是用来获取源代码的代码树。 这仅在你想快速完成cvs操作(diff, annotate, 等) 或者你有多台计算机你想只从cvs服务器仅下载一次新数据时(你的其它计算机可以从本地的cvs镜像上获取代码树)。
一个supfile文件的简单例子:

cvs host=anoncvs.usa.openbsd.org hostbase=/ base=/home delete

这会将cvs树镜像到 /home/cvs 目录内,同时sup数据文件镜像到 /home/sup。 OpenBSD完整的cvs树大约3.5GB左右,自然它还在不断增加中。
建立一个匿名镜像
如果你想建立一个匿名的镜像站点并向公众提供服务, 请联络anoncvs 维护人员。 匿名镜像需要大约3.5GB的磁盘空间(但还在增加中!), 并且要为每个用户提供32MB的交换空间(这里假设用户进行的是大型的操作; 尽管一般操作占用的资源会少一些, 但是anoncvs仍会比ftp或sup消耗更多的资源). 这样的anoncvs服务器应该对附近区域的用户来说有极好的网络带宽。 这个文档对如何建立anoncvs服务器进行了描述。
最终注意事项
升级完你的代码树, 你应该在尝试构建前先阅读 /usr/src/Makefile 文件头部的注释内容, 同时, 如果可能你应该在 make build 前先构建一个新的内核, 在某些情况下可能必须先rebuild和安装config工具你才能构建你的新内核, 如果 config GENERIC 这个步骤失败就极有可能属于这种情况。 强调一个重要的注意事项:通过rebuild源代码从发行版升级到当前版的代码树是很困难的, 因为各种软件的依赖包经常不明确, 因此, 我们建议你先安装一个最新的snapshot版后再从源码进行构建。

$OpenBSD: anoncvs.html,v 1.295 2009/02/20 18:17:06 beck Exp $

 
 
 
 
 
 
————————————————————以下是英文版————————————————————
 
Anonymous CVS
--------------------------------------------------------------------------------
Table Of Contents
What is Anonymous CVS?
What is CVS?
Getting Started Using Anonymous CVS
Using CVS to Get and Update your Source Tree
Available Anonymous CVS Servers
Getting crypto sources through cvs(1)
Example usages for cvs(1)
Use rsh(1) or ssh(1)?
Mirroring the CVS repository via sup(1)
Setting up an anoncvs mirror
--------------------------------------------------------------------------------
What is Anonymous CVS?
Anonymous CVS is a method of keeping your local copy of the OpenBSD source tree up to date with respect to changes made to current OpenBSD sources. In addition to following the bleeding edge of development, it is also possible to track the patches for errata of a release.
The major advantage of Anonymous CVS over other source code update techniques is that it works directly against a central source code repository or mirror. This means that you have the full set of CVS commands available to control merging and updating your changes with other source changes and for performing diffs, change histories and other queries against the central repository.
The OpenBSD Project currently has four active and two historic source repositories:
src - Houses all source code for the OpenBSD Operating System.
ports - Houses the OpenBSD Ports.
www - Houses all OpenBSD web pages. (Including this one).
xenocara - Houses OpenBSD's active X.org v7 source tree.
X11 and XF4 - Houses OpenBSD's adaptation of the XFree86-3 and XFree86-4 source trees. These are here just for historical purposes, most users will have no reason to use this tree, it is no longer being used.
To summarize, the real strength of using Anonymous CVS is that it is a "tolerant" source code control system - it respects changes that you have made to your local sources and makes "best efforts" to update your entire source tree, rather than leaving you a list of arcane problems that have to be resolved before continuing.
What is CVS?
CVS is the source code control system used to manage the OpenBSD source tree. It implements a central repository for all officially released source code and changes, while permitting developers to maintain local copies of the source code with their working changes. There are two levels of source tree access:
Read-write access for developers: Developers who need to commit changes to the source tree must have an account on the OpenBSD machines. Getting this access will be a natural result of working on the sources with other OpenBSD developers. If someone does some good work and shows they can work with the team, they will get an account.
Read-only access for everyone: Anyone can access the read-only CVS repositories. These copies of the read-write CVS repository are mirrored often.
The major strength of CVS is that it has the ability to perform intelligent merges of changes to the central repository with changes that you make to your local copy. This means that if you make a change to a module and perform an update, your changes are not "blown away", rather CVS makes best efforts to merge the changes made to the central sources with changes you've made to your local copy.
In the event that the changes can't be completely merged, CVS provides a "soft fallback", providing you with annotated changes to your local copy, preserving an unmodified copy of your version and continuing to update any other source modules you requested.
Getting Started Using Anonymous CVS
While you can download the entire source tree from an AnonCVS server, you can often save a lot of time and bandwidth by "preloading" your source tree with the source files from either the OpenBSD CD or from an FTP server. This is particularly true if you are running -stable, as relatively few files change between the -release and -stable.
To extract the source tree from the CD to /usr/src (assuming the CD is mounted on /mnt):
    # cd /usr/src
    # tar xzf /mnt/src.tar.gz
    # cd /usr
    # tar xzf /mnt/xenocara.tar.gz
    # tar xzf /mnt/ports.tar.gz
The source files for download from the FTP servers are separated into two files to minimize the time required to download for those wishing to work with only one part of the tree. The two files are sys.tar.gz, which contains the files used to create the kernel, and src.tar.gz which contains all the other "userland" utilities. In general, however, you will usually want both of them installed. Assuming the downloaded files, src.tar.gz, sys.tar.gz and xenocara.tar.gz are in /usr:
    # cd /usr/src
    # tar xzf ../sys.tar.gz
    # tar xzf ../src.tar.gz
    # cd /usr
    # tar xzf xenocara.tar.gz
    # tar xzf ports.tar.gz
Not all people will wish to unpack all the file sets, but as the system must be kept in sync, you will generally need to set up all trees.
You can also just use cvs(1) to "checkout" the source repository for you. This is discussed in the next section.
After this, /usr/src will be a nice checkout area where all cvs(1) commands will work properly.
Using CVS to get and update your source tree
CVS was designed to be a simple way to retrieve and update your sources. You must first decide whether you want to track -current or a patch branch. The current tree has all of the up to the minute changes, whereas a patch branch contains a formal release plus the patches from the errata and lesser issues already applied. For more information on these "flavors" of OpenBSD, see here.
Once you have decided which tree to follow, you must choose which Anonymous CVS server you are going to use. A list of these servers is below.
Once you have chosen which Anonymous CVS Server you will use, you can start using cvs. For those of you who have CDs you can start with the CVS checkout that is on the CD by using the method above to get the sources onto your system. If you don't have a CD handy, use the method below to checkout the sources. This method puts the OpenBSD source tree into /usr/src.
 # cd /usr; cvs checkout -P src
The above will checkout the current source tree. Many of you will only want the patch branch sources. To checkout a patch branch, you must specify a tag along with your command. Example:
 # cd /usr; cvs checkout -P -rOPENBSD_4_5 src
Or OPENBSD_4_4 for 4.4, etc.
The OPENBSD_4_5 tag contains the release sources and errata already applied.
Available Anonymous CVS Servers
Please see the note about ssh vs. rsh below!


Location: Paris, France.
Maintained by Landry Breuil.
Protocols: ssh.
Updated every 2 hours from anoncvs1.ca.openbsd.org.


Location: University of Erlangen-Nuremberg, Erlangen, Germany.
Maintained by Alexander von Gernler.
Protocols: ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA) 1024 fc:94:b0:c1:e5:b0:98:7c:58:43:99:76:97:ee:9f:b7
(DSA) 1024 a9:00:3f:ba:50:81:16:d1:e9:b8:4f:3c:b2:10:e2:6c


Host also known as anoncvs.usa.openbsd.org, anoncvs4.usa.openbsd.org.
Location: Redwood City, CA, USA.
Maintained by Todd C. Miller.
Protocols: rsh, ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 1024 64:de:26:16:c2:ff:1b:c7:24:ed:a4:4a:d7:2f:69:3e
(RSA) 1024 49:67:9a:46:62:8a:3f:4e:b3:63:ca:d6:41:29:2a:2f
(DSA) 1024 a7:75:49:77:f3:47:d1:3c:5e:65:84:84:3b:03:f1:33


Location: National Center for Atmospheric Research, Boulder, CO, USA.
Maintained by Todd C. Miller.
Protocols: rsh, ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 2048 80:cd:f6:fc:4f:0e:cb:80:6a:d0:6a:5e:dd:9e:5d:0a
(RSA) 2048 49:6f:4a:be:02:63:0d:c0:54:b0:57:f0:48:7f:ce:16
(DSA) 1024 f9:ab:fc:60:a3:15:8f:9c:47:24:9e:92:15:78:0d:f3


Location: Lake in the Hills, IL, USA.
Maintained by Joshua Stein.
Protocols: ssh.
Updated every 3 hours.
SSH fingerprints:
(RSA) 1024 54:74:ca:17:d0:07:c3:53:b7:7e:1d:9b:10:bf:04:37
(DSA) 1024 46:78:40:52:7a:18:f9:0e:68:61:b0:27:29:f9:d9:c4


Location: Michigan Technological University, Houghton, Michigan, USA.
Maintained by Chris Linn.
Protocols: ssh.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 2048 d7:91:a2:f4:d2:8d:81:7f:3c:44:91:8f:b5:b9:46:48
(RSA) 2048 de:f1:09:85:a0:db:60:97:d4:95:0d:07:80:4e:ee:68
(DSA) 1024 78:05:5c:c7:ce:7e:6f:c8:6d:b7:e2:7e:ba:06:1c:40


Location: Vienna, Austria.
Maintained by Martin Reindl.
Protocols: ssh, ssh port 2022.
Updated every 2 hours from anoncvs1.usa.openbsd.org.
SSH fingerprints:
(RSA) 2048 e4:a7:3a:ab:e1:a7:c8:eb:5c:f4:ff:38:95:6f:81:f2
(DSA) 2048 66:03:a3:bc:46:85:f3:6c:4b:6b:e3:d4:f5:5f:a6:c4


Host also known as anoncvs.ca.openbsd.org, openbsd.sunsite.ualberta.ca.
Location: Edmonton, Canada.
Maintained by Bob Beck.
Protocols: ssh, ssh port 2022.
Updated every 2 hours.


Location: Toronto, Canada.
Maintained by Brad Smith.
Protocols: ssh, ssh port 2022.
Updated every 2 hours.


Location: Elion, Tallinn, Estonia.
Maintained by Rivo Nurges.
Protocols: ssh.
Updated every 2 hours from cvsync.de.openbsd.org.
SSH fingerprints:
(RSA) 1024 e1:12:fb:6b:e5:c0:6a:b3:f8:ca:b1:4c:20:fb:5e:07
(DSA) 1024 bb:5c:44:f4:d9:12:3b:22:08:a9:12:c5:0c:e7:db:49


Location: Paris, France.
Maintained by Frank Denis.
Protocols: ssh, ssh port 2022.
Updated every 2 hours from anoncvs3.usa.openbsd.org.
SSH fingerprints:
(RSA1) 2048 4d:60:d8:ab:bc:c6:29:64:b4:45:1b:98:2b:fe:40:7e
(RSA) 2048 01:f1:c4:25:c8:e3:0d:0e:7a:33:94:14:f4:9d:98:5f
(DSA) 2048 73:36:41:46:fd:0a:67:df:e6:c1:4a:6b:02:61:f4:61


Location: Nürnberg, Germany.
Maintained by Armin Wolfermann.
Protocols: ssh.
Updated every 4 hours from anoncvs1.usa.openbsd.org.
SSH fingerprints:
(RSA) 1024 f2:73:d2:f6:e3:01:ef:ca:3b:e7:6c:80:b6:bd:bb:84
(DSA) 1024 fb:33:05:62:96:20:cf:88:7e:10:cb:8d:91:72:57:32


Location: Budapest, Hungary.
Maintained by Robert Nagy.
Protocols: ssh.
Updated every 3 hours from anoncvs.de.openbsd.org.


Host also known as kankoromochi.econ.nagasaki-u.ac.jp.
Location: Nagasaki University, Faculty of Economics, Nagasaki, Japan.
Maintained by Suzuki Itoshi.
Protocols: ssh, pserver.
Updated every 3 hours.


Location: TVK, Cable TV and Internet Services, Taurage, Lithuania.
Maintained by Donatas Budvytis.
Protocols: ssh.
Updated every 3 hours from cvsup.no.openbsd.org.


Host also known as anoncvs.calyx.nl.
Location: Amsterdam, The Netherlands.
Protocols: ssh.
Updated every 3 hours.


Host also known as cvs.inet.no.
Location: Oslo, Norway.
Maintained by Michael Schuldman.
Protocols: ssh, ssh port 2022.
Updated every 4 hours from rsync.de.openbsd.org.


Location: Warsaw, Poland.
Maintained by Piotr Klein.
Protocols: ssh.
Updated every 3 hours.


Host also known as nina.kerberos.si.
Location: Ljubljana, Slovenia.
Maintained by Mitja Muzenic.
Protocols: ssh.
Updated every 2 hours from cvsync.de.openbsd.org.


Location: Stockholm, Sweden.
Maintained by Viktor Holmlund.
Protocols: ssh.
Updated every 3 hours from rsync.de.openbsd.org.


Location: DePaul University, Chicago, IL, USA.
Maintained by Eric Pancer.
Protocols: ssh, ssh port 2022, pserver.
Updated every 2 hours.
SSH fingerprints:
(RSA1) 1024 5b:1c:cb:b7:5f:82:82:cc:af:13:21:a4:2c:c2:55:6b
(RSA) 1024 18:0f:97:2a:cf:6c:7f:d4:ca:2b:bc:c8:b9:56:2b:86
(DSA) 1024 65:cb:ce:7c:3e:29:5c:82:0b:9d:fa:b7:bb:e0:4b:47


Location: CalPOP, Los Angeles, CA, USA.
Maintained by Brian Brombacher.
Protocols: ssh, ssh port 2022, pserver.
Updated every 3 hours from rt.fm.
SSH fingerprints:
(RSA1) 2048 e4:22:93:81:84:e0:68:8c:0b:d5:1f:78:cd:6f:fa:c3
(RSA) 2048 8f:42:bd:b0:a2:94:df:6b:af:1e:96:03:ea:68:03:d9
(DSA) 1024 26:51:e8:b3:38:88:dc:a8:2a:98:59:86:ab:40:bb:a4


Location: Frontier Communications, Rochester, NY, USA.
Maintained by jared r r spiegel.
Protocols: ssh.
Updated every 4 hours from anoncvs.ca.openbsd.org.

Note: If your server is listed on here with inaccurate or unknown information, please contact
You may want to use traceroute(8) to find out which server is nearest you. Problems with a server should be reported to the maintainer of the server in question.
Getting crypto sources through cvs(1)
IMPORTANT NOTE: There are a few issues relating to cryptographic software that everyone should be aware of:
The OpenBSD sources are from Canada. As researched by a Canadian individual and as described in the Export Control list of Canada it is legal to export crypto software from Canada to the world.
However, if you are outside the USA or Canada, you should not fetch the cryptographic sections of the OpenBSD sources from an anoncvs server located in the USA. The files in question are...
src/kerberosIV/*
src/kerberosV/*
src/lib/libdes/*
src/lib/libc/crypt/crypt.c
src/lib/libc/crypt/morecrypt.c
src/sys/crypto
src/sys/netinet
src/usr.sbin/afs/src/rxkad/*
XF4/xc-mit/lib/Xdmcp/Wraphelp.c
XF4/xc-old/lib/Xdmcp/Wraphelp.c
XF4/xc/lib/Xdmcp/Wraphelp.c
Because of US Dept. of Commerce policy, crypto software may only be exported to Canada from the USA.
Example usages for cvs(1)
NOTICE: If you want to update a branch (such as a patch branch) to current, you would add the -A flag to cvs, but this flag is of little use otherwise. Some older versions of the OpenBSD documentation recommended use of this flag in many examples. We no longer recommend this flag unless absolutely necessary.
A sample use of an anoncvs server would be:
$ cd /tmp
$ cvs -d get src/sys/arch/sparc
    [copies the files from the repository to your machine]
$ cd src/sys/arch/sparc
$ cvs log locore.s
    [shows the commit log for the chosen file]
$ cvs diff -bc -r1.1 -r1.5 locore.s
    [shows the changes between revisions 1.1 and rev 1.5]
In order to use a cvs ``pserver'' (a direct TCP connection instead of using ssh or rsh) you must login once:
$ cvs -d :pserver:anoncvs@anoncvs.ca.openbsd.org:/cvs login
(Logging in to )
CVS password: anoncvs
    [This writes a line to ~/.cvspass (filename over-ridden by CVS_PASSFILE).]
    [An example line from my ~/.cvspass after typing 'blah' for the above    ]
    [password is:                                                            ]
    [:pserver:anoncvs@anoncvs5.usa.openbsd.org:/cvs Au'yc                    ]
    [After logging in ONCE every other use of the above CVSROOT will work.   ]
$ cvs -d :pserver:anoncvs@anoncvs.ca.openbsd.org:/cvs get ksrc-i386 ksrc-common
    [Allows you to retrieve ONLY that necessary to rebuild an i386 kernel.   ]
Here is how someone using anoncvs regularly would update his source tree:
First, start out by `get'-ing an initial tree:
(If you are following current):
 # cd /usr
 # cvs -qd get -P src
(If you are following the patch branch for 4.5):
 # cd /usr
 # cvs -qd get -rOPENBSD_4_5 -P src
Anytime afterwards, to `update' this tree:
(If you are following current):
 # cd /usr/src
 # cvs -q up -Pd
(If you are following the patch branch for 4.5):
 # cd /usr/src
 # cvs -q up -rOPENBSD_4_5 -Pd
Every time you ran this it would synchronize your /usr/src tree. It would not destroy any of your local changes, rather it would attempt to merge changes in.
NOTE: If you are updating a source tree that you initially fetched from a different server, or from a CD, you must add the -d options to cvs.
 # cd /usr/src
 # cvs -d -q up -Pd
To use ports, it is similar to src:
(If you are following current):
 # cd /usr
 # cvs -qd get -P ports
(If you are following the patch branch for 4.5):
 # cd /usr
 # cvs -qd get -rOPENBSD_4_5 -P ports
Anytime afterwards, to `update' this tree:
(If you are following current):
 # cd /usr/ports
 # cvs -q up -Pd
(If you are following the patch branch for 4.5):
 # cd /usr/ports
 # cvs -q up -rOPENBSD_4_5 -Pd
In the above example, -q is optional, only intended to minimize cvs's output. For those who like to see screenfulls of output, it can be omitted.
To make a diff of a locally patched module (here cd.c) to include with a bug report:
 # cd /usr
 # cvs diff -u src/sys/scsi/cd.c > /tmp/patch
The cvs(1) man page (included with the CVS sources) has much more information about how CVS can be used.
Warning: When using cvs you should take care that your current directory is either the root of the tree you are referencing or in a separate place such as /tmp. Some commands such as "get" can create an arbitrary sub-tree in the current directory, and a subsequent update will recursively flesh out this sub-tree.
The anoncvs service gives fledgling developers a chance to learn CVS operation and get thoroughly involved in the development process before getting "commit" access -- as a result of showing useful skills and high quality results they will naturally later be given developer access. As well, people providing patches can create their "diff"s relative to the CVS tree, which will ease integration.
Use rsh(1) or ssh(1)?
CVS supports three access methods between the CVS server and the CVS client:
ssh: Secure Shell can be used to access the anonymous CVS servers. This is the recommended way of doing so, as it is encrypted.
rsh: Remote Shell can be used on some of the servers for users who don't have access to ssh.
pserver: pserver is primarily useful for users who are behind firewalls that block the other two connections.
NOTE: For users wishing to use rsh, you must first set the CVS_RSH environment variable to point to the rsh(1) program:
For Korn/Bourne shells:
        $ export CVS_RSH=/usr/bin/rsh
For csh/tcsh:
        % setenv CVS_RSH /usr/bin/rsh
By default, OpenBSD's CVS client uses ssh ("secure shell": OpenSSH) to talk to the CVS server.
Many of the CVS sites no longer support rsh or pserver for security reasons. Local problems like firewalls or imperfect protocol emulators such as slirp may also hinder rsh usage. However, if rsh is desired, one must set the CVS_RSH environment variable to point to rsh (typically /usr/bin/rsh).
If local policy prevents outgoing connections to ssh's default port of 22, port 2022 may be used in its place. Note, however, that not all anoncvs servers accept ssh connections on this port. Furthermore, most anoncvs servers no longer accept the none cipher, as it is disabled in recent versions of ssh for security reasons. Also, do not be tempted to turn on compression: CVS already compresses.
One could specify something like the following in the $HOME/.ssh/config configuration file to avoid the pitfalls and restrictions mentioned above:
 Host anoncvs.ca.openbsd.org
     Compression no
     Port 2022
CVS is a little noisy starting up; to quiet it a bit you may want to do this:
 $ export CVS_CLIENT_PORT=-1

Mirroring the CVS repository via sup(1)
Users wishing to mirror the OpenBSD CVS tree itself may now do so from anoncvs.usa.openbsd.org or anoncvs3.usa.openbsd.org (these are different machines). Note that this is the cvs tree, not a checked out source tree. It is only useful if you want to be able to do fast cvs operations (diff, annotate, etc) or if you have multiple source trees and you only want to transfer new data once (you can then checkout a tree from your local cvs mirror).
A sample supfile would be:
 cvs host=anoncvs.usa.openbsd.org hostbase=/ base=/home delete
which would mirror the cvs tree into /home/cvs with the sup data files ending up in /home/sup. The full OpenBSD cvs tree is currently about 3.5GB in size, and will, of course continue to grow.
Setting up an anoncvs mirror
If you wish to setup a new anoncvs mirror site and make it available to the general public, please contact the anoncvs maintainer. Anoncvs mirrors currently require about 3.5GB of disk (and it will grow!), and use up to 32MB of swap per anoncvs user (assuming the user does a large operation; while smaller operations use fewer resources, anoncvs still makes much more of an impact than ftp or sup). Such anoncvs machines should have excellent network connectivity for the area they are expected to serve. A document which describes the setup of anoncvs servers is available.
Final notes
After upgrading your source tree, you should read the comments at the top of /usr/src/Makefile before attempting a build. Also, you should build a new kernel before doing a make build if possible. In some cases it may be necessary to rebuild and install the config utility before you can build the kernel. If config GENERIC fails this is probably the case.
It is important to note that upgrading from a release to the current tree by rebuilding the sources can be rather difficult due to dependencies that are often not obvious. Therefore, it is suggested that you first install the latest snapshot before attempting a tree build from source.

--------------------------------------------------------------------------------
 
$OpenBSD: anoncvs.html,v 1.301 2009/07/05 20:26:38 nick Exp $
阅读(2406) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~