Practical software engineering: Revision control & make 15-441 Spring 2010, Recitation #2.

Slides:



Advertisements
Similar presentations
1. What is Subversion? Why do we need CM? Basic concepts Repositories Options Setup Clients Options Setup Operation Troubleshooting Slide 2.
Advertisements

Version Control System Sui Huang, McMaster University Version Control SystemSui Huang, McMaster University Version Control System -- base on Subversion.
David Notkin Autumn 2009 CSE303 Lecture 22 Subversion is an open source version control system. Social Implications Friday version control system.
Using subversion COMP 2400 Prof. Chris GauthierDickey.
Systems Dev. Tutorial II: Make, utilities, & scripting Recitation Wednesday, Sept 13 th, 2006.
Source Code Revision Control with Subversion Christophe Dupré May 13, 2005 Update KEJ May 10, 2006 Scientific Computation Research Center Rensselaer Polytechnic.
6/27/20151 Doris Lee Concurrent Version System (CVS)
Low level CASE: Source Code Management. Source Code Management  Also known as Configuration Management  Source Code Managers are tools that: –Archive.
Makefiles, Unix, and Project 1 Q&A : Recitation 2 September 12, 2007.
Source Control Repositories for Enabling Team Working Svetlin Nakov Telerik Corporation
David Stotts UNC Computer Science (2013) with slides from a talk by Karsten Dambekalns (2005)
SubVersioN – the new Central Service at DESY by Marian Gawron.
Version Control. What is Version Control? Manages file sharing for Concurrent Development Keeps track of changes with Version Control SubVersion (SVN)
Recitation 1: Intro & Revision Control Dave Andersen CMU Computer Science Fall 2006.
Source Code Revision Control Software CVS and Subversion (svn)
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
Distributed Version Control. Image stolen from which is really good, go read it.  Old-school version control.
Version control Using Git 1Version control, using Git.
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
The Design Workshop Introduction to Version Control 1.
Version Control with Subversion Quick Reference of Subversion.
Git – versioning and managing your software L. Grewe.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
CVS 簡介 數位芝麻網路公司蔡志展 2001/8/18 大綱 • CVS 簡介 • CVS 安裝 • CVS 設定 (Linux/Windows) • CVS 指令簡介 • CVS 多人環境的應用.
Version control Using Git Version control, using Git1.
Old Chapter 10: Programming Tools A Developer’s Candy Store.
…using Git/Tortoise Git
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
SENG 403 Tutorial 1 1SENG 403 – Winter Agenda Version Control Basics Subversion Basic actions in Subversion Some examples 2SENG 403 – Winter 2012.
Chapter Ten g++ and make1 System Programming Software Development: g++ and make.
Computer Science and Engineering The Ohio State University  Widely used, especially in the opensource community, to track all changes to a project and.
CVS – concurrent versions system Network Management Workshop intERlab at AIT Thailand March 11-15, 2008.
CSE 219 Computer Science III CVS
INFSO-RI Enabling Grids for E-sciencE SCDB C. Loomis / Michel Jouvin (LAL-Orsay) Quattor Tutorial LCG T2 Workshop June 16, 2006.
CVS – concurrent versions system AROC Guatemala July 19-23, 2010 Guatemala City, Guatemala.
Version Control Systems. Version Control Manage changes to software code – Preserve history – Facilitate multiple users / versions.
CVS: Concurrent Version System Lecturer: Prof. Andrzej (AJ) Bieszczad Phone: “UNIX for Programmers and Users” Third.
GIT.
Sabriansyah R.A Version Control. The Repository Subversion adalah sistem tersentralisasi untuk informasi sharing Repository adalah pusat penyimpanan data.
12 CVS Mauro Jaskelioff (originally by Gail Hopkins)
Version Control System
NETWORK PROGRAMMING INTRO TO DISTRIBUTED SYSTEMS FALL 2015 L3-socket Dongsu Han Some material taken from publicly available lecture slides including Srini.
Version Control and SVN ECE 297. Why Do We Need Version Control?
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Daniel Spangenberger Computer Networks, Fall 2007.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
1 CSE 303 Lecture 19 Version control and Subversion ( svn ) slides created by Marty Stepp
Makefiles & Project 1 Q&A Recitation Staff.
TEAM FOUNDATION VERSION CONTROL AN OVERVIEW AND WALKTHROUGH By: Michael Mallar.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
Makefile Script file to automate program compilation and linking (making) 1. Write the "makefile" 2. Write your programs 3. Run "make" or "make -f makefile"
UNIX Development: g++ and make CS 2204 Class meeting 8 Created by Doug Bowman, 2001 Modified by Mir Farooq Ali, 2002.
Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Corporation
NALINI S. NAUTIYAL SYSTEM SOFTWARE DIVISION Subversion.
Using Subversion for Source Code Control Michael McLennan HUBzero® Platform for Scientific Collaboration Purdue University This work licensed under Creative.
1 Subversion Kate Hedstrom April Version Control Software System for managing source files –For groups of people working on the same code –When.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Problem Solving With C++ SVN ( Version Control ) April 2016.
Version Control Using Subversion Tom Hilinski Natural Resource Ecology Laboratory Colorado State University October 2007
Source Control Dr. Scott Schaefer. Version Control Systems Allow for maintenance and archiving of multiple versions of code / other files Designed for.
Concurrent Versions System User guide for CS408
Version Control with Subversion
SVN intro (review).
Source Control Dr. Scott Schaefer.
Version control, using Git
Subversion.
Concurrent Version Control
Concurrent Version System (CVS)
Presentation transcript:

Practical software engineering: Revision control & make Spring 2010, Recitation #2

Overview Revision control systems – Motivation – Features – Subversion primer Make – Simple gcc – Make basics and variables – Testing Useful Unix commands

Dealing with large codebases Complications – Code synchronization – Backups – Concurrent modifications Solution: Revision Control System (RCS) – Store all of your code in a repository on a server – Metadata to track changes, revisions, etc… – Also useful for writing books, papers, etc…

Basic RCS features (1/2) Infinite undo – go back to previous revisions Automatic backups – all your code ever, forever saved Changes tracking – see differences between revisions

Basic RCS features (2/2) Concurrency – Multiple people working at the same time Snapshots – Save stable versions on the side (i.e. handin) Branching – Create diverging code paths for experimentation

Typical RCS workflow 1.Create repository on RCS server 2.Checkout the repository to your local machine 3.Work locally: create, delete and modify files 4.Update the repository to check for changes other people might have made 5.Resolve any existing conflicts 6.Commit your changes to the repository

RCS implementations Revision Control System (RCS) – Early system, no concurrency or conflict resolution Concurrent Versions System (CVS) – Concurrency, versioning of single files Subversion (SVN) – File and directory moving and renaming, atomic commits

Concurrent edits (1/2) Carnegie Mellon File v1 Both check out file Edits (lines 1-20) File v2 Edits (lines 30-40) commit Update Merged automatically!

Concurrent edits (2/2) Carnegie Mellon File v1 Both check out file Edits (lines 1-20) File v2 Edits (lines 10-20) commit Update Conflict needing manual intervention!

Resolving conflicts When changes can’t be merged automatically – SVN gives you 3 files: file.mine : your file file.rx : the remote file file : original file with marked conflicts You can – Discard your changes – Discard others’ changes – Go over each conflict and arbitrate as appropriate

Interacting with SVN Command line – Readily available in andrew machines Graphical tools – Easier to use – Subclipse for Eclipse gives IDE/SVN integration

Command line SVN example (1/2) $ svn co A Project1Team63/trunk A Project1Team63/branches A Project1Team63/tags Checked out revision 1. $ cd Project1Team63/trunk/ $ echo -e ”hello world" > sircd.c $ svn add sircd.c $ vim Makefile $ svn add Makefile $ svn commit -m 'adding Makefile and sircd.c!' $ cd../ $ svn cp trunk tags/checkpoint1 $ svn commit -m 'making a tag of the trunk for checkpoint1!'

Command line SVN example (2/2) Revision control lets you note (and then see) what you changed: > svn log gtcd.cc r986 | ntolia | :13: (Tue, 01 Aug 2006) | 6 lines This allows the sp to get rid of chunks early before a transfer is complete. Useful when a file is requested in-order and the file size > mem cache size > svn diff -r 1:2 file Index: file =================================================================== --- file (revision 1) +++ file (revision 2) This isatestfile -It startedwithtwolines +It nolongerhastwolines +it hasthree

General SVN tips Update, make, test, only then commit Merge often Comment commits Avoid commit races Modular design avoids conflicts

Know more Chapter 2 of Dave Andersen’s notes “SE for Systems Hackers” (link on course website) subversion.tigris.org for SVN software & info svnbook.red-bean.com for SVN book

Make Utility for executable building automation Saves you time and frustration Helps you test more and better

Simple gcc If we have files: prog.c: The main program file lib.c: Library.c file lib.h: Library header file % gcc -c prog.c -o prog.o % gcc -c lib.c -o lib.o % gcc lib.o prog.o -o binary

