Advertisement
Guest User

Untitled

a guest
Feb 1st, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # This script will set up your Android sources by cherry-picking
  4. # all needed commits and fixes.
  5. # Please fetch the mentioned repos ONCE before running this script by
  6. # executing this script with the --fetch argument.
  7. # Make sure you ran ". build/envsetup.sh" before running this script!
  8.  
  9.  
  10. # Resetting some variables in case they were set
  11.  
  12. errorcount=0
  13. failing_commit=""
  14. fetch=0
  15.  
  16. # Create array of commit IDs and repo URLs
  17. declare -A commit_id=()
  18. declare -A repo_url=()
  19.  
  20.  
  21. ##### Definable values
  22. remote_name="p880-dev_autofetch"
  23.  
  24. paths="frameworks/native frameworks/base frameworks/opt/telephony system/core"
  25.  
  26. commit_id[frameworks_native]='8465cdba74a038bb29598cfb4f48754b83124f48 208b1fcc0df405dc15582798c4e5406ba16201a9 49beaf826eb1c4eae3fe3202ef682a5973213c2d c83b9661c0fca41a5f43473def58379c7d7ae7d7 0c880a230ef4331cc071d45b6b06a8b0572c5a8f'
  27. commit_id[frameworks_base]='45b92f41db68285e87980fafaa263511a6568705'
  28. commit_id[frameworks_opt_telephony]='e7490c2c565d388212d84f627fb59c2bcccf8d61'
  29. commit_id[system_core]='51585e24e4e7c2c304767a537d7b3ee6e6fa31c9 c0860dada6e1305741d28c55d8119aab031412e3 e9f305d5f0cc3ed7cdcb20227018dbcfb41f7152 b08cf09c8b6be1052a812887418da48f06f747ad'
  30.  
  31. repo_url[frameworks_native]='git@bitbucket.org:laufersteppenwolf/android_frameworks_native.git'
  32. repo_url[frameworks_base]='git@github.com:laufersteppenwolf/android_frameworks_base-1.git'
  33. repo_url[frameworks_opt_telephony]='git@bitbucket.org:laufersteppenwolf/android_frameworks_opt_telephony.git'
  34. repo_url[system_core]='git@github.com:CyanogenMod/android_system_core.git'
  35.  
  36. #####
  37.  
  38.  
  39. if [[ $1 = '--fetch' ]]; then
  40. fetch=1
  41. fi
  42.  
  43. cherry-pick() { # $1 = commit ID
  44. echo "cherry-picking $1"
  45. git cherry-pick $1
  46.  
  47. exitcode=$?
  48. # check if the cherry-pick was successful, otherwise reset
  49. if [[ $exitcode != 0 ]]; then
  50. ((errorcount++))
  51. failing_commit="$failing_commit $1"
  52. git reset --hard HEAD
  53. fi
  54. }
  55.  
  56. fetch() { # $1 = repo url
  57. echo "Adding remote $remote_name $1"
  58. git remote add $remote_name $1
  59. git fetch $remote_name
  60. }
  61.  
  62. note_enter() {
  63. echo ""
  64. echo "*************************************************************"
  65. echo "* Entering $1 "
  66. echo "*************************************************************"
  67. echo ""
  68. }
  69.  
  70. croot
  71.  
  72. for path in ${paths}; do
  73. note_enter ${path}
  74.  
  75. sleep 1
  76.  
  77. commit_path=$(echo ${path} | sed 's/\//_/g')
  78.  
  79. cd ${path}
  80.  
  81. if [[ $fetch != 0 ]]; then
  82. fetch ${repo_url[${commit_path}]}
  83. fi
  84.  
  85. for commit in ${commit_id[${commit_path}]}; do
  86. sleep 1
  87. cherry-pick $commit
  88. done
  89.  
  90. croot
  91. done
  92.  
  93. if [[ $errorcount != 0 ]]; then
  94. echo ""
  95. echo "*************************************************************"
  96. echo "* $errorcount commits failed and got reset!"
  97. echo "* Please look into the issue and fix the failing commits!"
  98. echo "*************************************************************"
  99. else
  100. echo ""
  101. echo "*************************************************************"
  102. echo "* All commits applied successfully!"
  103. echo "*************************************************************"
  104. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement