Chinaunix首页 | 论坛 | 博客
  • 博客访问: 240439
  • 博文数量: 32
  • 博客积分: 2033
  • 博客等级: 大尉
  • 技术积分: 354
  • 用 户 组: 普通用户
  • 注册时间: 2007-06-10 01:53
文章分类
文章存档

2011年(2)

2010年(16)

2009年(13)

2008年(1)

我的朋友

分类: LINUX

2010-07-13 11:00:04


因为一直在用本地的repo,
不同的项目和项目组也要创建repo server,所以这个创建本地repo server的过程
还是比较频繁,写在这里备忘吧,只是一个工作记录,附加一点简单说明。

repo只是一个简单的脚本,实际上下面都是使用git的,repo也是为了管理很多个
git仓库而来的。比如android实际上是由很多个git项目在推进的。

首先我们是要有一个git server了,
至于安装git server的办法,可以参考网上说明
我的配置文件如下
root@ailantian-desktop:/var/log/git-daemon# cat /etc/sv/git-daemon/run
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst  \
   /usr/lib/git-core/git-daemon --enable=receive-pack --user=git --group=git --export-all --base-path=/home/git/gittrees /home/git/gittrees
root@ailantian-desktop:/var/log/git-daemon#

下面是具体创建repo server的过程,
这个是在git server上面,gitserver 对外服务的目录看上面的配置也知道是在
/home/git/gittrees

下面是创建存放git仓库的目录
git@ailantian-desktop:~/gittrees$ mkdir froyo-arabic-repo
git@ailantian-desktop:~/gittrees$

准备代码
git@ailantian-desktop:~$ mkdir froyo-arabic
git@ailantian-desktop:~/froyo-arabic$ tar zxf /home/froyo.tgz

git@ailantian-desktop:~/froyo-arabic$ ls
froyo
git@ailantian-desktop:~/froyo-arabic$
准备所需要的git仓库,服务端的分支
git@ailantian-desktop:~/froyo-arabic/froyo$ repo branches
   (no branches)
git@ailantian-desktop:~/froyo-arabic/froyo$
git@ailantian-desktop:~/froyo-arabic/froyo$ repo start froyo-arabic-dev-r0 --all
Starting froyo-arabic-dev-r0: 100% (158/158), done. 
git@ailantian-desktop:~/froyo-arabic/froyo$
git@ailantian-desktop:~/froyo-arabic/froyo$ repo branches
*  froyo-arabic-dev-r0       | in all projects
git@ailantian-desktop:~/froyo-arabic/froyo$
git@ailantian-desktop:~/froyo-arabic/froyo$ cd .repo/manifests
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ git branch -a
* default
  remotes/origin/android-1.5
  remotes/origin/android-1.5r2
  remotes/origin/android-1.5r3
  remotes/origin/android-1.5r4
  remotes/origin/android-1.6_r1
  remotes/origin/android-1.6_r1.1
  remotes/origin/android-1.6_r1.2
  remotes/origin/android-1.6_r1.3
  remotes/origin/android-1.6_r1.4
  remotes/origin/android-1.6_r1.5
  remotes/origin/android-1.6_r2
  remotes/origin/android-2.0.1_r1
  remotes/origin/android-2.0_r1
  remotes/origin/android-2.1_r1
  remotes/origin/android-2.1_r2
  remotes/origin/android-2.1_r2.1p
  remotes/origin/android-2.1_r2.1p2
  remotes/origin/android-2.1_r2.1s
  remotes/origin/android-cts-2.1_r2
  remotes/origin/android-sdk-1.5-pre
  remotes/origin/android-sdk-1.5_r1
  remotes/origin/android-sdk-1.5_r3
  remotes/origin/android-sdk-1.6-docs_r1
  remotes/origin/android-sdk-1.6_r1
  remotes/origin/android-sdk-1.6_r2
  remotes/origin/android-sdk-2.0.1-docs_r1
  remotes/origin/android-sdk-2.0.1_r1
  remotes/origin/android-sdk-2.0_r1
  remotes/origin/android-sdk-2.1_r1
  remotes/origin/android-sdk-tools_r2
  remotes/origin/android-sdk-tools_r3
  remotes/origin/android-sdk-tools_r4
  remotes/origin/android-sdk-tools_r5
  remotes/origin/cdma-import
  remotes/origin/cupcake
  remotes/origin/cupcake-release
  remotes/origin/donut
  remotes/origin/donut-plus-aosp
  remotes/origin/eclair
  remotes/origin/froyo
  remotes/origin/master
  remotes/origin/release-1.0
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$
创建manifests的信息,我们要改成本地的。
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ git checkout -b froyo-arabic-dev-r0
Switched to a new branch 'froyo-arabic-dev-r0'
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ git branch
  default
