Document

advertisement
27-Mar(Fri) , 2009
3rd Korea Android Seminar
Using Repo to maintain Android
Lim,GeunSik
(invain@naver.com , leemgs@gmail.com)
http://blog.naver.com/invain
OS Group, SAIT, Samsung Electronics
3rd Korea Android Seminar
1/51
Agenda
01. History
02. Repo on android opensource project (AOSP)
03. git Brief overview
04. How to use git ( installation and Practice )
05. Commands (Tutorial)
06. Contribution Workflow for AOSP
07. Opensource tools to help git
08. Quick Reference
09. X86 android using git tree
10. X86 Android Platform on VirtualBox
3rd Korea Android Seminar
2/51
01. History
Why do I prepare Repo(Git) as SCM?
Internal Potential Power
•Google is a content provider
•Partnerships (OHA 47 companies)
•Mind-Share
SCM
Of
Android
• Still Vaporware in market
• Lack of Vertical Integration
Android’s SWOT Analysis
•Social networking applications
•Developing markets
•Proprietary clones
(License Inheritance)
•Advertising competition
* SCM : Source Code Management
External Environments
3rd Korea Android Seminar
3/51
01. History
Location of SCM in FOSS World
3rd Korea Android Seminar
4/51
01. History
Have we addressed everyting?
requirements
How to glue all together?
Design
How to design
Linux?
Implement
Tools?
integrate
What packages to use?
test
What package version?
Dependencies?
deployment
maintenance
3rd Korea Android Seminar
5/51
01. History
Can we control scalable project ?
It’s hard enough to control everything when
you know where it all came from add
packages to a variety of platforms ...
3rd Korea Android Seminar
6/51
01. History
What do you like Version Control System?
3rd Korea Android Seminar
7/51
02. Repo on aosp
Repo Command on Android Git trees
• What is “Repo”(The Multiple Git Repository Tool ) Script?
Repo is a tool that we built on top of Git. Repo helps us manage the many
Git repositories. Repo is not meant to replace Git, only to make it easier to
work with Git in the context of Android.
• Installing Repo
$ curl(or wget) http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir mydroid ← working-directory-name
$ cd mydroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git
• Synchronizing your client
To synchronize the files for all available projects:
$ repo sync
To synchronize the files for selected projects:
$ repo sync project1 project2 ...
3rd Korea Android Seminar
8/51
02. Repo on aosp
Repo Command on Android Git trees
• Creating topic branches
To start a topic branch using Repo:
$ repo start branchname
To verify that your new branch was created:
$ repo status
• Using topic branches
To assign the branch to a particular project:
$ repo start branchname project
To switch back and forth among branches that you have created in your local
work environment:
$ git checkout branchname
To see a list of existing branches:
$ git branch
The name of the current branch will be preceded by an asterisk.
3rd Korea Android Seminar
9/51
02. Repo on aosp
Repo Command on Android Git trees
• Viewing client status
To list the state of your files:
$ repo status
To see uncommitted edits:
$ repo diff
The repo diff command shows every local edit that you have made that would
not go into the commit, if you were to commit right now.
To see every edit that would go into the commit if you were to commit right now,
you need a Git command, git diff. Before running it, be sure you are down in
the project directory:
$ cd ~/workingdirectory/project
$ git diff --cached
3rd Korea Android Seminar
10/51
02. Repo on aosp
Repo Command on Android Git trees
• Recovering sync conflicts
If a repo sync shows sync conflicts:
View the files that are unmerged (status code = U).
Edit the conflict regions as necessary.
Change into the relevant project directory, run git add and git commit for the
files in question, and then "rebase" the changes. For example:
$ cd bionic
$ git add bionic/*
$ git commit
$ git rebase --continue
When the rebase is complete start the entire sync again:
$ repo sync bionic proj2 proj3 ... projN
3rd Korea Android Seminar
11/51
02. Repo on aosp
Repo Command on Android Git trees
• Cleaning up your client files
To update your local working directory after changes are merged in Gerrit:
$ repo sync
To safely remove stale topic branches:
$ repo prune
• Deleting a client
Deleting a client will permanently delete any changes you have not yet
uploaded for review. Because all state information is stored in your client, you
only need to delete the directory from your filesystem:
$ cd ~
$ rm -rf working-directory-name
3rd Korea Android Seminar
12/51
02. Repo on aosp
Repo Command on Android Git tree
• Scripting common tasks
You can use Repo to run the same program across all projects:
$ repo forall [ proj1 proj2 ... projN ] -c 'echo $REPO_PROJECT $@' [ arg1
arg2 ... argN ]
The -c argument is evaluated through /bin/sh and any arguments after it are
passed through as shell positional parameters.
• Repo command reference
(init, sync, upload, download, forall, help, prune, start, status)
Repo usage takes the following form:
$ repo command options
Optional elements are shown in brackets [ ]. Once Repo is installed, you can
get information about any command by running
$ repo help command
3rd Korea Android Seminar
13/51
03. git Brief overview
History of Git
• Started in 2005 to replace BitKeeper(http://www.bitkeeper.com/.)
• Designed to support the kernel development. (2.6.12 ~ )
 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary
• Multi-platform: Mac OS X, Windows, Linux and Unix
• GPL v2 & Originally written by Linus Torvalds
 http://git.or.cz/gitwiki/LinusTalk200705Transcript
• Git is currently maintained by Junio C Hamano
3rd Korea Android Seminar
14/51
03. git Brief overview
Projects that use Git for their SCM
• Used widely
•
Android (http://android.git.kernel.org ) ,
•
Moblin (http://git.moblin.org) ,
•
OLPC (http://dev.laptop.org/git )) ,
•
Linux (http://git.kernel.org , from 2.6.12 on 17 Jun 2005 ) ,
•
GCC (http://gcc.gnu.org/git/),
•
Glibc (http://sourceware.org/git/),
•
Fedora(http://git.fedoraproject.org/) ,
•
Gnome (http://git.gnome.org ),
•
Wine (http://source.winehq.org/git/) ,
•
Samba (http://gitweb.samba.org/) ,
•
FreeDesktop.org (http://cgit.freedesktop.org/  X.org,Cairo) ,
•
Perl (http://perl5.git.perl.org/) ,
•
Ruby on Rails, VLC, yum, OpenVZ, Udev, ALSA, mtd-utils, DragonFly
BSD, Compiz-Fusion, GNU AutoConf/Automake, U-Boot, X264, etc …
3rd Korea Android Seminar
Glibc
15/51
03. git Brief overview
What is Git?
• Git manages changes to tree of files over time.
• Git is optimized for:
Distributed Development
Large files set
Complex merges
Making trial branches
Being very fast
Being robust
http://git-scm.com/
(Before → http://git.or.cz)
• Git is not optimized for:
Tracking file permissions and ownership
Track individual filles with separate history
3rd Korea Android Seminar
16/51
03. git Brief overview
Git Homepage
What is Git?
SourceCode
Quick Guide
Manual
(http://book.git-scm.com)
3rd Korea Android Seminar
17/51
03. git Brief overview
The name
"I'm an egotistical bastard, and I name all my
projects after myself. First 'Linux', now 'git' "
-Linus Torvald
git is British slang for "silly, stupid, or worthless person"
3rd Korea Android Seminar
18/51
03. git Brief overview
The name
Alternatively, Linus said:
that "git" can mean anything, depending on your
mood:
• Random three-letter combination that is pronounceable,
and not actually used by any common UNIX command.
• Stupid. Contemptible and despicable. Simple.
• Global information tracker if you're in a good mood, and it
actually works for you.
• Goddamn idiotic truckload of sh*t when it breaks
3rd Korea Android Seminar
19/51
03. git Brief overview
Linus’s Core Goal
• It must be distributed
• Disconnected mode of operation
• "Trusted Lieutenants" concept
• Very strong safeguards against corruption, either
accidental or malicious
• Fast merge and search
• "Take CVS as an example of what not to do; if in
doubt, make the exact opposite decision." -Linus
3rd Korea Android Seminar
20/51
03. git Brief overview
Usage Concepts
•Everyone has the commit bit.
•Send the patch or publish repository.
•Multi protocols: git, HTTP and SSH.
•Everyone has the entire "repository".
(Disks are cheap)
•Every ID is based on SHA-1
sha-1 is 160 bits long
3rd Korea Android Seminar
21/51
03. git Brief overview
Facts
2009-03-04
•The overall design is heavily based on pipeline
of tools"
•UNIX philosophy.
•Mostly written in C, with higher level UI in
POSIX shell and some Perl/Python/Wish
mixture.
•Every git command is a git-XXXX application.
•Currently more than 140+ commands are
available.
•Git doesn't have a specialized built-in help
system.
3rd Korea Android Seminar
03. git Brief overview
Concepts
•Repository:an archive of what the working tree looked like at different
times in the past
•Working tree: The tree of actual checked out fi
les. Contains a .git directory.
•Branch: a new development tree, which is disjoint from the other you've
just cloned.
•Master repository:The mainline of development in most repositories is
done on a branch master called “master".
•Tag: a link to a commit ID.
•Head: HEAD refers to the most recent commit of the last
branch you checked out.
•Merge: Consolidate work
•Index: Git does not commit changes directly from the working tree into
the repository. Instead, changes are
3rd Korea Android Seminar
03. git Brief overview
Flow
3rd Korea Android Seminar
04. How to use git
How to install git
Fedora 9:
sudo yum install git
Ubuntu 8.XX:
sudo apt-get install git git-core giggle
If you want to install full components, use asterrisk
character like git*.
giggle is a GUI tool, others are gitk git-gui
3rd Korea Android Seminar
25/51
05. Commands (Tutorial)
Git’s components
Git has many component program,
the following is an unabridged list of the them as of git version 1.6.2.
git
git-add
git-add--interactive
git-am
git-annotate
git-apply
git-applymbox
git-applypatch
git-archive
git-bisect
git-blame
git-branch
git-bundle
git-cat-file
git-check-attr
git-checkout
git-checkout-index
git-check-ref-format
git-cherry
git-cherry-pick
git-clean
git-clone
git-commit
git-commit-tree
git-config
git-convert-objects
git-count-objects
git-daemon
git-describe
git-diff
git-diff-files
git-diff-index
git-diff-tree
git-fast-import
git-fetch
git-fetch-pack
git-fetch--tool
git-fmt-merge-msg
git-for-each-ref
git-format-patch
git-fsck
git-fsck-objects
git-gc
git-get-tar-commit-id
git-grep
git-hash-object
git-http-fetch
git-http-push
git-imap-send
git-index-pack
git-init
git-init-db
git-instaweb
git-local-fetch
git-log
git-lost-found
git-ls-files
git-ls-remote
git-ls-tree
git-mailinfo
git-mailsplit
git-merge
git-merge-base
git-merge-file
git-merge-index
git-merge-octopus
git-merge-one-file
git-merge-ours
git-merge-recursive
git-merge-resolve
git-merge-stupid
git-merge-subtree
git-mergetool
git-merge-tree
git-mktag
git-mktree
git-mv
git-name-rev
git-pack-objects
git-pack-redundant
git-pack-refs
git-parse-remote
git-patch-id
git-peek-remote
git-prune
git-prune-packed
git-pull
git-push
git-quiltimport
git-read-tree
git-rebase
git-receive-pack
git-reflog
git-relink
git-remote
git-repack
git-repo-config
git-request-pull
git-rerere
git-reset
3rd Korea Android Seminar
git-revert
git-rev-list
git-rev-parse
git-rm
git-runstatus
git-send-pack
git-shell
git-shortlog
git-show
git-show-branch
git-show-index
git-show-ref
git-sh-setup
git-ssh-fetch
git-ssh-pull
git-ssh-push
git-ssh-upload
git-status
git-stripspace
git-symbolic-ref
git-tag
git-tar-tree
git-unpack-file
git-unpack-objects
git-update-index
git-update-ref
git-update-server-info
git-upload-archive
git-upload-pack
git-var
git-verify-pack
git-verify-tag
git-whatchanged
git-write-tree
05. Commands (Tutorial)
Git Quick Howto
Summary: basic commands
• init/clone
• pull
• log/gitk
$ git init
• add/commit $ git clone <some/where/else>
$ git pull <origin> <master>
$ git log
• push
$ gitk
$ git add <./kernel/sched.c>
$ git commit
$ git push <origin> <head>
3rd Korea Android Seminar
06. Contribution Workflow for AOSP
Contribution Workflow for AOSP 1/2
If you are interested in developing applications for Android, visit the Android
application developer site.
Continue
3rd
Korea Android Seminar
28/51
06. Contribution Workflow for AOSP
Contribution Workflow for AOSP 2/2
3rd Korea Android Seminar
29/51
07. Opensource tools to help git
Front Ends - gitk
GITK is Generalized Interface Toolkit. The aim of the GITK project is to provide a
solution, which will dramatically improve the adaptivity of software. The vision is
to get "user interfaces for all" and even more.
http://gitk.sourceforge.net/
3rd Korea Android Seminar
30/51
07. Opensource tools to help git
Front Ends - Git-gui
http://www.kernel.org/pub/software/scm/git/docs/git-gui.html
A Tcl/Tk based portable graphical user interface to Git. git-gui focuses on
allowing users to make changes to their repository
3rd Korea Android Seminar
31/51
07. Opensource tools to help git
Front Ends - Git-web
Gitweb is a Git web interface, the one working on http://www.kernel.org/git/. It is
written in Perl, and can be used as a CGI script, or as a mod_perl legacy script
(run by ModPerl::Registry handler). It allows browsing a git repository (or a set of
git repositories) using a web browser.
3rd Korea Android Seminar
32/51
07. Opensource tools to help git
Front Ends - Git-php
The goal of git-php is a robust PHP web interface to git repositories. It is meant to
be easily customizable through styles and the ability to be embedded into any
PHP page. For example, creating a git repository viewer plug-in for your favorite
PHP based cms should be easy with git-php.
http://code.google.com/p/git-php/
3rd Korea Android Seminar
33/51
07. Opensource tools to help git
Front Ends - Tig
Tig is a git repository browser that additionally can act as a pager for output from
various git commands. http://jonas.nitro.dk/tig/
* Examples: The blame view, The diff view, The log view, The main and diff
view, The main view, The revision graph rendering, Browsing the commit tree
The revision graph
rendering
3rd Korea Android Seminar
34/51
07. Opensource tools to help git
Front Ends - Msysgit
Git on Windows was only officially supported using Cygwin. To help make a
native Windows version, this project was started, based on the fork. This project
tries to provide a repository containing everything needed to compile MinGW Git
from scratch, on Windows. http://code.google.com/p/msysgit/
3rd Korea Android Seminar
35/51
07. Opensource tools to help git
Front Ends - GitHub
GitHub(Online project hosting using Git.) is the easiest and prettiest way to
participate in that collaboration: fork projects, send pull requests, monitor
development, all with ease.
GitHub was written for public, open source projects and private, proprietary
codes — if you use Git, GitHub is for you.
Free!
• Unlimited Public Repositories
• Unlimited Public Collaborators
• 300 MB Disk Space
3rd Korea Android Seminar
36/51
07. Opensource tools to help git
Front Ends - cgit
Cgit is a cgi application implemented in C: it's basically (yet) another git
command, used to generate html. it is licensed under GPL v2. All git operations
are performed by linking with libgit.a http://hjemli.net/git/cgit/
3rd Korea Android Seminar
37/51
07. Opensource tools to help git
Front Ends - gitstat
Gitstat is an Open Source, web-based git statistics interface. You can browse upto-date statistics information, search and view changesets(patchs) status,
monitor git tree. ... http://sourceforge.net/projects/gitstat/
3rd Korea Android Seminar
38/51
07. Opensource tools to help git
Front Ends - Qgit
•QGit is a git GUI viewer built on Qt/C++. Qgit implements a GUI for the most
common StGIT commands like push/pop and apply/format patches.
•With qgit you will be able to browse revisions history, view patch content and
changed files, graphically following different development branches.
http://digilander.libero.it/mcostalba/
3rd Korea Android Seminar
39/51
07. Opensource tools to help git
Front Ends - TortoiseGit
• It is porting TortoiseSVN to TortoiseGit The latest release 0.4.2.0 This release
can complete regular task, such commit, show log, diff two version, create branch
and tag, Create patch and so on. http://code.google.com/p/tortoisegit/
3rd Korea Android Seminar
40/51
07. Opensource tools to help git
Front Ends - Git Extensions
• Git Extensions is a toolkit to make working with Git under Windows more
intuitive. The shell extension will intergrate in Windows Explorer and presents a
context menu on files and directories. There is also a Visual Studio plugin to use
git from Visual Studio. Sourcecode:
http://github.com/spdr870/gitextensions/tree/master
3rd Korea Android Seminar
41/51
07. Opensource tools to help git
Front Ends - Gerrit
• Gerrit is a web based code review system, facilitating online code reviews for
projects using the Git version control system.
• http://code.google.com/p/gerrit/
3rd Korea Android Seminar
42/51
07. Opensource tools to help git
Front Ends - Jgit/Egit
• JGit/EGit is an Eclipse plugin for working with Git repositories. JGit and EGit are
implementations of the Git SCM (by King Penguin) in Java.
•It consists of a generic package for reading and writing to a Git repository, plus
an Eclipse-specific plugin.
•EGit is an Eclipse Team provider for Git. http://code.google.com/p/egit/
•JGit is a 100% pure Java implementation of Git. EGit relies upon JGit for the
bulk of its implementation. http://www.jgit.org/
3rd Korea Android Seminar
43/51
07. Opensource tools to help git
Front Ends - StGit
StGit is a Python application providing similar functionality to Quilt (i.e.
pushing/popping patches to/from a stack) on top of Git.
These operations are performed using Git commands and the patches are stored
as Git commit objects, allowing easy merging of the StGit patches into other
repositories using standard Git functionality.
http://www.procode.org/stgit/
*Help
• For a full list of StGit commands: $ stg helpFor
• quick help on individual subcommands: $ stg help <cmd>
• For more extensive help on a subcommand: $ man stg-<cmd>
(The documentation is also available in HTML format.)
Ref) Quilt originally was based on Andrew Morton's patch scripts found at
http://www.zip.com.au/~akpm/linux/patches/
3rd Korea Android Seminar
44/51
08. Quick Reference
Git Overview
3rd Korea Android Seminar
45/51
08. Quick Reference
Git Cheat Sheet 1/2
3rd Korea Android Seminar
46/51
08. Quick Reference
Git and Repo Cheat Sheet
3rd Korea Android Seminar
47/51
09. X86 android using git tree
ASUS EEE701 Netbook’s Git tree
Dima Zavin <dima@android.com>
Dima Zavin <dima@android.com>
* Config file for X86 Netbook
http://android.git.kernel.org/?p=platform/vendor/asus/eee_701.git;a=blob;f=kernel.config;h=181bdcff0ee
5996c4c9d93deb9f2666db2f9f473;hb=3d3a44ef8809c999ffb5d1e18d0178e7c13cf49b
3rd Korea Android Seminar
48/51
09. X86 android using git tree
ASUS EEE701 Netbook’s Git tree
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
kernel
kernel.config
kernel.version
modules/atl2.ko
modules/bitblit.ko
modules/cfbcopyarea.ko
modules/cfbfillrect.ko
modules/cfbimgblt.ko
modules/drm-patches/0001-intelfb-Force-color-depth-changes-to-be-applied-to.patch
modules/drm-patches/0002-intelfb-Also-fail-check_var-if-the-virtual-screen-d.patch
modules/drm-patches/0003-intel_fb-pan_display-should-call-mode_set_base-and.patch
modules/drm-patches/0004-intel_fb-Add-a-hack-to-allocate-the-virtual-screen.patch
modules/drm.ko
20. AT_Translated_Set_2_keyboard.kcm
modules/fbcon.ko
21. AT_Translated_Set_2_keyboard.kl
modules/font.ko
22. Android.mk
modules/i915.ko
23. AndroidProducts.mk
modules/module.versions
24. BoardConfig.mk
modules/softcursor.ko
25. disk_layout.conf
system.prop
26. eee_701.mk
27. init.eee_701.rc
28. init.eee_701.sh
29. init.rc
3rd Korea Android Seminar
49/51
10. X86 Android Platform on VirtualBox
X86 Android Platform on Virtualbox
http://www.youtube.com/watch?v=y3dnFD9CBOk
3rd Korea Android Seminar
50/51
Thanks
3rd Korea Android Seminar
51/51
51/51
Git Workflow for Linux Kernel 1/2
3rd Korea Android Seminar
52/51
Git Workflow for Linux Kernel 2/2
3rd Korea Android Seminar
53/51
Download