41
1 CSE306 Operating Systems Projects CVS/SSH tutorial

1 CSE306 Operating Systems Projects CVS/SSH tutorial

Embed Size (px)

Citation preview

1

CSE306 Operating Systems Projects

CVS/SSH tutorial

2

What is CVS?

• Concurrent Versions System

• Version Control System

• Multi-developer environment

3

CVS

RepositoryDeveloper1

Developer2

Developer3

Developer4

4

checkoutupdatecheckindevelopment

Ideal development with CVS

repository

Developer A

Developer B

5

Definitions-Repository

• The Repository is a directory tree containing the CVS administrative files and all the RCS files that constitute "imported" or "committed" work.

• Kept in a shared area, separate from the working areas of all developers.

6

Definitions-RCS

• An RCS file is a text file containing the source text and the revision history for all committed revisions of a source file.

• Stored separately from the working files, in a directory hierarchy, called the Repository.

• RCS is the "Revision Control System" that CVS uses to manage individual files. RCS file names normally end in ",v".

7

Definitions-Working file

• A working file is a disk file containing a checked-out copy of a source file that earlier had been placed under CVS. If the working file has been edited, the changes since the last committed revision are invisible to other users of CVS.

• A working directory is the place where you work and the place from which you "commit" files.

8

Definitions-Checkout

• “Checking out" is the act of using the "checkout" command to copy a particular revision from a set of RCS files into your working area.

• You normally execute "checkout" only once per working directory (or tree of working directories), maintaining them thereafter with the "update" command.

9

Definitions-Revision

• A "revision" is a version of a file that was "committed" ("checked in", in RCS terms) some time in the past.

• Each version of a file has a unique revision number.

• Every file in a CVS repository can contain many versions, which are given revision numbers in form x.y[.x.y[...]].

• ! 1.1 !----! 1.2 !----! 1.3 !----! 1.4 !----! 1.5 !

10

Definition-Tag-symbolic revision

• A release of a system will have many different revision numbers

• To let you find all the files in a release, use tags.

• Read Manual if you are interested

11

Definition-Branch

• Version number can contain more than two numbers to mark branches.

Reasons to branch:• fix bugs in product while working on next

version• work on subproject that will take a week to

finish

12

Working on branches

1.1 1.2 1.3

release_1

cvs tag release_1

cvs up -r rel_1_fix

1.4

release_2

cvs tag release_2

1.2.2.1 1.2.2.2

patch

rel_

1_fixcvs tag -b rel_1_fix

13

checkin

X

Real development with CVS

repository

Developer A

Developer B

updateconflict resolutioncheckin

conflict

14

CVS and the Development Cycle

1. Check out source files in working directory.

2. Edit source files.3. Unit test your code.4. Update working files to merge in

changes from other developers (if necessary).

15

CVS and the Development Cycle

5. Test again if the sources were merged on step 4.

6. Commit changes.7. Repeat from step 2 until you have

a new release.8. Tag the release.9. Submit the module name and

release tag for integration build.

16

Useful CVS commands

cvs [cvs-options] command [cmd-options] [files]

cvs checkout Check out source for editing.

