📄 version_control_systems.html
字号:
</div></li><li class="level2"><div class="li"> Edit the file you found in the previous step. In this example it is <code>/etc/xinetd.d/cvs</code>, so that it looks something like:<pre class="code"># CVS pserver (remote acces to your CVS repositories)# Please read the section on security and passwords in the CVS manual,# before you enable this.# default: offservice cvspserver{ disable = no socket_type = stream protocol = tcp wait = no user = root server = /usr/bin/mypserver.sh server_args = -f}</pre><p>Note : Please read the section on security and passwords in the <acronym title="Concurrent Versions System">CVS</acronym> manual to ensure that this is appropriate for your environment.</p></div></li><li class="level2"><div class="li"> Restart <code>xinetd</code><pre class="code">home:/home/rgetz # /etc/init.d/xinetd restartShutting down xinetd: doneStarting INET services. (xinetd) done</pre></div></li><li class="level2"><div class="li"> Check that things are running now:<pre class="code">rgetz@home:~> telnet localhost 2401Trying 127.0.0.1...Connected to localhost.Escape character is '^]'.cvs [pserver aborted]: bad auth protocol start:Connection closed by foreign host.</pre><p>If things are still not working, you may need to change the configuration in the system Firewall to allow traffic on port 2401. It is also helpful if you are running into problems to check the last lines in the <code>messages</code> file with <code>tail -20 /var/log/messages</code> </p></div></li><li class="level2"><div class="li"> Add the anonymous user<pre class="code">home:/home/rgetz # useradd anonymous</pre></div></li><li class="level2"><div class="li"> All the cvs lock files are placed in <code>/var/lock/cvs</code>, so you need to create this directory, and ensure it is world writable<pre class="code">home:/cvsroot/gcc3/CVSROOT # mkdir -p /var/lock/cvshome:/cvsroot/gcc3/CVSROOT # chmod 777 /var/lock/cvs</pre></div></li></ol></li><li class="level1"><div class="li"> Do an initial rsync the projects you are going to create local repositories of. The first time that this is done, it can take a over two hours per repository.<pre class="code">rsync -azv cvs.blackfin.uclinux.org::uclinux533 /cvsroot/uclinux533rsync -azv cvs.blackfin.uclinux.org::gcc3 /cvsroot/gcc3rsync -azv cvs.blackfin.uclinux.org::uboot533 /cvsroot/uboot533rsync -azv cvs.blackfin.uclinux.org::jtag /cvsroot/jtagrsync -azv cvs.blackfin.uclinux.org::jtagtools /cvsroot/jtagtools</pre></div></li><li class="level1"><div class="li"> Because rysnc can sometimes take over 60 minutes to complete, and we don’t want to be running more than one rsync at a time, this small shell script will make sure that this is the only rsync connecting to a site with “blackfin” in the name (to make sure that the network does not become congested) before starting the network transfer. It times out in 59 minutes, as we will be starting it every 60 minutes with a cron job. Make a new file <code>/usr/local/bin/blackfin_rsync</code><pre class="code">#!/bin/sh# This needs 1 argumentif [ $# -ne 1 ]; then echo 1>&2 Usage: $0 repository_name exitfi# Set initial variables to zeroI=0# This checks to see if rsync is running.# $RUN will be set to 0 if it is not running#RUN=`/bin/ps -C rsync | grep -v PID | wc -l`while [ "$RUN" -gt 0 ]do # This will put all the rsync process ID into a tmp file # This assumes that the first parameter from ps is the PID # /bin/ps -C rsync | grep -v PID | awk '{print $1}' > /tmp/tmp_file # This will read the file into the pid[] array typeset -i cnt=0 while read line do pid[$cnt]=$line ((cnt = cnt + 1 )) done < /tmp/tmp_file typeset -i temp=0 # This checks to see if the rsync is running is going to a site # with 'blackfin' in the address. If so, wait. Otherwise, skip it. while [ "$temp" -ne "$cnt" ] do RUN=`ps ${pid[$temp]} | grep -v PID | grep blackfin | wc -l` if [ "$RUN" -gt 0 ] ; then break fi ((temp = temp + 1)) done # Wait 1 minute sleep 60 I=$[I+1] if [ "$I" -gt 59 ] ; then # If waiting 59 minutes stop rm /tmp/tmp_file exit fidonersync -az --delete --force cvs.blackfin.uclinux.org::$1 /cvsroot/$1# rsync options are:# -a archive mode, equivalent to -rlptgoD# -r recurse into directories# -l copy symlinks as symlinks# -p preserve permissions# -t preserve times# -g preserve group# -o preserve owner# -D preserve devices# -z compress file data# --delete delete files that don't exist on sender# --force force deletion of dirs even if not empty</pre><p>Ensure that this file has execute permissions with <code>chmod +x /usr/local/bin/blackfin_rsync</code></p></div></li><li class="level1"><div class="li"> Add to the crontab, with <code>crontab -e</code>. The following lines should be in your crontab file:<pre class="code">#min hour day month dayofweek command#0-59 0-23 1-32 1-12 0-70 * * * * /usr/local/bin/blackfin_rsync jtag10 * * * * /usr/local/bin/blackfin_rsync jtagtools20 * * * * /usr/local/bin/blackfin_rsync uboot53330 * * * * /usr/local/bin/blackfin_rsync uclinux53345 * * * * /usr/local/bin/blackfin_rsync gcc3</pre><p>To reduce load on the server - use different times than this. If everyone uses the same times, it will have periods of intense activity (and be slow for everyone), and then periods where it is sitting idle.</p></div></li><li class="level1"><div class="li"> Now your localhost cvs should be set up. Now you can replace <code>cvs.blackfin.uclinux.org</code> with <code>localhost</code>. Not only can this be used for a local cvs, but you now can tell other people on the same subnet as you, that they can use your cvs server to pull from. This will increase their bandwidth, and reduce the overall load on the main cvs server. </div></li></ol></div><!-- SECTION [2125-14671] --><h3><a name="adding_files_to_cvs" id="adding_files_to_cvs">Adding Files to CVS</a></h3><div class="level3"><p>This section describes some of the most common <em><strong>cvs</strong></em> commands. These commands are issued through the <em><strong>cvs</strong></em> command line interface, though equivalent actions may be preformed through a graphical front-end. Some commands, such as checkout, may be issued by an anonymous user; however, any commands which make changes to the <acronym title="Concurrent Versions System">CVS</acronym> repository will require developer access. This section will assume developer access, though some of the commands may be extended to an anonymous user.</p><p> First, for SSH1 access the environment variable <acronym title="Concurrent Versions System">CVS</acronym>_RSH must be set. To do this enter the following command:</p><pre class="code">bash$ export CVS_RSH=ssh</pre><p>Next the environment variable CVSROOT must be set to the <acronym title="Concurrent Versions System">CVS</acronym> root path for the repository you want to access. To do this enter a command similar to the following for developer access:</p><pre class="code">bash$ export CVSROOT=:ext:<developer name>@cvs.blackfin.uclinux.org:<path to cvs tree (e.g. /cvsroot/bfin-docs)></pre><p> <strong>cvs</strong><strong>-d</strong></p><p></p><p>For anonymous access, if permitted, use a commands similar to the following:</p><pre class="code">bash$ export CVSROOT=:pserver:anonymous@cvs.blackfin.uclinux.org:<path to cvs tree (e.g. /cvsroot/bfin-docs)>bash$ cvs login</pre><p>The login command must be issued before any other commands when anonymous access is used. When prompted for a password for anonymous simply press the Enter key. Also, it should be noted that not all commands described in this section can be executed by an anonymous user. Commands which write to the <acronym title="Concurrent Versions System">CVS</acronym> repository; commands such as add, commit, and import; cannot be executed by an anonymous user.</p><p>Next, if this is the first time any developer has used the <acronym title="Concurrent Versions System">CVS</acronym> repository for this project, a new module must be created. To start a new module a new empty directory should be created locally, this directory can then be imported to the <acronym title="Concurrent Versions System">CVS</acronym> repository. To do this enter the following commands:</p><pre class="code">bash$ mkdir <name of new module>bash$ cd <name of new module>bash$ cvs import -m "<message>" <name of new module> <vendor tag> <release tag></pre><p>If the message (<strong>-m</strong>) switch is not specified an editor session will be started where you can type a message for the release.</p><p> The message field allows you to enter any comments you would like associated with the module. The vendor and release tags are user defined symbolic revision names, they can follow any convention you like provided the names only contain alpha-numeric characters, dashes, and underscores. These user defined symbolic revision names are separate from the <acronym title="Concurrent Versions System">CVS</acronym> assigned revision numbers. For more information on tags and revision numbers see the <a href="http://ximbiot.com/cvs/cvshome/docs/" class="urlextern" title="http://ximbiot.com/cvs/cvshome/docs/" rel="nofollow">CVS documentation</a>.</p><p> Now that at least one module exists, it must be checked out so that it may be edited locally. To checkout a module enter the following commands:</p><pre class="code">bash$ cd <path where module should be created></pre><p>The module will be created as a sub-directory within the current directory. </p><pre class="code">bash$ cvs checkout <module name></pre><p>Now that a copy of the module exists locally add or edit files in the local copy of the module. Once you are satisfied with the changes you have made you must let <acronym title="Concurrent Versions System">CVS</acronym> know which new files, if any, have been added to the module. This is done with the following commands:</p><pre class="code">bash$ cd <module directory>bash$ cvs add <filename></pre><p>Once <acronym title="Concurrent Versions System">CVS</acronym> has been notified of any new files, the changes which were made to the local module must be committed to the <acronym title="Concurrent Versions System">CVS</acronym> repository. To commit a single file enter the following commands:</p><pre class="code">bash$ cd <module directory>bash$ cvs commit -m "<message>" <filename></pre><p>Alternately, to commit the whole module enter:</p><pre class="code">bash$ cvs commit -m "<message>" <module directory></pre><p>If the message (<strong>-m</strong>) switch is not specified an editor session will be started where you can type a message for the release.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -