Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: 30-40 minutes “Unix is user-friendly. It's just very selective about.

Similar presentations


Presentation on theme: "Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: 30-40 minutes “Unix is user-friendly. It's just very selective about."— Presentation transcript:

1 Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: 30-40 minutes “Unix is user-friendly. It's just very selective about who its friends are.”(Magi’s favourite quote ) http://www.youtube.com/watch?v=dFUlAQZB9Ng

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 UWO Computer Science Department3 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 UWO Computer Science Department4 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 UWO Computer Science Department5 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 09:59 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 the file by changing the access mode of the file

6 UWO Computer Science Department6 Permitting Your Group Access To let the members of a Unix group see a file owned by that Unix group, issue the command chmod g+rw 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 g+rx QueueTypes.h Then cartier issues command ls –lg QueueTypes.h System should give something like: -rw-r----- 1 cartier CS2212-YXX 258 Oct 17 09:59 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 o+rx file

7 UWO Computer Science Department7 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 g+rx 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 UWO Computer Science Department8 Summary User cartier does: groups System response with: 2ndyr CS2212-YXX cartier now does: chgrp –R CS2212-YXX project chmod –R g+rx project cd project ls –lg QueueTypes.h System responds with something like: -rw-r----- 1 cartier CS2212-YXX 251 Oct 17 09:59 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 UWO Computer Science Department9 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 don’t overwrite each others changes —To roll back changes —To have a history of who did what —So we always have a working copy

10 UWO Computer Science Department -JAMIE ANDREWS CS470 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 UWO Computer Science Department -JAMIE ANDREWS CS470 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 can’t compile the program anymore 6.Now there is no working master copy!

12 UWO Computer Science Department -JAMIE ANDREWS CS470 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 Chris’s original changes!

13 Git Hub We are going to use GitHub to hold the repo in a “cloud” - UWO Computer Science Department13

14 UWO Computer Science Department14 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 won’t 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 didn’t break any of the other components that you weren’t 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 UWO Computer Science Department15 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 UWO Computer Science Department16 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 UWO Computer Science Department17 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 follows: svnadmin 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 UWO Computer Science Department18 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 g+rws (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 UWO Computer Science Department19 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 > Show View > 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 UWO Computer Science Department20 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 > 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.


Download ppt "Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: 30-40 minutes “Unix is user-friendly. It's just very selective about."

Similar presentations


Ads by Google