码迷,mamicode.com
首页 > 其他好文 > 详细

使用CSDN CODE来存放OPENSTACK位于GITHUB上的源码

时间:2014-11-20 12:04:42      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   io   ar   color   os   使用   sp   

use CSDN CODE to pull openstack codes

Author:Hyphen

问题

直接从GITHUB上获取代码,经常是没保障,特别是用DEVSTACK的时候,经常超时,所以我想到了每天把GITHUB上的代码更新到本地的想法。但本地还要搞一套GIT服务环境,而且也只是自己用,为何不使用公开的软件库呢,之前记得OSCHINA和CSDN 都搞GIT,相比之下,使用了CSDN CODE,使用起来就跟GITHUB一样,但有个问题是容量现在默认只给我一个G,昨天把OPENSTACK,OPENSTACK-DEV,STACKFORGE这三个目录下,DEVSTACK安装时要用到的库都同步了下,大半个G。

解决方案

我就是在我本地一个实例上,为每个软件库建立一个目录,然后PULL GITHUB上的代码,切换远程URL为CSDN CODE我的软件库,PUSH代码。这些都写了个循环的脚本来做,初定每天更新一次,定时。 CSDN CODE我的软件库 https://code.csdn.net/yanheven1/

sync_git.sh

  1. #!/bin/sh -x
  2. PROJECT=("ceilometer" "cinder" "glance" "heat" "horizon" "ironic" "keystone" "neutron" "nova" "sahara" "swift" "trove" "requirements" "tempest" "tempest-lib" "python-ceilometerclient" "python-cinderclient" "python-glanceclient" "python-heatclient" "python-ironicclient" "python-keystoneclient" "python-neutronclient" "python-novaclient" "python-saharaclient" "python-swiftclient" "python-troveclient" "python-openstackclient" "cliff" "pycadf" "stevedore" "taskflow" "glance_store" "heat-cfntools" "heat-templates" "django_openstack_auth" "keystonemiddleware" "diskimage-builder" "os-apply-config" "os-collect-config" "os-refresh-config" "tripleo-image-elements" "ironic-python-agent")
  3. PROJECT_STACKFORGE=("swift3" "wsme" "pecan" "sqlalchemy-migrate")
  4. PROJECT_OPENSTACK_DEV=("pbr" "devstack")
  5. PROJECT_OSLO=("oslo.concurrency" "oslo.config" "oslo.context" "oslo.db" "oslo.i18n" "oslo.log" "oslo.messaging" "oslo.middleware" "oslo.rootwrap" "oslo.serialization" "oslo.utils" "oslo.vmware")
  6. PROJECT_OSLO_NAME=("oslo-concurrency" "oslo-config" "oslo-context" "oslo-db" "oslo-i18n" "oslo-log" "oslo-messaging" "oslo-middleware" "oslo-rootwrap" "oslo-serialization" "oslo-utils" "oslo-vmware")
  7. for pro in "${PROJECT[@]}";do mkdir /home/$pro;done
  8. for pro in "${PROJECT_STACKFORGE[@]}";do mkdir /home/$pro;done
  9. for pro in "${PROJECT_OPENSTACK_DEV[@]}";do mkdir /home/$pro;done
  10. for pro in "${PROJECT_OSLO[@]}";do mkdir /home/$pro;done
  11. GIT_OPENSTACK=https://github.com/openstack
  12. GIT_STACKFORGE=https://github.com/stackforge
  13. GIT_OPENSTACK_DEV=https://github.com/openstack-dev
  14. GIT_CSDN=git@code.csdn.net:yanheven1
  15. for pro in "${PROJECT[@]}"
  16. do
  17. cd /home/$pro
  18. git init
  19. git remote add origin $GIT_OPENSTACK/$pro.git
  20. git pull origin master
  21. git remote rm origin
  22. git remote add origin $GIT_CSDN/$pro.git
  23. git push origin master
  24. git remote rm origin
  25. done
  26. for pro in "${PROJECT_STACKFORGE[@]}"
  27. do
  28. cd /home/$pro
  29. git init
  30. git remote add origin $GIT_STACKFORGE/$pro.git
  31. git pull origin master
  32. git remote rm origin
  33. git remote add origin $GIT_CSDN/$pro.git
  34. git push origin master
  35. git remote rm origin
  36. done
  37. for pro in "${PROJECT_OPENSTACK_DEV[@]}"
  38. do
  39. cd /home/$pro
  40. git init
  41. git remote add origin $GIT_OPENSTACK_DEV/$pro.git
  42. git pull origin master
  43. git remote rm origin
  44. git remote add origin $GIT_CSDN/$pro.git
  45. git push origin master
  46. git remote rm origin
  47. done
  48. for ((i=0;i<12;i++))
  49. do
  50. cd /home/${PROJECT_OSLO[$i]}
  51. git init
  52. git remote add origin $GIT_OPENSTACK/${PROJECT_OSLO[$i]}.git
  53. git pull origin master
  54. git remote rm origin
  55. git remote add origin $GIT_CSDN/${PROJECT_OSLO_NAME[$i]}.git
  56. git push origin master
  57. git remote rm origin
  58. done

然后定时执行:

  1. 0 * * * * sh /home/git.sh

最后修改下DEVSTACK下面的stackrc文件中的软件库URL即可使用:

  1. sed -i "s/{GIT_BASE}\/openstack\/oslo./{GIT_BASE}\/oslo-/g" /home/stack/devstack/stackrc
  2. sed -i "s/{GIT_BASE:-git:\/\/git.openstack.org}/{GIT_BASE:-https:\/\/code.csdn.net\/yanheven1}/g" /home/stack/devstack/stackrc
  3. sed -i "s/{GIT_BASE}\/stackforge/{GIT_BASE}/g" /home/stack/devstack/stackrc
  4. sed -i "s/{GIT_BASE}\/openstack/{GIT_BASE}/g" /home/stack/devstack/stackrc
  5. sed -i "s/{GIT_BASE}\/openstack-dev/{GIT_BASE}/g" /home/stack/devstack/stackrc

使用CSDN CODE来存放OPENSTACK位于GITHUB上的源码

标签:des   style   http   io   ar   color   os   使用   sp   

原文地址:http://blog.csdn.net/yanheven1/article/details/41309415

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!