cvs commit check files into the repository (check in

cvs add Add new file/directory to repository.

cvs remove Remove an entry from the repository.

cvs update Bring working files into sync with repository.

17

Useful CVS Commands(con.)

cvs diff Compare working files to version in repository or versions inside the repository.

cvs log Show revision history for files.

cvs status Show status of checked out files.

cvs tag Label the sources.

18

Notes

• When to commit:

Commit to mark a working state that you might want to return to later.

For more information on CVS, please see

• www.cvshome.org

• www.loria.fr/~molli/cvs-index.html

• www.refcards.com/about/cvs.html

19

Starting the Projectwith CVS/SSH

20

Let us check your project

• To enable us to check the log, you must do this:

cd ~ chmod 711 . mkdir ~/.ssh2 chmod 700 ~/.ssh2 cp ~cse306/id_kifer.pub ~/.ssh2/ cp ~cse306/id_cse306.pub ~/.ssh2/

21

Let us check your project(con.)

• Create a file called ~/.ssh2/authorization • Add the following lines there:

Key id_kifer.pub Key id_cse306.pub

• Ensure proper access for both partners: chgrp -R your-group your-cvs-repository-directory chmod -R 770 your-cvs-repository-directory chmod -R g+s your-cvs-repository-directory

22

Start working with CVS

• Create empty repository

cvs -d ~/CVSROOT init

• protect yourself from copycats!

chmod -R 770 ~/CVSROOT

23

Working with partner

• if you are working with a partner and are assigned to the same user group, say c306-00 then also type the following two commands:

chgrp -R c306-00 ~/CVSROOT make sure new directories are created with the right permissions:

chmod -R g+s ~/CVSROOT

24

Create directory structure for your repository

• your OSP project dir mkdir ~/your-project-dir/OSP

• your project dir for Proj 1 mkdir ~/your-project-dir/OSP/memory

• your project dir for Proj 2 mkdir ~/your-project-dir/OSP/threads

• your project dir for Proj 3 mkdir ~/your-project-dir/OSP/devices

25

Import directory structure

• cd ~/your-project-dir/OSP • Import directory structure of your OSP project

into your CVS repository cvs -d ~/CVSROOT import -m "Created

OSP directory structure" OSP osp start

• In the above, `osp' and `start' are called "vendor" and "release" tags and can be anything. CVS requires them for import, but you can forget about them from now on.

26

Remove it

• Set the appropriate permissions for the OSP module in the cvs repository. Read/write for you and partner -- nobody else

chmod 770 ~/CVSROOT/OSP • Remove the OSP dir structure you just created

cd ~/your-project-dir • BE CAREFUL HERE!!!!!!

rm -r OSP

27

Check Out

• Checkout OSP from the repository (this lets OSP create the necessary structures)

cvs -d ~/CVSROOT checkout OSP

• Protect yourself!

chmod 700 OSP

28

Partner

• Your partner should also checkout the same thing, but, of course, use ~your_account_id instead of just ~. Let's suppose you are 'john': Your partner does:

cd ~/your-partner's-project-dir

cvs -d ~john/CVSROOT checkout OSP

chmod 700 OSP

29

Add new files

• Adding files (such as memory.c) to your repository using the command 'cvs add‘

• Use `cvs add filename' to tell CVS that you want to version control the file.

• Command: cvs add [-k kflag] [-m message] files

The `-m' option specifies a description for the file. This description appears in the history log

30

Commit

• Use `cvs commit filename' to actually check in the file into the repository. Other developers cannot see the file until you perform this step.

31

Which editor should I use?

• XEmacs (suggested)• Nice interface to CVS, called pcl-cvs. Most of the

CVS commands are available through the Tools/PCL_CVS menu of XEmacs.

• Put this line in your ~/.emacs file. (require 'pcl-cvs)

• After you invoke `cvs update', you get a CVS buffer , where you can invoke even more commands through the top-level menu called CVS

32

Where should I work?

• Undergraduate Computing Lab

• Remote access to UG lab by SSH (no GUI)

• Working at home with Linux/FreeBSD

• Working at home with MS Windows

using WinCVS

33

Upgraded UG Lab

• Request a UG account at

www.ug.cs.sunysb.edu

• Apply an access card from the undergrad secretary

• Read www.ug.cs.sunysb.edu to begin working

34

Using SSH (Secure Shell)

• Remote access to UG lab by SSH only!

• Download a copy for your computer from

www.ssh.com/download

softweb.cc.sunysb.edu

• Type “man ssh” for more information

35

Working at home with Linux/FreeBSD

• Set the environment variable CVS_RSH to ssh

• You can checkout a copy directly to your home computer as follows (assuming that you are 'mary' in the UG lab): cvs –d :ext:[email protected]:your_homedir/CVSROOT checkout OSP

• Note: your_homedir must be the full path name to your home directory at public.ug.cs.sunysb.edu

36

WinCVS on your desktop

• Download a copy from

www.wincvs.org

www.cvsgui.org

• Set up with SSH step by step

http://www.cvsgui.org/ssh.html

37

WinCVS: Configuration

Your UNIX login

38

WinCvs: Main screen

file view

status view

modules

stat

e ic

on

revi

sio

n n

um

ber

file

typ

e

bra

nch

nam

e

39

Checking out the sources

40

Source history & diff

41

Commit, Update & Tagupdatecommit

tag