gcc flags Useful flags 1.-g: debugging hook 2.-Wall: show all warnings 3.-Werror: treat warning as errors 4.-O0, -O1, -O2, -O3: optimization level 5.-DDEBUG: macro for DEBUG (#define DEBUG) Avoid using dangerous optimizations that could affect correctness

More gcc % gcc -g -Wall -Werror -c prog.c -o prog.o % gcc -g -Wall -Werror -c lib.c -o lib.o % gcc -g -Wall -Werror lib.o prog.o -o binary This gets boring, fast!

Makefile basics Build targets target: dependency1 dependency2... unix command (start line with TAB)‏ unix command

binary: lib.o prog.o gcc -g -Wall lib.o prog.o -o binary lib.o: lib.c gcc -g -Wall -c lib.c -o lib.o prog.o: prog.c gcc -g -Wall -c prog.c -o prog.o clean: rm *.o binary Makefile example

Makefile variables (1/7) Variables CC = gcc CFLAGS = -g -Wall -Werror OUTPUT = binary

binary: lib.o prog.o gcc -g -Wall lib.o prog.o -o binary lib.o: lib.c gcc -g -Wall -c lib.c -o lib.o prog.o: prog.c gcc -g -Wall -c prog.c -o prog.o clean: rm *.o binary Makefile variables (2/7)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary $(OUTPUT): lib.o prog.o $(CC) $(CFLAGS) lib.o prog.o -o binary lib.o: lib.c $(CC) $(CFLAGS) -c lib.c -o lib.o prog.o: prog.c $(CC) $(CFLAGS) -c prog.c -o prog.o clean: rm *.o $(OUTPUT)‏ Makefile variables (3/7)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary $(OUTPUT): lib.o prog.o $(CC) $(CFLAGS) lib.o prog.o -o binary lib.o: lib.c $(CC) $(CFLAGS) -c lib.c -o lib.o prog.o: prog.c $(CC) $(CFLAGS) -c prog.c -o prog.o clean: rm *.o $(OUTPUT)‏ Makefile variables (4/7)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary OBJFILES = lib.o prog.o $(OUTPUT): $(OBJFILES)‏ $(CC) $(CFLAGS) $(OBJFILES) -o binary lib.o: lib.c $(CC) $(CFLAGS) -c lib.c -o lib.o prog.o: prog.c $(CC) $(CFLAGS) -c prog.c -o prog.o clean: rm *.o $(OUTPUT)‏ Makefile variables (5/7)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary OBJFILES = lib.o prog.o $(OUTPUT): $(OBJFILES)‏ $(CC) $(CFLAGS) $(OBJFILES) -o binary lib.o: lib.c $(CC) $(CFLAGS) -c lib.c -o lib.o prog.o: prog.c $(CC) $(CFLAGS) -c prog.c -o prog.o clean: rm *.o $(OUTPUT)‏ Makefile variables (6/7)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary OBJFILES = lib.o prog.o $(OUTPUT): $(OBJFILES)‏ $(CC) $(CFLAGS) $(OBJFILES) -o binary %.o: %.c # $<: dependency (%.c)‏ # target (%.o)‏ $(CC) $(CFLAGS) -c $< -o clean: rm *.o $(OUTPUT)‏ Makefile variables (7/7)

Simple Test Script (1/2) %./server 6667 & % cat testfile.01 |./testscript.py % cat testfile.02 |./testscript.py % killall -9 server

Simple Test Script (2/2) #/bin/sh echo “Starting server on port 6667.”./server 6667 & SERVERPID = $! echo “Running test files.” cat testfile.01 |./testscript.py cat testfile.02 |./testscript.py echo “Killing server process.” kill $(SERVERPID)‏

CC = gcc CFLAGS = -g -Wall OUTPUT = binary OBJFILES = lib.o prog.o all: $(OUTPUT)‏ $(OUTPUT): $(OBJFILES)‏ $(CC) $(CFLAGS) $(OBJFILES) -o binary %.o: %.c # $<: dependencies (%.c)‏ # target (%.o)‏ $(CC) $(CFLAGS) -c $< -o clean: rm *.o $(OUTPUT)‏ Augmenting the Makefile for testing (1/2)

CC = gcc CFLAGS = -g -Wall OUTPUT = binary OBJFILES = lib.o prog.o all: $(OUTPUT) test $(OUTPUT): $(OBJFILES)‏ $(CC) $(CFLAGS) $(OBJFILES) -o binary %.o: %.c # $<: dependencies (%.c)‏ # target (%.o)‏ $(CC) $(CFLAGS) -c $< -o test: $(OUTPUT)‏ sh./testscript.sh clean: rm *.o $(OUTPUT)‏ Augmenting the Makefile for testing (2/2)

Using the Makefile % make % make test % make clean Know more Google –“makefile example” –“makefile template” –“make tutorial” –Chapter 3 of Dave Andersen’s notes

Extra: useful Unix commands (1/2) find “func_name” in files % grep -r func_name. replace “bad_func_name” to “good_func_name” % sed -e “s/bad_func_name/good_func_name/g”\ prog.c > prog.c.new

Extra: useful Unix commands (2/2) find a file named “prog.c” % find -name prog.c download files from the Internet % wget untar and unzip a file % tar xzvf file.tar.gz