ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2013年5月23日 星期四

python script : follow repo/manifest.xml 做出 repo mirror 的結構.

是希望由工作的 source 做出 repo --mirror 的目錄結構:
import subprocess
import os
import xml.dom.minidom
sourcepath = "/home/charles-chang/imx53qsbandroid4.3/src/"
root = xml.dom.minidom.parse(os.path.join(sourcepath,'.repo/manifest.xml'))
projlist = []
for node in root.childNodes[0].childNodes:
if node.nodeName == 'project':
pname = node.getAttribute('name')
ppath = node.getAttribute('path')
subprocess.call(['git','clone','--mirror',os.path.join(sourcepath,ppath),os.path.join('./',pname)])
view raw gistfile1.py hosted with ❤ by GitHub


這樣做完後,還要到 platform 目錄下 單獨 clone .repo/manifests.git 出來,這樣還有修改,吃 argument 作 source path:
import subprocess
import os
import xml.dom.minidom
import sys
if len(sys.argv) < 2:
print 'Please specify the source path'
sys.exit()
sourcepath = sys.argv[1]
root = xml.dom.minidom.parse(os.path.join(sourcepath,'.repo/manifest.xml'))
for node in root.childNodes[0].childNodes:
if node.nodeName == 'project':
pname = node.getAttribute('name')
ppath = node.getAttribute('path')
subprocess.call(['git','clone','--mirror',os.path.join(sourcepath,ppath),os.path.join('./',pname+'.git')])
print 'cloning the manifest...'
subprocess.call(['git','clone','--mirror',os.path.join(sourcepath,'.repo/manifests.git'),'platform/manifests.git'])
view raw gistfile1.py hosted with ❤ by GitHub


但是很奇怪的是,這樣做出來的 folder (假設是 uuu),用 repo init clone 下來後,folder structure 竟然也是 mirror 的結構...
$mkdir uuuclone && cd uuuclone $repo init -u ~/uuu/platform/manifests.git -b cv3000 $repo sync

但是..再由 uuuclone clone 的話就 OK 了...@_@...
$mkdir uuucloneclone && cd uuucloneclone $repo init -u ~/uuuclone/platform/manifests.git -b cv3000 $repo sync

不知道為什麼會這樣,但是 uuuclone 已經可以用了,所以就把他放到 git server 的 git-daemon folder 裡..

沒有留言:

標籤

網誌存檔