Using UNIX groups and Subversion - PowerPoint PPT Presentation

About This Presentation
Title:

Using UNIX groups and Subversion

Description:

Object-Oriented Software Engineering Using UNIX groups and Subversion Unix is user-friendly. It's just very selective about who its friends are. (Magi s ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 21
Provided by: TimothyCL4
Category:

less

Transcript and Presenter's Notes

Title: Using UNIX groups and Subversion


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

Unix is user-friendly. It's just very selective
about who its friends are.(Magis favourite
quote ?)
http//www.youtube.com/watch?vdFUlAQZB9Ng
Estimated Time 30-40 minutes
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 several commands
  • 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
    CS2212 in it
  • E.g CS2212-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 2212 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 CS2212-YXX QueueTypes.h
  • You can do more than one file this way
    e.g. chgrp CS2212-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 CS2212-YXX 258 Oct 17
    0959 QueueType.h
  • CS2212-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 CS2212-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 CS2212-YXX project chmod R grx project
  • Directory project and everything in it now
    accessible to group CS2212-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 CS2212-YXX
  • cartier now does chgrp R CS2212-YXX
    project chmod R grx project cd project ls
    lg QueueTypes.h
  • System responds with something like -rw-r-----
    1 cartier CS2212-YXX 251 Oct 17 0959
    QueueTypes.h
  • User bolivar (in the same group) does groups
  • System responds with 3rdyr CS2212-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.
  • Some common ones Subversion (SVN), CVS, Git
  • Why do we need repositories?
  • So we dont overwrite each others changes
  • To roll back changes
  • To have a history of who did what
  • So we always have a working copy

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
  1. Bob has master copy of the files Person.java and
    Address.java
  2. Alice and Chris get copies of both files
  3. Alice changes Person.java and Chris changes
    Address.java (everything still works for them)
  4. Alice copies Person.java back to Bobs area, Chris
    copies Address.java back to Bobs area
  5. Bob tries but cant compile the program anymore
  6. Now there is no working master copy!

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

13
Git Hub
  • We are going to use GitHub to hold the repo in a
    cloud
  • -

14
Minimizing Problems
  • ALWAYS FOLLOW THESE STEPS
  • Start fresh ? Before starting any work, update
    all the files in your workspace with the latest
    updates (In Eclipse you right click on the
    project in Subversion 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!

15
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)

16
  • 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.

17
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
  • Create the Subversion repository as
    followssvnadmin create Repo
  • Build the repository in Eclipse (build a project,
    add some files, then go to the Subversion
    perspective to attach your files to the
    repository)
  • Have your group members attach to your repository
    in Eclipse

18
Step 2 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)

19
Step 3 Share Projects
  • Note A file is flagged as either ASCII or
    Binary, this is important when Subversion
    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 gt Show View gt Navigator (MIGHT NOW BE
    CALLED PROJECT EXPLORER) 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

20
Step 4 Bring in Another User
  • Another user wants to use files in the
    repository, so he/she would
  • Open the Subversion Perspective
  • Right click in the window and select new gt
    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