Using UNIX groups and CVS - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Using UNIX groups and CVS

Description:

CVS is a code repository that is optimistic (it assumes that conflicts are rare) ... Type cvs with the absolute path and then init as below: ... – PowerPoint PPT presentation

Number of Views:181
Avg rating:3.0/5.0
Slides: 20
Provided by: TimothyCL9
Category:
Tags: cvs | unix | cvs | groups | using

less

Transcript and Presenter's Notes

Title: Using UNIX groups and CVS


1
Object-Oriented Software Engineering
  • Using UNIX groups and CVS

2
Unix Groups
  • You should now have been placed in a Unix group
    on the GAUL system
  • Everyone in your project group (team) should be
    in the same Unix group
  • This means that you can share files with your
    group members without letting members of other
    groups see them
  • You will want to do this for the final code
    submission directory
  • We will look at sever command
  • groups for seeing what Unix groups you are in
  • chgrp for assigning the group ownership of a
    file
  • chmod for permitting group members to access a
    file

3
Your Unix Groups
  • To find what Unix groups you are in, issue the
    command groups
  • You should see a group name with the string CS212
    in it
  • E.g CS212-YXX where Y is your section number 1or
    2 and XX is your group number 07 for group 7
  • This is the Unix group that all the members of
    your project group are in
  • You should also see a group name indicating that
    you are in an undergrad course (e.g. 2ndyr or
    undrgrad)
  • This is your default group, but does not matter
    for CS 212 purposes

4
Giving a File to Your Group
  • Permitting a file to your Unix group has two
    stages
  • Change the group ownership of the file
  • Permit it to group
  • Every file has two owners
  • A user (I.e. you, for your files)
  • A Unix group
  • By default, your default Unix group is the group
    owner of your files
  • To change the Unix group of a file or files,
    issue the command chgrp group file, where
  • group is the Unix group you want to change it to
  • file is the name of the file
  • Example to give ownership of QueueTypes.h to
    group CS212-YXX chgrp CS212-YXX QueueTypes.h
  • You can do more than one file this way
    e.g. chgrp CS212-YXX .c .o

5
Checking Group Ownership
  • To see what group a file belongs to
  • Issue the command ls lg file
  • This will list the group owner after the user
    owner
  • Example cartier issues command ls lg
    QueueTypes.h
  • System responds with something like
  • -rw------- 1 cartier CS212-YXX 258 Oct 17 0959
    QueueType.h
  • CS212-YXX is the group owner
  • A file can only have one group owner to change
    it, just use the chgrp command again with a
    different group name
  • To restore default group ownership to a file,
    just make a copy of it and delete the original
  • But using only the chgrp command is still not
    sufficient to let other members of your group to
    see the file
  • It is necessary to permit thefile by changing
    the access mode of the file

6
Permitting Your Group Access
  • To let the members of a Unix group see a file
    owned by that Unix group, issue the command chmod
    grw file
  • This permits the group (g) to have read access
    (r) to file
  • It also permits the group (g) to execute (x) file
    it is already executable
  • You can do this on multiple files too
  • Example
  • cartier issues command chmod grx QueueTypes.h
  • Then cartier issues command ls lg QueueTypes.h
  • System should give something like-rw-r----- 1
    cartier CS212-YXX 258 Oct 17 0959 QueueType.h
  • The second r in rw-r----- indicates that the
    group now has access
  • People outside the Unix group (others) do not
    have read access unless you also say chmod orx
    file

7
Permitting Access to Directories
  • Note to give access to a file in a directory,
    you have to chgrp and chmod the directory too!
  • Option R on chgrp and chmod will do it
    recursively on all members of the directory
  • Example from home directory cartier says chgrp
    R CS212-YXX project chmod R grx project
  • Directory project and everything in it now
    accessible to group CS212-YXX
  • For more details on how to permit files other
    different ways, see man chmod

8
Summary
  • User cartier does groups
  • System response with 2ndyr CS212-YXX
  • cartier now does chgrp R CS212-YXX
    project chmod R grx project cd project ls
    lg QueueTypes.h
  • System responds with something like -rw-r-----
    1 cartier CS212-YXX 251 Oct 17 0959
    QueueTypes.h
  • User bolivar (in the same group) does groups
  • System responds with 3rdyr CS212-YXX
  • bolivar now does cd cartier/project
  • User bolivar will now be able to read
    QueueTypes.h

9
Code Repositories
  • Repository for code is used when coding with
    other team members, where you share the code.
  • Your whole team has access to the repository. The
    latest version of ALL of the code is stored in
    the repository, if you need to make changes, you
    check out ONLY the pieces you will use to make
    the changes and test the changes, change the
    code, and then check it back in.
  • CVS is a code repository that is optimistic (it
    assumes that conflicts are rare). Thus, it allows
    any member of the team to make changes to any
    piece he/she has access to. Since two team
    members can commit changes to the same resource,
    conflicts must be resolved by the second
    committer.

10
Revision Control The Problem
  • Take a software project where
  • There are several files with several people
    working on those files
  • You want one final version of everything
  • Possible Problems
  • Different people having different versions of
    files
  • Inconsistent changes by different people
  • Changes getting lost

11
Example 1 Conflicting Changes
  • Bob has master copy of the files Person.java and
    Address.java
  • Alice and Chris get copies of both files
  • Alice changes Person.java and Chris changes
    Address.java (everything still works for them)
  • Alice copies Person.java back to Bobs area, Chris
    copies Address.java back to Bobs area
  • Bob tries but cant compile the program anymore
  • Now there is no working master copy!

12
Example 2 Changes Getting Lost
  • Alice and Chris both change Person.java
  • Chris sends his copy to Bob
  • Later, Alice sends her changes to Bob
  • Finally, Chris gets Alices changes from Bob
  • Now no one has Chriss original changes!

13
Minimizing Problems
  • ALWAYS FOLLOW THESE STEPS
  • Start fresh ? Before starting anywork, update
    all the files in your workspace with the latest
    updates (In eclipse you right click on the
    project in CVS Repository View and select
    Checkout)
  • Run your unit tests ? Make sure they all pass, if
    the system is broken before you start and you
    start making changes, you wont know if your
    changes broke it, or there were previous problems
  • Make changes ? Do all your editing in your local
    workspace. Debug until everything works
  • Run the unit tests again ? Make sure your changes
    didnt break any of the other components that you
    werent even working on.
  • Synchronize ? When you are ready to commit,
    synchronize. Check incoming changes and add them
    to your files. Resolve changes. Rerun your unit
    tests to make sure everything is still correct.
    THEN COMMIT YOUR CHANGES!

14
Terminology
  • Check Out ? checks out all the files in the
    project
  • Update ? gets the latest version from the
    repository and inserts it into your stuff (you
    should always do this first)
  • Sync with repository ? Shows the modifications
    between the latest version in the repository and
    the changes you have made
  • Commit ? takes your current file and writes it to
    the repository (so this will be the new master
    copy)

15
  • When you Sync with Repository, you will see
    something like this
  • This shows the changes, resolve the changes and
    then sync again, then commit when you have no
    changes.

16
Step 1 Create a Repository
  • Have one person create an initial repository on
    Gaul
  • In unix, create a directory that will be the
    repository
  • Change the permissions on that directory so your
    group can access it.
  • Go to that directory and type pwd to find the
    absolute path
  • Type cvs with the absolute path and then init as
    below cvs d /gaul/u0//youruserid/repositorydi
    rectory init
  • Build the repository in Eclipse (build a project,
    add some files, then go to the CVS perspective to
    attach your files to the repository)
  • Have your group members attach to your repository
    in Eclipse (we will do this in our workshop on
    Thursday, Feb 23 in PB 225)

17
Change the permission on the directories
  • Make sure that the user who creates the
    repository on Gaul changes the permission and
    groups on the appropriate directories
  • NOTE I read that you have to do a chmod like
    this
  • chmod grws (set the setgid bit default
    group id- now files created in the directory will
    have the same group as the directory NOT the
    default group)

18
Share Projects
  • Note A file is flagged as either ASCII or
    Binary, this is important when CVS displays the
    line-by-line changes. In most cases, text files
    should be ASCII
  • To share the project
  • Right click on the project in Navigator view
    (Window Show View Navigator) and select
    Team, then select Share Project. Just leave the
    name the same as the project name.
  • Commit the files in the project to the repository

19
Bring in Another User
  • Another user wants to use files in the
    repository, so he/she would
  • Open the CVS Perspective
  • Right click in the window and select new
    Repository Location
  • Type in the same machine (gaul) and absolute
    path, but his/her own userid and password
  • Then expand the repository location, then expand
    HEAD and you should see the project. Right click
    on the project and choose Checkout As Project,
    select Navigator view and now the other user sees
    the project.
Write a Comment
User Comments (0)
About PowerShow.com