* froyo-arabic-dev-r0
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ vi default.xml



             fetch="git://192.168.12.147/froyo-arabic-repo/"
           review="review.source.android.com" />
             remote="ts-arabic" />


有下面的一些,把revision去掉,我们的仓库里面不想创建tools_r6的版本,就用
默认的就可以了。
 
改成如下的,类似的修改还有另外一处。
 

git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ git add default.xml
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ git commit -m "create arabic froyou dev repo"
[froyo-arabic-dev-r0 9060fa8] create arabic froyou dev repo
 1 files changed, 6 insertions(+), 6 deletions(-)
git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$

git@ailantian-desktop:~/froyo-arabic/froyo/.repo/manifests$ cd /home/git/gittrees/froyo-arabic-repo/
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$ mkdir platform
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$ cp -ra /home/git/froyo-arabic/froyo/.repo/projects/* ./platform
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$ mv platform/device/ .
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$ ls
device  platform
git@ailantian-desktop:~/gittrees/froyo-arabic-repo$
git@ailantian-desktop:~/gittrees/froyo-arabic-repo/platform$ ls
bionic.git  build.git  dalvik.git       external    hardware       ndk.git   prebuilt.git  system
bootable    cts.git    development.git  frameworks  manifests.git  packages  sdk.git
git@ailantian-desktop:~/gittrees/froyo-arabic-repo/platform$






然后我们就可以在客户端来验证了。

client

ailantian@vax:~$ mkdir froyo-arabic
ailantian@vax:~$ cd froyo-arabic/
ailantian@vax:~/froyo-arabic$
ailantian@vax:~/froyo-arabic$ repo init -u git://192.168.12.147/froyo-arabic-repo/platform/manifests.git -b froyo-arabic-dev-r0
Getting repo ...
   from git://android.git.kernel.org/tools/repo.git
remote: Counting objects: 1050, done.
remote: Compressing objects: 100% (446/446), done.
remote: Total 1050 (delta 658), reused 950 (delta 583)
Receiving objects: 100% (1050/1050), 312.16 KiB | 180 KiB/s, done.
Resolving deltas: 100% (658/658), done.
From git://android.git.kernel.org/tools/repo
 * [new branch]      maint      -> origin/maint
 * [new branch]      master     -> origin/master
 * [new branch]      stable     -> origin/stable
 * [new tag]         v1.6.9.8   -> v1.6.9.8
From git://android.git.kernel.org/tools/repo
 * [new tag]         v1.0       -> v1.0
 * [new tag]         v1.0.1     -> v1.0.1
 * [new tag]         v1.0.2     -> v1.0.2
 * [new tag]         v1.0.3     -> v1.0.3
 * [new tag]         v1.0.4     -> v1.0.4
 * [new tag]         v1.0.5     -> v1.0.5
 * [new tag]         v1.0.6     -> v1.0.6
 * [new tag]         v1.0.7     -> v1.0.7
 * [new tag]         v1.0.8     -> v1.0.8
 * [new tag]         v1.0.9     -> v1.0.9
 * [new tag]         v1.1       -> v1.1
 * [new tag]         v1.2       -> v1.2
 * [new tag]         v1.3       -> v1.3
 * [new tag]         v1.3.1     -> v1.3.1
 * [new tag]         v1.3.2     -> v1.3.2
 * [new tag]         v1.4       -> v1.4
 * [new tag]         v1.4.1     -> v1.4.1
 * [new tag]         v1.4.2     -> v1.4.2
 * [new tag]         v1.4.3     -> v1.4.3
 * [new tag]         v1.4.4     -> v1.4.4
 * [new tag]         v1.5       -> v1.5
 * [new tag]         v1.5.1     -> v1.5.1
 * [new tag]         v1.6       -> v1.6
 * [new tag]         v1.6.1     -> v1.6.1
 * [new tag]         v1.6.2     -> v1.6.2
 * [new tag]         v1.6.3     -> v1.6.3
 * [new tag]         v1.6.4     -> v1.6.4
 * [new tag]         v1.6.5     -> v1.6.5
 * [new tag]         v1.6.6     -> v1.6.6
 * [new tag]         v1.6.7     -> v1.6.7
 * [new tag]         v1.6.7.1   -> v1.6.7.1
 * [new tag]         v1.6.7.2   -> v1.6.7.2
 * [new tag]         v1.6.7.3   -> v1.6.7.3
 * [new tag]         v1.6.7.4   -> v1.6.7.4
 * [new tag]         v1.6.7.5   -> v1.6.7.5
 * [new tag]         v1.6.8     -> v1.6.8
 * [new tag]         v1.6.8.1   -> v1.6.8.1
 * [new tag]         v1.6.8.10  -> v1.6.8.10
 * [new tag]         v1.6.8.11  -> v1.6.8.11
 * [new tag]         v1.6.8.2   -> v1.6.8.2
 * [new tag]         v1.6.8.3   -> v1.6.8.3
 * [new tag]         v1.6.8.4   -> v1.6.8.4
 * [new tag]         v1.6.8.5   -> v1.6.8.5
 * [new tag]         v1.6.8.6   -> v1.6.8.6
 * [new tag]         v1.6.8.7   -> v1.6.8.7
 * [new tag]         v1.6.8.8   -> v1.6.8.8
 * [new tag]         v1.6.8.9   -> v1.6.8.9
 * [new tag]         v1.6.9     -> v1.6.9
 * [new tag]         v1.6.9.1   -> v1.6.9.1
 * [new tag]         v1.6.9.2   -> v1.6.9.2
 * [new tag]         v1.6.9.3   -> v1.6.9.3
 * [new tag]         v1.6.9.4   -> v1.6.9.4
 * [new tag]         v1.6.9.5   -> v1.6.9.5
 * [new tag]         v1.6.9.6   -> v1.6.9.6
 * [new tag]         v1.6.9.7   -> v1.6.9.7
Getting manifest ...
   from git://192.168.12.147/froyo-arabic-repo/platform/manifests.git
remote: Counting objects: 253, done.
remote: Compressing objects: 100% (122/122), done.
remote: Total 253 (delta 91), reused 231 (delta 72)
Receiving objects: 100% (253/253), 47.97 KiB, done.
Resolving deltas: 100% (91/91), done.
From git://192.168.12.147/froyo-arabic-repo/platform/manifests
 * [new branch]      default    -> origin/default
 * [new branch]      froyo-arabic-dev-r0 -> origin/froyo-arabic-dev-r0
From git://192.168.12.147/froyo-arabic-repo/platform/manifests
 * [new tag]         android-1.0 -> android-1.0

Your Name  [ailantian]: liujm
Your Email [ailantian@vax.thunderst.com]: liujm@abc.com

Your identity is: liujm
is this correct [y/n]? y


ailantian@vax:~/froyo-arabic$ repo sync
这里很慢
.....................
Fetching projects: 100% (158/158), done. 
Checking out files: 100% (8334/8334), done.ut files:  13% (1088/8334)  
Checking out files: 100% (9087/9087), done.ut files:  10% (929/9087)  
Checking out files: 100% (350/350), done.g out files:   6% (24/350)  
Checking out files: 100% (3358/3358), done.out files:  30% (1026/3358)  
Checking out files: 100% (4170/4170), done.out files:  50% (2101/4170)  
Checking out files: 100% (1138/1138), done.
Checking out files: 100% (634/634), done.g out files:  41% (266/634)  
Checking out files: 100% (9996/9996), done.out files:   4% (470/9996)  
Checking out files: 100% (10047/10047), done.t files:   4% (461/10047)  
Checking out files: 100% (4749/4749), done. out files:  43% (2068/4749)  
Checking out files: 100% (312/312), done.ng out files:  23% (72/312)  
Checking out files: 100% (486/486), done.ng out files:  32% (156/486)  
Checking out files: 100% (2078/2078), done. out files:   2% (48/2078)  
Syncing work tree: 100% (158/158), done. 

ailantian@vax:~/froyo-arabic$


然后就是验证提交了,在各个不同的仓库里面修改文件,然后提交。
这个就是纯git的使用了,大家参考文档即可。
本地工作就参考git的工作方式,本地要创建分支,因为提交的时候只能按分支来
提交,把本地的分支提交到远程的某个分支。
大体类似这样的
本地的branch。我们上面创建的repo name是ts-arabic
远程的branch就是froyo-arabic-dev-r0

    repo start "$LOBRANCH" --all
    repo forall -c "git config remote.${REPONAME}.push refs/heads/${LOBRANCH}:refs/heads/${REBRANCHE}"
    repo forall -c "git config branch.${LOBRANCH}.merge ${REBRANCHE}"


刚才看了一下,网上也有不少文章讲这个的,大家也可以参考。
TI参与开源项目一直都很积极,而且做的也很好。



恩,在网上溜的时候发现有中文版本的,排版也不错
http://blog.csdn.net/tjd0227/archive/2010/06/01/5640418.aspx

阅读(4651) | 评论(2) | 转发(1) |
0

上一篇:android简易双屏支持

下一篇:讨厌的ipv6

给主人留下些什么吧!~~

chinaunix网友2010-12-23 17:39:04

楼上的是我的,那个cts.git 是我在找不到manifests.git 情况下,换的,但是cts.git怎么没有?git-daemon是配置正确的。

chinaunix网友2010-12-23 17:36:21

您好!我刚接触这个,有个问题请教下,就是我repo sync 下来的代码froyo/.repo/manifests/projects/目录下没有manifests.git文件,这是怎么回事呢?错误信息: fatal: The remote end hung up unexpectedly fatal: cannot obtain manifest git://127.0.0.1/froyo-taowu/platform/cts.git