CS2043 - Unix Tools & Scripting Lecture 17 VCS ?· CS2043 - Unix Tools & Scripting Lecture 17 ... (with…

Download CS2043 - Unix Tools & Scripting Lecture 17 VCS ?· CS2043 - Unix Tools & Scripting Lecture 17 ... (with…

Post on 14-Aug-2018

212 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>CS2043 - Unix Tools &amp; ScriptingLecture 17</p><p>VCS and Package ManagementSpring 2015 1</p><p>Instructor: Nicolas Savva</p><p>March 2nd, 2015</p><p>1based on slides by Hussam Abu-Libdeh, Bruno Abrahao and David Slater over the years</p><p>(with additional material from software-carpentry)</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Announcements</p><p>The final project is coming out later today</p><p>Up to 2 slip days for the final project</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>cal - a calendar (Assignment 3)</p><p>ascii calendar</p><p>cal [options] [[month] year]</p><p>-A 2: display two months after the current month-B 5: display five months after the current month-N : toggle layout-w : show week number-j : Julian days (from start of year)</p><p>Example: cal -A 2 -B 1 -Nw May 2015</p><p>calendar</p><p>Reminder service using a calendar file.man calendar for more info</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>GNU Make (recap)</p><p>http://software-carpentry.org/v4/make/index.html</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>GNU Make</p><p>manage compilation of programs written in languages like C</p><p>used to automatically update any set of files that depend onanother set of files</p><p>Makefile describes how files depend on each other, and how toupdate out-of-date files</p><p>makes use of patterns, rules, and variables to eliminateredundancy</p><p>uses macros to control operation</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems (VCS)</p><p>Version control is the lab notebook of the digital world: its whatprofessionals use to keep track of what theyve done and tocollaborate with other people.Every large software development project relies on it, and mostprogrammers use it for their small jobs as well. And it isnt just forsoftware: books, papers, small data sets, and anything thatchanges over time or needs to be shared can and should be storedin a version control system.</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Why version control?</p><p>Keep revision history</p><p>Easy way to share files between machines</p><p>More effective collaboration</p><p>(Remote) backup</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems (VCS)</p><p>hard (not impossible) to accidentally overlook or overwritesomeones changes to files (highlighted by VCS)</p><p>no disputes about which copy is the most up to date.It is the master copy</p><p>nothing that is committed to version control is lost (means wehave an infinite undo for the committed states of the files)</p><p>version control system never overwrites the master copy in therepository</p><p>every time someone commits a new version it is saved as anaddition on top of the previous one</p><p>possible to go back in time to see exactly who wrote what ona particular day</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems: flavors</p><p>Distributed</p><p>GitMercurial (Hg)Bazaar...</p><p>client-server</p><p>Subversion (SVN)CVS...</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems: Subversion</p><p>Subversion svn : xlient-server VCS model</p><p>svn</p><p>svn checkout https://myrepo.org/myproj/placetoputworkcp/ makes a local working copysvn log : display history of the project (comments, changes anddetails)svn add mynewfile : add a new file to svn version controlsvn commit -m "comment goes here" : commit changesto repositorysvn update : retrieve latest changes from remote repositorysvn diff -r HEAD : compare working copy against HEADrevision from repositorysvn revert myfile.txt : undo uncommitted changes (rollback to HEAD)svn merge -r HEAD:num myfile.txt : where num is therevision we want to roll back to</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>SVN CMD Summary</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems: Git</p><p>git : distributed VCS model</p><p>git</p><p>git config --global user.name "Your Name" :configure usernamegit config --global user.email"you@some.domain" : configure emailgit init : initialize working dir as repogit clone http://mygiturl.edu : clone a remoterepository</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems: More Git</p><p>git : distributed VCS model</p><p>git</p><p>git status : show state of working dirgit add myfile1 myfile2 : add files to staging areagit add -A . : add all modified files recursivelygit commit -m "Some message" : commit changes to localrepogit log : view repo commit historygit diff : show difference between current and last saved stategit diff --staged : difference between last saved andstaged thingsgit diff HEAD 42 myfile : compare file to an earlierversion</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Version Control Systems: Even More Git</p><p>git : distributed VCS model</p><p>git</p><p>git reset --hard HEAD : erase all local changes since lastcommitgit checkout 424242 path/to/file : restore file to astate from a prior revisiongit remote add nickname remotespecurl : add aremote repo to the git repo git remote -v : list associatedremote git reposgit push nickname master : commit local state to masterbranch of remote repogit push -u nickname master : push to remote repo ifmaster does not existgit pull nickname master : get changes from remoterepository</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Repositories Host projects online</p><p>Bitbucket (Mercurial or Git)</p><p>Github (Git)</p><p>Launchpad (Bazaar)</p><p>Google Code (SVN, Mercurial or Git)</p><p>Microsoft CodePlex (SVN, Mercurial or Git)</p><p>Sourceforge (CVS, SVN, Bazaar, Git or Mercurial)</p><p>Cornell Forge (SVN) - http://forge.cornell.edu</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Further resources (Git)</p><p>Git tutorialhttps://www.atlassian.com/git/tutorial</p><p>Pro Git bookhttp://git-scm.com/documentation</p><p>Git (Interactive) Cheat Sheethttp://ndpsoftware.com/git-cheatsheet.html</p><p>Another Cheatsheethttps://www.atlassian.com/dms/wac/images/landing/git/atlassian git cheatsheet.pdfhttps://training.github.com/kit/downloads/github-git-cheat-sheet.pdf</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Package Management System</p><p>Parts of a Linux distribution and most of the addon softwareare installed via the Package Management System</p><p>A package contains the files and other instructions to setup apiece of software</p><p>Many packages depend on each other</p><p>High-level managers download packages, figure outdependencies and deal with groups of packages</p><p>Low-level managers unpack individual packages, run scripts,and get the software installed correctly</p><p>Two main families exist: dpkg and rpm (low level)</p><p>apt-get (Debian), zypper (SUSE), yum (Fedora) at thehigh level</p><p>We briefly touch how to install, remove, or search for packagesusing the different families of package management tools.</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Command Line Interface: Debian/Ubuntu</p><p>apt aka Advanced Package Tool(apt-get and apt-cache commands)</p><p>Debian:</p><p>sudo dpkg -l: list installed packagessudo apt-cache search myprogname: search for apackagesudo apt-get install myprogname: install a packagesudo apt-get upgrade: update installed packagessudo apt-get remove myprogname: remove a packagesudo apt-cache policy myprogname: check packagestatus</p><p>Check https://wiki.debian.org/AptCLI for more info</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Command Line Interface: Fedora CentOS</p><p>yum aka Yellowdog Updater Modified (rpm compatible)</p><p>Debian:</p><p>sudo yum list installed: list installed packagessudo yum search myprogname: search for a packagesudo yum install myprogname: install a packagesudo yum update: update installed packagessudo yum remove myprogname: remove a packagesudo yum info myprogname: check package status</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Command Line Interface: openSUSE</p><p>zypper similar to yum (rpm based)</p><p>Debian:</p><p>sudo rmp -qa: list installed packagessudo zypper search myprogname: search for a packagesudo zypper install myprogname: install a packagesudo zypper update: update installed packagessudo zypper remove myprogname: remove a packagesudo zypper info myprogname: check package status</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Command Line Interface: OSX darwin</p><p>Check https://guide.macports.org/ and install Xcode andMacPorts</p><p>port command</p><p>Also check Homebrew (brew) : http://brew.sh/</p><p>Darwin:</p><p>sudo port installed: list installed packagessudo port search myprogname: search for a packagesudo port install myprogname: install a packagesudo port upgrade: update installed packagessudo port uninstall myprogname: remove a packagesudo port info myprogname: check package status</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li><li><p>Next Time</p><p>Instructor: Nicolas Savva CS2043 - Unix Tools &amp; Scripting Lecture 17 VCS and Package Management</p></li></ul>